private void CreateCurrentCardTypeStatsList() { currentCardTypeStatsList = EditorUtils.SetupReorderableList("Card stats", currentCardType.stats, ref currentCardTypeStat, (rect, x) => { EditorGUI.LabelField(new Rect(rect.x, rect.y, 200, EditorGUIUtility.singleLineHeight), x.name); }, (x) => { currentCardTypeStat = x; }, () => { var stat = new CardStat(); if (currentCardType.stats.Count > 0) { stat.id = currentCardType.stats.Max(x => x.id) + 1; } else { stat.id = 0; } currentCardType.stats.Add(stat); }, (x) => { currentCardTypeStat = null; }); }
public CardTypesEditor(GameConfiguration config) : base(config) { cardTypesList = EditorUtils.SetupReorderableList("Card types", gameConfig.cardTypes, ref currentCardType, (rect, x) => { EditorGUI.LabelField(new Rect(rect.x, rect.y, 200, EditorGUIUtility.singleLineHeight), x.name); }, (x) => { currentCardType = x; currentCardTypeProperty = null; currentCardTypeStat = null; currentCardTypeDestroyCondition = null; CreateCurrentCardTypePropertiesList(); CreateCurrentCardTypeStatsList(); CreateCurrentCardTypeDestroyConditionsList(); }, () => { var cardType = new CardType(); gameConfig.cardTypes.Add(cardType); }, (x) => { currentCardType = null; currentCardTypeProperty = null; currentCardTypeStat = null; currentCardTypeDestroyCondition = null; }); }
protected void DrawDefinitionStat(DefinitionStat stat) { var oldLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = EditorConfig.LargeLabelWidth; GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Name"); stat.name = EditorGUILayout.TextField(stat.name, GUILayout.MaxWidth(EditorConfig.RegularTextFieldWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Base value"); stat.baseValue = EditorGUILayout.IntField(stat.baseValue, GUILayout.MaxWidth(EditorConfig.RegularIntFieldWidth)); stat.originalValue = stat.baseValue; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Minimum value"); stat.minValue = EditorGUILayout.IntField(stat.minValue, GUILayout.MaxWidth(EditorConfig.RegularIntFieldWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Maximum value"); stat.maxValue = EditorGUILayout.IntField(stat.maxValue, GUILayout.MaxWidth(EditorConfig.RegularIntFieldWidth)); GUILayout.EndHorizontal(); GUILayout.EndVertical(); EditorGUIUtility.labelWidth = oldLabelWidth; }
public PlayerEditor(GameConfiguration config) : base(config) { playerStatsList = EditorUtils.SetupReorderableList("Player stats", gameConfig.playerStats, ref currentPlayerStat, (rect, x) => { EditorGUI.LabelField(new Rect(rect.x, rect.y, 200, EditorGUIUtility.singleLineHeight), x.name); }, (x) => { currentPlayerStat = x; }, () => { var stat = new PlayerStat(); gameConfig.playerStats.Add(stat); }, (x) => { currentPlayerStat = null; }); }