Beispiel #1
0
        public static void AddCompObj(CompObj rdComp)
        {
            int nInstanceID = rdComp.m_nInstanceID;

            if (ms_CompObjDict.ContainsKey(nInstanceID))
            {
                ms_CompObjDict[nInstanceID] = rdComp;
            }
            else
            {
                ms_CompObjDict.Add(nInstanceID, rdComp);
            }
        }
        private void ShowComponentPanel()
        {
            if (select_obj == null || ShowPanelDataSet.ms_currentSelectComps == null || ShowPanelDataSet.ms_remoteGameObject == null)
            {
                return;
            }

            GUILayout.BeginVertical("Box", GUILayout.Width(400));
            scroll_view_nodestatus_pos = GUILayout.BeginScrollView(scroll_view_nodestatus_pos);

            ShowGameObjectHeadInfo(select_obj);

            for (int i = 0; i < ShowPanelDataSet.ms_currentSelectComps.Length; ++i)
            {
                //GUIStyle uiStyle = m_uiStyleActive;
                CompObj rdComp = ShowPanelDataSet.ms_currentSelectComps[i];

                GUILayout.BeginVertical("Box");

                GUILayout.BeginHorizontal();

                bool m_Expand = rdComp.m_bExpand;
                rdComp.m_bExpand = GUILayout.Toggle(rdComp.m_bExpand, "", EditorStyles.foldout, GUILayout.Width(15));

                if (!rdComp.m_bContainEnable || rdComp.m_szName.Equals("RemoteServer"))
                {
                    GUILayout.Label("", GUILayout.Width(15));
                }
                else
                {
                    bool bEnable = rdComp.m_bEnable;
                    //                 if (rdComp.bEnable == false) {
                    //                     uiStyle = m_uiStyleInActive;
                    //                 }
                    rdComp.m_bEnable = GUILayout.Toggle(rdComp.m_bEnable, "", GUILayout.Width(15));
                    if (bEnable != rdComp.m_bEnable)
                    {
                        string data = IObject.Serializer <CompObj>(rdComp);

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

                        net_client.SendCmd(cmd);
                    }
                }

                //if (FilterList.HideComponent.Find(compType => compType.Equals(rdComp.szName)) == null) {
                //             if (select_comp == rdComp) {
                //                 uiStyle = m_uiStyleSelected;
                //             }

                GUILayout.Label(rdComp.m_szName);
                GUILayout.EndHorizontal();

                Type PropertyType = Util.GetTypeByName(rdComp.m_szName);

                if (m_Expand == false && rdComp.m_bExpand == true)
                {
                    select_comp = rdComp;

                    //Type PropertyType = Util.GetTypeByName(rdComp.szName);
                    ShowPanelDataSet.ms_remoteComponent = ShowPanelDataSet.ms_remoteGameObject.GetComponent(PropertyType);

                    string data = IObject.Serializer <CompObj>(rdComp);

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

                    net_client.SendCmd(cmd);
                }

                if (rdComp.m_bExpand)
                {
                    ShowPropertyPanel(ShowPanelDataSet.ms_remoteGameObject.GetComponent(PropertyType), rdComp.m_nInstanceID);
                }

                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }