Ejemplo n.º 1
0
        public AOKMail(SOSMail sos, GameProgress progress, string dateTime, ReplayData replay)
        {
            TeamName        = sos.TeamName;
            TeamID          = sos.TeamID;
            Seed            = sos.Seed;
            TurnsTaken      = sos.TurnsTaken;
            RescueSeed      = sos.RescueSeed;
            DateDefeated    = sos.DateDefeated;
            Goal            = sos.Goal;
            DefeatedVersion = sos.DefeatedVersion;
            OfferedItem     = sos.OfferedItem;
            GoalText        = sos.GoalText;
            TeamProfile     = sos.TeamProfile;

            RescuingTeam = progress.ActiveTeam.Name;
            RescuingID   = progress.UUID;
            DateRescued  = dateTime;
            List <string>    teamNames         = new List <string>();
            List <MonsterID> teamProfile       = new List <MonsterID>();
            List <int>       teamPersonalities = new List <int>();

            foreach (Character chara in progress.ActiveTeam.Players)
            {
                teamNames.Add(chara.BaseName);
                teamProfile.Add(chara.BaseForm);
                teamPersonalities.Add(chara.Discriminator);
            }
            RescuingNames         = teamNames.ToArray();
            RescuingProfile       = teamProfile.ToArray();
            RescuingPersonalities = teamPersonalities.ToArray();

            RescueReplay = replay;
        }
Ejemplo n.º 2
0
        public override IEnumerator <YieldInstruction> EndGame(ResultType result, ZoneLoc nextArea, bool display, bool fanfare)
        {
            Outcome = result;
            bool   recorded   = DataManager.Instance.RecordingReplay;
            string recordFile = null;

            if (result == ResultType.Rescue)
            {
                Location = ZoneManager.Instance.CurrentZone.Name.ToLocal();

                DataManager.Instance.MsgLog.Clear();
                //end the game with a recorded ending
                recordFile = DataManager.Instance.EndPlay(this, StartDate);

                SOSMail    sos         = Rescue.SOS;
                string     dateRescued = String.Format("{0:yyyy-MM-dd}", DateTime.Now);
                ReplayData replay      = DataManager.Instance.LoadReplay(DataManager.REPLAY_PATH + recordFile, false);
                AOKMail    aok         = new AOKMail(sos, DataManager.Instance.Save, dateRescued, replay);
                GeneratedAOK = DataManager.SaveRescueMail(DataManager.RESCUE_OUT_PATH + DataManager.AOK_PATH, aok, false);
                string deletePath = DataManager.FindRescueMail(DataManager.RESCUE_IN_PATH + DataManager.SOS_PATH, sos, sos.Extension);
                if (deletePath != null)
                {
                    File.Delete(deletePath);
                }

                if (nextArea.IsValid()) //  if an exit is specified, go to the exit.
                {
                    NextDest = nextArea;
                }
                else
                {
                    NextDest = new ZoneLoc(1, new SegLoc(-1, 1));
                }
            }
            else if (result != ResultType.Cleared)
            {
                if (GameManager.Instance.CurrentScene == GroundScene.Instance)
                {
                    Location = ZoneManager.Instance.CurrentGround.GetSingleLineName();
                }
                else if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
                {
                    Location = ZoneManager.Instance.CurrentMap.GetSingleLineName();
                }

                DataManager.Instance.MsgLog.Clear();
                //end the game with a recorded ending
                recordFile = DataManager.Instance.EndPlay(this, StartDate);

                if (Outcome != ResultType.Escaped && Stakes == DungeonStakes.Risk) //remove all items
                {
                    LossPenalty(this);
                }

                if (nextArea.IsValid()) //  if an exit is specified, go to the exit.
                {
                    NextDest = nextArea;
                }
                else
                {
                    NextDest = new ZoneLoc(1, new SegLoc(-1, 1));
                }
            }
            else
            {
                int completedZone = ZoneManager.Instance.CurrentZoneID;
                DungeonUnlocks[completedZone] = UnlockState.Completed;

                Location = ZoneManager.Instance.CurrentZone.Name.ToLocal();

                DataManager.Instance.MsgLog.Clear();
                //end the game with a recorded ending
                recordFile = DataManager.Instance.EndPlay(this, StartDate);

                if (nextArea.IsValid()) //  if an exit is specified, go to the exit.
                {
                    NextDest = nextArea;
                }
                else
                {
                    NextDest = new ZoneLoc(1, new SegLoc(-1, 1));
                }
            }

            TotalAdventures++;

            foreach (Character character in ActiveTeam.Players)
            {
                character.Dead = false;
                character.FullRestore();
            }
            foreach (Character character in ActiveTeam.Assembly)
            {
                character.Dead = false;
                character.FullRestore();
            }
            MidAdventure = false;
            ClearDungeonItems();
            //clear rescue status
            Rescue = null;

            //merge back the team if the dungeon was level-limited
            yield return(CoroutineManager.Instance.StartCoroutine(RestoreLevel()));

            //save the result to the main file
            if (Stakes != DungeonStakes.None)
            {
                GameState    state    = DataManager.Instance.LoadMainGameState();
                MainProgress mainSave = state.Save as MainProgress;
                mainSave.MergeDataTo(this);
                DataManager.Instance.SaveMainGameState();
            }
            else
            {
                GameState    state    = DataManager.Instance.LoadMainGameState();
                MainProgress mainSave = state.Save as MainProgress;
                mainSave.MergeDataTo(mainSave);
                DataManager.Instance.SetProgress(state.Save);
                DataManager.Instance.Save.NextDest = NextDest;
            }

            MenuBase.Transparent = false;

            if (recorded && display)
            {
                GameProgress ending = DataManager.Instance.GetRecord(DataManager.REPLAY_PATH + recordFile);

                if (fanfare)
                {
                    if (result != ResultType.Cleared && result != ResultType.Escaped && result != ResultType.Rescue)
                    {
                        GameManager.Instance.Fanfare("Fanfare/MissionFail");
                    }
                    else
                    {
                        GameManager.Instance.Fanfare("Fanfare/MissionClear");
                    }
                }
                else
                {
                    GameManager.Instance.SE("Menu/Skip");
                }

                FinalResultsMenu menu = new FinalResultsMenu(ending);
                yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.ProcessMenuCoroutine(menu)));
            }

            yield return(new WaitForFrames(20));
        }