public void DrawGraph(InternalTimelineGraphGroupAsset groupAsset, InternalTimelineGraphAsset graphAsset) { GUILayoutExtension.HorizontalGroup(() => { EditorGUILayout.LabelField(graphAsset.name, GUILayout.Width(150)); if (GUILayout.Button("打开", GUILayout.Width(50))) { TimelineWindow.Open(graphAsset); } if (GUILayout.Button("删除", GUILayout.Width(50))) { groupAsset.RemoveGraph(graphAsset); } if (GUILayout.Button("重命名", GUILayout.Width(50))) { MiscHelper.Input($"输入{groupAsset.DisplayName}名:", (string name) => { graphAsset.name = name; EditorUtility.SetDirty(graphAsset); EditorUtility.SetDirty(target); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }); } }); }
private void DrawSystemSort(SystemSort sort, SystemType systemType) { GUILayoutExtension.HorizontalGroup(() => { EditorGUILayout.LabelField(sort.typeName); MiscHelper.Btn("Up", 50, 35, () => { sort.sort--; UpdateSystemSort(); }); MiscHelper.Btn("Down", 50, 35, () => { sort.sort++; UpdateSystemSort(); }); MiscHelper.Btn("Del", 50, 35, () => { sortAsset.GetSystemSorts(systemType).Remove(sort); UpdateSystemSort(); }); MiscHelper.Dropdown(systemType.ToString(), systemTyps, (int x) => { SystemType newType = (SystemType)x; if (newType == systemType) { return; } sortAsset.GetSystemSorts(systemType).Remove(sort); sortAsset.GetSystemSorts(newType).Add(sort); UpdateSystemSort(); }); }); }
public void DrawGraph(ConfigAssetGroup groupAsset, ConfigAsset asset) { GUILayoutExtension.HorizontalGroup(() => { EditorGUILayout.LabelField(asset.name, GUILayout.Width(150)); if (GUILayout.Button("打开", GUILayout.Width(50))) { ConfigAssetWindow.Open(asset); } if (GUILayout.Button("删除", GUILayout.Width(50))) { groupAsset.RemoveAsset(asset); } if (GUILayout.Button("重命名", GUILayout.Width(50))) { MiscHelper.Input($"输入配置名:", (string name) => { asset.name = name; EditorUtility.SetDirty(asset); EditorUtility.SetDirty(target); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }); } }); }
public override void OnDraw() { GUILayout.BeginHorizontal(); GUILayoutExtension.HorizontalGroup(() => { DrawPlayOperate(); GUILayout.FlexibleSpace(); DrawSkillLineTime(); }, EditorStylesExtension.NullStyle, GUILayout.Width(HorWidth), GUILayout.Height(window.ToolbarSize.height)); GUILayout.FlexibleSpace(); GUILayout.Label(GetTimelineName()); GUILayout.FlexibleSpace(); GUILayoutExtension.HorizontalGroup(() => { DrawBtnList(); }, EditorStylesExtension.NullStyle, GUILayout.Width(HorWidth), GUILayout.Height(window.ToolbarSize.height)); GUILayout.EndHorizontal(); }
private void OnGUI() { if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel)) { bigLabel.value = new GUIStyle(GUI.skin.label); bigLabel.value.fontSize = 18; bigLabel.value.fontStyle = FontStyle.Bold; bigLabel.value.alignment = TextAnchor.MiddleLeft; bigLabel.value.stretchWidth = true; } //¹¤¾ßÀ¸ GUILayoutExtension.HorizontalGroup(() => { string selMap = currSelAsset == null ? "Null" : currSelAsset.name; GUILayout.Label($"µ±Ç°ÅäÖÃ:{selMap}", bigLabel.value); if (currSelAsset != null) { if (GUILayout.Button("±£´æÅäÖÃ", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight))) { SaveAsset(currSelAsset); } } }, GUILayout.Height(50)); if (currSelAsset != null) { GUILayoutExtension.ScrollView(ref ScrollPos, () => { GUILayoutExtension.HorizontalGroup(() => { EditorGUILayout.Space(35); //×ֶΠforeach (var fieldInfo in fields.Keys) { ConfigValueAttribute attr = fields[fieldInfo]; Rect rect = GetFieldRect(fieldInfo); EditorGUI.LabelField(rect, GUIHelper.TextContent(attr.Name, attr.Tooltip), bigLabel.value); } }); for (int i = 0; i < configs.Count; i++) { IConfig config = configs[i]; GUILayoutExtension.HorizontalGroup(() => { GUI.color = Color.white; if (IsInSel(config)) { GUI.color = SelectColor; } MiscHelper.Btn("Ñ¡Ôñ", 35, 35, () => { OnClickSelBtn(config); }); foreach (var fieldInfo in fields.Keys) { object value = fieldInfo.GetValue(config); //float height = GUIExtension.GetHeight(fieldInfo.FieldType, value, GUIHelper.TextContent("")); object newValue = GUIExtension.DrawField(GetFieldRect(fieldInfo), value, GUIHelper.TextContent("")); if (newValue == null || !newValue.Equals(value)) { CommandDispacter.Do(new ChangeValueCommand(config, fieldInfo, newValue)); } } GUI.color = Color.white; }); } }); } OnHandleEvent(Event.current); }
private void OnGUI() { if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel)) { bigLabel.value = new GUIStyle(GUI.skin.label); bigLabel.value.fontSize = 18; bigLabel.value.fontStyle = FontStyle.Bold; bigLabel.value.alignment = TextAnchor.MiddleLeft; bigLabel.value.stretchWidth = true; } //工具栏 GUILayoutExtension.HorizontalGroup(() => { string selMap = currSelMap == null ? "Null" : currSelMap.mapId.ToString(); GUILayout.Label($"当前地图:{selMap}", bigLabel.value); if (GUILayout.Button("加载地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight))) { List <string> mapNames = new List <string>(); for (int i = 0; i < maps.Count; i++) { mapNames.Add(maps[i].mapId.ToString()); } MiscHelper.Menu(mapNames, (string selMap) => { ED_MapCom mapAsset = GetMap(int.Parse(selMap)); GameObject mapGo = (GameObject)PrefabUtility.InstantiatePrefab(mapAsset.gameObject); OnChangeMap(mapGo.GetComponent <ED_MapCom>()); }); } if (currSelMap != null) { if (GUILayout.Button("保存地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight))) { SaveMap(currSelMap); Refresh(); } } if (GUILayout.Button("新建地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight))) { MiscHelper.Input("输入地图Id", (string x) => { if (GetMap(int.Parse(x)) != null) { Debug.LogError($"地图Id重复>>>>{x}"); return; } SaveMap(currSelMap); ED_MapCom mapCom = MapEditorDef.CreateMapGo(x); mapCom.SetUid(GetMapStartUid()); OnChangeMap(mapCom); }); } if (GUILayout.Button("导出所有配置", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight))) { ED_MapCom.ActorCnfs = MapEditorWindow.ActorCnfs; List <ED_MapCom> maps = MapSetting.GetAllMaps(); for (int i = 0; i < maps.Count; i++) { GameObject mapGo = GameObject.Instantiate(maps[i].gameObject); ED_MapCom eD_MapCom = mapGo.GetComponent <ED_MapCom>(); MapModel model = eD_MapCom.ExportData(); string filePath = MapSetting.GetMapModelSavePath(model.mapId.ToString()); IOHelper.WriteText(JsonMapper.ToJson(model), filePath); DestroyImmediate(eD_MapCom.gameObject); Debug.Log($"地图配置生成成功>>>>{filePath}"); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } }, GUILayout.Height(50)); GUILayoutExtension.HorizontalGroup(() => { //演员分组列表 GUILayoutExtension.VerticalGroup(() => { GUILayout.Label("演员列表", bigLabel.value); for (int i = 0; i < ActorCnfs.Count; i++) { if (GUILayout.Button($"{ActorCnfs[i].name}-{ActorCnfs[i].id}", GUILayout.Width(100), GUILayout.Height(BtnHeight))) { ED_ActorCom actorCom = currSelMap.CreateActor(ActorCnfs[i]); Selection.activeObject = actorCom; } } }, GUILayout.Width(50)); }); }