Exemple #1
0
        public override void Initialize()
        {
            DiplomacyUI.SyncDiplomacyPopup(this._app, this.ID, this._otherPlayer);
            PlayerInfo playerInfo1 = this._app.GameDatabase.GetPlayerInfo(this._app.Game.LocalPlayer.ID);
            PlayerInfo playerInfo2 = this._app.GameDatabase.GetPlayerInfo(this._otherPlayer);

            this._app.UI.SetEnabled("btnDemMoney", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SavingsDemand)));
            this._app.UI.SetEnabled("btnDemSystemInfo", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SystemInfoDemand)));
            this._app.UI.SetEnabled("btnDemResearchPoints", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.ResearchPointsDemand)));
            this._app.UI.SetEnabled("btnDemSlaves", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SlavesDemand)));
            this._app.UI.SetEnabled("btnDemWorld", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.WorldDemand)));
            this._app.UI.SetEnabled("btnDemProvince", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.ProvinceDemand)));
            this._app.UI.SetEnabled("btnDemSurrender", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo2, DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SurrenderDemand)));
            this._app.UI.SetButtonText("btnDemMoney", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_SAVINGS"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SavingsDemand))));
            this._app.UI.SetButtonText("btnDemSystemInfo", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_SYSTEMINFO"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SystemInfoDemand))));
            this._app.UI.SetButtonText("btnDemResearchPoints", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_RESEARCHPOINTS"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.ResearchPointsDemand))));
            this._app.UI.SetButtonText("btnDemSlaves", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_SLAVES"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SlavesDemand))));
            this._app.UI.SetButtonText("btnDemWorld", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_WORLD"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.WorldDemand))));
            this._app.UI.SetButtonText("btnDemProvince", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_PROVINCE"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.ProvinceDemand))));
            this._app.UI.SetButtonText("btnDemSurrender", string.Format(App.Localize("@UI_DIPLOMACY_DEMAND_SURRENDER"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.DEMAND, new RequestType?(), new DemandType?(DemandType.SurrenderDemand))));
            if (this._app.AssetDatabase.GetFaction(playerInfo1.FactionID).HasSlaves())
            {
                this._app.UI.SetPropertyInt("pnlDemand", "height", 210);
                this._app.UI.SetPropertyInt(this._app.UI.Path("pnlDemand", "pnlBoxPanel"), "height", 160);
                this._app.UI.SetVisible("btnDemSlaves", true);
            }
            else
            {
                this._app.UI.SetPropertyInt("pnlDemand", "height", 190);
                this._app.UI.SetPropertyInt(this._app.UI.Path("pnlDemand", "pnlBoxPanel"), "height", 140);
                this._app.UI.SetVisible("btnDemSlaves", false);
            }
        }
 public override void Initialize()
 {
     DiplomacyUI.SyncPanelColor(this._app, this.ID, this._panelColor);
     this._app.UI.ClearItems("lstType");
     foreach (KeyValuePair <ConsequenceType, string> consequenceTypeLoc in TreatyEditDialog.ConsequenceTypeLocMap)
     {
         this._app.UI.AddItem("lstType", string.Empty, (int)consequenceTypeLoc.Key, App.Localize(consequenceTypeLoc.Value));
     }
     this._app.UI.SetSelection("lstType", (int)this._editedConsequence.Type);
     this._app.UI.SetPropertyString("txtValue", "text", this._editedConsequence.ConsequenceValue.ToString());
     this._valueSpinner = new ValueBoundSpinner(this.UI, "spnValue", 0.0, 1.0, 1.0, 1.0);
     this._valueSpinner.ValueChanged += new ValueChangedEventHandler(this._valueSpinner_ValueChanged);
     if (ConsequenceEditDialog.ConsequenceTypeSpinnerDescriptors.ContainsKey(this._editedConsequence.Type))
     {
         this._valueSpinner.SetValueDescriptor(ConsequenceEditDialog.ConsequenceTypeSpinnerDescriptors[this._editedConsequence.Type]);
         this._editedConsequence.ConsequenceValue = (float)this._valueSpinner.Value;
         this._app.UI.SetPropertyString("txtValue", "text", this._editedConsequence.ConsequenceValue.ToString());
         this._valueSpinner.SetVisible(true);
         this._app.UI.SetVisible("txtValue", true);
     }
     else
     {
         this._valueSpinner.SetVisible(false);
         this._app.UI.SetVisible("txtValue", false);
     }
 }
Exemple #3
0
 public override void Initialize()
 {
     this._crits.Activate();
     this._starmap.Sync(this._crits);
     this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "ohStarmap"), (object)this._starmap.ObjectID);
     DiplomacyUI.SyncDiplomacyPopup(this._app, this.ID, this._otherPlayer);
     this.SyncSystemSelect();
 }
Exemple #4
0
        public static void SyncIndyDiplomacyCard(App game, string panelName, int playerId)
        {
            PlayerInfo playerInfo = game.GameDatabase.GetPlayerInfo(playerId);

            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UICardPlayerName), "text", playerInfo.Name);
            DiplomacyUI.SyncPanelColor(game, game.UI.Path(panelName, DiplomacyUI.UIPanelBackground), playerInfo.PrimaryColor);
            DiplomacyUI.CardStateFunctionMap[DiplomacyCardState.DiplomacyActions](game, game.UI.Path(panelName, "stateDiplomacyActions"), playerInfo, false);
            DiplomacyUI.CardStateFunctionMap[DiplomacyCardState.PlayerHistory](game, game.UI.Path(panelName, "statePlayerHistory"), playerInfo, false);
            DiplomacyUI.CardStateFunctionMap[DiplomacyCardState.PlayerStats](game, game.UI.Path(panelName, "statePlayerStats"), playerInfo, false);
        }
Exemple #5
0
        public override void Initialize()
        {
            PlayerInfo playerInfo = this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID);

            this._app.GameDatabase.GetPlayerInfo(this._otherPlayer);
            DiplomacyUI.SyncDiplomacyPopup(this._app, this.ID, this._otherPlayer);
            this._app.UI.SetEnabled("btnMoney", playerInfo.Savings > 0.0);
            this._app.UI.SetEnabled("btnResearch", playerInfo.Savings > 0.0);
            this._app.UI.SetButtonText("btnMoney", string.Format(App.Localize(GiveTypeDialog.GiveTypeLocMap[GiveType.GiveSavings])));
            this._app.UI.SetButtonText("btnResearch", string.Format(App.Localize(GiveTypeDialog.GiveTypeLocMap[GiveType.GiveResearchPoints])));
        }
 public override void Initialize()
 {
     DiplomacyUI.SyncPanelColor(this._app, this.ID, this._panelColor);
     this._app.UI.ClearItems("lstType");
     foreach (KeyValuePair <IncentiveType, string> incentiveTypeLoc in TreatyEditDialog.IncentiveTypeLocMap)
     {
         this._app.UI.AddItem("lstType", string.Empty, (int)incentiveTypeLoc.Key, App.Localize(incentiveTypeLoc.Value));
     }
     this._app.UI.SetSelection("lstType", (int)this._editedIncentive.Type);
     this._app.UI.SetPropertyString("txtValue", "text", this._editedIncentive.IncentiveValue.ToString());
     this._valueSpinner = new ValueBoundSpinner(this.UI, "spnValue", IncentiveEditDialog.IncentiveTypeSpinnerDescriptors[this._editedIncentive.Type]);
     this._valueSpinner.ValueChanged += new ValueChangedEventHandler(this._valueSpinner_ValueChanged);
 }
Exemple #7
0
        public static void SyncPlayerDiplomacyCard(
            App game,
            string panelName,
            int playerId,
            DiplomacyCardState cardState,
            bool updateButtonIds)
        {
            PlayerInfo playerInfo = game.GameDatabase.GetPlayerInfo(playerId);

            if (updateButtonIds)
            {
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UICardPreviousState), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICardPreviousState));
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UICardNextState), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICardNextState));
                game.UI.SetButtonText(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UIDeclareButton), string.Format(App.Localize("@UI_DIPLOMACY_DECLARE"), (object)game.AssetDatabase.DeclareWarPointCost));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UISurpriseAttackButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UISurpriseAttackButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UIDeclareButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIDeclareButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UIRequestButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIRequestButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UIDemandButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIDemandButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UITreatyButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UITreatyButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UILobbyButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UILobbyButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateDiplomacyActions", DiplomacyUI.UIGiveButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIGiveButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateEspionage", DiplomacyUI.UIIntelButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIIntelButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateEspionage", DiplomacyUI.UICounterIntelButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICounterIntelButton));
                game.UI.SetPropertyString(game.UI.Path(panelName, "stateEspionage", DiplomacyUI.UIOperationsButton), "id", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIOperationsButton));
            }
            game.UI.SetEnabled(game.UI.Path(panelName, string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICardPreviousState)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICardNextState)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UISurpriseAttackButton)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIDeclareButton)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIRequestButton)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIDemandButton)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UITreatyButton)), (!playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIGiveButton)), (playerInfo.isDefeated ? 0 : (game.GameDatabase.GetPlayerInfo(game.LocalPlayer.ID).Savings > 0.0 ? 1 : 0)) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateDiplomacyActions", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UILobbyButton)), (playerInfo.isDefeated ? 0 : (game.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.LOBBY, new RequestType?(), new DemandType?()) ? 1 : 0)) != 0);
            bool flag = game.AssetDatabase.GetFaction(playerInfo.FactionID).Name == "loa" && game.GameDatabase.PlayerHasTech(game.LocalPlayer.ID, "CCC_Artificial_Intelligence") || game.AssetDatabase.GetFaction(playerInfo.FactionID).Name != "loa";

            game.UI.SetEnabled(game.UI.Path(panelName, "stateEspionage", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIIntelButton)), (playerInfo.isDefeated ? 0 : (flag ? 1 : 0)) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateEspionage", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UICounterIntelButton)), (playerInfo.isDefeated ? 0 : (flag ? 1 : 0)) != 0);
            game.UI.SetEnabled(game.UI.Path(panelName, "stateEspionage", string.Format("{0}|{1}", (object)panelName, (object)DiplomacyUI.UIOperationsButton)), (playerInfo.isDefeated ? 0 : (flag ? 1 : 0)) != 0);
            foreach (DiplomacyCardState diplomacyCardState in Enum.GetValues(typeof(DiplomacyCardState)))
            {
                game.UI.SetVisible(game.UI.Path(panelName, string.Format("state{0}", (object)diplomacyCardState.ToString())), (playerInfo.isDefeated ? (diplomacyCardState == DiplomacyCardState.PlayerStats ? 1 : 0) : (diplomacyCardState == cardState ? 1 : 0)) != 0);
            }
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UICardPlayerName), "text", playerInfo.Name);
            DiplomacyUI.SyncEspionageState(game, panelName, playerInfo, updateButtonIds);
            DiplomacyUI.SyncPanelColor(game, game.UI.Path(panelName, DiplomacyUI.UIPanelBackground), playerInfo.PrimaryColor);
            DiplomacyUI.CardStateFunctionMap[cardState](game, game.UI.Path(panelName, string.Format("state{0}", (object)cardState.ToString())), playerInfo, (updateButtonIds ? 1 : 0) != 0);
        }
 public override void Initialize()
 {
     this.InitializePanel();
     this._receivingPlayer = this._app.GameDatabase.GetPlayerInfo(this._editedTreaty.ReceivingPlayerId);
     DiplomacyUI.SyncPanelColor(this._app, "pnlBackground", this._receivingPlayer.PrimaryColor);
     this.hasTreaty = true;
     this.SyncTreatyEditor();
     this._durationSpinner                      = new ValueBoundSpinner(this.UI, "spnDuration", 1.0, 500.0, 1.0, 1.0);
     this._limitationValueSpinner               = new ValueBoundSpinner(this.UI, "spnLimitationValue", 1.0, (double)int.MaxValue, 1.0, 1.0);
     this._durationSpinner.ValueChanged        += new ValueChangedEventHandler(this._durationSpinner_ValueChanged);
     this._limitationValueSpinner.ValueChanged += new ValueChangedEventHandler(this._limitationValueSpinner_ValueChanged);
     if (this._receivingPlayer.isStandardPlayer)
     {
         return;
     }
     this._editedTreaty.Type = TreatyType.Incorporate;
     this.SyncTreatyEditor();
 }
        public override void Initialize()
        {
            this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID);
            PlayerInfo playerInfo = this._app.GameDatabase.GetPlayerInfo(this._otherPlayer);

            DiplomacyUI.SyncDiplomacyPopup(this._app, this.ID, this._otherPlayer);
            this._app.UI.SetEnabled("btnReqMoney", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.SavingsRequest), new DemandType?()));
            this._app.UI.SetEnabled("btnReqSystemInfo", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.SystemInfoRequest), new DemandType?()));
            this._app.UI.SetEnabled("btnReqResearchPoints", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.ResearchPointsRequest), new DemandType?()));
            this._app.UI.SetEnabled("btnReqMilitaryAssistance", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.MilitaryAssistanceRequest), new DemandType?()));
            this._app.UI.SetEnabled("btnReqGatePermission", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.GatePermissionRequest), new DemandType?()));
            this._app.UI.SetEnabled("btnReqEstablishEnclave", this._app.Game.CanPerformLocalDiplomacyAction(playerInfo, DiplomacyAction.REQUEST, new RequestType?(RequestType.EstablishEnclaveRequest), new DemandType?()));
            this._app.UI.SetButtonText("btnReqMoney", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_SAVINGS"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.SavingsRequest), new DemandType?())));
            this._app.UI.SetButtonText("btnReqSystemInfo", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_SYSTEMINFO"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.SystemInfoRequest), new DemandType?())));
            this._app.UI.SetButtonText("btnReqResearchPoints", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_RESEARCHPOINTS"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.ResearchPointsRequest), new DemandType?())));
            this._app.UI.SetButtonText("btnReqMilitaryAssistance", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_MILITARYASSISTANCE"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.MilitaryAssistanceRequest), new DemandType?())));
            this._app.UI.SetButtonText("btnReqGatePermission", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_GATEPERMISSION"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.GatePermissionRequest), new DemandType?())));
            this._app.UI.SetButtonText("btnReqEstablishEnclave", string.Format(App.Localize("@UI_DIPLOMACY_REQUEST_ESTABLISHENCLAVE"), (object)this._app.Game.GetDiplomacyActionCost(DiplomacyAction.REQUEST, new RequestType?(RequestType.EstablishEnclaveRequest), new DemandType?())));
        }
Exemple #10
0
        private static void SyncEspionageState(
            App game,
            string panelName,
            PlayerInfo playerInfo,
            bool updateButtonIds)
        {
            PlayerInfo playerInfo1 = game.GameDatabase.GetPlayerInfo(game.LocalPlayer.ID);

            game.UI.SetPropertyString(game.UI.Path(panelName, panelName.Split('.')[0] + "|btnIntel", "lblIntelLabel"), "text", string.Format(App.Localize("@UI_DIPLOMACY_INTEL"), (object)playerInfo1.IntelPoints));
            game.UI.SetPropertyString(game.UI.Path(panelName, panelName.Split('.')[0] + "|btnCounterIntel", "lblCounterIntelLabel"), "text", string.Format(App.Localize("@UI_DIPLOMACY_COUNTER_INTEL"), (object)playerInfo1.CounterIntelPoints));
            game.UI.SetPropertyString(game.UI.Path(panelName, panelName.Split('.')[0] + "|btnOperations", "lblOperationsLabel"), "text", string.Format(App.Localize("@UI_DIPLOMACY_OPERATIONS"), (object)playerInfo1.OperationsPoints));
            game.UI.SetEnabled(game.UI.Path(panelName, panelName.Split('.')[0] + "|btnCounterIntel"), (playerInfo1.CounterIntelPoints >= game.AssetDatabase.RequiredCounterIntelPointsForMission ? 1 : 0) != 0);
            DiplomacyUI.ClearIntelList(game, panelName);
            int num = 0;

            foreach (IntelMissionInfo intelMissionInfo in game.GameDatabase.GetIntelInfosForPlayer(game.LocalPlayer.ID).Where <IntelMissionInfo>((Func <IntelMissionInfo, bool>)(x => x.TargetPlayerId == playerInfo.ID)).ToList <IntelMissionInfo>())
            {
                DiplomacyUI.AddIntelListItem(game, panelName, "Pending Intel", intelMissionInfo.ID);
                num = num > intelMissionInfo.ID ? num : intelMissionInfo.ID;
            }
            int itemid = num + 1;

            foreach (TurnEvent turnEvent in game.GameDatabase.GetTurnEventsByTurnNumber(game.GameDatabase.GetTurnCount(), game.LocalPlayer.ID).Where <TurnEvent>((Func <TurnEvent, bool>)(x =>
            {
                if (x.EventType != TurnEventType.EV_INTEL_MISSION_CRITICAL_FAILED)
                {
                    return(x.EventType == TurnEventType.EV_INTEL_MISSION_FAILED);
                }
                return(true);
            })).ToList <TurnEvent>())
            {
                DiplomacyUI.AddIntelListItem(game, panelName, "Pending Intel", itemid);
                ++itemid;
            }
            game.UI.ClearItems(game.UI.Path(panelName, DiplomacyUI.UICounterIntelList));
            foreach (CounterIntelStingMission intelStingMission in game.GameDatabase.GetCountIntelStingsForPlayerAgainstPlayer(game.LocalPlayer.ID, playerInfo.ID).ToList <CounterIntelStingMission>())
            {
                game.UI.AddItem(game.UI.Path(panelName, DiplomacyUI.UICounterIntelList), string.Empty, intelStingMission.ID, string.Format(App.Localize("@UI_COUNTER_INTEL_LIST_ITEM")));
            }
        }
Exemple #11
0
        public static void SyncDiplomacyPopup(App game, string panelName, int playerId)
        {
            PlayerInfo     playerInfo     = game.GameDatabase.GetPlayerInfo(playerId);
            DiplomaticMood diplomaticMood = game.GameDatabase.GetDiplomacyInfo(playerInfo.ID, game.Game.LocalPlayer.ID).GetDiplomaticMood();

            game.UI.SetVisible(DiplomacyUI.UIRelation, true);
            switch (diplomaticMood)
            {
            case DiplomaticMood.Hatred:
                game.UI.SetPropertyString(DiplomacyUI.UIRelation, "sprite", "Hate");
                break;

            case DiplomaticMood.Love:
                game.UI.SetPropertyString(DiplomacyUI.UIRelation, "sprite", "Love");
                break;

            default:
                game.UI.SetVisible(DiplomacyUI.UIRelation, false);
                break;
            }
            DiplomacyUI.SyncPanelColor(game, game.UI.Path(panelName, DiplomacyUI.UIPanelBackground), playerInfo.PrimaryColor);
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIAvatar), "sprite", Path.GetFileNameWithoutExtension(playerInfo.AvatarAssetPath));
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIBadge), "sprite", Path.GetFileNameWithoutExtension(playerInfo.BadgeAssetPath));
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UICardPlayerName), "text", playerInfo.Name);
            if (!(panelName == DiplomacyUI.UILobbyPanel))
            {
                return;
            }
            foreach (PlayerInfo standardPlayerInfo in game.GameDatabase.GetStandardPlayerInfos())
            {
                if (standardPlayerInfo.ID != playerId)
                {
                    float num1 = (float)game.GameDatabase.GetDiplomacyInfo(playerInfo.ID, standardPlayerInfo.ID).Relations / 2000f;
                    float num2 = ((float)((!(game.GameDatabase.GetPlayerFaction(standardPlayerInfo.ID).Name == "morrigi") || standardPlayerInfo.ID != game.Game.LocalPlayer.ID ? 0.0 : (double)game.AssetDatabase.GetTechBonus <float>("PSI_Lesser_Glamour", "diplomaticoffering") * 0.5) + (game.GameDatabase.PlayerHasTech(game.Game.LocalPlayer.ID, "PSI_Lesser_Glamour") ? (double)game.AssetDatabase.GetTechBonus <float>("PSI_Lesser_Glamour", "diplomaticoffering") : 0.0)) + num1) * 100f;
                    game.UI.AddItem(DiplomacyUI.UILobbyPlayerList, "", standardPlayerInfo.ID, standardPlayerInfo.Name + " (" + (object)(int)num2 + "% Chance)");
                }
            }
            game.UI.SetSelection(DiplomacyUI.UILobbyPlayerList, game.LocalPlayer.ID);
        }
Exemple #12
0
 public override void Initialize()
 {
     DiplomacyUI.SyncDiplomacyPopup(this._app, this.ID, this._otherPlayer);
     this.SyncScalar();
 }
Exemple #13
0
        private static void SyncPlayerHistoryState(
            App game,
            string panelName,
            PlayerInfo playerInfo,
            bool updateButtonIds)
        {
            int turnCount = game.GameDatabase.GetTurnCount();

            game.UI.ClearItems(DiplomacyUI.UINewsList);
            List <DiplomacyReactionHistoryEntryInfo> list = game.GameDatabase.GetDiplomacyReactionHistory(playerInfo.ID, game.Game.LocalPlayer.ID, turnCount, 10).ToList <DiplomacyReactionHistoryEntryInfo>();
            Vector3 vector3_1 = new Vector3(0.2f, 0.8f, 0.2f);
            Vector3 vector3_2 = new Vector3(0.8f, 0.2f, 0.2f);

            foreach (DiplomacyReactionHistoryEntryInfo historyEntryInfo in list)
            {
                Vector3 vector3_3 = historyEntryInfo.Difference > 0 ? vector3_1 : vector3_2;
                game.UI.AddItem(game.UI.Path(panelName, DiplomacyUI.UINewsList), string.Empty, historyEntryInfo.ID, string.Empty);
                string itemGlobalId = game.UI.GetItemGlobalID(game.UI.Path(panelName, DiplomacyUI.UINewsList), string.Empty, historyEntryInfo.ID, string.Empty);
                game.UI.SetEnabled(itemGlobalId, false);
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtTurn"), "text", historyEntryInfo.TurnCount.ToString());
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtType"), "text", App.Localize("@" + historyEntryInfo.Reaction.ToString()));
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtChange"), "text", historyEntryInfo.Difference > 0 ? string.Format("+{0}", (object)historyEntryInfo.Difference) : historyEntryInfo.Difference.ToString());
                game.UI.SetPropertyColorNormalized(game.UI.Path(itemGlobalId, "txtChange"), "color", vector3_3);
            }
            game.UI.ClearItems(DiplomacyUI.UIInteractionsList);
            foreach (DiplomacyActionHistoryEntryInfo actionInfo in game.GameDatabase.GetDiplomacyActionHistory(playerInfo.ID, game.Game.LocalPlayer.ID, turnCount - 1, 10).ToList <DiplomacyActionHistoryEntryInfo>())
            {
                game.UI.AddItem(game.UI.Path(panelName, DiplomacyUI.UIInteractionsList), string.Empty, actionInfo.ID, string.Empty);
                string itemGlobalId = game.UI.GetItemGlobalID(game.UI.Path(panelName, DiplomacyUI.UIInteractionsList), string.Empty, actionInfo.ID, string.Empty);
                game.UI.SetEnabled(itemGlobalId, false);
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtTurn"), "text", actionInfo.TurnCount.ToString());
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtInteraction"), "text", DiplomacyUI.GetDiplomacyActionString(game, actionInfo));
            }
        }
Exemple #14
0
        private static void SyncDiplomacyActionsState(
            App game,
            string panelName,
            PlayerInfo playerInfo,
            bool updateButtonIds)
        {
            int         turnCount     = game.GameDatabase.GetTurnCount();
            FactionInfo factionInfo   = game.GameDatabase.GetFactionInfo(playerInfo.FactionID);
            string      propertyValue = game.GameDatabase.GetPlayerInfo(game.Game.LocalPlayer.ID).FactionDiplomacyPoints[factionInfo.ID].ToString();
            List <DiplomacyActionHistoryEntryInfo> list = game.GameDatabase.GetDiplomacyActionHistory(game.Game.LocalPlayer.ID, playerInfo.ID, turnCount, 1).ToList <DiplomacyActionHistoryEntryInfo>();

            game.UI.ClearItems(game.UI.Path(panelName, DiplomacyUI.UIPendingActions));
            foreach (DiplomacyActionHistoryEntryInfo actionInfo in list)
            {
                game.UI.AddItem(game.UI.Path(panelName, DiplomacyUI.UIPendingActions), string.Empty, actionInfo.ID, string.Empty);
                string itemGlobalId = game.UI.GetItemGlobalID(game.UI.Path(panelName, DiplomacyUI.UIPendingActions), string.Empty, actionInfo.ID, string.Empty);
                game.UI.SetEnabled(itemGlobalId, false);
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtTurn"), "text", actionInfo.TurnCount.ToString());
                game.UI.SetPropertyString(game.UI.Path(itemGlobalId, "txtInteraction"), "text", DiplomacyUI.GetDiplomacyActionString(game, actionInfo));
            }
            string        str = ((IEnumerable <string>)panelName.Split('.')).First <string>();
            bool          isStandardPlayer = playerInfo.isStandardPlayer;
            UICommChannel ui1 = game.UI;
            string        panelId1;

            if (!isStandardPlayer)
            {
                panelId1 = game.UI.Path(panelName, DiplomacyUI.UIDeclareButton);
            }
            else
            {
                panelId1 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UIDeclareButton);
            }
            string text = string.Format(App.Localize("@UI_DIPLOMACY_DECLARE"), (object)game.Game.GetDiplomacyActionCost(DiplomacyAction.DECLARATION, new RequestType?(), new DemandType?()));

            ui1.SetButtonText(panelId1, text);
            UICommChannel ui2 = game.UI;
            string        panelId2;

            if (!isStandardPlayer)
            {
                panelId2 = game.UI.Path(panelName, DiplomacyUI.UISurpriseAttackButton);
            }
            else
            {
                panelId2 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UISurpriseAttackButton);
            }
            int num1 = DiplomacyUI.EnableSupriseButton(game.Game, playerInfo) ? 1 : 0;

            ui2.SetEnabled(panelId2, num1 != 0);
            UICommChannel ui3 = game.UI;
            string        panelId3;

            if (!isStandardPlayer)
            {
                panelId3 = game.UI.Path(panelName, DiplomacyUI.UIDeclareButton);
            }
            else
            {
                panelId3 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UIDeclareButton);
            }
            int num2 = DiplomacyUI.EnableDeclareButton(game.Game, playerInfo) ? 1 : 0;

            ui3.SetEnabled(panelId3, num2 != 0);
            UICommChannel ui4 = game.UI;
            string        panelId4;

            if (!isStandardPlayer)
            {
                panelId4 = game.UI.Path(panelName, DiplomacyUI.UIRequestButton);
            }
            else
            {
                panelId4 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UIRequestButton);
            }
            int num3 = DiplomacyUI.EnableRequestButton(game.Game, playerInfo) ? 1 : 0;

            ui4.SetEnabled(panelId4, num3 != 0);
            UICommChannel ui5 = game.UI;
            string        panelId5;

            if (!isStandardPlayer)
            {
                panelId5 = game.UI.Path(panelName, DiplomacyUI.UIDemandButton);
            }
            else
            {
                panelId5 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UIDemandButton);
            }
            int num4 = DiplomacyUI.EnableDemandButton(game.Game, playerInfo) ? 1 : 0;

            ui5.SetEnabled(panelId5, num4 != 0);
            UICommChannel ui6 = game.UI;
            string        panelId6;

            if (!isStandardPlayer)
            {
                panelId6 = game.UI.Path(panelName, DiplomacyUI.UITreatyButton);
            }
            else
            {
                panelId6 = string.Format("{0}|{1}", (object)str, (object)DiplomacyUI.UITreatyButton);
            }
            int num5 = DiplomacyUI.EnableTreatyButton(game.Game, playerInfo) ? 1 : 0;

            ui6.SetEnabled(panelId6, num5 != 0);
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIActionRdpValue), "text", propertyValue);
        }
Exemple #15
0
        private static void SyncPlayerStatsState(
            App game,
            string panelName,
            PlayerInfo playerInfo,
            bool updateButtonIds)
        {
            FactionInfo   factionInfo                     = game.GameDatabase.GetFactionInfo(playerInfo.FactionID);
            string        propertyValue1                  = string.Format("{0:000}", (object)Math.Abs(game.GameDatabase.GetFactionInfo(game.GameDatabase.GetPlayerFactionID(game.Game.LocalPlayer.ID)).IdealSuitability - factionInfo.IdealSuitability));
            string        enginePlantTechString           = GameSession.GetBestEnginePlantTechString(game, playerInfo.ID);
            string        engineTechString                = GameSession.GetBestEngineTechString(game, playerInfo.ID);
            string        propertyValue2                  = game.GameDatabase.GetPlayerInfo(game.Game.LocalPlayer.ID).FactionDiplomacyPoints[factionInfo.ID].ToString();
            DiplomacyInfo diplomacyInfo                   = game.GameDatabase.GetDiplomacyInfo(playerInfo.ID, game.Game.LocalPlayer.ID);
            int           numHistoryTurns                 = 10;
            int           currentTurn                     = game.GameDatabase.GetTurnCount();
            List <DiplomacyReactionHistoryEntryInfo> list = game.GameDatabase.GetDiplomacyReactionHistory(playerInfo.ID, game.Game.LocalPlayer.ID, currentTurn, 10).ToList <DiplomacyReactionHistoryEntryInfo>();

            int[] numArray = new int[numHistoryTurns];
            numArray[numHistoryTurns - 1] = diplomacyInfo.Relations;
            string propertyValue3 = numArray[numHistoryTurns - 1].ToString();

            for (int i = numHistoryTurns - 2; i >= 0; --i)
            {
                numArray[i] = numArray[i + 1] + list.Where <DiplomacyReactionHistoryEntryInfo>((Func <DiplomacyReactionHistoryEntryInfo, bool>)(x =>
                {
                    int?turnCount = x.TurnCount;
                    int num       = currentTurn - (numHistoryTurns - 1 - i);
                    if (turnCount.GetValueOrDefault() == num)
                    {
                        return(turnCount.HasValue);
                    }
                    return(false);
                })).Sum <DiplomacyReactionHistoryEntryInfo>((Func <DiplomacyReactionHistoryEntryInfo, int>)(y => y.Difference));
                propertyValue3 = propertyValue3 + "|" + numArray[i].ToString();
            }
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIRelationsGraph), "data", propertyValue3);
            string diplomaticMoodSprite = diplomacyInfo.GetDiplomaticMoodSprite();

            if (!string.IsNullOrEmpty(diplomaticMoodSprite))
            {
                game.UI.SetVisible(DiplomacyUI.UIRelation, true);
                game.UI.SetPropertyString(DiplomacyUI.UIRelation, "sprite", diplomaticMoodSprite);
            }
            else
            {
                game.UI.SetVisible(DiplomacyUI.UIRelation, false);
            }
            game.UI.SetText(game.UI.Path(panelName, DiplomacyUI.UIRelationText), DiplomacyUI.GetRelationText(diplomacyInfo.State));
            string propertyValue4 = Path.GetFileNameWithoutExtension(playerInfo.AvatarAssetPath);

            if (propertyValue4 == "")
            {
                propertyValue4 = game.AssetDatabase.GetFaction(playerInfo.FactionID).SplinterAvatarPath();
            }
            game.UI.SetVisible(game.UI.Path(panelName, "eliminated"), (playerInfo.isDefeated ? 1 : 0) != 0);
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIAvatar), "sprite", propertyValue4);
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIBadge), "sprite", Path.GetFileNameWithoutExtension(playerInfo.BadgeAssetPath));
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIHazardRating), "text", propertyValue1);
            game.UI.SetVisible(game.UI.Path(panelName, DiplomacyUI.UIHazardRating), (factionInfo.Name != "loa" ? 1 : 0) != 0);
            game.UI.SetVisible(game.UI.Path(panelName, "hazardtitle"), (factionInfo.Name != "loa" ? 1 : 0) != 0);
            if (playerInfo.isStandardPlayer)
            {
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIDriveTech), "text", enginePlantTechString);
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIDriveSpecial), "text", engineTechString);
            }
            else
            {
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIDriveTech), "text", App.Localize("@UI_DIPLOMACY_TECHLEVEL_1"));
                game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIDriveSpecial), "text", "");
            }
            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIStatRpdValue), "text", propertyValue2);
            GovernmentInfo governmentInfo = game.GameDatabase.GetGovernmentInfo(playerInfo.ID);

            game.UI.SetPropertyString(game.UI.Path(panelName, DiplomacyUI.UIGovernmentType), "text", App.Localize(string.Format("@UI_EMPIRESUMMARY_{0}", (object)governmentInfo.CurrentType.ToString().ToUpper())));
        }