void ShowLobby() { DebugLogMain.hLog("ShowLobby"); HideAllMenus(); lobbyMenu.ShowMenu(); }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 100), "Add")) { P2pNode node = (P2pNode)objPool.GetOneObject(); node.transform.position = transform.position + new Vector3(randomFloat, randomFloat, randomFloat); node.transform.SetParent(transform); int nodeId; if (nodeIdQueue.Count > 0) { nodeId = nodeIdQueue.Dequeue(); } else { nodeId = maxNodeId; maxNodeId++; } node.InitP2pObject(nodeId); nodeList.Add(nodeId, node); } if (GUI.Button(new Rect(200, 10, 150, 100), "delete")) { if (nodeList.Count > 0) { int nodeId = randomNodeId; DebugLogMain.hLog("" + nodeId); PoolObject pObj = nodeList[nodeId]; nodeList.Remove(nodeId); nodeIdQueue.Enqueue(nodeId); pObj.RecycleSelf(); } /* * if (nodeList.Count > 0) { * int index = Random.Range(0, nodeList.Count); * Debug.Log("" + index); * PoolObject obj = nodeList[index]; * nodeList.Remove(index); * //objList.RemoveAt(index); * obj.RecycleSelf(); * } */ } if (GUI.Button(new Rect(400, 10, 150, 100), "Recycle All")) { objPool.RecycleAll(); } if (GUI.Button(new Rect(600, 10, 150, 100), "Initialize Pool")) { objPool.InitPool(5); } }
void ServerMsg(NetworkMessage _msg) { var msg = _msg.ReadMessage <UNetMessage>(); int count = msg.msgs.Length; for (int i = 0; i < count; i++) { DebugLogMain.hLog("ID: " + msg.msgs[i].id + ", Name: " + msg.msgs[i].name + ", POS: " + msg.msgs[i].position); } DebugLogMain.hLog("====================="); }
// Update is called once per frame //void Update () {} IEnumerator GetTest() { yield return(null); WebRequestResult result = null; yield return(webServiceObj.Get <IdFormat>("http://chanel.ndm.tw/api/getid.ashx", result, 1000, tempCallBack)); if (result != null) { DebugLogMain.hLog(((IdFormat)result).KEY); } else { DebugLogMain.hLog("error: " + ((IdFormat)webServiceObj.result).KEY); } }
void ClientMsg(NetworkMessage _msg) { var msg = _msg.ReadMessage <MsgTest>(); DebugLogMain.hLog("Send to Client: " + msg.msg); }