Exemple #1
0
 void Awake()
 {
     Instance    = this;
     _eventGroup = EventEditor.Instance.EventGroup;
     _config     = _eventGroup.Config;
     position    = new Rect(160, 160, 360, 640);
 }
        private void LoadFile()
        {
            string path = EditorUtility.OpenFilePanel("选择文件", "Assets", "asset");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            ConfigEditor.CloseWindow();
            _eventGroupFilePath = Utils.AbsolutePathToAssetDataBasePath(path);
            EventGroup          = AssetDatabase.LoadAssetAtPath <NonlinearEventGroup>(_eventGroupFilePath);
            _lastEventID        = EventGroup.GetLastEventID() + 1;
            ReloadTransitions();
            _selectedNode = null;
            UpdatePopUpCharacterNames();
        }
        private void CreateNewFile()
        {
            string path = EditorUtility.SaveFilePanel(
                "选择保存位置", "Assets", "event_group.asset", "asset");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            ConfigEditor.CloseWindow();
            EventGroup          = CreateInstance <NonlinearEventGroup>();
            _eventGroupFilePath = Utils.AbsolutePathToAssetDataBasePath(path);
            AssetDatabase.CreateAsset(EventGroup, _eventGroupFilePath);
            AssetDatabase.SaveAssets();
            ResetTransitions();
            _selectedNode = null;
            EditConfigFile();
        }