예제 #1
0
        public InspectorSerializObjct()
        {
            _serializObject = new WindowInspectorObj();

            //WindowBase t = new Game.UI.TestWindow();
            //Game.UI.TestWindow tt = new WindowBase() as Game.UI.TestWindow;
        }
예제 #2
0
        /// <summary>
        /// 将读到的property数组转为list
        /// </summary>
        private void TurnPropertyArray2List(SerializedProperty refList)
        {
            if (refList is null)
            {
                Log.Error("refList is null");
                return;
            }
            if (_list is null)
            {
                _list = new List <InspectorSerializObjct>();
            }

            WindowInspectorObj obj = null;
            var cnt = refList.arraySize;

            for (int i = 0; i < cnt; i++)
            {
                var sObj = refList.GetArrayElementAtIndex(i);
                var go   = sObj.FindPropertyRelative("go");
                var type = sObj.FindPropertyRelative("type").stringValue;
                var name = sObj.FindPropertyRelative("name").stringValue;
                if (go is null || string.IsNullOrEmpty(type) || string.IsNullOrEmpty(name))
                {
                    continue;
                }


                var serialObj = new WindowInspectorObj(go.objectReferenceValue as GameObject, type, name);
                var index     = GetSelectedIndex(serialObj.Type, GetGameobjetsCompTypes(serialObj.GameObj));

                var currSelected = Selection.objects[0];
                var temp         = currSelected as GameObject;

                var inspectObj = new InspectorSerializObjct()
                {
                    _serializObject = serialObj,
                    _selectTypeIdx  = index,
                    _objectNodePath = UITools.GetGameObjectChildPath(serialObj.GameObj, temp),
                };
                _list.Add(inspectObj);
            }
        }