private void Gui_PLYDataList() { Rect Panel = new Rect(0f, 0f, 250f, 800f); GUILayout.BeginArea(Panel, new GUIContent("PLY Data List"), GUI.skin.window); GUILayout.BeginHorizontal(); GUILayout.Label("Search", GUILayout.Width(60)); SearchText = GUILayout.TextField(SearchText); GUILayout.EndHorizontal(); ListScroll = GUILayout.BeginScrollView(ListScroll, false, true); for (int Index = 0; Index < PLYDataList.Count; ++Index) { string Name = MeshList[Index].name; if (ModGUI.NameSearch(Name, SearchText)) { bool flag2 = Index == SelectID; if (GUILayout.Button(string.Format("ID : {0}\n{1}", Index, Name), (!flag2) ? "button" : "buttongreen", GUILayout.ExpandHeight(false)) && !flag2) { SelectID = Index; GUISoundManager.GetSingleton().PlayBeep(); } } } GUILayout.EndScrollView(); GUILayout.EndArea(); }
private bool Gui_1 <T>(List <string> NameList, List <T> ObjectList, ref T SelectObject, ref string Search, ref Vector2 Scroll) where T : UnityEngine.Object { GUILayout.BeginHorizontal(); GUILayout.Label("Search", GUILayout.Width(60)); Search = GUILayout.TextField(Search); GUILayout.EndHorizontal(); Scroll = GUILayout.BeginScrollView(Scroll, false, true); bool B = false; for (int Index = 0; Index < NameList.Count; ++Index) { string Name = NameList[Index]; if (ModGUI.NameSearch(Name, Search)) { bool Flag = SelectObject != ObjectList[Index]; string Text = string.Format("ID : {0}\n{1}", Index, Name); if (GUILayout.Button(new GUIContent(Text), (Flag) ? "button" : "buttongreen", GUILayout.ExpandHeight(false)) && Flag) { SelectObject = ObjectList[Index]; B = true; GUISoundManager.GetSingleton().PlayBeep(); } } } GUILayout.EndScrollView(); GUILayout.EndArea(); return(B); }
public override void OnGui() { GUILayout.BeginArea(new Rect(0f, 0f, 340f, 580f), "Select Contestants", GUI.skin.window); _treeSelector.OnGui(new Rect(30f, 35f, 280f, 520f), new Action <BlueprintFile>(UpdateFileData)); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(340f, 0f, 600f, 580f), "Tournament Settings", GUI.skin.window); optpos = GUILayout.BeginScrollView(optpos, false, true); GUISliders.TotalWidthOfWindow = 580; GUISliders.TextWidth = 240; GUISliders.DecimalPlaces = 0; GUISliders.UpperMargin = 0; _focus.spawndis = GUISliders.LayoutDisplaySlider("Spawn Distance", _focus.spawndis, 100f, 5000f, enumMinMax.none, new ToolTip("Spawn distance between teams")); _focus.spawngap = GUISliders.LayoutDisplaySlider("Spawn Gap", _focus.spawngap, 10f, 500f, enumMinMax.none, new ToolTip("Spawn distance between team members")); _focus.minalt = GUISliders.LayoutDisplaySlider("Min Alt", _focus.minalt, -500f, _focus.maxalt, enumMinMax.none, new ToolTip("Add to penalty time when below this")); _focus.maxalt = GUISliders.LayoutDisplaySlider("Max Alt", _focus.maxalt, _focus.minalt, 2000f, enumMinMax.none, new ToolTip("Add to penalty time when above this")); _focus.maxdis = GUISliders.LayoutDisplaySlider("Max Dis", _focus.maxdis, 0f, 10000f, enumMinMax.none, new ToolTip("Max distance from nearest enemy before penalty time added")); _focus.maxoob = GUISliders.LayoutDisplaySlider("Penalty Time", _focus.maxoob, 0f, 10000f, enumMinMax.none, new ToolTip("Max penalty time (seconds)")); _focus.maxtime = GUISliders.LayoutDisplaySlider("Match Time", _focus.maxtime, 0f, 10000f, enumMinMax.none, new ToolTip("Max match time (seconds), Currently doesn't effect anything")); _focus.maxcost = GUISliders.LayoutDisplaySlider("Max Design Cost", _focus.maxcost, 0f, 10000000f, enumMinMax.none, new ToolTip("Max design cost, Currently doesn't effect anything")); _focus.maxmat = GUISliders.LayoutDisplaySlider("Starting Material", _focus.maxmat, 0f, 100000f, enumMinMax.none, new ToolTip("Amount of material per team (centralised)")); _focus.matconv = GUISliders.LayoutDisplaySlider("Dmg to Mat %", _focus.matconv, -1f, 100f, enumMinMax.none, new ToolTip("Damage to material conversion, -1 disables self/team damage material return")); _focus.eastWestBoard = (int)GUISliders.LayoutDisplaySlider("E-W Board", _focus.eastWestBoard, 0, sectionsEastWest, enumMinMax.none, new ToolTip("The east-west boardindex, it is the first number on the map. 0 is the left side")); _focus.northSouthBoard = (int)GUISliders.LayoutDisplaySlider("N-S Board", _focus.northSouthBoard, 0, sectionsNorthSouth, enumMinMax.none, new ToolTip("The north-south boardindex, it is the second number on the map. 0 is the bottom side.")); _focus.MoveCam(); _focus.srules = Convert.ToBoolean(GUISliders.LayoutDisplaySlider(((Tournament.OPTIONS.STANDARDRULES)Convert.ToInt32(_focus.srules)).ToString(), Convert.ToInt32(_focus.srules), 0f, 1f, enumMinMax.none, new ToolTip("Standard despawn rules, or customise"))); if (!_focus.srules) { _focus.penaltynoai = Convert.ToBoolean(GUISliders.LayoutDisplaySlider(((Tournament.OPTIONS.AIPENALTY)Convert.ToInt32(_focus.penaltynoai)).ToString(), Convert.ToInt32(_focus.penaltynoai), 0f, 1f, enumMinMax.none, new ToolTip("Does having no AI left add to penalty time?"))); _focus.standardhp = Convert.ToBoolean(GUISliders.LayoutDisplaySlider(((Tournament.OPTIONS.HPMODE)Convert.ToInt32(_focus.standardhp)).ToString(), Convert.ToInt32(_focus.standardhp), 0f, 1f, enumMinMax.none, new ToolTip("Calculate HP by % of alive blocks or % of alive block costs"))); _focus.penaltyhp = GUISliders.LayoutDisplaySlider("HP Penalty %", _focus.penaltyhp, 0f, 100f, enumMinMax.none, new ToolTip("Adds to penalty time when below hp %, 0 disables")); } GUILayout.EndScrollView(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(0f, 580f, 940f, 200f), "Spawn Settings", GUI.skin.window); GUISliders.TotalWidthOfWindow = 600; GUISliders.TextWidth = 240; GUISliders.DecimalPlaces = 0; GUISliders.UpperMargin = 40; Dir = (Tournament.SPAWN.DIR)GUISliders.DisplaySlider(0, Dir.ToString(), (int)Dir, 0, 3, enumMinMax.none, new ToolTip("Direction")); Loc = (Tournament.SPAWN.LOC)GUISliders.DisplaySlider(1, Loc.ToString(), (int)Loc, 0, 3, enumMinMax.none, new ToolTip("Location")); if (_treeSelector.CurrentData != null) { if (GUI.Button(new Rect(600f, 25f, 280f, 50f), "Add to Team 1")) { GUISoundManager.GetSingleton().PlayBeep(); TournamentEntry tmp = new TournamentEntry { IsKing = true, spawn_direction = Dir, spawn_location = Loc, Bpf = _treeSelector.CurrentData }; _focus.entry_t1.Add(tmp); } if (GUI.Button(new Rect(600f, 100f, 280f, 50f), "Add to Team 2")) { GUISoundManager.GetSingleton().PlayBeep(); TournamentEntry tmp = new TournamentEntry { IsKing = false, spawn_direction = Dir, spawn_location = Loc, Bpf = _treeSelector.CurrentData }; _focus.entry_t2.Add(tmp); } } GUILayout.EndArea(); GUILayout.BeginArea(new Rect(940f, 0f, 340f, 580f), "Selected", GUI.skin.window); listpos = GUILayout.BeginScrollView(listpos); GUILayout.Box("<color=#ffa500ff>~---------T1---------~</color>"); if (_focus.entry_t1.Count != 0) { foreach (TournamentEntry tp in _focus.entry_t1) { var tmpk = ""; foreach (var s in tp.LabelCost) { tmpk += "\n" + s; } GUILayout.Box(string.Format("<color=#ffa500ff>{3} {2}\n{0} {1}\n~-------SPAWNS-------~</color>{4}\n<color=#ffa500ff>~--------------------~</color>", tp.Bpf.Name, tp.bp.CalculateResourceCost(false, true).Material, tp.spawn_location, tp.spawn_direction, tmpk)); if (GUILayout.Button("^ Remove ^")) { _focus.entry_t1.Remove(tp); } } } GUILayout.Box("<color=#ff0000ff>~---------T2---------~</color>"); if (_focus.entry_t2.Count != 0) { foreach (TournamentEntry tp in _focus.entry_t2) { var tmpk = ""; foreach (var s in tp.LabelCost) { tmpk += "\n" + s; } GUILayout.Box(string.Format("<color=#ff0000ff>{3} {2}\n{0} {1}\n~-------SPAWNS-------~</color>{4}\n<color=#ffa500ff>~--------------------~</color>", tp.Bpf.Name, tp.bp.CalculateResourceCost(false, true).Material, tp.spawn_location, tp.spawn_direction, tmpk)); if (GUILayout.Button("^ Remove ^")) { _focus.entry_t2.Remove(tp); } } } GUILayout.EndScrollView(); GUILayout.EndArea(); if (GUI.Button(new Rect(970f, 660f, 280f, 50f), "Start") && _focus.entry_t1.Count > 0 && _focus.entry_t2.Count > 0) { DeactivateGui(); _focus.StartMatch(); } }
public unsafe override void OnGui() { GUILayout.BeginArea(new Rect(0f, 0f, 340f, 580f), "Select Contestants", GUI.skin.window); _treeSelector.ScaleTheUi = true; _treeSelector.OnGui(new Rect(30f, 35f, 280f, 520f), (Action <BlueprintFile>)UpdateFileData); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(340f, 0f, 600f, 430f), "Tournament Settings", GUI.skin.window); optpos = GUILayout.BeginScrollView(optpos, (GUILayoutOption[])new GUILayoutOption[0]); GUISliders.TotalWidthOfWindow = 580; GUISliders.TextWidth = 240; GUISliders.DecimalPlaces = 0; GUISliders.UpperMargin = 0; t.spawndis = GUISliders.DisplaySlider(0, "Spawn Distance", t.spawndis, 100f, 10000f, 0, new ToolTip("Spawn distance between teams")); t.spawngap = GUISliders.DisplaySlider(1, "Spawn Gap Horizontal", t.spawngap, 0f, 500f, 0, new ToolTip("Spawn distance between team members left to right")); t.spawngap2 = GUISliders.DisplaySlider(2, "Spawn Gap Forward-Back", t.spawngap2, 0f, 1000f, 0, new ToolTip("Spawn distance between team members front to back")); t.minalt = GUISliders.DisplaySlider(3, "Min Alt", t.minalt, -500f, t.maxalt, 0, new ToolTip("Add to penalty time when below this")); t.maxalt = GUISliders.DisplaySlider(4, "Max Alt", t.maxalt, t.minalt, 2000f, 0, new ToolTip("Add to penalty time when above this")); t.maxdis = GUISliders.DisplaySlider(5, "Max Dis", t.maxdis, 0f, 10000f, 0, new ToolTip("Max distance from nearest enemy before penalty time added")); t.maxoob = GUISliders.DisplaySlider(6, "Penalty Time", t.maxoob, 0f, 10000f, 0, new ToolTip("Max penalty time (seconds)")); t.maxtime = GUISliders.DisplaySlider(7, "Match Time", t.maxtime, 0f, 10000f, 0, new ToolTip("Max match time (seconds)")); t.maxmat = GUISliders.DisplaySlider(8, "Starting Material", t.maxmat, 0f, 1000000f, 0, new ToolTip("Amount of material per team (centralised) or per vehicle (localised)")); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); GUILayout.Space(40); t.localResourcesBool = GUILayout.Toggle(t.localResourcesBool, new GUIContent("Use Local Resources", "Off - Resources centralised for each team \n On - Resources allocated per vehicle/blueprint")); GUILayout.Space(250); t.selectableResourcesBool = GUILayout.Toggle(t.selectableResourcesBool, new GUIContent("Use Individual Resources", "To allocate different resources to different teams/vehicles \n Uses the resource slider setting when 'add to team' is pressed \nWarning - max one vehicle per spwan stick in local resource setting")); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(340f, 430f, 600f, 150f), "Battle Location", GUI.skin.window); optpos = GUILayout.BeginScrollView(optpos, (GUILayoutOption[])new GUILayoutOption[0]); GUISliders.TotalWidthOfWindow = 580; GUISliders.TextWidth = 240; GUISliders.DecimalPlaces = 0; GUISliders.UpperMargin = -350; t.eastWestBoard = (int)GUISliders.DisplaySlider(9, "Map Tile East-West", t.eastWestBoard, 0, sectionsEastWest, enumMinMax.none, new ToolTip("The east-west boardindex, it is the first number on the map. 0 is the left side")); t.northSouthBoard = (int)GUISliders.DisplaySlider(10, "Map Tile North-South", t.northSouthBoard, 0, sectionsNorthSouth, enumMinMax.none, new ToolTip("The north-south boardindex, it is the second number on the map. 0 is the bottom side.")); t.MoveCam(); GUILayout.EndScrollView(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(0f, 580f, 600f, 200f), "Spawn Settings", GUI.skin.window); GUISliders.TotalWidthOfWindow = 400; GUISliders.TextWidth = 100; GUISliders.DecimalPlaces = 0; GUISliders.UpperMargin = 40; t.Dir = (Tournament.SPAWN.DIR) checked ((int)unchecked (GUISliders.DisplaySlider(0, t.Dir.ToString(), (float)t.Dir, 0f, 3f, 0, new ToolTip("Direction")))); t.Loc = (Tournament.SPAWN.LOC) checked ((int)unchecked (GUISliders.DisplaySlider(1, t.Loc.ToString(), (float)t.Loc, 0f, 3f, 0, new ToolTip("Location")))); t.offset = GUISliders.DisplaySlider(2, "Height Offset", t.offset, -100f, 400f, 0, new ToolTip("Height Offset from location")); if (_treeSelector.CurrentData != null) { if (GUI.Button(new Rect(400f, 40f, 150f, 50f), "Add to Team 1")) { GUISoundManager.GetSingleton().PlayBeep(); TournamentEntry tournamentEntry = new TournamentEntry(); tournamentEntry.IsKing = true; tournamentEntry.spawn_direction = t.Dir; tournamentEntry.spawn_location = t.Loc; tournamentEntry.offset = t.offset; tournamentEntry.res = t.maxmat; tournamentEntry.bpf = _treeSelector.CurrentData; t.entry_t1.Add(tournamentEntry); } if (GUI.Button(new Rect(400f, 100f, 150f, 50f), "Add to Team 2")) { GUISoundManager.GetSingleton().PlayBeep(); TournamentEntry tournamentEntry2 = new TournamentEntry(); tournamentEntry2.IsKing = false; tournamentEntry2.spawn_direction = t.Dir; tournamentEntry2.spawn_location = t.Loc; tournamentEntry2.offset = t.offset; tournamentEntry2.res = t.maxmat; tournamentEntry2.bpf = _treeSelector.CurrentData; t.entry_t2.Add(tournamentEntry2); } } GUILayout.EndArea(); GUILayout.BeginArea(new Rect(600f, 580f, 340f, 200f), "Mod Settings", GUI.skin.window); GUILayout.BeginVertical(); //new Rect(80f, 50f, 200f, 50f), if (GUILayout.Button("Save Settings")) { GUISoundManager.GetSingleton().PlayBeep(); t.saveSettings(); } //new Rect(140f, 300f, 200f, 50f), if (GUILayout.Button("Restore Defaults")) { GUISoundManager.GetSingleton().PlayBeep(); t.loadDefaults(); } t.defaultKeysBool = GUILayout.Toggle(t.defaultKeysBool, "Use Default Keybinds"); GUILayout.EndVertical(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(940f, 0f, 340f, 580f), "Selected", GUI.skin.window); listpos = GUILayout.BeginScrollView(listpos, (GUILayoutOption[])new GUILayoutOption[0]); GUILayout.Box("<color=#ffa500ff>~---------T1---------~</color>", (GUILayoutOption[])new GUILayoutOption[0]); if (t.entry_t1.Count != 0) { foreach (TournamentEntry item in t.entry_t1) { string text = ""; string[] labelCost = item.labelCost; foreach (string str in labelCost) { text = text + "\n" + str; } string res = "Resource: " + item.res; GUILayout.Box(string.Format("<color=#ffa500ff>{3} {2}\n{0} {1}\n{5}\n~-------SPAWNS-------~</color>{4}\n<color=#ffa500ff>~--------------------~</color>", item.bpf.Name, (item.bp.CalculateResourceCost(false, true, true)).Material, item.spawn_location, item.spawn_direction, text, res), (GUILayoutOption[])new GUILayoutOption[0]); if (GUILayout.Button("^ Remove ^", (GUILayoutOption[])new GUILayoutOption[0])) { t.entry_t1.Remove(item); } } } GUILayout.Box("<color=#ff0000ff>~---------T2---------~</color>", (GUILayoutOption[])new GUILayoutOption[0]); if (t.entry_t2.Count != 0) { foreach (TournamentEntry item2 in t.entry_t2) { string text2 = ""; string[] labelCost2 = item2.labelCost; foreach (string str2 in labelCost2) { text2 = text2 + "\n" + str2; } string res2 = "Resource: " + item2.res; GUILayout.Box(string.Format("<color=#ff0000ff>{3} {2}\n{0} {1}\n{5}\n~-------SPAWNS-------~</color>{4}\n<color=#ffa500ff>~--------------------~</color>", item2.bpf.Name, (item2.bp.CalculateResourceCost(false, true, true)).Material, item2.spawn_location, item2.spawn_direction, text2, res2), (GUILayoutOption[])new GUILayoutOption[0]); if (GUILayout.Button("^ Remove ^", (GUILayoutOption[])new GUILayoutOption[0])) { t.entry_t2.Remove(item2); } } } GUILayout.EndScrollView(); GUILayout.EndArea(); if (GUI.Button(new Rect(970f, 660f, 280f, 50f), "Start") && t.entry_t1.Count > 0 && t.entry_t2.Count > 0) { this.DeactivateGui(0); t.loadCraft(); t.StartMatch(); } }