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 override void OnGui() { GUILayout.BeginArea(new Rect(20f, 20f, 500f, 350f), "Propulsion Block GUI", GUI.skin.window); float num = 150f; bool flag = false; bool flag2 = false; if (!this._focus.User.IsOnSubConstructable) { if (this._focus.OrientationWithRespectToConstruct == enumBlockOrientations.forwards || this._focus.OrientationWithRespectToConstruct == enumBlockOrientations.backwards) { this._focus.DriveMode = enumPropulsionDriveModes.main; } else { flag = GUI.Toggle(new Rect(40f, 40f, num, 30f), this._focus.DriveMode == enumPropulsionDriveModes.thruster, "Thruster"); flag2 = GUI.Toggle(new Rect(40f + num, 40f, num, 30f), this._focus.DriveMode == enumPropulsionDriveModes.thrusterreverse, "Thruster reverse"); } } bool flag3 = GUI.Toggle(new Rect(40f + num + num, 40f, num, 30f), this._focus.DriveMode == enumPropulsionDriveModes.main, "Main"); bool flag4 = false; bool flag5 = false; if (!this._focus.User.IsOnSubConstructable && (this._focus.OrientationWithRespectToConstruct == enumBlockOrientations.up || this._focus.OrientationWithRespectToConstruct == enumBlockOrientations.down)) { flag4 = GUI.Toggle(new Rect(40f + num * 0.5f, 70f, num, 30f), this._focus.DriveMode == enumPropulsionDriveModes.roll, "roll (LHS)"); flag5 = GUI.Toggle(new Rect(40f + num * 0.5f + num, 70f, num, 30f), this._focus.DriveMode == enumPropulsionDriveModes.rollreverse, "roll reverse (RHS)"); } if (flag && this._focus.DriveMode != enumPropulsionDriveModes.thruster) { this._focus.DriveMode = enumPropulsionDriveModes.thruster; } else if (flag2 && this._focus.DriveMode != enumPropulsionDriveModes.thrusterreverse) { this._focus.DriveMode = enumPropulsionDriveModes.thrusterreverse; } else if (flag3 && this._focus.DriveMode != enumPropulsionDriveModes.main) { this._focus.DriveMode = enumPropulsionDriveModes.main; } else if (flag4 && this._focus.DriveMode != enumPropulsionDriveModes.roll) { this._focus.DriveMode = enumPropulsionDriveModes.roll; } else if (flag5 && this._focus.DriveMode != enumPropulsionDriveModes.rollreverse) { this._focus.DriveMode = enumPropulsionDriveModes.rollreverse; } string text = null; enumPropulsionDriveModes driveMode = this._focus.DriveMode; if (driveMode == enumPropulsionDriveModes.thruster) { text = this.ThrusterDescription(); } else if (driveMode == enumPropulsionDriveModes.thrusterreverse) { text = this.ThrusterReverseDescription(); } else if (driveMode == enumPropulsionDriveModes.roll) { text = this.RollDescription(); } else if (driveMode == enumPropulsionDriveModes.rollreverse) { text = this.RollReverseDescription(); } else if (driveMode == enumPropulsionDriveModes.main) { text = "Runs with the main forwards facing propulsion systems"; } string text2 = string.Concat(new object[] { StaticMaths.R2(this._focus.DirectForceFraction * 100f), " % applied directly behind the centre of mass.\n", StaticMaths.R2((1f - this._focus.DirectForceFraction) * 100f), "% applied from the block's position" }); string text3 = StaticMaths.R2(this._focus.PlacementForceFraction * 100f) + "% of maximum force attainable due to placement of this block"; GUI.Label(new Rect(40f, 100f, 400f, 100f), text); GUI.Label(new Rect(40f, 180f, 400f, 100f), text2); GUI.Label(new Rect(40f, 280f, 400f, 100f), text3); GUISliders.TotalWidthOfWindow = 500; GUISliders.TextWidth = 180; GUISliders.DecimalPlaces = 1; GUISliders.UpperMargin = 320; this._focus.PowerScale = GUISliders.DisplaySlider(0, "Drive fraction:", this._focus.PowerScale, 0f, 1f, enumMinMax.none, new ToolTip("Adjust the thrust (and power usage) of this engine. Useful for fine balancing of aircraft", 12, false)); if (GUI.Button(new Rect(40f, 470f, 100f, 60f), "Copy to clipboard")) { PropulsionModuleClipboard.CopyPropulsionToClipboard(this._focus); } if (PropulsionModuleClipboard.default_propulsion_set) { if (GUI.Button(new Rect(160f, 470f, 100f, 60f), "Paste from clipboard")) { PropulsionModuleClipboard.PastePropulsionFromClipboard(this._focus); } } else { GUI.Button(new Rect(160f, 470f, 100f, 60f), "Paste from clipboard", "buttongrey"); } if (GUI.Button(new Rect(380f, 470f, 100f, 60f), "Exit")) { this.DeactivateGui(GuiDeactivateType.Standard); } GUILayout.EndArea(); /* * //WheelSettingsGUI.WheelSettingsGui( ); * * * //GUILayout.BeginArea(new Rect(20f, 20f, 500f, 450f), "Propulsion Block GUI", GUI.skin.window); * GUILayout.BeginArea(new Rect(20f, 500f, 500f, 300f), "Whhel Settings GUI: " + this._focus.User.name, GUI.skin.window); * //GUILayout.BeginArea(new Rect(10f, 40f, 600, 300f), "Color", GUI.skin.window) ; * * GUISliders.TotalWidthOfWindow = 500; * GUISliders.TextWidth = 100; * GUISliders.UpperMargin = 40; * GUISliders.DecimalPlaces = 2; * //float OtherVal = 0.1f ; * //this.SetBlue (GUISliders.DisplaySlider (2, "Blue: ", this._blue, 0f, 1f, enumMinMax.none, null), true); * //this.imaginary (GUISliders.DisplaySlider (2, "Blue: ", this.imaginary, 0f, 1f, enumMinMax.none, null), true); * * int GUISIndex = 0; * * float SuspensionDistance = this._focus.User.GetParameters1().x ; * //this.anc = this._focus. * * this.anc.MaxThrustMultipler = GUISliders.DisplaySlider (GUISIndex, "MaxThrustMultipler: ", this.anc.MaxThrustMultipler, 0f, 100f, enumMinMax.none, null) ; * GUISIndex++; * this.anc.Spring = GUISliders.DisplaySlider (GUISIndex, "Spring: ", this.anc.Spring, 0f, 100f, enumMinMax.none, null) ; * GUISIndex++; * SuspensionDistance = GUISliders.DisplaySlider (GUISIndex, "Suspension Distance: ", SuspensionDistance, 0f, 100f, enumMinMax.none, null) ; * GUISIndex++; * * this._focus.User.SetParameters1(new Vector4 (SuspensionDistance, this._focus.User.GetParameters1().y, this._focus.User.GetParameters1().z, this._focus.User.GetParameters1().w)) ; * * * //bool result = false ; * * //this.ApplySuspentionParam () ; * * //if (GuiCommon.DisplayCloseButton(360)) * //{ * // result = true ; * //} * * * GUILayout.EndArea() ; * //return result ; */ /* * if (_focus.User.ExtraGUI()) * { * DeactivateGui() ; * return ; * } */ if (this._focus.OptionalControlModule != null && ControllableBlockGUIPanel.InputPanel(this._focus.OptionalControlModule, true)) { this.DeactivateGui(GuiDeactivateType.Standard); } }
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(); } }