public static void OnGirlHeadPressed(ButtonBehavior b) { tooltip.Hide(); Game.Manager.Audio.Play(AudioCategory.SOUND, click, Game.Session.gameCanvas.cellphone.pauseBehavior.pauseDefinition); currentGirl = Game.Data.Girls.Get(Game.Session.gameCanvas.cellphone.GetCellFlag("profile_girl_id")); UiCellphoneAppPairs p = (Game.Session.gameCanvas.cellphone.appPrefabs.FirstOrDefault((UiCellphoneApp a) => a is UiCellphoneAppPairs) as UiCellphoneAppPairs); Game.Session.gameCanvas.cellphone.LoadApp(Game.Session.gameCanvas.cellphone.appPrefabs.IndexOf(p)); }
private void Update() //called by Unity every frame { if (!Game.Manager) { return; //don't run update code before Game.Manager exists } BasePatches.Update(); CheatPatches.Update(); InputPatches.Update(); RunTimerPatches.Update(); if (tooltip != null) { if (tooltipTimer.ElapsedMilliseconds > tooltipLength) { tooltipTimer.Reset(); tooltip.Hide(); tooltip = null; } } //if tooltip became null, stop timer else { tooltipTimer.Reset(); } //Check for the Return hotkey if (ResetKey.Value.IsDown() || ResetKey2.Value.IsDown()) { if (UnloadGame()) { hasReturned = true; BasePatches.searchForMe = -111; if (run != null) { run.reset(); run = null; } } } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { //display the splits folder on Ctrl+S if (Input.GetKeyDown(KeyCode.S)) { if (Game.Manager.Ui.currentCanvas.titleCanvas) { System.Diagnostics.Process.Start(Directory.GetCurrentDirectory() + "/splits"); } /* * else if (run != null) * { * run.save(); * ShowNotif("Run saved!", 2); * }*/ //don't allow saving midrun, could be done accidentally } //reset run on Ctrl+R if (Input.GetKeyDown(KeyCode.R) && run != null) { run.reset(true); ShowNotif("Run reset!", 2); } //quit run on Ctrl+Q if (Input.GetKeyDown(KeyCode.Q) && run != null) { run.reset(false); ShowNotif("Run quit!", 2); } } //if currently in a puzzle, and the status bar is up, and it's not nonstop mode, send data to autosplitters if (!Game.Manager.Ui.currentCanvas.titleCanvas && Game.Session && Game.Session.Puzzle.isPuzzleActive && !Game.Session.gameCanvas.cellphone.isOpen && Game.Session.Puzzle.puzzleStatus.statusType != PuzzleStatusType.NONSTOP) { //this is a possibly bold but necessary assumption to make about cellphone._currentApp UiCellphoneAppStatus status = (UiCellphoneAppStatus)AccessTools.Field(typeof(UiCellphone), "_currentApp").GetValue(Game.Session.gameCanvas.cellphone); bool isBonusRound = Game.Session.Puzzle.puzzleStatus.bonusRound; if (status.affectionMeter.currentValue == 0) { startingRelationshipType = Game.Persistence.playerFile.GetPlayerFileGirlPair(Game.Session.Location.currentGirlPair).relationshipType; startingCompletedPairs = Game.Persistence.playerFile.completedGirlPairs.Count; } if (status.affectionMeter.currentValue == status.affectionMeter.maxValue && (Game.Session.gameCanvas.puzzleGrid.roundState == PuzzleRoundState.SUCCESS || isBonusRound)) { if (!splitThisDate && run != null) { bool didSplit = false; //always split for the two tutorial splits if (Game.Session.Location.currentGirlPair.girlDefinitionOne.girlName == "Kyu") { didSplit = run.split(isBonusRound); } //don't split for dates in 48 Shoes, or in postgame else if (run.goal != 48 && Game.Persistence.playerFile.storyProgress < 13) { if (run.goal == 1 || SplitRules.Value <= 0) { didSplit = run.split(isBonusRound); } else if (SplitRules.Value == 1 && !isBonusRound) { didSplit = run.split(isBonusRound); } else if (SplitRules.Value == 2 && isBonusRound) { didSplit = run.split(isBonusRound); } //check for final split regardless of option else if (isBonusRound && (run.goal == startingCompletedPairs + 1 || (run.goal == 25 && Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS))) { didSplit = run.split(isBonusRound); } } if (didSplit) { //initiate the timers for displaying and removing our split times RunTimerPatches.initialTimerDelay.Start(); if (!isBonusRound) { RunTimerPatches.undoTimer.Start(); } GirlPairDefinition pair = Game.Session.Location.currentGirlPair; int dateNum = 1; if (startingRelationshipType == GirlPairRelationshipType.ATTRACTED) { dateNum = 2; } if (isBonusRound) { dateNum = 3; } //Kyu pair starts at ATTRACTED (2) and her bonus should be 2, not 3, so this is the easiest way if (pair.girlDefinitionOne.girlName == "Kyu") { dateNum--; } if (Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS) { dateNum = 5 - (Game.Session.Puzzle.puzzleStatus.girlListCount / 2); } string newSplit = pair.girlDefinitionOne.girlName + " & " + pair.girlDefinitionTwo.girlName; //don't put a number on the date if they started as lovers, or it's nonstop mode? (for 100%) //the storyProgress check probably makes this pointless if (startingRelationshipType != GirlPairRelationshipType.LOVERS && Game.Session.Puzzle.puzzleStatus.statusType != PuzzleStatusType.NONSTOP) { newSplit += " #" + dateNum; } newSplit += "\n " + run.splitText + "\n"; run.push(newSplit); if (isBonusRound && pair.girlDefinitionOne.girlName != "Kyu") { //I think it's possible that, with a huge chain reaction, completedGirlPairs.Count might not have updated yet //so use the number from before the date, +1 //funnily enough, that also makes the final boss's goal of "25" count //but I'll leave the double-check there if (run.goal == startingCompletedPairs + 1 || (run.goal == 25 && Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS)) { Logger.LogMessage("initiating run.save"); if (run.rerollOccurred) { run.push("\n(Rerolled for Lillian)\n"); } //run.save(); RunTimerPatches.savePBDelay.Start(); } } } } if (isBonusRound) { BasePatches.searchForMe = 200; } else { BasePatches.searchForMe = 100; } splitThisDate = true; } else { BasePatches.searchForMe = 0; splitThisDate = false; } } //title-screen only options, to prevent non-vanilla things happening midrun if (Game.Manager.Ui.currentCanvas.titleCanvas) { UiTitleCanvas tc = (UiTitleCanvas)Game.Manager.Ui.currentCanvas; bool isLoading = (bool)AccessTools.Field(typeof(UiTitleCanvas), "_loadingGame").GetValue(tc); //display New Version tooltip for 10 seconds if (newVersionAvailable && !alertedOfUpdate) { alertedOfUpdate = true; ShowTooltip("Update Available!\nClick on Credits!", 10000, 0, 45); } if (!InputPatches.codeScreen && Input.GetKeyDown(KeyCode.A)) { CodeDefinition codeDefinition = Game.Data.Codes.Get(ABIAHAIR); if (!Game.Persistence.playerData.unlockedCodes.Contains(codeDefinition)) { Game.Persistence.playerData.unlockedCodes.Add(codeDefinition); ShowTooltip("Abia's Hair Enabled!", 2000); } else { Game.Persistence.playerData.unlockedCodes.Remove(codeDefinition); ShowTooltip("Abia's Hair Disabled!", 2000); } Game.Manager.Ui.currentCanvas.GetComponent <UiTitleCanvas>().coverArt.Refresh(); } //check for Kyu outfits if (Input.GetKey(KeyCode.K)) { bool hairstyle = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)); for (int i = (int)KeyCode.Alpha0; i <= (int)KeyCode.Alpha5; i++) { //Alpha0 = 48, Keypad0 = 256 int num = i - 48; if ((Input.GetKeyDown((KeyCode)i) || Input.GetKeyDown((KeyCode)(i + 208)))) { SetKyuOutfit(num, hairstyle); string s = "Kyu "; if (hairstyle) { s += "Hairstyle #"; } else { s += "Outfit #"; } s += num + " Chosen!"; ShowTooltip(s, 2000); } } } //check for the Cheat Mode hotkey if (!InputPatches.codeScreen && cheatsEnabled == false && !isLoading && CheatHotkey.Value.IsDown()) { Game.Manager.Audio.Play(AudioCategory.SOUND, Game.Manager.Ui.sfxReject); PlayCheatLine(); Harmony.CreateAndPatchAll(typeof(CheatPatches), null); CheatPatches.UnlockAllCodes(); ShowTooltip("Cheat Mode Activated!", 2000, 0, 30); cheatsEnabled = true; } } }