예제 #1
0
        private void ShowConnectPanel()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("IP:", GUILayout.Width(40));
                m_szIPAddr = GUILayout.TextField(m_szIPAddr, GUILayout.Width(100));
                m_szPort   = GUILayout.TextField(m_szPort, GUILayout.Width(40));

                if (GUILayout.Button("Connect", GUILayout.Width(100)))
                {
                    net_client.Connect(m_szIPAddr, int.Parse(m_szPort));
                    PlayerPrefs.SetString("RemoteDebuggerIP", m_szIPAddr);
                }

                if (net_client.IsConnected)
                {
                    if (GUILayout.Button("Query", GUILayout.Width(100)))
                    {
                        m_eShowType = ShowType.enum_SceneObjs;
                        ShowPanelDataSet.InitDataSet();

                        Cmd cmd = new Cmd();
                        cmd.WriteNetCmd(NetCmd.C2S_CmdQueryAllObjs);
                        net_client.SendCmd(cmd);
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
예제 #2
0
        public bool S2C_QueryAllObjs(NetCmd cmd, Cmd c)
        {
            string rdGameObjs = c.ReadString();

            try {
                ShowPanelDataSet.InitDataSet();
                GameObj[] arrRdObjs = IObject.DeSerializerArray <GameObj>(rdGameObjs);

                for (int i = 0; i < arrRdObjs.Length; ++i)
                {
                    ShowPanelDataSet.AddGameObj(arrRdObjs[i]);
                }

                if (OnUpdateData != null)
                {
                    OnUpdateData();
                }
            }
            catch (Exception ex) {
                Debug.LogException(ex);
            }

            return(true);
        }