public GVariableModel(Transform t) { target = t; path = GGlobalFun.GetGameObjectPath(t, Selection.activeTransform); type = GetUIType(); name = GetName(string.Format("{0}_{1}", type, t.name), t); state.SetIndex(type, t); Init(state, this); }
public void Init() { GScriptInfo so = null; if (GFileOperation.IsExists(GConfigure.InfoPath)) { so = AssetDatabase.LoadAssetAtPath <GScriptInfo>(GConfigure.InfoPath); } if (so == null) { return; } var fields = so.GetFieldInfos(GConfigure.selectTransform.name); for (int i = 0; i < fields.Length; i++) { var obj = GConfigure.selectTransform.Find(fields[i].path); if (obj == null) { continue; } var v = this[obj]; v.state.isVariable = true; v.state.isAttribute = fields[i].mainAttrInfo.isAttr; v.state.attributeName = fields[i].mainAttrInfo.name; v.state.isEvent = fields[i].mainAttrInfo.isEvent; v.type = fields[i].mainAttrInfo.type; v.state.SetIndex(fields[i].mainAttrInfo.type, obj); v.LstSubModel.Clear(); v.state.LstSubState.Clear(); for (int j = 0; j < fields[i].subField.Count; j++) { var subState = new QVariableState(); subState.isVariable = true; subState.isAttribute = fields[i].subField[j].isAttr; subState.isEvent = fields[i].subField[j].isEvent; subState.SetIndex(fields[i].subField[j].type, obj); v.AddSubState(subState); subState.Model.type = fields[i].subField[j].type; subState.attributeName = fields[i].subField[j].name; } } GConfigure.Version = so.GetVersion(GConfigure.selectTransform.name); }