private void InitItems() { foreach (KeyValuePair <string, string> key in Config.Section_hotkeys) { hotkeyLabels.Add(key.Key); hotkeyButtons.Add(key.Value); } hotkeyLabels.Add("MaxSlots"); windowRect = SNWindow.InitWindowRect(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47)); itemsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyLabels.Count, Screen.height / 45, space, space, false, true); buttonsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x + windowRect.width / 2, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyButtons.Count + 1, Screen.height / 45, space, space, false, true); SNGUI.CreateGuiItemsGroup(hotkeyLabels.ToArray(), itemsRect, GuiItemType.LABEL, ref itemInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleLeft); SNGUI.CreateGuiItemsGroup(hotkeyButtons.ToArray(), buttonsRect, GuiItemType.NORMALBUTTON, ref buttonInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleCenter); SNGUI.SetGuiItemsGroupLabel("Functions", itemsRect.GetLast(), ref itemInfo, new GuiItemColor()); SNGUI.SetGuiItemsGroupLabel("Hotkeys", buttonsRect.GetLast(), ref buttonInfo, new GuiItemColor()); }
public void Awake() { Instance = this; useGUILayout = false; #if DEBUG_PROGRAM isActive = true; #endif UpdateTitle(); warpSound = ScriptableObject.CreateInstance <FMODAsset>(); warpSound.path = "event:/tools/gravcannon/fire"; techMatrix = new TechnologyMatrix(); tMatrix = new List <TechTypeData> [18]; techMatrix.InitTechMatrixList(ref tMatrix); techMatrix.InitFullTechMatrixList(ref FullTechMatrix); FullTechMatrix.Sort(); /* * if (Main.isExistsSMLHelperV2) * { * techMatrix.IsExistsModdersTechTypes(ref tMatrix, techMatrix.Known_Modded_TechTypes); * } * else * { * Debug.LogWarning("[CheatManager] Warning: 'SMLHelper.V2' not found! Some functions are not available!"); * } */ techMatrix.SortTechLists(ref tMatrix); buttonText = new ButtonText(); drawRect = SNWindow.InitWindowRect(windowRect, true); List <Rect> commandRects = SNWindow.SetGridItemsRect(drawRect, 4, 3, ITEMSIZE, SPACE, SPACE, true, true); SNGUI.CreateGuiItemsGroup(buttonText.Buttons, commandRects, GuiItemType.NORMALBUTTON, ref commands, new GuiItemColor()); SNGUI.SetGuiItemsGroupLabel("Commands", commandRects.GetLast(), ref commands, new GuiItemColor(GuiColor.White)); List <Rect> toggleCommandRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref commandRects), drawRect.width, drawRect.height), 4, 5, ITEMSIZE, SPACE, SPACE, true, true); SNGUI.CreateGuiItemsGroup(buttonText.ToggleButtons, toggleCommandRects, GuiItemType.TOGGLEBUTTON, ref toggleCommands, new GuiItemColor(GuiColor.Red, GuiColor.Green)); SNGUI.SetGuiItemsGroupLabel("Toggle Commands", toggleCommandRects.GetLast(), ref toggleCommands, new GuiItemColor(GuiColor.White)); List <Rect> daynightTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref toggleCommandRects), drawRect.width, drawRect.height), 6, 1, 24, SPACE, SPACE, true, true); SNGUI.CreateGuiItemsGroup(buttonText.DayNightTab, daynightTabrects, GuiItemType.TAB, ref daynightTab, new GuiItemColor()); SNGUI.SetGuiItemsGroupLabel("Day/Night Speed:", daynightTabrects.GetLast(), ref daynightTab, new GuiItemColor(GuiColor.White)); List <Rect> weatherTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref daynightTabrects), drawRect.width, drawRect.height), 5, 1, ITEMSIZE, SPACE, SPACE, true, true); SNGUI.CreateGuiItemsGroup(buttonText.WeatherCommands, weatherTabrects, GuiItemType.TOGGLEBUTTON, ref weatherTab, new GuiItemColor(GuiColor.Red, GuiColor.Green)); SNGUI.SetGuiItemsGroupLabel("Weather Settings:", weatherTabrects.GetLast(), ref weatherTab, new GuiItemColor(GuiColor.White)); List <Rect> categoriesTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref weatherTabrects), drawRect.width, drawRect.height), 4, 5, ITEMSIZE, SPACE, SPACE, true, true); SNGUI.CreateGuiItemsGroup(buttonText.CategoriesTab, categoriesTabrects, GuiItemType.TAB, ref categoriesTab, new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White)); SNGUI.SetGuiItemsGroupLabel("Categories:", categoriesTabrects.GetLast(), ref categoriesTab, new GuiItemColor(GuiColor.White)); float nextYpos = SNWindow.GetNextYPos(ref categoriesTabrects); scrollRect = new Rect(drawRect.x + SPACE, nextYpos, drawRect.width - (SPACE * 2), drawRect.height - nextYpos); List <Rect>[] scrollItemRects = new List <Rect> [tMatrix.Length + 2]; for (int i = 0; i < tMatrix.Length; i++) { float width = drawRect.width; if (i == 0 && tMatrix[0].Count > MAXSHOWITEMS) { width -= 20; } else if (tMatrix[i].Count * (ITEMSIZE + SPACE) > scrollRect.height) { width -= 20; } scrollItemRects[i] = SNWindow.SetGridItemsRect(new Rect(0, 0, width, tMatrix[i].Count * (ITEMSIZE + SPACE)), 1, tMatrix[i].Count, ITEMSIZE, SPACE, 2, false, false, true); } scrollItemRects[tMatrix.Length] = SNWindow.SetGridItemsRect(new Rect(0, 0, drawRect.width - 20, warpTargets.Targets.Count * (ITEMSIZE + SPACE)), 1, warpTargets.Targets.Count, ITEMSIZE, SPACE, 2, false, false, true); scrollItemRects[tMatrix.Length + 1] = SNWindow.SetGridItemsRect(new Rect(0, 0, drawRect.width - 20, FullTechMatrix.Count * (ITEMSIZE + SPACE)), 1, FullTechMatrix.Count, ITEMSIZE, SPACE, 2, false, false, true); scrollItemsList = new List <GuiItem> [tMatrix.Length + 2]; for (int i = 0; i < tMatrix.Length; i++) { scrollItemsList[i] = new List <GuiItem>(); CreateTechGroup(tMatrix[i], scrollItemRects[i], GuiItemType.NORMALBUTTON, ref scrollItemsList[i], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); } scrollItemsList[tMatrix.Length] = new List <GuiItem>(); scrollItemsList[tMatrix.Length + 1] = new List <GuiItem>(); AddListToGroup(warpTargets.Targets, scrollItemRects[tMatrix.Length], GuiItemType.NORMALBUTTON, ref scrollItemsList[tMatrix.Length], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); AddTechListToGroup(FullTechMatrix, scrollItemRects[tMatrix.Length + 1], GuiItemType.NORMALBUTTON, ref scrollItemsList[tMatrix.Length + 1], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); var searchSeaGlide = new TechnologyMatrix.TechTypeSearch(TechType.Seaglide); string seaglideName = tMatrix[1][tMatrix[1].FindIndex(searchSeaGlide.EqualsWith)].Name; var searchSeamoth = new TechnologyMatrix.TechTypeSearch(TechType.Seamoth); seamothName = tMatrix[0][tMatrix[0].FindIndex(searchSeamoth.EqualsWith)].Name; var searchExosuit = new TechnologyMatrix.TechTypeSearch(TechType.Exosuit); exosuitName = tMatrix[0][tMatrix[0].FindIndex(searchExosuit.EqualsWith)].Name; var searchHoverBike = new TechnologyMatrix.TechTypeSearch(TechType.Hoverbike); hoverbikeName = tMatrix[0][tMatrix[0].FindIndex(searchHoverBike.EqualsWith)].Name; var searchSeaTruck = new TechnologyMatrix.TechTypeSearch(TechType.SeaTruck); seatruckName = tMatrix[0][tMatrix[0].FindIndex(searchSeaTruck.EqualsWith)].Name; string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast", $"{hoverbikeName} Move on Water" }; float scrollRectheight = (MAXSHOWITEMS + 1) * (scrollItemsList[0][0].Rect.height + 2); float y = scrollRect.y + scrollRectheight + SPACE; List <Rect> vehicleSettingsRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, y, drawRect.width, drawRect.height), 2, 2, ITEMSIZE, SPACE, SPACE, false, true); SNGUI.CreateGuiItemsGroup(vehicleSetButtons, vehicleSettingsRects, GuiItemType.TOGGLEBUTTON, ref vehicleSettings, new GuiItemColor(GuiColor.Red, GuiColor.Green)); SNGUI.SetGuiItemsGroupLabel("Vehicle settings:", vehicleSettingsRects.GetLast(), ref vehicleSettings, new GuiItemColor(GuiColor.White)); string[] sliderLabels = { $"{seamothName} speed multiplier:", $"{exosuitName} speed multiplier:", $"{hoverbikeName} speed multiplier:" }; List <Rect> slidersRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref vehicleSettingsRects), drawRect.width, drawRect.height), 1, 3, SLIDERHEIGHT, SPACE, SPACE, false, false); SNGUI.CreateGuiItemsGroup(sliderLabels, slidersRects, GuiItemType.HORIZONTALSLIDER, ref sliders, new GuiItemColor()); sliders[0].OnChangedEvent = onSeamothSpeedValueChanged; sliders[1].OnChangedEvent = onExosuitSpeedValueChanged; sliders[2].OnChangedEvent = onHoverbikeSpeedValueChanged; commands[(int)Commands.BackWarp].Enabled = false; commands[(int)Commands.BackWarp].State = GuiItemState.PRESSED; daynightTab[4].State = GuiItemState.PRESSED; categoriesTab[0].State = GuiItemState.PRESSED; seamothSpeedMultiplier = 1; exosuitSpeedMultiplier = 1; hoverbikeSpeedMultiplier = 1; seatruckSpeedMultiplier = 1; buttonControl = new ButtonControl(); }