void OnDisable() { xml.Close(); TowerFileXml.Close(); UIFunction.ClearChild(MapPanel); LocalMessage.SetHandler(null); }
void OnDisable() { UIFunction.ClearChild(PlayerListPanel); PlayerContainer.Clear(); ObjectContainer.Clear(); LocalMessage.SetHandler(null); }
private Dictionary <GameObject, ulong> ObjectContainer = new Dictionary <GameObject, ulong>(); //玩家物体——玩家编号 void OnEnable() { LocalMessage.SetHandler(MessageHandler); InputField[] tempIF = { PlayerGoldInputField, TowerAttackInputField, TowerSpeedInputField, TowerBuildCostInputField, MonsterDefenseInputField, MonsterHipPointInputField, MonsterSpeedInputField }; Dropdown[] tempD = { PlayerGoldDropdown, TowerAttackDropdown, TowerSpeedDropdown, TowerBuildCostDropdown, MonsterDefenseDropdown, MonsterHipPointDropdown, MonsterSpeedDropdown, Difficult, CheckPoint }; if (LocalMessage.LocalIdentity != 0) { foreach (InputField field in tempIF) { field.enabled = false; } foreach (Dropdown d in tempD) { d.enabled = false; } } else { foreach (InputField field in tempIF) { field.enabled = true; } foreach (Dropdown d in tempD) { d.enabled = true; } } byte[] msg = new byte[8]; SmallTools.CopyArray(msg, SmallTools.ToByteArray(LocalMessage.LocalPlayerNumber)); LocalMessage.scom.SendMessage(MsgType.PlayerMsgInRoom, msg); }
private Dictionary <ushort, GameObject> RoomContainer2 = new Dictionary <ushort, GameObject>(); //房间号——组件 // Use this for initialization void OnEnable() { if (LocalMessage.scom == null) { LocalMessage.scom = new SocketCom(); if (!LocalMessage.scom.Initialize()) { EditorUtility.DisplayDialog("网络连接失败", "无法连接到服务器", "返回主菜单"); BackMainMenu(); return; } LocalMessage.SetHandler(MessageHandle); } else { LocalMessage.scom.SendMessage(MsgType.RoomMsgList); } //EditorUtility.DisplayDialog("打开", "进入大厅", "关闭"); }
//退出房间 private void ExitRoom() { LocalMessage.SetHandler(null); this.gameObject.SetActive(false); HallPanel.gameObject.SetActive(true); }