static void SizeToolsButtonToData(SizePositionCategory cat, SizePositionButton button, ref SizePositionMod mod) { switch (cat) { case SizePositionCategory.Size: switch (button) { case SizePositionButton.SizeTopUp: mod.SizeModifier = Vector2Int.up; break; case SizePositionButton.SizeTopDown: mod.SizeModifier = Vector2Int.down; break; case SizePositionButton.SizeLeftEdgeRight: mod.SizeModifier = Vector2Int.left; mod.PosModifier = Vector2Int.right; mod.SpecialCase = true; break; case SizePositionButton.SizeLeftEdgeLeft: mod.SizeModifier = Vector2Int.right; mod.PosModifier = Vector2Int.left; mod.SpecialCase = true; break; case SizePositionButton.SizeRightEdgeRight: mod.SizeModifier = Vector2Int.right; break; case SizePositionButton.SizeRightEdgeLeft: mod.SizeModifier = Vector2Int.left; break; case SizePositionButton.SizeBottomDown: mod.SizeModifier = Vector2Int.up; mod.PosModifier = Vector2Int.down; mod.SpecialCase = true; break; case SizePositionButton.SizeBottomUp: mod.SizeModifier = Vector2Int.down; mod.PosModifier = Vector2Int.up; mod.SpecialCase = true; break; } break; case SizePositionCategory.Position: switch (button) { case SizePositionButton.Left: mod.PosModifier = Vector2Int.left; break; case SizePositionButton.Up: mod.PosModifier = Vector2Int.up; break; case SizePositionButton.Down: mod.PosModifier = Vector2Int.down; break; case SizePositionButton.Right: mod.PosModifier = Vector2Int.right; break; } break; case SizePositionCategory.Tiles: switch (button) { case SizePositionButton.Left: mod.TileModifier = Vector2Int.left; break; case SizePositionButton.Up: mod.TileModifier = Vector2Int.up; break; case SizePositionButton.Down: mod.TileModifier = Vector2Int.down; break; case SizePositionButton.Right: mod.TileModifier = Vector2Int.right; break; } break; } }
// ReSharper disable once MethodTooLong static SizePositionButton SizeToolsInnerGUI(out SizePositionCategory cat, out SizePositionButton button) { cat = SizePositionCategory.None; button = SizePositionButton.None; using (new GUILayout.HorizontalScope()) { using (new GUILayout.VerticalScope()) { using (new GUILayout.HorizontalScope()) { GUILayout.Space(57); if (GUILayout.Button("^", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeTopUp; } } using (new GUILayout.HorizontalScope()) { GUILayout.Space(57); if (GUILayout.Button("v", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeTopDown; } } using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("<", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeLeftEdgeLeft; } if (GUILayout.Button(">", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeLeftEdgeRight; } GUILayout.Label("Size", GUILayout.Width(30)); if (GUILayout.Button("<", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeRightEdgeLeft; } if (GUILayout.Button(">", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeRightEdgeRight; } } using (new GUILayout.HorizontalScope()) { GUILayout.Space(57); if (GUILayout.Button("^", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeBottomUp; } } using (new GUILayout.HorizontalScope()) { GUILayout.Space(57); if (GUILayout.Button("v", GUILayout.Width(20))) { cat = SizePositionCategory.Size; button = SizePositionButton.SizeBottomDown; } } } //GUILayout.Space(100); using (new GUILayout.VerticalScope()) { GUILayout.Space(14); using (new GUILayout.HorizontalScope()) { GUILayout.Space(42); if (GUILayout.Button("^", GUILayout.Width(20))) { cat = SizePositionCategory.Position; button = SizePositionButton.Up; } } GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("<", GUILayout.Width(20))) { cat = SizePositionCategory.Position; button = SizePositionButton.Left; } GUILayout.Label("Position", GUILayout.Width(50)); if (GUILayout.Button(">", GUILayout.Width(20))) { cat = SizePositionCategory.Position; button = SizePositionButton.Right; } } GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { GUILayout.Space(42); if (GUILayout.Button("v", GUILayout.Width(20))) { cat = SizePositionCategory.Position; button = SizePositionButton.Down; } } } using (new GUILayout.VerticalScope()) { GUILayout.Space(14); using (new GUILayout.HorizontalScope()) { GUILayout.Space(42); if (GUILayout.Button("^", GUILayout.Width(20))) { cat = SizePositionCategory.Tiles; button = SizePositionButton.Up; } } GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("<", GUILayout.Width(20))) { cat = SizePositionCategory.Tiles; button = SizePositionButton.Left; } GUILayout.Label(" Tiles", GUILayout.Width(50)); if (GUILayout.Button(">", GUILayout.Width(20))) { cat = SizePositionCategory.Tiles; button = SizePositionButton.Right; } } GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { GUILayout.Space(42); if (GUILayout.Button("v", GUILayout.Width(20))) { cat = SizePositionCategory.Tiles; button = SizePositionButton.Down; } } } } GUILayout.Space(10); return(button); }