예제 #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
        /*private void ShowNode(ShowType eDataType, GameObj obj, int split, GUIStyle btnStyle) {
         *  if (obj == null) {
         *      return;
         *  }
         *
         *  if (!obj.bActive) {
         *      btnStyle = m_uiStyleInActive;
         *  }
         *
         *  GUILayout.BeginHorizontal();
         *  GUILayout.Label("", GUILayout.Width(split));
         *
         *  if (obj.arrChildren.Length > 0) {
         *      string szExpand = obj.bExpand ? "-" : "+";
         *      if (GUILayout.Button(szExpand, GUILayout.Width(25))) {
         *          obj.bExpand = !obj.bExpand;
         *      }
         *  }
         *  else {
         *      GUILayout.Label("", GUILayout.Width(25));
         *  }
         *
         *  GUIStyle uiStyleSelected = btnStyle;
         *  if (select_obj == obj) {
         *      uiStyleSelected = m_uiStyleSelected;
         *  }
         *  if (GUILayout.Button(obj.szName, uiStyleSelected, GUILayout.Width(150))) {
         *      select_obj = obj;
         *      string data = RDDataBase.Serializer<GameObj>(obj);
         *
         *      Cmd cmd = new Cmd(data.Length);
         *      cmd.WriteNetCmd(NetCmd.C2S_QueryComponent);
         *      cmd.WriteString(data);
         *
         *      net_client.SendCmd(cmd);
         *
         *      OnUpdateUI();
         *  }
         *  GUILayout.EndHorizontal();
         *
         *  if (obj.bExpand && obj.arrChildren.Length > 0) {
         *      for (int i = 0; i < obj.arrChildren.Length; ++i) {
         *          GameObj rd = null;
         *          if (eDataType == ShowType.enum_SceneObjs) {
         *              ShowPanelDataSet.TryGetGameObj(obj.arrChildren[i], out rd);
         *          }
         *          else {
         *              ShowPanelDataSet.TryGetFrustumGameObj(obj.arrChildren[i], out rd);
         *          }
         *
         *          if (rd != null) {
         *              ShowNode(eDataType, rd, 25 + split, btnStyle);
         *          }
         *      }
         *  }
         * }*/

        void OnDisable()
        {
            if (net_client != null)
            {
                net_client.Dispose();
                net_client = null;
            }

            ShowPanelDataSet.ClearAllData();
            CustomCmdExecutor.Instance.UnInit();
        }
예제 #3
0
        private void SetParentNodeExpand(GameObj rd, bool bExpand)
        {
            GameObj rdParent = null;

            ShowPanelDataSet.TryGetGameObj(rd.m_nParentID, out rdParent);
            if (rdParent != null)
            {
                rdParent.m_bExpand = true;
                SetParentNodeExpand(rdParent, bExpand);
            }
        }
예제 #4
0
        private void ShowNodeList(ShowType eDataType, GameObj obj, GUIStyle labelStyle)
        {
            if (obj == null)
            {
                return;
            }

            if (!obj.m_bActive)
            {
                labelStyle = m_LabelStyleInActive;
            }

            GUIStyle selectedStyle = labelStyle;

            if (select_obj == obj)
            {
                selectedStyle = m_LabelStyleSelected;
            }

            if (obj.m_szName.ToLower().Contains(m_szObjName.ToLower()))
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(obj.m_szName, selectedStyle))
                {
                    select_obj = obj;
                    SetParentNodeExpand(obj, true);
                    string data = IObject.Serializer <GameObj>(select_obj);

                    Cmd cmd = new Cmd(data.Length);
                    cmd.WriteNetCmd(NetCmd.C2S_QueryComponent);
                    cmd.WriteString(data);

                    net_client.SendCmd(cmd);

                    OnUpdateUI();
                }
                GUILayout.EndHorizontal();
            }

            if (obj.m_childrenID.Length > 0)
            {
                for (int i = 0; i < obj.m_childrenID.Length; ++i)
                {
                    GameObj rd = null;
                    ShowPanelDataSet.TryGetGameObj(obj.m_childrenID[i], out rd);
                    if (rd != null)
                    {
                        ShowNodeList(eDataType, rd, labelStyle);
                    }
                }
            }
        }
예제 #5
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);
        }
예제 #6
0
        public bool S2C_QueryComponent(NetCmd cmd, Cmd c)
        {
            string data = c.ReadString();

            try {
                CompObj[] rdComps = IObject.DeSerializerArray <CompObj>(data);

                if (ShowPanelDataSet.ms_remoteGameObject != null)
                {
                    UnityEngine.Object.DestroyImmediate(ShowPanelDataSet.ms_remoteGameObject);
                }

                ShowPanelDataSet.ms_remoteGameObject = new GameObject("_RemoteDebugger");
                ShowPanelDataSet.ms_remoteGameObject.SetActive(false);

                for (int i = 0; i < rdComps.Length; ++i)
                {
                    if (ShowPanelDataSet.AddRemoteComponent(rdComps[i].m_szName))
                    {
                        ShowPanelDataSet.AddCompObj(rdComps[i]);
                    }
                }

                ShowPanelDataSet.ms_currentSelectComps = rdComps;
            }
            catch (Exception ex) {
                Debug.LogException(ex);
            }
            //ShowPanelDataSet.select_node_components.Add(JsonMapper.ToObject<CompNode>(data));
            if (OnUpdateData != null)
            {
                OnUpdateData();
            }

            return(true);
        }
예제 #7
0
        private void ShowNodeRecursion(ShowType eDataType, GameObj obj, int split, GUIStyle labelStyle)
        {
            if (obj == null)
            {
                return;
            }

            if (!obj.m_bActive)
            {
                labelStyle = m_LabelStyleInActive;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(split));

            GUIStyle selectedStyle = labelStyle;

            if (select_obj == obj)
            {
                selectedStyle = m_LabelStyleSelected;
            }

            if (obj.m_childrenID.Length > 0)
            {
                obj.m_bExpand = GUILayout.Toggle(obj.m_bExpand, "", EditorStyles.foldout, GUILayout.Width(10));
            }
            else
            {
                GUILayout.Label("", GUILayout.Width(10));
            }

            if (GUILayout.Button(obj.m_szName, selectedStyle))
            {
                select_obj = obj;
                string data = IObject.Serializer <GameObj>(select_obj);

                Cmd cmd = new Cmd(data.Length);
                cmd.WriteNetCmd(NetCmd.C2S_QueryComponent);
                cmd.WriteString(data);

                net_client.SendCmd(cmd);

                OnUpdateUI();
            }
            GUILayout.EndHorizontal();

            if (obj.m_bExpand && obj.m_childrenID.Length > 0)
            {
                for (int i = 0; i < obj.m_childrenID.Length; ++i)
                {
                    GameObj rd = null;
                    if (eDataType == ShowType.enum_SceneObjs)
                    {
                        ShowPanelDataSet.TryGetGameObj(obj.m_childrenID[i], out rd);
                    }
                    else
                    {
                        ShowPanelDataSet.TryGetFrustumGameObj(obj.m_childrenID[i], out rd);
                    }

                    if (rd != null)
                    {
                        ShowNodeRecursion(eDataType, rd, 15 + split, labelStyle);
                    }
                }
            }
        }
예제 #8
0
        bool Listen()
        {
            if (select_obj == null)
            {
                return(false);
            }

            bool bRepaint = false;

            switch (Event.current.keyCode)
            {
            case KeyCode.RightArrow: {
                if (select_obj.m_childrenID.Length > 0)
                {
                    select_obj.m_bExpand = true;
                    Repaint();
                }
                break;
            }

            case KeyCode.LeftArrow: {
                if (select_obj.m_childrenID.Length > 0)
                {
                    select_obj.m_bExpand = false;
                    Repaint();
                }
                break;
            }

            case KeyCode.DownArrow: {
                if (Event.current.rawType == EventType.KeyUp)
                {
                    GameObj nextObj = ShowPanelDataSet.GetNextGameObj(select_obj);
                    if (nextObj != null)
                    {
                        select_obj = nextObj;
                        string data = IObject.Serializer <GameObj>(select_obj);
                        Cmd    cmd  = new Cmd(data.Length);
                        cmd.WriteNetCmd(NetCmd.C2S_QueryComponent);
                        cmd.WriteString(data);
                        net_client.SendCmd(cmd);
                    }
                }
                break;
            }

            case KeyCode.UpArrow: {
                if (Event.current.rawType == EventType.KeyUp)
                {
                    GameObj nextObj = ShowPanelDataSet.GetPreGameObj(select_obj);
                    if (nextObj != null)
                    {
                        select_obj = nextObj;
                        string data = IObject.Serializer <GameObj>(select_obj);
                        Cmd    cmd  = new Cmd(data.Length);
                        cmd.WriteNetCmd(NetCmd.C2S_QueryComponent);
                        cmd.WriteString(data);
                        net_client.SendCmd(cmd);
                    }
                }
                break;
            }
            }

            return(bRepaint);
        }