public override void destroy() { base.destroy(); foreach (var character in mCharacterGUIDList) { character.Value.destroy(); } mCharacterList = null; mCharacterTypeList = null; mCharacterGUIDList = null; mMyself = null; }
protected override void onInit(SceneProcedure lastProcedure, string intent) { LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAIN_FRAME); LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_CHARACTER); LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_BILLBOARD); LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_ROOM_MENU); // 显示角色信息 CharacterMyself myself = mCharacterManager.getMyself(); if (myself != null) { CharacterData data = myself.getCharacterData(); mScriptCharacter.setCharacterInfo(data.mHead, data.mName, data.mGUID, data.mMoney); } }
protected override void onInit(SceneProcedure lastProcedure, string intent) { // 显示布局 LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_ALL_CHARACTER_INFO); LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAHJONG_BACK_FRAME); LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAHJONG_FRAME); // 通知房间开始等待玩家加入 MahjongScene mahjongScene = mGameScene as MahjongScene; mahjongScene.getRoom().notifyStartWait(); // 设置显示房间号 CharacterMyself myself = mCharacterManager.getMyself(); mScriptMahjongFrame.setRoomID(myself.getCharacterData().mRoomID); mScriptMahjongFrame.notifyInfo("正在等待其他玩家准备"); }
public Character createCharacter(string name, CHARACTER_TYPE type, int id, bool createNode) { if (mCharacterList.ContainsKey(name)) { UnityUtility.logError("error : there is a character named : " + name + "! can not create again!"); return(null); } if (type == CHARACTER_TYPE.CT_MYSELF) { if (mMyself != null) { Debug.LogError("error : Myself has exist ! can not create again, name : " + name); return(null); } } Character newCharacter = createCharacter(type, name); // 如果是玩家自己,则记录下来 if (type == CHARACTER_TYPE.CT_MYSELF) { mMyself = newCharacter as CharacterMyself; } if (newCharacter != null) { // 将角色挂接到管理器下 if (createNode) { GameObject charNode = new GameObject(); charNode.name = newCharacter.getName(); newCharacter.setObject(charNode); newCharacter.setParent(mManagerObject); } newCharacter.init(); newCharacter.setID(id); addCharacterToList(newCharacter); UnityUtility.notifyIDUsed(id); } return(newCharacter); }
public override void execute() { CharacterMyself myself = mCharacterManager.getMyself(); // 速度 if (myself != null && myself.getProcessExternalSpeed()) { CommandCharacterHardwareSpeed cmdSpeed = newCmd(out cmdSpeed, false); cmdSpeed.mDirectSpeed = false; cmdSpeed.mExternalSpeed = true; if (GameUtility.mReadRPM) { cmdSpeed.mSpeed = GameUtility.HWSToMS(mRPM); } else { cmdSpeed.mSpeed = GameUtility.HWSToMS(mPower); } pushCommand(cmdSpeed, mCharacterManager.getMyself()); } // 按键 KeyCode[] key = new KeyCode[] { KeyCode.A, KeyCode.B, KeyCode.X, KeyCode.Y }; int count = key.Length; for (int i = 0; i < count; ++i) { mGameInputManager.setKeyState(key[i], isKeyDown(i)); } // 转向 mGameInputManager.setStickAngle(mAngle); if (mScriptDebugInfo != null) { mScriptDebugInfo.setOrginStackAngle(mAngle); mScriptDebugInfo.setRPM(mRPM); mScriptDebugInfo.setPower(mPower); } }