public override string ToString()
        {
            string text = (m_filters == null) ? string.Empty : string.Join("\n", from f in m_filters
                                                                           select f.ToString());

            return(string.Format("{0}: {1}, {2}, {3}: {4}", "id", id, ToStringExtensions.ToStringSigned(modificationValue), "m_filters", text));
        }
Beispiel #2
0
        private void SetValue(int value, Type type)
        {
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0051: Unknown result type (might be due to invalid IL or missing references)
            //IL_0072: Unknown result type (might be due to invalid IL or missing references)
            //IL_0093: Unknown result type (might be due to invalid IL or missing references)
            switch (type)
            {
            case Type.Damage:
                m_spriteTextRenderer.color = new Color(1f, 22f / 51f, 22f / 51f);
                break;

            case Type.Heal:
                m_spriteTextRenderer.color = new Color(28f / 51f, 28f / 51f, 1f);
                break;

            case Type.Action:
                m_spriteTextRenderer.color = new Color(1f, 50f / 51f, 0f);
                break;

            case Type.Movement:
                m_spriteTextRenderer.color = new Color(28f / 51f, 227f / 255f, 18f / 85f);
                break;

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
            m_isNegative = (value < 0);
            m_spriteTextRenderer.text = ToStringExtensions.ToStringSigned(value);
        }
Beispiel #3
0
        public override void Refresh()
        {
            var sb = new StringBuilder("Province name: ").Append(Game.selectedProvince);

            if (Game.devMode)
            {
                sb.Append("\nID: ").Append(Game.selectedProvince.ID);
                sb.Append("\nNeighbors: ").Append(Game.selectedProvince.AllNeighbors().ToString(", "));
            }
            sb.Append("\nPopulation (with families): ").Append(Game.selectedProvince.getFamilyPopulation());

            sb.Append("\nAverage loyalty: ").Append(Game.selectedProvince.AllPops.GetAverageProcent(x => x.loyalty));
            //sb.Append("\nMajor culture: ").Append(Game.selectedProvince.getMajorCulture());
            //sb.Append("\nGDP: ").Append(Game.selectedProvince.getGDP());
            sb.Append("\nResource: ");
            if (Game.selectedProvince.getResource() == null)
            {
                sb.Append("none ");
            }
            else
            {
                sb.Append(Game.selectedProvince.getResource());
            }
            //sb.Append("\nTerrain: ").Append(Game.selectedProvince.getTerrain());
            //sb.Append("\nRural overpopulation: ").Append(Game.selectedProvince.GetOverpopulation());
            sb.Append("\nCores: ").Append(Game.selectedProvince.getCoresDescription());


            sb.Append("\nCultures: ").Append(Game.selectedProvince.AllPops.Group(x => x.culture, y => y.population.Get())
                                             .OrderByDescending(x => x.Value.get()).ToString(", ", 2));

            sb.Append("\nClasses: ").Append(Game.selectedProvince.AllPops.Group(x => x.Type, y => y.population.Get())
                                            .OrderByDescending(x => x.Value.get()).ToString(", ", 0));

            if (Game.selectedProvince.getModifiers().Count > 0)
            {
                sb.Append("\nModifiers: ").Append(ToStringExtensions.ToString(Game.selectedProvince.getModifiers()));
            }

            Text text = btnOwner.GetComponentInChildren <Text>();

            text.text = "Owner: " + Game.selectedProvince.Country;

            btnBuild.interactable = ProductionType.allowsForeignInvestments.checkIftrue(Game.Player, Game.selectedProvince, out btnBuild.GetComponent <ToolTipHandler>().text);
            btnBuild.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "B" + " button");

            btMobilize.interactable = Province.doesCountryOwn.checkIftrue(Game.Player, Game.selectedProvince, out btMobilize.GetComponent <ToolTipHandler>().text);
            btMobilize.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "M" + " button");

            //if (Game.devMode)
            //    sb.Append("\nColor: ").Append(province.getColorID());
            btAttackThat.interactable = Diplomacy.canAttack.isAllTrue(Game.selectedProvince, Game.Player, out btAttackThat.GetComponent <ToolTipHandler>().text);
            btAttackThat.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "T" + " button");
            btGrandIndependence.interactable = Province.canGetIndependence.isAllTrue(Game.selectedProvince, Game.Player, out btGrandIndependence.GetComponent <ToolTipHandler>().text);
            generaltext.text = sb.ToString();
        }
Beispiel #4
0
 public void AddModificationPreview(int modification)
 {
     m_modificationPreviewValue = modification;
     UpdateTweenedValue();
     Highlight(highlight: true);
     if (m_modificationText != null && m_previewResource != null && m_previewResource.displayText)
     {
         m_modificationText.text = ToStringExtensions.ToStringSigned(modification);
         m_modificationText.get_gameObject().SetActive(true);
     }
 }
Beispiel #5
0
 public void SetModificationValue(int value)
 {
     //IL_001d: Unknown result type (might be due to invalid IL or missing references)
     //IL_004e: Unknown result type (might be due to invalid IL or missing references)
     if (value == 0)
     {
         m_image.set_color(new Color(0.5f, 0.5f, 0.5f, 1f));
         m_spriteTextRenderer.set_enabled(false);
     }
     else
     {
         m_image.set_color(new Color(1f, 1f, 1f, 1f));
         m_spriteTextRenderer.text = ToStringExtensions.ToStringSigned(value);
         m_spriteTextRenderer.set_enabled(true);
     }
 }
        private void refresh(bool callRebuildDropDown)
        {
            table.Refresh();
            movementsText.text = ToStringExtensions.ToString(Game.Player.Politics.AllMovements.OrderByDescending(x => x.getRelativeStrength(Game.Player).get()));
            if (movementsText.preferredHeight > 90 && movementsText.preferredHeight < 130)
            {
                movementsText.text += "\n\n\n\n";
            }

            movementsHorizontalScrollBar.value = 0;
            if (ReferenceEquals(selectedReformType, null))
            {
                voteButton.interactable = false;
                voteButton.GetComponentInChildren <Text>().text = "Select reform";
                descriptionText.text = "Select reform from left";
                forceDecisionButton.GetComponent <ToolTipHandler>().SetText("");
                voteButton.GetComponent <ToolTipHandler>().SetText("");
            }
            else //did selected reform
            {
                if (callRebuildDropDown) // meaning changed whole reform
                {
                    rebuildDropDown();
                }
                descriptionText.text = selectedReformType.ShortName + " reforms " + selectedReformType.FullName
                                       + "\nCurrently: ";

                // todo fix that mess in 3 places
                var isUnemploymentReformType = selectedReformType.Value as UnemploymentSubsidies.UnemploymentReformValue;
                if (isUnemploymentReformType == null)
                {
                    var isUBIReform = selectedReformType.Value as UBI.UBIReformValue;
                    if (isUBIReform == null)
                    {
                        var isPovertyAid = selectedReformType.Value as PovertyAid.PovertyAidReformValue;
                        if (isPovertyAid == null)
                        {
                            // default text
                            descriptionText.text += selectedReformType.Value;
                            var isNamedReformType = selectedReformType.Value as INameable;
                            if (isNamedReformType != null)
                            {
                                descriptionText.text += isNamedReformType.FullName;
                            }
                        }
                        else
                        {
                            descriptionText.text += isPovertyAid.ToString(Game.Player.market);
                        }
                    }
                    else
                    {
                        descriptionText.text += isUBIReform.ToString(Game.Player.market);
                    }
                }
                else
                {
                    descriptionText.text += isUnemploymentReformType.ToString(Game.Player.market);
                }


                descriptionText.text += "\nSelected: ";

                if (selectedReformType == selectedReformValue)
                {
                    descriptionText.text            += "current";
                    forceDecisionButton.interactable = false;
                    voteButton.interactable          = false;
                }
                else
                {
                    //else
                    {
                        var isUnempValue = selectedReformValue as UnemploymentSubsidies.UnemploymentReformValue;
                        if (isUnempValue != null)
                        {
                            descriptionText.text += isUnempValue.ToString(Game.Player.market);
                        }
                        else
                        {
                            var isPvrtREf = selectedReformValue as PovertyAid.PovertyAidReformValue;
                            if (isPvrtREf != null)
                            {
                                descriptionText.text += isPvrtREf.ToString(Game.Player.market);
                            }
                            else
                            {
                                var isUBIRfr = selectedReformValue as UBI.UBIReformValue;
                                if (isUBIRfr != null)
                                {
                                    descriptionText.text += isUBIRfr.ToString(Game.Player.market);
                                }
                                else
                                {
                                    var isNamedReformValue = selectedReformValue as INameable;
                                    if (isNamedReformValue != null)
                                    {
                                        descriptionText.text += isNamedReformValue.FullName;
                                    }
                                    else
                                    {
                                        descriptionText.text += selectedReformValue;
                                    }
                                }
                            }
                        }
                    }
                    Procent procentPopulationSayedYes = new Procent(0f);
                    Procent procentVotersSayedYes     = Game.Player.Provinces.getYesVotes(selectedReformValue, ref procentPopulationSayedYes);

                    Dictionary <PopType, int> divisionPopulationResult = new Dictionary <PopType, int>();
                    Dictionary <PopType, int> divisionVotersResult     = Game.Player.Provinces.getYesVotesByType(selectedReformValue, ref divisionPopulationResult);

                    RefreshInfoAboutVotes(procentVotersSayedYes, procentPopulationSayedYes, divisionVotersResult, divisionPopulationResult);

                    // Control buttons interactability && tooltips
                    if (selectedReformValue != null)
                    {
                        if (procentVotersSayedYes.get() >= Options.votingPassBillLimit && Game.Player.government != Government.Despotism)
                        { // can vote for reform
                            voteButton.interactable = selectedReformValue.IsAllowed(Game.Player, selectedReformValue, out voteButton.GetComponent <ToolTipHandler>().text);
                            forceDecisionButton.GetComponent <ToolTipHandler>().SetText(voteButton.GetComponent <ToolTipHandler>().GetText());
                            forceDecisionButton.interactable = false;
                            voteButton.GetComponentInChildren <Text>().text = "Vote for " + selectedReformValue;
                        }
                        else // not enough votes for reform or is despotism
                        {
                            voteButton.interactable          = false;
                            forceDecisionButton.interactable = selectedReformValue.IsAllowed(Game.Player, selectedReformValue, out forceDecisionButton.GetComponent <ToolTipHandler>().text);
                            voteButton.GetComponent <ToolTipHandler>().SetText(forceDecisionButton.GetComponent <ToolTipHandler>().GetText());
                            voteButton.GetComponentInChildren <Text>().text = "Not enough votes";
                            if (Game.Player.government == Government.Despotism)
                            {
                                forceDecisionButton.GetComponent <ToolTipHandler>().text += "\n\nPeople wouldn't be that angry if you force decisions as Despot";
                            }
                            else
                            {
                                forceDecisionButton.GetComponent <ToolTipHandler>().text += "\n\nForcing decision against people's desires will drop loyalty!";
                            }
                        }
                    }
                }
            }
        }