Пример #1
0
        internal void SaveChanges()
        {
            var aiVersion = AIVersion.FromVersion(this.GetType().Assembly.GetName().Version);

            foreach (var ai in _ais)
            {
                ai.version = aiVersion.version;
                EditorUtility.SetDirty(ai);
            }

            AssetDatabase.SaveAssets();
        }
Пример #2
0
        internal void Begin(AIStorage[] ais)
        {
            _ais             = ais;
            _repairedAIIds   = null;
            _identifiedTypes = new Dictionary <string, Type>();
            _stagedAis       = new StageElement[ais.Length];
            for (int i = 0; i < ais.Length; i++)
            {
                _stagedAis[i] = SerializationMaster.Deserialize(ais[i].configuration);
            }

            if (_customTasks == null)
            {
                _customTasks = (from t in ApexReflection.GetRelevantTypes()
                                where !t.IsAbstract && typeof(IRepairTask).IsAssignableFrom(t) && t.GetConstructor(Type.EmptyTypes) != null
                                select Activator.CreateInstance(t) as IRepairTask).OrderByDescending(t => t.versionThreshold).ToArray();
            }

            if (_customTasks.Length > 0)
            {
                for (int i = 0; i < ais.Length; i++)
                {
                    var aiVersion = new AIVersion(ais[i].version).ToVersion();
                    for (int j = 0; j < _customTasks.Length; j++)
                    {
                        var task = _customTasks[j];
                        if (task.versionThreshold >= aiVersion)
                        {
                            var editorCfg = task.repairsEditorConfiguration ? GetEditorDoc(i) : null;
                            if (task.Repair(_stagedAis[i], editorCfg))
                            {
                                this.customRepairsMade = true;
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
 private AIUI()
 {
     _aiVersion     = AIVersion.FromVersion(this.GetType().Assembly.GetName().Version);
     _undoRedo      = new UndoRedoManager(this);
     _selectedViews = new List <TopLevelView>(4);
 }