Esempio n. 1
0
        private void MakePrefab()
        {
            if (!string.IsNullOrEmpty(_config.generatingType))
            {
                GameObject prefabTemplate = FindAssetObject <GameObject>("@UI_PREFAB_TEMPLATE", PREFAB_EXT);
                if (prefabTemplate != null)
                {
                    GameObject newPrefab     = Instantiate(prefabTemplate);
                    Type       generatedType = UIManEditorReflection.GetTypeByName(_config.generatingType);
                    if (generatedType != null)
                    {
                        var newVM = (ViewModelBehaviour)newPrefab.AddComponent(generatedType);
                        newPrefab.name = _config.generatingType;
                        newPrefab.GetComponent <DataContext>().viewModel = newVM;
                    }

                    var newPrefabPath = UIManDefine.ASSETS_FOLDER + (_config.generatingTypeIsDialog ? _config.dialogPrefabFolder : _config.screenPrefabFolder);
                    EditorUtils.CreatePath(newPrefabPath);
                    PrefabUtility.SaveAsPrefabAsset(newPrefab, newPrefabPath + "/" + _config.generatingType + PREFAB_EXT);

                    DestroyImmediate(newPrefab);
                }

                _config.generatingType = null;
            }
        }
Esempio n. 2
0
 private static void Initialize()
 {
     UIManEditorReflection.RefreshAssemblies(false);
     _screenTypes       = UIManEditorReflection.GetAllTypes <UIManScreen>(true);
     _dialogTypes       = UIManEditorReflection.GetAllTypes <UIManDialog>(true);
     _modelTypes        = UIManEditorReflection.GetAllTypes <ObservableModel>(true);
     _container         = EditorWindow.GetWindow <UIGenerator>(true, "UIMan - UI Generator");
     _container.minSize = new Vector2(900, 600);
     _container.maxSize = _container.minSize;
     GetConfig();
 }
Esempio n. 3
0
 public void OnSelecType(string typeName)
 {
     _config.selectedType  = typeName;
     _selectedType         = UIManEditorReflection.GetTypeByName(typeName);
     _selectedTypeIsSealed = _selectedType.IsSealed;
     _selectedProperties   = _selectedType.GetUIManProperties(true);
     this.namespaceField   = new TextFieldHelper(_selectedType.Namespace);
     this.baseTypePopup    = new EditablePopup(_arrSupportType, _selectedType.BaseType.Name, OnChangeBaseType);
     _currentScriptPath    = UIManCodeGenerator.GetScriptPathByType(_selectedType);
     _handlerScriptPath    = UIManCodeGenerator.GeneratPathWithSubfix(_currentScriptPath, ".Handler.cs");
     CachePropertiesDrawer();
 }
Esempio n. 4
0
        public EditablePropertyDrawer(UIManConfig config, Type viewModelType, CustomPropertyInfo property, Action <CustomPropertyInfo> onPropertyChanged, Action <CustomPropertyInfo> onPropertyDelete)
        {
            this._viewModelType     = viewModelType;
            this._property          = property;
            this._onPropertyChanged = onPropertyChanged;
            this._onPropertyDelete  = onPropertyDelete;

            this.observableTypes = UIManEditorReflection.GetAllObservableTypes(this._viewModelType, config.classNamespace);

            for (var i = 0; i < this.observableTypes.Length; i++)
            {
                if (this._property.LastPropertyType == this.observableTypes[i])
                {
                    this.selectedType = i;
                    break;
                }
            }
        }
Esempio n. 5
0
 private static void OnScriptsReloaded()
 {
     UIManEditorReflection.RefreshAssemblies(true);
 }