コード例 #1
0
        public static void Postfix(MainMenuLoadPanel __instance, MainMenuLoadButton lb)
        {
            SaveLoadManager.GameInfo gameInfo = SaveLoadManager.main.GetGameInfo(lb.saveGame);

            if ((gameInfo == null) || !gameInfo.IsValid() || gameInfo.isFallback)
            {
                return;
            }

            DeathRunSaveData slotData = DeathRunUtils.FindSave(lb.saveGame);

            if (slotData == null)
            {
                return;
            }

            if (!"".Equals(slotData.startSave.message))
            {
                lb.load.FindChild("SaveGameMode").GetComponent <Text>().text = slotData.startSave.message;

                slotData.runData.updateFromSave(slotData);

                string duration = Utils.PrettifyTime((int)slotData.playerSave.allLives);

                if (slotData.playerSave.allLives >= 60 * 60 * 24)
                {
                    int total = (int)slotData.playerSave.allLives;
                    int days  = total / (60 * 60 * 24);
                    total -= (days * 60 * 60 * 24);

                    int hours = total / (60 * 60);
                    total -= hours * 60 * 60;

                    int minutes = total / 60;
                    total -= minutes;

                    duration = "" + days + " " + ((days == 1) ? "day" : "days") + ", " + hours + ":" + ((minutes < 10) ? "0" : "") + minutes;
                }

                duration += ". Score: " + slotData.runData.Score;

                lb.load.FindChild("SaveGameLength").GetComponent <Text>().text = duration;
            }
        }