private void ApplyToTypeInfo(Utility.TypeAndAttr info) { this.currentTypeInfo = info; object obj = null; bool loadResult = ConfigLoader.LoadData(out obj, info.type); if (!loadResult) { obj = System.Activator.CreateInstance(info.type); } ApplyCurrentValue(obj); }
private static void UpdateInfo(Utility.TypeAndAttr typeAndAttr) { object obj = null; ConfigLoader.LoadData(out obj, typeAndAttr.type); if (obj == null) { obj = System.Activator.CreateInstance(typeAndAttr.type); } IConfigUpdateOnBuild config = obj as IConfigUpdateOnBuild; config.OnPreprocessBuild(); Utility.SaveDataToStreamingAssets(config); }
private void InitConfigType() { if (this.typeInfoList == null || this.typeInfoList.Count <= 0) { return; } var configType = rootVisualElement.Q <VisualElement>("ConfigType"); configTypePopup = new PopupField <Utility.TypeAndAttr>(this.typeInfoList, 0, TypeAndAttrToString, TypeAndAttrToString); currentTypeInfo = typeInfoList[0]; #if UNITY_2019_1_OR_NEWER || UNITY_2019_OR_NEWER configTypePopup.RegisterValueChangedCallback((val) => { OnChangedSelectConfig(val); }); #else configTypePopup.OnValueChanged((val) => { OnChangedSelectConfig(val); }); #endif configType.Add(configTypePopup); this.ApplyToTypeInfo(currentTypeInfo); }
private static string TypeAndAttrToString(Utility.TypeAndAttr data) { return(data.attr.filename); }