Exemplo n.º 1
0
        public void Awake()
        {
            Instance     = this;
            useGUILayout = false;

            warpSound      = ScriptableObject.CreateInstance <FMODAsset>();
            warpSound.path = "event:/tools/gravcannon/fire";

            TechnologyMatrix = new List <TechMatrix.TechTypeData> [TechMatrix.techMatrix.Length];
            TechMatrix.InitTechMatrixList(ref TechnologyMatrix);

            if (Main.isExistsSMLHelperV2)
            {
                TechMatrix.IsExistsModdersTechTypes(ref TechnologyMatrix, TechMatrix.Known_Modded_TechTypes);
            }
            else
            {
                Logger.Log("[CheatManager] Warning:\n'SMLHelper.V2' not found! Some functions are not available!", LogType.Warning);
            }
            TechMatrix.SortTechLists(ref TechnologyMatrix);

            Buttons         = new List <GUIHelper.ButtonInfo>();
            toggleButtons   = new List <GUIHelper.ButtonInfo>();
            daynightTab     = new List <GUIHelper.ButtonInfo>();
            categoriesTab   = new List <GUIHelper.ButtonInfo>();
            vehicleSettings = new List <GUIHelper.ButtonInfo>();

            GUIHelper.CreateButtonsList(ButtonText.Buttons, GUIHelper.BUTTONTYPE.NORMAL_CENTER, ref Buttons);
            GUIHelper.CreateButtonsList(ButtonText.ToggleButtons, GUIHelper.BUTTONTYPE.TOGGLE_CENTER, ref toggleButtons);
            GUIHelper.CreateButtonsList(ButtonText.DayNightTab, GUIHelper.BUTTONTYPE.TAB_CENTER, ref daynightTab);
            GUIHelper.CreateButtonsList(ButtonText.CategoriesTab, GUIHelper.BUTTONTYPE.TAB_CENTER, ref categoriesTab);

            var    searchSeaGlide = new TechMatrix.TechTypeSearch(TechType.Seaglide);
            string seaglideName   = TechnologyMatrix[1][TechnologyMatrix[1].FindIndex(searchSeaGlide.EqualsWith)].Name;

            var searchSeamoth = new TechMatrix.TechTypeSearch(TechType.Seamoth);

            seamothName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchSeamoth.EqualsWith)].Name;

            var searchExosuit = new TechMatrix.TechTypeSearch(TechType.Exosuit);

            exosuitName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchExosuit.EqualsWith)].Name;

            var searchCyclops = new TechMatrix.TechTypeSearch(TechType.Cyclops);

            cyclopsName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchCyclops.EqualsWith)].Name;

            string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast" };

            GUIHelper.CreateButtonsList(vehicleSetButtons, GUIHelper.BUTTONTYPE.TOGGLE_CENTER, ref vehicleSettings);

            daynightTab[4].Pressed    = true;
            categoriesTab[0].Pressed  = true;
            toggleButtons[17].Pressed = false;
            Buttons[7].Enabled        = false;
            Buttons[7].Pressed        = true;

            exosuitSpeedMultiplier = 1;
            cyclopsSpeedMultiplier = 1;
        }
Exemplo n.º 2
0
        private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            if (scene.name == "Main")
            {
                CheatManager.Load();
            }

            if (scene.name == "StartScreen")
            {
                Logger.Load();
            }
        }
Exemplo n.º 3
0
        public static CheatManager Load()
        {
            if (Instance == null)
            {
                Instance = FindObjectOfType(typeof(CheatManager)) as CheatManager;

                if (Instance == null)
                {
                    GameObject cheatmanager = new GameObject().AddComponent <CheatManager>().gameObject;
                    cheatmanager.name = "CheatManager";
                    Instance          = cheatmanager.GetComponent <CheatManager>();
                }
            }

            return(Instance);
        }
        public void Awake()
        {
            Instance     = this;
            useGUILayout = false;

#if DEBUG
            isActive = true;
#endif
            UpdateTitle();
            warpSound      = ScriptableObject.CreateInstance <FMODAsset>();
            warpSound.path = "event:/tools/gravcannon/fire";

            techMatrix = new TechnologyMatrix();
            tMatrix    = new List <TechTypeData> [techMatrix.baseTechMatrix.Count];
            techMatrix.InitTechMatrixList(ref tMatrix);


            if (Main.isExistsSMLHelperV2)
            {
                techMatrix.IsExistsModdersTechTypes(ref tMatrix, techMatrix.Known_Modded_TechTypes);
            }
            else
            {
                SNLogger.Log($"[{Config.PROGRAM_NAME}] 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 = drawRect.SetGridItemsRect(4, 2, ITEMSIZE, SPACE, SPACE, true, true);
            commands.CreateGuiItemsGroup(buttonText.Buttons, commandRects, GuiItemType.NORMALBUTTON, new GuiItemColor());
            commands.SetGuiItemsGroupLabel("Commands", commandRects.GetLast(), new GuiItemColor(GuiColor.White));

            List <Rect> toggleCommandRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref commandRects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true);
            toggleCommands.CreateGuiItemsGroup(buttonText.ToggleButtons, toggleCommandRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green));
            toggleCommands.SetGuiItemsGroupLabel("Toggle Commands", toggleCommandRects.GetLast(), new GuiItemColor(GuiColor.White));

            List <Rect> daynightTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref toggleCommandRects), drawRect.width, drawRect.height).SetGridItemsRect(6, 1, ITEMSIZE, SPACE, SPACE, true, true);
            daynightTab.CreateGuiItemsGroup(buttonText.DayNightTab, daynightTabrects, GuiItemType.TAB, new GuiItemColor());
            daynightTab.SetGuiItemsGroupLabel("Day/Night Speed:", daynightTabrects.GetLast(), new GuiItemColor(GuiColor.White));

            List <Rect> categoriesTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref daynightTabrects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true);
            categoriesTab.CreateGuiItemsGroup(buttonText.CategoriesTab, categoriesTabrects, GuiItemType.TAB, new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White));
            categoriesTab.SetGuiItemsGroupLabel("Categories:", categoriesTabrects.GetLast(), 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 + 1];

            for (int i = 0; i < tMatrix.Length; i++)
            {
                float width = drawRect.width;

                if (i == 0 && tMatrix[0].Count > MAXSHOWITEMS)
                {
                    width -= 20;
                }

                if (tMatrix[i].Count * 26 > 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);

            scrollItemsList = new List <GuiItem> [tMatrix.Length + 1];

            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>();
            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);

            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 searchCyclops = new TechnologyMatrix.TechTypeSearch(TechType.Cyclops);
            cyclopsName = tMatrix[0][tMatrix[0].FindIndex(searchCyclops.EqualsWith)].Name;

            string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast" };

            float scrollRectheight = 5 * (scrollItemsList[0][0].Rect.height + 2);
            float y = scrollRect.y + scrollRectheight + SPACE;

            List <Rect> vehicleSettingsRects = new Rect(drawRect.x, y, drawRect.width, drawRect.height).SetGridItemsRect(2, 1, ITEMSIZE, SPACE, SPACE, false, true);
            vehicleSettings.CreateGuiItemsGroup(vehicleSetButtons, vehicleSettingsRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green));
            vehicleSettings.SetGuiItemsGroupLabel("Vehicle settings:", vehicleSettingsRects.GetLast(), new GuiItemColor(GuiColor.White));

            string[] sliderLabels = { $"{seamothName} speed multiplier:", $"{exosuitName} speed multiplier:", $"{cyclopsName} speed multiplier:" };

            List <Rect> slidersRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref vehicleSettingsRects), drawRect.width, drawRect.height).SetGridItemsRect(1, 3, SLIDERHEIGHT, SPACE, SPACE, false, false);
            sliders.CreateGuiItemsGroup(sliderLabels, slidersRects, GuiItemType.HORIZONTALSLIDER, new GuiItemColor());

            sliders[0].OnChangedEvent = onSeamothSpeedValueChanged;
            sliders[1].OnChangedEvent = onExosuitSpeedValueChanged;
            sliders[2].OnChangedEvent = onCyclopsSpeedValueChanged;

            commands[(int)Commands.BackWarp].Enabled = false;
            commands[(int)Commands.BackWarp].State   = GuiItemState.PRESSED;

            daynightTab.SetStateInverseTAB(4);
            categoriesTab[0].State = GuiItemState.PRESSED;

            seamothSpeedMultiplier = 1;
            exosuitSpeedMultiplier = 1;
            cyclopsSpeedMultiplier = 1;

            buttonControl = new ButtonControl();
        }