Esempio n. 1
0
    void ShowLobby()
    {
        DebugLogMain.hLog("ShowLobby");

        HideAllMenus();
        lobbyMenu.ShowMenu();
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    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("=====================");
    }
Esempio n. 4
0
    // 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);
        }
    }
Esempio n. 5
0
    void ClientMsg(NetworkMessage _msg)
    {
        var msg = _msg.ReadMessage <MsgTest>();

        DebugLogMain.hLog("Send to Client: " + msg.msg);
    }