public static void SaveCurrentSkillUnitToList() { int id = currentskillAssetData.skillUnit.id; for (int i = 0; i < allSkillUnits.units.Count; i++) { if (allSkillUnits.units[i].id == id) { DataConvert.ConvertSkillUnit(allSkillUnits.units[i], currentskillAssetData.skillUnit); for (int j = 0; j < allSkillUnits.arts.Count; j++) { if (allSkillUnits.units[i].artId == allSkillUnits.arts[j].id) { allSkillUnits.arts[j] = DataConvert.ConvertSkillArt(EditorDataContainer.currentskillAssetData.skillArt); return; } } return; } } }
private void DrawUnitList(float width) { //unit list GUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("SkillUnit List"); List <SkillUnit.SkillUnit> skillinits = EditorDataContainer.allSkillUnits.units; unitScrollPos = EditorGUILayout.BeginScrollView(unitScrollPos); //列表 if (unitList == null) { // 加入数据数组 unitList = new ReorderableList(skillinits, typeof(SkillUnit.SkillUnit), false, false, true, true); } // 绘制Item显示列表 unitList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { SkillUnit.SkillUnit element = skillinits[index]; Rect drawRect = new Rect(rect.x, rect.y + 20, width - 30, 600); GUILayout.BeginArea(drawRect); GUILayout.Label("index: " + index); EditorDrawUtility.DrawSkillUnit(DataConvert.ConvertSkillUnit(element)); GUILayout.EndArea(); EditorGUILayout.Separator(); }; unitList.elementHeight = 600; // 绘制表头 unitList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "SkillUnitList"); }; // 选择回调 unitList.onSelectCallback = (ReorderableList l) => { SelectSkillUnit = l.index; }; unitList.DoLayoutList(); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); }
private void OnGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("输入技能id数字或id名称搜索"); id = EditorGUILayout.IntField("id数字:", id); idName = EditorGUILayout.TextField("id名称:", idName); if (GUILayout.Button("id数字搜索并应用", GUILayout.Height(40))) { if (id > 0 && EditorDataContainer.allSkillUnits.units.Count > id) { idName = EditorDataContainer.GetSkillStringById(id); DataConvert.ConvertSkillUnit(EditorDataContainer.currentskillAssetData.skillUnit, EditorDataContainer.allSkillUnits.units[id]); 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("id名字搜索并应用", GUILayout.Height(40))) { id = EditorDataContainer.GetSkillIdByString(idName); if (id > 0 && EditorDataContainer.allSkillUnits.units.Count > id) { DataConvert.ConvertSkillUnit(EditorDataContainer.currentskillAssetData.skillUnit, EditorDataContainer.allSkillUnits.units[id]); 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("Close", GUILayout.Height(40))) { Close(); } EditorGUILayout.EndVertical(); }
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(); } }