private void OnGUIRowsAndCols(Layout verticalLayout, SerializedProperty property) { SerializedProperty rows = property.FindPropertyRelative("_rows"); Layout.Builder builder = new Layout.Builder(); builder.PushChild(new LayoutChild(LayoutSize.Exact(ROWS_LABEL_WIDTH))); builder.PushChild(new LayoutChild(LayoutSize.RatioOfRemainder(0.5f), LayoutMargin.Right(DIMENSION_CENTER_BUFFER))); builder.PushChild(new LayoutChild(LayoutSize.Exact(COLS_LABEL_WIDTH))); builder.PushChild(new LayoutChild(LayoutSize.RatioOfRemainder(0.5f))); Layout layout = builder.Compile(EditorGUI.IndentedRect(verticalLayout.Next())); EditorGUIExt.PushIndent(0); // Add label and int for row EditorGUI.LabelField(layout.Next(), new GUIContent("Rows:")); rows.intValue = EditorGUI.DelayedIntField(layout.Next(), rows.intValue); // Add label and int for columns EditorGUI.LabelField(layout.Next(), new GUIContent("Cols:")); cols = EditorGUI.DelayedIntField(layout.Next(), cols); EditorGUIExt.PopIndent(); }
public override void OnSRPGCKInspectorGUI() { c.characterName = EditorGUILayout.TextField("Name", c.characterName). NormalizeName(); c.EditorSetBaseStat( "team", EditorGUIExt.FormulaField( "Team #", c.EditorGetBaseStat("team") ?? Formula.Constant(0), "character.team.param", formulaOptions, lastFocusedControl, 0 ) ); EditorGUILayout.Space(); c.size = EditorGUILayout.Vector3Field("Size (Tiles):", c.size); EditorGUILayout.Space(); c.transformOffset = EditorGUILayout.Vector3Field( "Visual Offset:", c.transformOffset ); EditorGUILayout.Space(); c.equipmentSlots = EditorGUIExt.ArrayFoldout( "Equipment Slots", c.equipmentSlots, ref showSlots, false, 128, "body" ); EditorGUILayout.Space(); c.canMountF = EditorGUIExt.FormulaField( "Can Mount (t.)", c.canMountF ?? Formula.True(), "character.canMount.param", formulaOptions, lastFocusedControl, 0 ); c.isMountableF = EditorGUIExt.FormulaField( "Mountable By (t.)", c.isMountableF ?? Formula.False(), "character.isMountable.param", formulaOptions, lastFocusedControl, 0 ); c.EditorSetBaseStat("isTargetable", EditorGUIExt.FormulaField( "Is Targetable", c.EditorGetBaseStat("isTargetable") ?? Formula.True(), "character.isTargetable.param", formulaOptions, lastFocusedControl, 0 ) ); c.stats = EditorGUIExt.ParameterFoldout( "Statistic", c.stats, "" + c.GetInstanceID(), formulaOptions, lastFocusedControl, ref showStats, skipStats ); EditorGUILayout.Space(); }
private void RectSelect(Rect r, ShapeEditor.SelectionType selectionType) { var localRect = EditorGUIExt.FromToRect(ScreenToLocal(r.min), ScreenToLocal(r.max)); m_SelectionRect = localRect; }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUIExt.BasicSwitchDrawer(position, property, label, 80f, "type", "str", "obj"); }
private void SelectPointsInRect(Rect r, SelectionType st) { var localRect = EditorGUIExt.FromToRect(ScreenToLocal(r.min), ScreenToLocal(r.max)); m_Selection.RectSelect(localRect, st); }
protected void ReactionSkillGUI() { s.reactionSkill = EditorGUILayout.Toggle( "Reaction Skill", s.reactionSkill ); if (s.reactionSkill) { GUILayout.Label("Reaction Triggers"); EditorGUILayout.HelpBox( "e.g. \"applied loses health\"", MessageType.Info ); s.reactionStatChangesApplied = EditorGUIExt.StatChangeFoldout( "Stat Change (Applied)", s.reactionStatChangesApplied, ref showReactionStatChangesApplied ); EditorGUILayout.HelpBox( "e.g. \"applied is hit by geomancy\"", MessageType.Info ); s.reactionTypesApplied = EditorGUIExt.ArrayFoldout( "Reactable Type (Applied)", s.reactionTypesApplied, ref showReactionTypesApplied, false, -1, "attack" ); EditorGUILayout.HelpBox( "e.g. \"applier loses MP\"", MessageType.Info ); s.reactionStatChangesApplier = EditorGUIExt.StatChangeFoldout( "Stat Change (Applier)", s.reactionStatChangesApplier, ref showReactionStatChangesApplier ); EditorGUILayout.HelpBox( "e.g. \"applier receives vampirism bonus\"", MessageType.Info ); s.reactionTypesApplier = EditorGUIExt.ArrayFoldout( "Reactable Type (Applier)", s.reactionTypesApplier, ref showReactionTypesApplier, false, -1, "attack" ); //reaction region //reaction effects s.reactionTargetRegion = EditorGUIExt.RegionGUI( "Reaction Target", s.name + ".reaction", s.reactionTargetRegion, formulaOptions, lastFocusedControl, Screen.width - 32 ); s.reactionEffectRegion = EditorGUIExt.RegionGUI( "Reaction Effect", s.name + ".reaction", s.reactionEffectRegion, formulaOptions, lastFocusedControl, Screen.width - 32 ); s.reactionApplicationEffects = EditorGUIExt.StatEffectGroupGUI( "Per-Reaction Effect", s.reactionApplicationEffects, StatEffectContext.Action, "" + s.GetInstanceID(), formulaOptions, lastFocusedControl ); s.reactionEffects = EditorGUIExt.StatEffectGroupsGUI( "Per-Target Effect Group", s.reactionEffects, StatEffectContext.Action, "" + s.GetInstanceID(), formulaOptions, lastFocusedControl ); EditorGUILayout.Space(); } }
protected override void BasicSkillGUI() { CoreSkillGUI(); patk.referredSkill = EditorGUIExt.PickAssetGUI <ActionSkillDef>("Referred Skill", patk.referredSkill); if (patk.referredSkill == null) { patk.referredSkillName = EditorGUILayout.TextField("Referred Name", patk.referredSkillName); patk.referredSkillGroup = EditorGUILayout.TextField("Referred Group", patk.referredSkillGroup ?? ""); } if ((patk.mergeIsEnabledF = MergeChoiceGUI("IsEnabled", patk.mergeIsEnabledF)) != MergeMode.UseOriginal) { s.isEnabledF = EditorGUIExt.FormulaField( "Is Enabled", s.isEnabledF, s.skillName + ".isEnabledF", formulaOptions, lastFocusedControl ); } s.replacesSkill = EditorGUILayout. Toggle("Replaces Skill", s.replacesSkill); if (s.replacesSkill) { s.replacedSkill = EditorGUILayout. TextField("Skill", s.replacedSkill).NormalizeName(); s.replacementPriority = EditorGUILayout. IntField("Priority", s.replacementPriority); s.requiresReplacement = EditorGUILayout. Toggle("Requires Replacement", s.requiresReplacement); } if (!s.isPassive) { s.deactivatesOnApplication = EditorGUILayout. Toggle("Deactivates After Use", s.deactivatesOnApplication); } EditorGUILayout.Space(); if ((patk.mergeParameters = MergeListChoiceGUI("Parameters", patk.mergeParameters)) != MergeModeList.UseOriginal) { s.parameters = EditorGUIExt.ParameterFoldout( "Parameter", s.parameters, "" + s.GetInstanceID(), formulaOptions, lastFocusedControl, ref showParameters ); } EditorGUILayout.Space(); if ((patk.mergePassiveEffects = MergeListChoiceGUI("Passive Effects", patk.mergePassiveEffects)) != MergeModeList.UseOriginal) { s.passiveEffects = EditorGUIExt.StatEffectFoldout( "Passive Effect", s.passiveEffects, StatEffectContext.Normal, "" + s.GetInstanceID(), formulaOptions, lastFocusedControl, ref showPassiveEffects ); } }
protected override void TargetedSkillGUI() { if ((patk.mergeTurnToFaceTarget = MergeChoiceGUI("Face Target", patk.mergeTurnToFaceTarget)) != MergeMode.UseOriginal) { atk.turnToFaceTarget = EditorGUILayout.Toggle("Face Target", atk.turnToFaceTarget); } if ((patk.mergeDelay = MergeChoiceGUI("Scheduled Delay", patk.mergeDelay)) != MergeMode.UseOriginal) { atk.delay = EditorGUIExt.FormulaField("Scheduled Delay", atk.delay, atk.GetInstanceID() + "." + atk.name + ".delay", formulaOptions, lastFocusedControl); } if ((patk.mergeDelayedApplicationUsesOriginalPosition = MergeChoiceGUI("Trigger from Original Position", patk.mergeDelayedApplicationUsesOriginalPosition)) != MergeMode.UseOriginal) { atk.delayedApplicationUsesOriginalPosition = EditorGUILayout.Toggle("Trigger from Original Position", atk.delayedApplicationUsesOriginalPosition); } if ((patk.mergeMultiTargetMode = MergeChoiceGUI("Multi-Target Mode", patk.mergeMultiTargetMode)) != MergeMode.UseOriginal) { atk.multiTargetMode = (MultiTargetMode)EditorGUILayout.EnumPopup("Multi-Target Mode", atk.multiTargetMode); } if ((patk.mergeMaxWaypointDistanceF = MergeChoiceGUI("Max Waypoint Distance", patk.mergeMaxWaypointDistanceF)) != MergeMode.UseOriginal) { atk.maxWaypointDistanceF = EditorGUIExt.FormulaField("Max Waypoint Distance", atk.maxWaypointDistanceF, atk.GetInstanceID() + "." + atk.name + ".targeting.maxWaypointDistance", formulaOptions, lastFocusedControl); } if ((patk.mergeWaypointsAreIncremental = MergeChoiceGUI("Instantly Apply Waypoints", patk.mergeWaypointsAreIncremental)) != MergeMode.UseOriginal) { atk.waypointsAreIncremental = EditorGUILayout.Toggle("Instantly Apply Waypoints", atk.waypointsAreIncremental); } if ((patk.mergeCanCancelWaypoints = MergeChoiceGUI("Cancellable Waypoints", patk.mergeCanCancelWaypoints)) != MergeMode.UseOriginal) { atk.canCancelWaypoints = EditorGUILayout.Toggle("Cancellable Waypoints", atk.canCancelWaypoints); } if ((patk.mergeTargetSettings = MergeChoiceGUI("Target Settings", patk.mergeTargetSettings)) != MergeMode.UseOriginal) { if (atk.targetSettings == null) { atk.targetSettings = new TargetSettings[] { new TargetSettings() }; } EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); int arraySize = EditorGUILayout.IntField(atk.targetSettings.Length, GUILayout.Width(32)); GUILayout.Label(" " + "Target" + (atk.targetSettings.Length == 1 ? "" : "s")); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); var oldSettings = atk.targetSettings; if (arraySize != atk.targetSettings.Length) { TargetSettings[] newSettings = atk.targetSettings; Array.Resize(ref newSettings, arraySize); atk.targetSettings = newSettings; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); for (int i = 0; i < atk.targetSettings.Length; i++) { TargetSettings ts = i < oldSettings.Length ? oldSettings[i] : atk.targetSettings[i]; if (ts == null) { atk.targetSettings[i] = new TargetSettings(); ts = atk.targetSettings[i]; } atk.targetSettings[i] = EditorGUIExt.TargetSettingsGUI("Target " + i, atk.targetSettings[i], atk, formulaOptions, lastFocusedControl, i); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } }
private void RectSelect(Rect r, ShapeEditor.SelectionType selectionType) { Rect value = EditorGUIExt.FromToRect(this.ScreenToLocal(r.min), this.ScreenToLocal(r.max)); this.m_SelectionRect = new Rect?(value); }
protected virtual void TargetedSkillGUI() { if (!(target is MoveSkillDef)) { atk.turnToFaceTarget = EditorGUILayout.Toggle("Face Target", atk.turnToFaceTarget); } atk.delay = EditorGUIExt.FormulaField("Scheduled Delay", atk.delay, atk.GetInstanceID() + "." + atk.name + ".delay", formulaOptions, lastFocusedControl); if (Formula.NotNullFormula(atk.delay) && !(atk.delay.formulaType == FormulaType.Constant && atk.delay.constantValue == 0)) { atk.delayedApplicationUsesOriginalPosition = EditorGUILayout.Toggle("Trigger from Original Position", atk.delayedApplicationUsesOriginalPosition); } if (atk.targetSettings == null) { atk.targetSettings = new TargetSettings[] { new TargetSettings() }; } if ((atk.multiTargetMode = (MultiTargetMode)EditorGUILayout.EnumPopup("Multi-Target Mode", atk.multiTargetMode)) != MultiTargetMode.Single) { if (atk.multiTargetMode == MultiTargetMode.Chain) { atk.maxWaypointDistanceF = EditorGUIExt.FormulaField("Max Waypoint Distance", atk.maxWaypointDistanceF, atk.GetInstanceID() + "." + atk.name + ".targeting.maxWaypointDistance", formulaOptions, lastFocusedControl); } atk.waypointsAreIncremental = EditorGUILayout.Toggle("Instantly Apply Waypoints", atk.waypointsAreIncremental); atk.canCancelWaypoints = EditorGUILayout.Toggle("Cancellable Waypoints", atk.canCancelWaypoints); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); int arraySize = EditorGUILayout.IntField(atk.targetSettings.Length, GUILayout.Width(32)); GUILayout.Label(" " + "Target" + (atk.targetSettings.Length == 1 ? "" : "s")); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); var oldSettings = atk.targetSettings; if (arraySize != atk.targetSettings.Length) { TargetSettings[] newSettings = atk.targetSettings; Array.Resize(ref newSettings, arraySize); atk.targetSettings = newSettings; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); for (int i = 0; i < atk.targetSettings.Length; i++) { TargetSettings ts = i < oldSettings.Length ? oldSettings[i] : atk.targetSettings[i]; if (ts == null) { atk.targetSettings[i] = new TargetSettings(); ts = atk.targetSettings[i]; } atk.targetSettings[i] = EditorGUIExt.TargetSettingsGUI("Target " + i, atk.targetSettings[i], atk, formulaOptions, lastFocusedControl, i); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } else { atk.targetSettings[0] = EditorGUIExt.TargetSettingsGUI("Target", atk.targetSettings[0], atk, formulaOptions, lastFocusedControl, -1); } }
public override void OnSRPGCKInspectorGUI() { if (inv.GetComponent <Character>() != null) { EditorGUILayout.HelpBox("Inventory is used for unequipped items such as commodities and consumables. Inventory items do not provide passive effects, skills, or other adjustments until they are instantiated. Formulae are in character-stat scope.", MessageType.Info); } EditorGUIUtility.LookLikeInspector(); inv.limitedStacks = EditorGUILayout.Toggle( "Limited Stacks", inv.limitedStacks ); if (inv.limitedStacks) { inv.stackLimitF = EditorGUIExt.FormulaField( "Stack Limit:", inv.stackLimitF ?? Formula.Constant(20), inv.name + ".inventory.stackLimit", formulaOptions, lastFocusedControl ); } inv.limitedStacks = EditorGUILayout.Toggle( "Override Item Stack Size", inv.limitedStackSize ); if (inv.limitedStackSize) { inv.stackSizeF = EditorGUIExt.FormulaField( "Stack Size:", inv.stackSizeF ?? Formula.Constant(1), inv.name + ".inventory.stackSize", formulaOptions, lastFocusedControl ); } inv.limitedWeight = EditorGUILayout.Toggle( "Limited Weight", inv.limitedWeight ); if (inv.limitedWeight) { inv.weightLimitF = EditorGUIExt.FormulaField( "Weight Limit:", inv.weightLimitF ?? Formula.Constant(20), inv.name + ".inventory.weightLimit", formulaOptions, lastFocusedControl ); } inv.stacksMustBeUnique = EditorGUILayout.Toggle( "Stacks Must Be Unique", inv.stacksMustBeUnique ); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); if (inv.items == null) { inv.items = new List <Item>(); } if (inv.counts == null) { inv.counts = new List <int>(); } int arraySize = inv.items.Count; EditorGUILayout.BeginHorizontal(); GUILayout.Label("Size", GUILayout.Height(18)); GUILayout.FlexibleSpace(); arraySize = EditorGUILayout.IntField( arraySize, EditorStyles.textField, GUILayout.Height(18) ); EditorGUILayout.EndHorizontal(); while (arraySize > inv.items.Count) { Item def = null; int ct = 1; if (inv.items.Count > 0) { def = inv.items[inv.items.Count - 1]; ct = inv.counts[inv.counts.Count - 1]; } inv.items.Add(def); inv.counts.Add(ct); } while (arraySize < inv.items.Count) { inv.items.RemoveAt(inv.items.Count - 1); inv.counts.RemoveAt(inv.counts.Count - 1); } for (int i = 0; i < inv.items.Count; i++) { EditorGUILayout.BeginHorizontal(); inv.items[i] = EditorGUILayout.ObjectField( inv.items[i] as UnityEngine.Object, typeof(Item), false ) as Item; GUILayout.FlexibleSpace(); inv.counts[i] = EditorGUILayout.IntField(inv.counts[i]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUIUtility.LookLikeControls(); }
private static Rect GetCurrentRect(bool screenSpace, float textureWidth, float textureHeight, Vector2 startPoint, Vector2 endPoint) { Rect rect = SpriteEditorUtility.ClampedRect(SpriteEditorUtility.RoundToInt(EditorGUIExt.FromToRect(Handles.s_InverseMatrix.MultiplyPoint((Vector3)startPoint), Handles.s_InverseMatrix.MultiplyPoint((Vector3)endPoint))), new Rect(0f, 0f, textureWidth, textureHeight), false); if (screenSpace) { Vector2 vector = Handles.matrix.MultiplyPoint((Vector3) new Vector2(rect.xMin, rect.yMin)); Vector2 vector2 = Handles.matrix.MultiplyPoint((Vector3) new Vector2(rect.xMax, rect.yMax)); rect = new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y); } return(rect); }
public void OnGUI() { var evt = UnityEvent.current; Handles.BeginGUI(); Vector2 mousePos = evt.mousePosition; int id = m_RectSelectionID; switch (evt.GetTypeForControl(id)) { case EventType.Layout: if (!Tools.viewToolActive) { HandleUtility.AddDefaultControl(id); } break; case EventType.MouseDown: if (HandleUtility.nearestControl == id && evt.button == 0) { guiUtility.hotControl = id; m_SelectStartPoint = mousePos; } break; case EventType.MouseDrag: if (guiUtility.hotControl == id) { if (!m_RectSelecting && (mousePos - m_SelectStartPoint).magnitude > k_MinSelectionSize) { m_RectSelecting = true; } if (m_RectSelecting) { m_SelectMousePoint = mousePos; SelectionType type = SelectionType.Normal; if (UnityEvent.current.control) { type = SelectionType.Subtractive; } else if (UnityEvent.current.shift) { type = SelectionType.Additive; } RectSelect(EditorGUIExt.FromToRect(m_SelectStartPoint, m_SelectMousePoint), type); } evt.Use(); } break; case EventType.Repaint: if (guiUtility.hotControl == id && m_RectSelecting) { EditorStyles.selectionRect.Draw(EditorGUIExt.FromToRect(m_SelectStartPoint, m_SelectMousePoint), GUIContent.none, false, false, false, false); } break; case EventType.MouseUp: if (guiUtility.hotControl == id && evt.button == 0) { guiUtility.hotControl = 0; guiUtility.keyboardControl = 0; if (m_RectSelecting) { m_SelectMousePoint = new Vector2(mousePos.x, mousePos.y); SelectionType type = SelectionType.Normal; if (UnityEvent.current.control) { type = SelectionType.Subtractive; } else if (UnityEvent.current.shift) { type = SelectionType.Additive; } RectSelect(EditorGUIExt.FromToRect(m_SelectStartPoint, m_SelectMousePoint), type); m_RectSelecting = false; } else { ClearSelection(); } evt.Use(); } break; } Handles.EndGUI(); }
private static void DisplayAutoCompleteSection(CommandConsoleWindow window, string controlName) { ParametricCommandExecution exec = window.CurrentExecution; GUILayout.BeginVertical(MonkeyStyle.Instance.SearchLabelGroupStyle); if (exec.IsArray && exec.CurrentTextEntered.IsNullOrEmpty() && exec.CurrentAutoCompleteID == -1) { if (exec.HasNextVariable) { GUILayout.Label("Press TAB or ENTER to go to the next variable", MonkeyStyle.Instance.VariableTypeTextStyle, GUILayout.ExpandWidth(true)); } else { GUILayout.Label("Press TAB or ENTER to go to execute the command", MonkeyStyle.Instance.VariableTypeTextStyle, GUILayout.ExpandWidth(true)); } } GUILayout.BeginHorizontal(MonkeyStyle.Instance.SearchLabelStyle); GUILayout.BeginHorizontal(MonkeyStyle.Instance.AutoCompleteSearchLabelGroupStyle); DisplayInstructionOrDefault(window, exec); GUI.SetNextControlName(controlName); window.SearchTerms = EditorGUIExt.TextField(window.SearchTerms, controlName, MonkeyStyle.Instance.SearchLabelStyle); if (!window.IsDocked || window.JustOpenedActiveMode || window.PreventSearchMovement || window.Focused) { if (window.PreventSearchMovement) { CommandConsoleWindow.ForceEditSearchAtEnd(window.SearchTerms); } window.Focus(); GUI.FocusControl(controlName); } // GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); ComputeDragAndDrop(window); GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); DisplayAutoCompleteOptions(window); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); }
public override void OnSRPGCKInspectorGUI() { //Be sure that changing the team ID checks for duplicates! int newID = EditorGUILayout.IntField("ID", team.id); if (newID != team.id) { if (team.arbiter.GetTeam(newID) != null) { Debug.LogError("Cannot assign duplicate team ID " + newID); } else { team.id = newID; } } team.type = (TeamLocation)EditorGUILayout.EnumPopup("Type", team.type); team.parameters = EditorGUIExt.ParameterFoldout( "Parameter", team.parameters, "team." + team.id + ".params.", formulaOptions, lastFocusedControl, ref team.editorShowParameters ); if (team.arbiter == null) { EditorGUILayout.HelpBox("Teams must be children of Arbiter objects", MessageType.Error); return; } //toggles for ally/enemy by team, excepting self EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); //labels GUILayout.Label("Team:", GUILayout.Width(64), GUILayout.Height(18)); GUILayout.Label("Ally", GUILayout.Width(64), GUILayout.Height(18)); GUILayout.Label("Enemy", GUILayout.Width(64), GUILayout.Height(18)); GUILayout.Label("Neutral", GUILayout.Width(64), GUILayout.Height(18)); EditorGUILayout.EndVertical(); teamScroll = EditorGUILayout.BeginScrollView(teamScroll, false, false, GUILayout.Height(90)); EditorGUILayout.BeginHorizontal(); foreach (var t in team.arbiter.EditorGetTeams()) { if (t == team) { EditorGUILayout.BeginVertical(); GUILayout.Label("" + t.id, GUILayout.Width(32), GUILayout.Height(16)); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); continue; } EditorGUILayout.BeginVertical(); if (GUILayout.Button("" + t.id, GUILayout.Width(32), GUILayout.Height(16))) { EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorUtility.FocusProjectWindow(); Selection.activeObject = t; return; } EditorGUILayout.BeginHorizontal(); GUILayout.Space(12); EditorGUILayout.BeginVertical(); //radio boxes bool ally = team.allies.Contains(t.id); bool enemy = !ally && team.enemies.Contains(t.id); bool neutral = !ally && !enemy; bool newAlly = EditorGUILayout.Toggle(ally, EditorStyles.radioButton, GUILayout.Width(16), GUILayout.Height(16)); if (newAlly != ally) { if (newAlly) { team.allies.Add(t.id); team.enemies.Remove(t.id); } else { team.allies.Remove(t.id); } } if (newAlly) { enemy = false; neutral = false; } bool newEnemy = EditorGUILayout.Toggle(enemy, EditorStyles.radioButton, GUILayout.Width(16), GUILayout.Height(16)); if (newEnemy != enemy) { if (newEnemy) { team.enemies.Add(t.id); team.allies.Remove(t.id); } else { team.enemies.Remove(t.id); } } if (newEnemy) { neutral = false; } bool newNeutral = EditorGUILayout.Toggle(neutral, EditorStyles.radioButton, GUILayout.Width(16), GUILayout.Height(16)); if (newNeutral != neutral) { if (newNeutral) { team.enemies.Remove(t.id); team.allies.Remove(t.id); } } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); // GUILayout.Space(6); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); }