private void RefreshPermissionValues()
        {
            NavigationPermissionItem kingdomPermission = this._navigationHandler.KingdomPermission;

            this.IsKingdomEnabled = kingdomPermission.IsAuthorized;
            if (this.IsKingdomEnabled)
            {
                GameTexts.SetVariable("TEXT", GameTexts.FindText("str_kingdom", (string)null).ToString());
                GameTexts.SetVariable("HOTKEY", this._shortcuts.KingdomHotkey);
                this.KingdomHint.HintText = GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString();
            }
            else
            {
                this.KingdomHint.HintText = kingdomPermission.ReasonString;
            }
            NavigationPermissionItem clanPermission = this._navigationHandler.ClanPermission;

            this.IsClanEnabled = clanPermission.IsAuthorized;
            if (this.IsClanEnabled)
            {
                GameTexts.SetVariable("TEXT", GameTexts.FindText("str_clan", (string)null).ToString());
                GameTexts.SetVariable("HOTKEY", this._shortcuts.ClanHotkey);
                this.ClanHint.HintText = GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString();
            }
            else
            {
                this.ClanHint.HintText = clanPermission.ReasonString;
            }
        }
        private static void DeclareWarBetweenHeros(Hero assassin, Hero victim, out string declareWarMessage)
        {
            declareWarMessage = string.Empty;

            if (victim.MapFaction.IsAtWarWith(assassin.MapFaction))
            {
                return;
            }

            if (assassin.Clan == victim.Clan)
            {
                throw new NotImplementedException("Assassinating members of the same clan is not supported.");
            }

            if (assassin.Clan.Kingdom != null && assassin.Clan.Kingdom == victim.Clan.Kingdom)
            {
                if (assassin.IsFactionLeader)
                {
                    throw new NotImplementedException("Assassinating members of the kingdom you own is not supported.");
                }

                ChangeKingdomAction.ApplyByLeaveKingdom(assassin.Clan);
            }

            DeclareWarAction.ApplyDeclareWarOverProvocation(victim.MapFaction, assassin.MapFaction);

            GameTexts.SetVariable("FACTION1_NAME", victim.MapFaction.Name);
            GameTexts.SetVariable("FACTION2_NAME", assassin.MapFaction.Name);

            declareWarMessage = $"\n{GameTexts.FindText("str_factions_declare_war_news", null)}.";
        }
Esempio n. 3
0
        public bool SetToMainAgent(Agent agent)
        {
            if (agent != null)
            {
                if (Mission.MainAgent == agent || agent.Team != Mission.PlayerTeam)
                {
                    return(false);
                }
                if (!Utility.IsPlayerDead())
                {
                    MissionEvent.OnMainAgentWillBeChangedToAnotherOne(agent);
                    MissionLibrary.Event.MissionEvent.OnMainAgentWillBeChangedToAnotherOne(agent);
                    Utility.AIControlMainAgent(false);
                }
                GameTexts.SetVariable("ControlledTroopName", agent.Name);
                Utility.DisplayLocalizedText("str_rts_camera_control_troop");
                bool shouldSmoothMoveToAgent = Utility.BeforeSetMainAgent();
                if (_switchFreeCameraLogic.IsSpectatorCamera)
                {
                    Mission.MainAgent = agent;
                    Utility.AfterSetMainAgent(shouldSmoothMoveToAgent, _flyCameraMissionView.MissionScreen, false);
                }
                else
                {
                    Utility.PlayerControlAgent(agent);
                    Utility.AfterSetMainAgent(shouldSmoothMoveToAgent, _flyCameraMissionView.MissionScreen, true);
                }

                return(true);
            }

            Utility.DisplayLocalizedText("str_rts_camera_no_troop_to_control");
            return(false);
        }
Esempio n. 4
0
 public void UpdateProperties()
 {
     RelationToMainHeroText = "";
     GovernorOfText         = "";
     Skills.Clear();
     Traits.Clear();
     UpdateLearningSkillSelection();
     foreach (SkillObject item in SkillObject.All)
     {
         Skills.Add(new EncyclopediaSkillVM(item, _hero.GetSkillValue(item)));
     }
     foreach (TraitObject heroTrait in CampaignUIHelper.GetHeroTraits())
     {
         if (_hero.GetTraitLevel(heroTrait) != 0)
         {
             Traits.Add(new EncyclopediaTraitItemVM(heroTrait, _hero));
         }
     }
     IsChild = _hero.IsChild;
     if (_hero != Hero.MainHero)
     {
         RelationToMainHeroText = CampaignUIHelper.GetHeroRelationToHeroText(_hero, Hero.MainHero).ToString();
     }
     if (_hero.GovernorOf != null)
     {
         GameTexts.SetVariable("SETTLEMENT_NAME", _hero.GovernorOf.Owner.Settlement.EncyclopediaLinkWithName);
         GovernorOfText = GameTexts.FindText("str_governor_of_label").ToString();
     }
     HeroModel = new HeroViewModel();
     HeroModel.FillFrom(_hero);
     Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(_hero.ClanBanner), nineGrid: true);
 }
Esempio n. 5
0
        public bool ControlMainAgent(bool displayMessage = true)
        {
            try
            {
                if (Mission.MainAgent != null)
                {
                    if (Mission.MainAgent.Controller != Agent.ControllerType.Player)
                    {
                        if (displayMessage)
                        {
                            GameTexts.SetVariable("ControlledTroopName", Mission.MainAgent.Name);
                            Utility.DisplayLocalizedText("str_rts_camera_control_troop");
                        }
                        bool shouldSmoothMoveToAgent = Utility.BeforeSetMainAgent();
                        Utility.PlayerControlAgent(Mission.MainAgent);
                        Utility.AfterSetMainAgent(shouldSmoothMoveToAgent, _flyCameraMissionView.MissionScreen);

                        return(true);
                    }
                }
                else
                {
                    Utility.DisplayLocalizedText("str_rts_camera_no_troop_to_control");
                }
            }
            catch (Exception e)
            {
                Utility.DisplayMessage(e.ToString());
            }

            return(false);
        }
 public override void RefreshValues()
 {
     base.RefreshValues();
     this.ClanHint         = new HintViewModel();
     this.KingdomHint      = new HintViewModel();
     this.EncyclopediaHint = new HintViewModel(GameTexts.FindText("str_encyclopedia", (string)null).ToString(), (string)null);
     GameTexts.SetVariable("TEXT", GameTexts.FindText("str_character", (string)null).ToString());
     GameTexts.SetVariable("HOTKEY", this._shortcuts.CharacterHotkey);
     this.SkillsHint = new HintViewModel(GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString(), (string)null);
     GameTexts.SetVariable("TEXT", GameTexts.FindText("str_escape_menu", (string)null).ToString());
     GameTexts.SetVariable("HOTKEY", this._shortcuts.EscapeMenuHotkey);
     this.EscapeMenuHint = new HintViewModel(GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString(), (string)null);
     GameTexts.SetVariable("TEXT", GameTexts.FindText("str_quest", (string)null).ToString());
     GameTexts.SetVariable("HOTKEY", this._shortcuts.QuestHotkey);
     this.QuestsHint = new HintViewModel(GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString(), (string)null);
     GameTexts.SetVariable("TEXT", GameTexts.FindText("str_inventory", (string)null).ToString());
     GameTexts.SetVariable("HOTKEY", this._shortcuts.InventoryHotkey);
     this.InventoryHint = new HintViewModel(GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString(), (string)null);
     GameTexts.SetVariable("TEXT", GameTexts.FindText("str_party", (string)null).ToString());
     GameTexts.SetVariable("HOTKEY", this._shortcuts.PartyHotkey);
     this.PartyHint            = new HintViewModel(GameTexts.FindText("str_hotkey_with_hint", (string)null).ToString(), (string)null);
     this.CampHint             = new HintViewModel(GameTexts.FindText("str_camp", (string)null).ToString(), (string)null);
     this.FinanceHint          = new HintViewModel(GameTexts.FindText("str_finance", (string)null).ToString(), (string)null);
     this.CenterCameraHint     = new HintViewModel(GameTexts.FindText("str_return_to_hero", (string)null).ToString(), (string)null);
     this.KingdomHint.HintText = Hero.MainHero.MapFaction.IsKingdomFaction ? GameTexts.FindText("str_kingdom", (string)null).ToString() : GameTexts.FindText("str_need_to_be_a_part_of_kingdom", (string)null).ToString();
     this.AlertText            = GameTexts.FindText("str_map_bar_alert", (string)null).ToString();
     this.Refresh();
 }
Esempio n. 7
0
        public void InitializeValues()
        {
            if (this._SkillScreenVM.GetCharacterDeveloper() == null)
            {
                this.Level = 0;
            }
            else
            {
                this.Level     = this._SkillScreenVM.GetCharacterDeveloper().Hero.GetSkillValue(this.Skill);
                this.NextLevel = this.Level + 1;
                //this._isInSamePartyAsPlayer = (this._SkillScreenVM.hero.PartyBelongedTo != null && this._SkillScreenVM.hero.PartyBelongedTo == MobileParty.MainParty);
                this._SkillScreenVM.GetCharacterDeveloper().GetPropertyValue(this.Skill);
                this.CurrentSkillXP         = this._SkillScreenVM.GetCharacterDeveloper().GetSkillXpProgress(this.Skill);
                this.XpRequiredForNextLevel = Campaign.Current.Models.CharacterDevelopmentModel.GetXpRequiredForSkillLevel(this.Level + 1) - Campaign.Current.Models.CharacterDevelopmentModel.GetXpRequiredForSkillLevel(this.Level);
                this.ProgressPercentage     = 100.0 * (double)this._currentSkillXP / (double)this.XpRequiredForNextLevel;
                GameTexts.SetVariable("CURRENT_XP", this.CurrentSkillXP.ToString());
                GameTexts.SetVariable("LEVEL_MAX_XP", this.XpRequiredForNextLevel.ToString());
                this.ProgressHint = new HintViewModel(GameTexts.FindText("str_current_xp_over_max", null).ToString(), null);
                this.ProgressText = GameTexts.FindText("str_current_xp_over_max", null).ToString();
                GameTexts.SetVariable("REQUIRED_XP_FOR_NEXT_LEVEL", this.XpRequiredForNextLevel - this.CurrentSkillXP);
                this.SkillXPHint = new HintViewModel(GameTexts.FindText("str_skill_xp_hint", null).ToString(), null);

                this._orgFocusAmount   = this._SkillScreenVM.GetCharacterDeveloper().GetFocus(this.Skill);
                this.CurrentFocusLevel = this._orgFocusAmount;
                this.CreateLists();
            }
        }
        static void Postfix(TournamentVM __instance)
        {
            int num = BannerlordTweaksSettings.Instance is { } settings?settings.TournamentMaxBetAmount : __instance.MaximumBetValue;

            if (Hero.MainHero.GetPerkValue(DefaultPerks.Roguery.DeepPockets))
            {
                num *= (int)DefaultPerks.Roguery.DeepPockets.PrimaryBonus;
            }
            GameTexts.SetVariable("MAX_AMOUNT", num);
            __instance.BetDescriptionText = GameTexts.FindText("str_tournament_bet_description").ToString();
        }
        private void DoBribe()
        {
            Hero.MainHero.ChangeHeroGold(-GuardsBribeAmount);

            GameTexts.SetVariable("GOLD_AMOUNT", GuardsBribeAmount);

            var message = new InformationMessage(GameTexts.FindText("str_gold_removed_with_icon", null).ToString(), "event:/ui/notification/coins_negative");

            InformationManager.DisplayMessage(message);

            Mission.GetMissionBehaviour <AssassinationOutcomeLogic>().OnGuardsAcceptedBribe();
        }
        private static void TakeGoldFromHero(Hero hero, Clan captorClan, out string goldLossMessage)
        {
            var goldAmount = CalculateGoldLoss(hero.Gold, MaximumGoldPenalty);

            GiveGoldAction.ApplyBetweenCharacters(hero, captorClan.Leader, goldAmount, true);

            GameTexts.SetVariable("AMOUNT", goldAmount);

            goldLossMessage = GameTexts.FindText("str_you_have_lost_AMOUNT_denars", null).ToString();

            InformationManager.DisplayMessage(new InformationMessage(goldLossMessage));
        }
Esempio n. 11
0
 private void OnCurrentSelectedAmountChange()
 {
     using (IEnumerator <SpousesSelectTroopsItemVM> enumerator = this.Troops.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             enumerator.Current.IsRosterFull = (this._currentTotalSelectedTroopCount >= this._maxSelectableTroopCount);
         }
     }
     GameTexts.SetVariable("LEFT", this._currentTotalSelectedTroopCount);
     GameTexts.SetVariable("RIGHT", this._maxSelectableTroopCount);
     this.CurrentSelectedAmountText = GameTexts.FindText("str_LEFT_over_RIGHT_in_paranthesis", null).ToString();
 }
Esempio n. 12
0
        public static void PrintUsageHint()
        {
            var keyName = TextForKey(GeneralGameKeyCategories.GetKey(GeneralGameKey.OpenMenu));

            GameTexts.SetVariable("KeyName", keyName);
            var hint = Module.CurrentModule.GlobalTextManager.FindText("str_rts_camera_open_menu_hint").ToString();

            DisplayMessageOutOfMission(hint);
            keyName = TextForKey(RTSCameraGameKeyCategory.GetKey(GameKeyEnum.FreeCamera));
            GameTexts.SetVariable("KeyName", keyName);
            hint = Module.CurrentModule.GlobalTextManager.FindText("str_rts_camera_switch_camera_hint").ToString();
            DisplayMessageOutOfMission(hint);
        }
Esempio n. 13
0
        public override void RefreshValues()
        {
            base.RefreshValues();
            // CharacterCode characterCode = CharacterCode.CreateFrom(this.Clan.Leader.CharacterObject);
            CharacterCode characterCode = CampaignUIHelper.GetCharacterCode(this.Clan.Leader.CharacterObject, false);

            this.Visual   = new ImageIdentifierVM(characterCode);
            this.Banner   = new ImageIdentifierVM(this.Clan.Banner);
            this.Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(this.Clan.Banner), true);

            this.Name = this.Clan.Name.ToString();
            GameTexts.SetVariable("TIER", this.Clan.Tier);
            this.TierText = GameTexts.FindText("str_clan_tier", null).ToString();
        }
        private void SetGameTextVariables(
            MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum message,
            params int[] parameters)
        {
            if (parameters.Length == 0)
            {
                return;
            }
            switch (message)
            {
            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.BattleWarmupEnding:
                GameTexts.SetVariable("SECONDS_LEFT", parameters[0]);
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.BattleYouHaveXTheRound:
                Team team1 = parameters[0] == 0 ? Mission.Current.AttackerTeam : Mission.Current.DefenderTeam;
                Team team2 = GameNetwork.IsMyPeerReady ? GameNetwork.MyPeer.GetComponent <MissionPeer>().Team : (Team)null;
                if (team2 == null)
                {
                    break;
                }
                GameTexts.SetVariable("IS_WINNER", team2 == team1 ? 1 : 0);
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXRemoved:
                GameTexts.SetVariable("PARAM1", ((char)parameters[0]).ToString());
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXRemaining:
                GameTexts.SetVariable("PARAM1", ((char)parameters[0]).ToString());
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagsWillBeRemoved:
                GameTexts.SetVariable("PARAM1", parameters[0]);
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXCapturedByYourTeam:
            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXCapturedByOtherTeam:
                GameTexts.SetVariable("PARAM1", ((char)parameters[0]).ToString());
                break;

            case MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.GoldCarriedFromPreviousRound:
                GameTexts.SetVariable("PARAM1", parameters[0].ToString());
                break;
            }
        }
Esempio n. 15
0
 public override void RefreshValues()
 {
     base.RefreshValues();
     Name        = Hero.MainHero.Clan.Name.ToString();
     MembersText = new TextObject("{=wang_learning_skill}LearningSKill").ToString();
     CanvassText = new TextObject("{=wang_information}ClanInformation").ToString();
     IncomeText  = new TextObject("{=wang_mod_setting}ModSetting").ToString();
     FiefsText   = new TextObject("{=wang_log}").ToString();
     DoneLbl     = GameTexts.FindText("str_done").ToString();
     LeaderText  = GameTexts.FindText("str_sort_by_leader_name_label").ToString();
     GameTexts.SetVariable("TIER", Clan.PlayerClan.Tier);
     CurrentRenownText = GameTexts.FindText("str_clan_tier").ToString();
     _clanMembers?.RefreshValues();
     _canvassVM?.RefreshValues();
     _clanFiefs?.RefreshValues();
     _clanIncome?.RefreshValues();
     _leader?.RefreshValues();
 }
Esempio n. 16
0
        public void RefreshWithCurrentValues()
        {
            float num = Campaign.Current.Models.CharacterDevelopmentModel.CalculateLearningRate(this._boundAttributeCurrentValue, this.CurrentFocusLevel, this.Level, this._heroLevel, this._boundAttributeName, null);

            GameTexts.SetVariable("COUNT", num.ToString("0.00"));
            this.CurrentLearningRateText = GameTexts.FindText("str_learning_rate_COUNT", null).ToString();
            this.CanLearnSkill           = (num > 0f);
            this.LearningRate            = num;
            this.FullLearningRateLevel   = Campaign.Current.Models.CharacterDevelopmentModel.CalculateLearningLimit(this._boundAttributeCurrentValue, this.CurrentFocusLevel, this._boundAttributeName, null);
            int requiredFocusPointsToAddFocusWithCurrentFocus = this._SkillScreenVM.GetRequiredFocusPointsToAddFocusWithCurrentFocus(this._skill);

            GameTexts.SetVariable("COSTAMOUNT", requiredFocusPointsToAddFocusWithCurrentFocus);
            this.FocusCostText = requiredFocusPointsToAddFocusWithCurrentFocus.ToString();
            GameTexts.SetVariable("COUNT", requiredFocusPointsToAddFocusWithCurrentFocus);
            GameTexts.SetVariable("RIGHT", "");
            GameTexts.SetVariable("LEFT", GameTexts.FindText("str_cost_COUNT", null));
            MBTextManager.SetTextVariable("FOCUS_ICON", GameTexts.FindText("str_html_focus_icon", null), false);
            this.NextLevelCostText = GameTexts.FindText("str_sf_text_with_focus_icon", null).ToString();
            this.RefreshCanAddFocus();
        }
        private void RefreshAlliances()
        {
            if (this.PlayerAlliances == null)
            {
                this.PlayerAlliances = new MBBindingList <KingdomTruceItemVM>();
            }

            this.PlayerAlliances.Clear();

            foreach (Kingdom kingdom in Kingdom.All)
            {
                if (kingdom != this._playerKingdom && !kingdom.IsEliminated && (FactionManager.IsAlliedWithFaction(kingdom, this._playerKingdom)))
                {
                    this.PlayerAlliances.Add(new KingdomAllianceItemVM(this._playerKingdom, kingdom, this.OnDiplomacyItemSelection, this.BreakAlliance));
                }
            }


            GameTexts.SetVariable("STR", this.PlayerAlliances.Count);
            this.NumOfPlayerAlliancesText = GameTexts.FindText("str_STR_in_parentheses", null).ToString();
        }
Esempio n. 18
0
        public void RefreshMembersList()
        {
            Family.Clear();
            Companions.Clear();
            List <Hero> list = new List <Hero>();

            foreach (Hero noble in _faction.Nobles)
            {
                HeroHelper.SetLastSeenLocation(noble, willUpdateImmediately: true);
                if (noble.IsAlive)
                {
                    if (noble == Hero.MainHero)
                    {
                        list.Insert(0, noble);
                    }
                    else
                    {
                        list.Add(noble);
                    }
                }
            }
            IEnumerable <Hero> enumerable = _faction.Companions.Where((Hero m) => m.IsPlayerCompanion);

            foreach (Hero item in list)
            {
                Family.Add(new WangLordItemVM(item, OnMemberSelection));
            }
            foreach (Hero item2 in enumerable)
            {
                Companions.Add(new WangLordItemVM(item2, OnMemberSelection));
            }
            GameTexts.SetVariable("COMPANION_COUNT", _faction.Companions.Count());
            GameTexts.SetVariable("COMPANION_LIMIT", _faction.CompanionLimit);
            CompanionsText = GameTexts.FindText("str_companions_group").ToString();
            OnMemberSelection(GetDefaultMember());
        }
 private void UpdateAmountText()
 {
     GameTexts.SetVariable("LEFT", this.CurrentAmount);
     GameTexts.SetVariable("RIGHT", this.MaxAmount);
     this.AmountText = GameTexts.FindText("str_LEFT_over_RIGHT", null).ToString();
 }
 static void Postfix(TournamentVM __instance)
 {
     GameTexts.SetVariable("MAX_AMOUNT", Settings.Instance.TournamentMaxBetAmount);
     __instance.BetDescriptionText = GameTexts.FindText("str_tournament_bet_description").ToString();
 }
        public static void PrintDebugLogForInfo(
            Agent attackerAgent,
            Agent victimAgent,
            DamageTypes damageType,
            int speedBonus,
            int armorAmount,
            int inflictedDamage,
            int absorbedByArmor,
            sbyte collisionBone,
            float lostHpPercentage)
        {
            TextObject     message  = TextObject.Empty;
            CombatLogColor logColor = CombatLogColor.White;
            bool           isMine   = attackerAgent.IsMine;
            int            num      = victimAgent.IsMine ? 1 : 0;

            GameTexts.SetVariable("AMOUNT", inflictedDamage);
            GameTexts.SetVariable("DAMAGE_TYPE", damageType.ToString().ToLower());
            GameTexts.SetVariable("LOST_HP_PERCENTAGE", lostHpPercentage);
            if (num != 0)
            {
                GameTexts.SetVariable("ATTACKER_NAME", attackerAgent.Name);
                message  = GameTexts.FindText("combat_log_player_attacked");
                logColor = CombatLogColor.Red;
            }
            else if (isMine)
            {
                GameTexts.SetVariable("VICTIM_NAME", victimAgent.Name);
                message  = GameTexts.FindText("combat_log_player_attacker");
                logColor = CombatLogColor.Green;
            }
            CombatLogManager.Print(message, logColor);
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(PrintDebugLogForInfo));
            if (armorAmount > 0)
            {
                GameTexts.SetVariable("ABSORBED_AMOUNT", absorbedByArmor);
                GameTexts.SetVariable("ARMOR_AMOUNT", armorAmount);
                mbStringBuilder.AppendLine <string>(GameTexts.FindText("combat_log_damage_absorbed").ToString());
            }
            if (victimAgent.IsHuman)
            {
                Agent.AgentBoneMapArray boneMappingArray = victimAgent.BoneMappingArray;
                for (int index = 0; index < boneMappingArray.Length; ++index)
                {
                    HumanBone i = (HumanBone)index;
                    if ((int)collisionBone == (int)boneMappingArray[i])
                    {
                        GameTexts.SetVariable("BONE", i.ToString());
                        mbStringBuilder.AppendLine <string>(GameTexts.FindText("combat_log_hit_bone").ToString());
                        break;
                    }
                }
            }
            if (speedBonus != 0)
            {
                GameTexts.SetVariable("SPEED_BONUS", speedBonus);
                mbStringBuilder.AppendLine <string>(GameTexts.FindText("combat_log_speed_bonus").ToString());
            }
            CombatLogManager.Print(new TextObject(mbStringBuilder.ToStringAndRelease()));
        }
Esempio n. 22
0
 public override void OnMissionTick(float dt)
 {
     if (this.Mission.IsMissionEnding)
     {
         if (this._notificationsDisabled)
         {
             this._scoreBoardOpenedOnceOnMissionEnd = true;
         }
         if (this._missionEndedMessageShown && !this._scoreBoardOpenedOnceOnMissionEnd)
         {
             if ((double)this._checkRetreatingTimer.ElapsedTime > 7.0)
             {
                 this.CheckIsEnemySideRetreatingOrOneSideDepleted();
                 this._checkRetreatingTimer.Reset();
                 if (this.Mission.MissionResult != null && this.Mission.MissionResult.PlayerDefeated)
                 {
                     GameTexts.SetVariable("leave_key", Game.Current.GameTextManager.GetHotKeyGameText("CombatHotKeyCategory", 4));
                     InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_lost_press_tab_to_view_results"));
                 }
                 else if (this.Mission.MissionResult != null && this.Mission.MissionResult.PlayerVictory)
                 {
                     if (this._isEnemySideDepleted)
                     {
                         GameTexts.SetVariable("leave_key", Game.Current.GameTextManager.GetHotKeyGameText("CombatHotKeyCategory", 4));
                         InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_won_press_tab_to_view_results"));
                     }
                 }
                 else
                 {
                     GameTexts.SetVariable("leave_key", Game.Current.GameTextManager.GetHotKeyGameText("CombatHotKeyCategory", 4));
                     InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_finished_press_tab_to_view_results"));
                 }
             }
         }
         else if ((double)this._checkRetreatingTimer.ElapsedTime > 3.0 && !this._scoreBoardOpenedOnceOnMissionEnd)
         {
             if (this.Mission.MissionResult != null && this.Mission.MissionResult.PlayerDefeated)
             {
                 InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_lost"));
             }
             else if (this.Mission.MissionResult != null && this.Mission.MissionResult.PlayerVictory)
             {
                 if (this._isEnemySideDepleted)
                 {
                     InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_won"));
                 }
                 else if (this._isEnemySideRetreating)
                 {
                     InformationManager.AddQuickInformation(GameTexts.FindText("str_enemies_are_fleeing_you_won"));
                 }
             }
             else
             {
                 InformationManager.AddQuickInformation(GameTexts.FindText("str_battle_finished"));
             }
             this._missionEndedMessageShown = true;
             this._checkRetreatingTimer.Reset();
         }
         if (this._victoryReactionsActivated)
         {
             return;
         }
         AgentVictoryLogic missionBehaviour = this.Mission.GetMissionBehaviour <AgentVictoryLogic>();
         if (missionBehaviour == null)
         {
             return;
         }
         this.CheckIsEnemySideRetreatingOrOneSideDepleted();
         if (this._isEnemySideDepleted)
         {
             missionBehaviour.SetTimersOfVictoryReactions(this.Mission.PlayerTeam.Side);
             this._victoryReactionsActivated = true;
         }
         else if (this._isPlayerSideDepleted)
         {
             missionBehaviour.SetTimersOfVictoryReactions(this.Mission.PlayerEnemyTeam.Side);
             this._victoryReactionsActivated = true;
         }
         else
         {
             if (!this._isEnemySideRetreating || this._victoryReactionsActivatedForRetreating)
             {
                 return;
             }
             missionBehaviour.SetTimersOfVictoryReactionsForRetreating(this.Mission.PlayerTeam.Side);
             this._victoryReactionsActivatedForRetreating = true;
         }
     }
     else
     {
         if ((double)this._checkRetreatingTimer.ElapsedTime <= 1.0)
         {
             return;
         }
         this.CheckIsEnemySideRetreatingOrOneSideDepleted();
         this._checkRetreatingTimer.Reset();
     }
 }