private void DrawButtons() { //使用选择的技能参数 if (GUILayout.Button(new GUIContent("Use Choose Unit\n加载选择的技能数据", "使用选择的技能Unit"), GUILayout.Height(40))) { DataConvert.ConvertSkillUnit(EditorDataContainer.currentskillAssetData.skillUnit, EditorDataContainer.allSkillUnits.units[SelectSkillUnit]); int curart = EditorDataContainer.currentskillAssetData.skillUnit.artId; SkillUnit.SkillArt oart = EditorDataContainer.allSkillUnits.arts[curart]; DataConvert.ConvertSkillArt(EditorDataContainer.currentskillAssetData.skillArt, oart); EditorDataContainer.UseSkillArt(oart); } //使用选择的技能参数 if (GUILayout.Button(new GUIContent("Use Choose Skill Art\n加载选择的特效数据", "使用选择的技能数据填充当前技能数据"), GUILayout.Height(40))) { SkillUnit.SkillArt oart = EditorDataContainer.allSkillUnits.arts[SelectSkillArt]; EditorDataContainer.UseSkillArt(oart); } if (GUILayout.Button(new GUIContent("Generate Sequence\n生成序列", "生成序列"), GUILayout.Height(40))) { EditorDataContainer.GenerateSequence(EditorDataContainer.currentskillAssetData); Close(); } if (GUILayout.Button(new GUIContent("Generate SkillData\n生成技能数据", "由当前序列生成技能数据对象"), GUILayout.Height(40))) { if (CurrentSequence != null) { EditorDataContainer.currentskillAssetData = EditorDataContainer.MakeSkillAssetData(CurrentSequence); Debug.Log(EditorDataContainer.currentskillAssetData.skillArt.beginEffect.Count); Reset(); } } if (GUILayout.Button("Search\n搜索技能", GUILayout.Height(40))) { var window = GetWindow <SearchWindow>(); window.Show(); } if (GUILayout.Button("Save Asset\n保存技能为Asset", GUILayout.Height(40))) { EditorDataContainer.SaveSkillAssetData(); } if (GUILayout.Button("Load Asset\n加载Asset技能文件", GUILayout.Height(40))) { EditorDataContainer.LoadSkillAssetData(); Reset(); Repaint(); } if (GUILayout.Button("Save SystemTables\n保存技能到系统表", GUILayout.Height(40))) { EditorDataContainer.SaveSystemTables(); EditorDataContainer.LoadSystemTables(); Reset(); Repaint(); } if (GUILayout.Button(showUnitList ? "HideSkillUnitList\n隐藏系统技能表" : "ShowSkillUnitList\n显示系统技能表", GUILayout.Height(40))) { showUnitList = !showUnitList; } if (GUILayout.Button(showArtList ? "HideSkillArtList\n隐藏系统特效表" : "ShowSkillArtList\n显示系统特效表", GUILayout.Height(40))) { showArtList = !showArtList; } if (GUILayout.Button("Close\n关闭窗口", GUILayout.Height(40))) { Close(); } }
private void DisplayTopBar() { float space = 16.0f; GUILayout.Box("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(18.0f)); if (UnityEngine.Event.current.type == EventType.Repaint) { TopBar = GUILayoutUtility.GetLastRect(); } GUILayout.BeginArea(TopBar); { GUILayout.BeginHorizontal(); { if (GUILayout.Button("Create New Sequence", EditorStyles.toolbarButton)) { GameObject newSequence = new GameObject("Sequence"); JSequencer sequence = newSequence.AddComponent <JSequencer>(); //USUtility.CreateAndAttachObserver(sequence); if (CurrentSequence == null) { Selection.activeGameObject = newSequence; Selection.activeTransform = newSequence.transform; SequenceSwitch(sequence); } Repaint(); } string currentSequence = CurrentSequence != null ? CurrentSequence.name : ""; string label = "Select a Sequence"; if (CurrentSequence != null) { label = String.Format("Editting : {0}", currentSequence); } if (GUILayout.Button(label, EditorStyles.toolbarButton, GUILayout.Width(150.0f))) { GenericMenu menu = new GenericMenu(); JSequencer[] sequences = FindObjectsOfType(typeof(JSequencer)) as JSequencer[]; var orderedSequences = sequences.OrderBy(sequence => sequence.name); foreach (JSequencer sequence in orderedSequences) { menu.AddItem(new GUIContent(sequence.name), currentSequence == sequence.name ? true : false, (obj) => Selection.activeGameObject = (GameObject)obj, sequence.gameObject); } menu.ShowAsContext(); } GUILayout.Space(space); GUILayout.Box("", USEditorUtility.SeperatorStyle, GUILayout.Height(18.0f)); GUILayout.Space(space); if (CurrentSequence != null) { if (GUILayout.Button(new GUIContent(!CurrentSequence.IsPlaying ? USEditorUtility.PlayButton : USEditorUtility.PauseButton, "Toggle Play Mode (P)"), USEditorUtility.ToolbarButtonSmall)) { PlayOrPause(); } if (GUILayout.Button(USEditorUtility.StopButton, USEditorUtility.ToolbarButtonSmall)) { Stop(); } GUILayout.Space(space); GUILayout.Box("", USEditorUtility.SeperatorStyle, GUILayout.Height(18.0f)); GUILayout.Space(space); } if (GUILayout.Button("CreateNewSkill", EditorStyles.toolbarButton)) { Debug.Log("创建新技能"); var window = GetWindow <SetModelWindow>(); window.Show(); } if (GUILayout.Button("Configure", EditorStyles.toolbarButton)) { Debug.Log("配置面板"); var window = GetWindow <ConfigureWindow>(); window.CurrentSequence = CurrentSequence; window.Show(); } if (GUILayout.Button("Save", EditorStyles.toolbarButton)) { EditorDataContainer.SaveSkillAssetData(); } if (GUILayout.Button("Load", EditorStyles.toolbarButton)) { EditorDataContainer.LoadSkillAssetData(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } GUILayout.EndArea(); }