Files
youle_framework/client/js/gameabc-framework/templates/subgame-entry/SubGameHooks.template.js
T

207 lines
9.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================================
// SubGameHooks.template.js —— 子游戏接入入口(复制为 codes/SubGameHooks.js 后填实现)
// 平台契约文件(00/01/02 转发壳)会把同名平台接口转发到这里。只需实现【本游戏需要的】hook,
// 未实现的接口由转发壳走平台默认(B)或空操作(A)。严格 ES5。
// 接口清单与默认值见 spec §9 / 文档 06。
// ============================================================================
var SubGameHooks = window.SubGameHooks || {};
// ===== gameHallImport.*(大厅,9) =====
// [A] hallAppStart():大厅应用启动(注:与 Game_Modify.appStart 同名冲突,故加 hall 前缀区分)。
// SubGameHooks.hallAppStart = function () { /* ... */ };
// [A] jumpMenuScene():大厅跳转菜单场景。
// SubGameHooks.jumpMenuScene = function () { /* ... */ };
// [A] gameStart():大厅游戏开始入口。
// SubGameHooks.gameStart = function () { /* ... */ };
// [A] setGameList():设置游戏列表。
// SubGameHooks.setGameList = function () { /* ... */ };
// [A] clearGameinfo():清除游戏信息。
// SubGameHooks.clearGameinfo = function () { /* ... */ };
// [A] getWebdata(data):获取网络数据回调。
// SubGameHooks.getWebdata = function (data) { /* ... */ };
// [B] isInstalled(data):检查是否已安装;无 hook 时默认:return 1。
// SubGameHooks.isInstalled = function (data) { /* ... */ };
// [A] up_imgurl(recid, photo):更新图片 URL。
// SubGameHooks.up_imgurl = function (recid, photo) { /* ... */ };
// [A] getphoto(recid, photo):获取玩家头像。
// SubGameHooks.getphoto = function (recid, photo) { /* ... */ };
// ===== Game_Modify.*(事件/交互,来自 01,9) =====
// [A] utlmousedown(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6):精灵按下事件;子游戏转发到 SpriteEventController。
// SubGameHooks.utlmousedown = function (gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6) { /* ... */ };
// [A] utlmousedown_nomove(gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5):精灵按下(无移动)事件。
// SubGameHooks.utlmousedown_nomove = function (gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5) { /* ... */ };
// [A] mouseup(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2):精灵抬起事件。
// SubGameHooks.mouseup = function (gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2) { /* ... */ };
// [A] utlmousemove(gameid, spid, downx, downy, movex, movey, timelong, offmovex, offmovey, no1):精灵移动事件。
// SubGameHooks.utlmousemove = function (gameid, spid, downx, downy, movex, movey, timelong, offmovex, offmovey, no1) { /* ... */ };
// [A] utlgamemydrawbegin(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7):精灵绘制开始事件。
// SubGameHooks.utlgamemydrawbegin = function (gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7) { /* ... */ };
// [A] gamemydraw(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7):精灵绘制帧事件。
// SubGameHooks.gamemydraw = function (gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7) { /* ... */ };
// [A] OpenCreateRoom():打开创建房间界面。
// SubGameHooks.OpenCreateRoom = function () { /* ... */ };
// [A] CloseCreateRoom():关闭创建房间界面。
// SubGameHooks.CloseCreateRoom = function () { /* ... */ };
// [A] setRoomDes(roomcode, asetcount, roomtype):设置房间描述文案。
// SubGameHooks.setRoomDes = function (roomcode, asetcount, roomtype) { /* ... */ };
// ===== Game_Modify.*(生命周期/回调,来自 02,45) =====
// [A] appStart():游戏应用启动(与 gameHallImport.appStart 语义不同,对应 Game_Modify 侧启动)。
// SubGameHooks.appStart = function () { /* ... */ };
// [A] StartWar(_msg):开战(开局)回调,解包开局数据并初始化游戏状态。
// SubGameHooks.StartWar = function (_msg) { /* ... */ };
// [A] _ReceiveData(_msg):接收服务端主动推送的数据包,派发给对应业务处理器。
// SubGameHooks._ReceiveData = function (_msg) { /* ... */ };
// [A] createRoom(_roomtype, _infinite):前端发起创建房间请求。
// SubGameHooks.createRoom = function (_roomtype, _infinite) { /* ... */ };
// [A] myJoinRoom(_msg):自己成功进入房间回调。
// SubGameHooks.myJoinRoom = function (_msg) { /* ... */ };
// [A] Reconnect(_deskinfo):重连回调,用服务端返回的桌面信息恢复游戏界面。
// SubGameHooks.Reconnect = function (_deskinfo) { /* ... */ };
// [A] stopAllSounds():停止所有声音(切换到后台时触发)。
// SubGameHooks.stopAllSounds = function () { /* ... */ };
// [A] Free(_msg):投票解散确认回调。
// SubGameHooks.Free = function (_msg) { /* ... */ };
// [A] DeskInfo(_msg):未开战状态下加入牌桌的数据同步。
// SubGameHooks.DeskInfo = function (_msg) { /* ... */ };
// [A] breakRoom():开局后自己退出房间触发。
// SubGameHooks.breakRoom = function () { /* ... */ };
// [A] playerJoinRoom(seat):其他玩家加入房间通知。
// SubGameHooks.playerJoinRoom = function (seat) { /* ... */ };
// [A] playerLeaveRoom(seat):其他玩家离开房间通知。
// SubGameHooks.playerLeaveRoom = function (seat) { /* ... */ };
// [A] updateScene():更新游戏界面(分辨率变化等)。
// SubGameHooks.updateScene = function () { /* ... */ };
// [A] closeGameScene():关闭游戏界面。
// SubGameHooks.closeGameScene = function () { /* ... */ };
// [A] playerOffline(seat):玩家掉线通知。
// SubGameHooks.playerOffline = function (seat) { /* ... */ };
// [A] playerOnline(seat):玩家上线通知。
// SubGameHooks.playerOnline = function (seat) { /* ... */ };
// [A] playerphonestate(seat, type):玩家电话状态变化通知。
// SubGameHooks.playerphonestate = function (seat, type) { /* ... */ };
// [A] shakeEvent():设备摇一摇事件。
// SubGameHooks.shakeEvent = function () { /* ... */ };
// [A] calResult(inputArr):计算结算结果。
// SubGameHooks.calResult = function (inputArr) { /* ... */ };
// [A] onEnterMainScene(roomtype):进入游戏主场景。
// SubGameHooks.onEnterMainScene = function (roomtype) { /* ... */ };
// [A] onExitMainScene():退出游戏主场景。
// SubGameHooks.onExitMainScene = function () { /* ... */ };
// [A] onGameConfig(_gameConfig):获取游戏配置时触发。
// SubGameHooks.onGameConfig = function (_gameConfig) { /* ... */ };
// [A] onEnterVideo():进入牌局回放模式。
// SubGameHooks.onEnterVideo = function () { /* ... */ };
// [A] onSurrender(_msg):收到投降回包。
// SubGameHooks.onSurrender = function (_msg) { /* ... */ };
// [A] onReady(seat):玩家准备触发。
// SubGameHooks.onReady = function (seat) { /* ... */ };
// [B] getRoomInfo(roomtype, type, tea):获取房间描述文案;无 hook 时默认:"房间描述" + roomtype。
// SubGameHooks.getRoomInfo = function (roomtype, type, tea) { /* ... */ };
// [B] getStarLimit(roomtype):获取星星场下限分数;无 hook 时默认:return 2001000。
// SubGameHooks.getStarLimit = function (roomtype) { /* ... */ };
// [B] getMult(roomtype, type):获取星星场倍数;无 hook 时默认:return 10000。
// SubGameHooks.getMult = function (roomtype, type) { /* ... */ };
// [B] getFullRoomInfo(roomtype):获取房间完整信息描述;无 hook 时默认:"房间描述" + roomtype。
// SubGameHooks.getFullRoomInfo = function (roomtype) { /* ... */ };
// [A] onOpenHelp(spid):打开帮助页面。
// SubGameHooks.onOpenHelp = function (spid) { /* ... */ };
// [A] onMainMenuScene():显示大厅主菜单界面。
// SubGameHooks.onMainMenuScene = function () { /* ... */ };
// [A] onCheckInput(_result):数字输入框确认回调。
// SubGameHooks.onCheckInput = function (_result) { /* ... */ };
// [A] onCreateRoom(_data):创建房间成功后触发。
// SubGameHooks.onCreateRoom = function (_data) { /* ... */ };
// [B] getLeaveLimit(roomtype):获取离场限制局数;无 hook 时默认:return 10。
// SubGameHooks.getLeaveLimit = function (roomtype) { /* ... */ };
// [A] onLocationInfo(_locationInfo):成功获取定位信息回调。
// SubGameHooks.onLocationInfo = function (_locationInfo) { /* ... */ };
// [A] onCreateDesk(roomtype):进入游戏界面创建牌桌之前触发。
// SubGameHooks.onCreateDesk = function (roomtype) { /* ... */ };
// [B] getVideoByRoomType(roomtype):获取该房型是否开启视频功能;无 hook 时默认:return 1。
// SubGameHooks.getVideoByRoomType = function (roomtype) { /* ... */ };
// [B] getRoomTopDescAry(roomtype):获取房间顶部描述文案数组;无 hook 时默认:["" + roomtype]。
// SubGameHooks.getRoomTopDescAry = function (roomtype) { /* ... */ };
// [A] getShareRoom(_msg):星星场房间列表数据。
// SubGameHooks.getShareRoom = function (_msg) { /* ... */ };
// [A] myExitRoom(seat):玩家自己退出房间。
// SubGameHooks.myExitRoom = function (seat) { /* ... */ };
// [A] changeSeat(seat1, seat2):接收到换座包触发。
// SubGameHooks.changeSeat = function (seat1, seat2) { /* ... */ };
// [A] onCloseVip():关闭 VIP 选项时调用。
// SubGameHooks.onCloseVip = function () { /* ... */ };
// [B] getRoomMode(roomtype):判断房间模式(0=非金币场);无 hook 时默认:return 0。
// SubGameHooks.getRoomMode = function (roomtype) { /* ... */ };
// [B] getMaxPlayerCount(roomtype):获取房间最大玩家数量;无 hook 时默认:return Game_Config.Max.PlayerCnt || 4。
// SubGameHooks.getMaxPlayerCount = function (roomtype) { /* ... */ };
// [B] updatePlayerInfoUI(targetSeat):更新玩家信息 UI;无 hook 时默认:return false(让平台默认处理)。
// SubGameHooks.updatePlayerInfoUI = function (targetSeat) { /* ... */ };
window.SubGameHooks = SubGameHooks;
if (typeof module !== 'undefined' && module.exports) { module.exports = SubGameHooks; }