/// <summary>
        /// Invokes the Command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();
            string cityPickerTitle = ClientResources.GetString("propaganda_cityPickerTitle");

            SelectCity(cityPickerTitle);
            if (this.City == null)
            {
                OnCanceled();
                return;
            }
            EspionageResult result = this.DiplomaticTie.SpreadPropaganda(this.City);
            string          text   = string.Empty;

            switch (result)
            {
            case EspionageResult.Failure:
                text = ClientResources.GetString("propaganda_failure");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name);
                break;

            case EspionageResult.ImmuneToEspionage:
                text = ClientResources.GetString("propaganda_immune");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.Civilization.Adjective);
                break;

            case EspionageResult.Success:
                text = ClientResources.GetString("propaganda_success");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name);
                break;
            }
            IGameWindow gw = ClientApplication.Instance.GameWindow;

            gw.ShowMessageBox(text, ClientResources.GetString(StringKey.GameTitle));
            OnInvoked();
        }
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();
            ClientApplication          ca     = ClientApplication.Instance;
            IDiplomaticTiePicker       picker = (IDiplomaticTiePicker)ca.GetControl(typeof(IDiplomaticTiePicker));
            Collection <DiplomaticTie> ties   = new Collection <DiplomaticTie>();

            foreach (DiplomaticTie t in ca.Player.DiplomaticTies)
            {
                //TODO:  account for needed improvements
                if (t.HasEmbassy)
                {
                    ties.Add(t);
                }
            }
            picker.InitializePicker(ties);
            picker.ShowSimilizationControl();
            this.DiplomaticTie = picker.DiplomaticTie;
            IGameWindow gw       = ClientApplication.Instance.GameWindow;
            bool        canSteal = CheckForStealableTechnologies();

            if (!canSteal)
            {
                string msg = ClientResources.GetString("stealtechnology_noneavailable");
                msg = string.Format(
                    CultureInfo.CurrentCulture,
                    ClientApplication.Instance.Player.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.Civilization.Noun);
                gw.ShowMessageBox(msg, ClientResources.GetString(StringKey.GameTitle));
                OnCanceled();
            }
            this.City = this.DiplomaticTie.ForeignCountry.CapitalCity;
            EspionageResult result = this.DiplomaticTie.StealTechnology();
            string          text   = string.Empty;

            switch (result)
            {
            case EspionageResult.Failure:
                text = ClientResources.GetString("stealtechnology_failure");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name);
                break;

            case EspionageResult.ImmuneToEspionage:
                text = ClientResources.GetString("stealtechnology_immune");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.Civilization.Adjective);
                break;

            case EspionageResult.SpyCaught:
                text = ClientResources.GetString("stealtechnology_spycaught");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;

            case EspionageResult.Success:
                text = ClientResources.GetString("stealtechnology_success");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.Civilization.Noun);
                break;
            }

            gw.ShowMessageBox(text, ClientResources.GetString(StringKey.GameTitle));
            OnInvoked();
        }
Exemple #3
0
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();
            ClientApplication          ca     = ClientApplication.Instance;
            IDiplomaticTiePicker       picker = (IDiplomaticTiePicker)ca.GetControl(typeof(IDiplomaticTiePicker));
            Collection <DiplomaticTie> ties   = new Collection <DiplomaticTie>();

            foreach (DiplomaticTie t in ca.Player.DiplomaticTies)
            {
                //TODO:  account for needed improvements
                if (t.HasEmbassy)
                {
                    ties.Add(t);
                }
            }
            picker.InitializePicker(ties);
            picker.ShowSimilizationControl();
            this.DiplomaticTie = picker.DiplomaticTie;
            this.City          = this.DiplomaticTie.ForeignCountry.CapitalCity;
            EspionageResult result = this.DiplomaticTie.StealPlans();
            string          text   = string.Empty;

            switch (result)
            {
            case EspionageResult.ImmuneToEspionage:
                text = ClientResources.GetString("stealplans_immune");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.Civilization.Adjective);
                break;

            case EspionageResult.SpyCaught:
                text = ClientResources.GetString("stealplans_spycaught");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;

            case EspionageResult.SuccessWithCapturedSpy:
                text = ClientResources.GetString("stealplans_success_spycaught");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;

            case EspionageResult.Success:
                text = ClientResources.GetString("stealplans_success");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;
            }
            IGameWindow gw = ClientApplication.Instance.GameWindow;

            gw.ShowMessageBox(text, ClientResources.GetString(StringKey.GameTitle));
            OnInvoked();
        }
Exemple #4
0
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();

            string cityPickerTitle = ClientResources.GetString("sabotage_cityPickerTitle");

            SelectCity(cityPickerTitle);
            if (this.City == null)
            {
                OnCanceled();
                return;
            }
            BuildableItem   improvement = this.City.NextImprovement;
            EspionageResult result      = this.DiplomaticTie.Sabotage(this.City);
            string          text        = string.Empty;

            switch (result)
            {
            case EspionageResult.Failure:
                break;

            case EspionageResult.ImmuneToEspionage:
                text = ClientResources.GetString("sabotage_immune");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.Civilization.Adjective);
                break;

            case EspionageResult.SpyCaught:
                text = ClientResources.GetString("sabotage_spycaught");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;

            case EspionageResult.Success:
                text = ClientResources.GetString("sabotage_success");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    improvement.Name);
                break;

            case EspionageResult.SuccessWithCapturedSpy:
                text = ClientResources.GetString("sabotage_success_spycaught");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.City.Name,
                    improvement.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;
            }
            IGameWindow gw = ClientApplication.Instance.GameWindow;

            gw.ShowMessageBox(text, ClientResources.GetString(StringKey.GameTitle));
            OnInvoked();
        }
Exemple #5
0
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();
            ClientApplication ca        = ClientApplication.Instance;
            bool hasValidTies           = false;
            IDiplomaticTiePicker picker = (IDiplomaticTiePicker)ca.GetControl(typeof(IDiplomaticTiePicker));

            picker.PickerTitle = ClientResources.GetString("plantSpy_tiePickerTitle");
            Collection <DiplomaticTie> ties = new Collection <DiplomaticTie>();

            foreach (DiplomaticTie t in ca.Player.DiplomaticTies)
            {
                //TODO:  account for needed improvements
                if (t.HasEmbassy)
                {
                    hasValidTies = true;
                    if (!t.HasSpy)
                    {
                        ties.Add(t);
                    }
                }
            }
            if (ties.Count == 0 && hasValidTies)
            {
                //all the valid civs already have spys.
                string msg = ClientResources.GetString("plantSpy_spysExists");
                ca.GameWindow.ShowMessageBox(msg, ClientResources.GetString(StringKey.GameTitle));
                OnCanceled();
                return;
            }
            picker.InitializePicker(ties);
            picker.ShowSimilizationControl();
            this.tie = picker.DiplomaticTie;
            EspionageResult result = this.DiplomaticTie.PlantSpy();
            string          text   = string.Empty;

            switch (result)
            {
            case EspionageResult.Success:
                text = ClientResources.GetString("plantspy_success");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.CapitalCity.Name);
                break;

            case EspionageResult.Failure:
                text = ClientResources.GetString("plantspy_failure");
                text = string.Format(
                    CultureInfo.CurrentCulture,
                    text,
                    this.DiplomaticTie.ForeignCountry.CapitalCity.Name,
                    this.DiplomaticTie.ForeignCountry.Government.LeaderTitle,
                    this.DiplomaticTie.ForeignCountry.LeaderName);
                break;
            }
            IGameWindow gw = ClientApplication.Instance.GameWindow;

            gw.ShowMessageBox(text, ClientResources.GetString(StringKey.GameTitle));
            OnInvoked();
        }