Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private static string TypeAndAttrToString(Utility.TypeAndAttr data)
 {
     return(data.attr.filename);
 }