Exemplo n.º 1
0
        public void SetPhrase(string phrase, Dictionary <string, string> substitutions = null)
        {
            string str;

            Core.LocalizationModel model = AmbitionApp.GetModel <Core.LocalizationModel>();
            BodyTxt.text  = model.GetString(phrase + DialogConsts.BODY, substitutions);
            TitleTxt.text = model.GetString(phrase + DialogConsts.TITLE, substitutions);

            if (DismissTxt != null)
            {
                str = model.GetString(phrase + DialogConsts.CANCEL, substitutions);
                if (str != null && DismissTxt != null)
                {
                    DismissTxt.text = str;
                }
                else
                {
                    DismissTxt.text = model.GetString(DialogConsts.DEFAULT_CANCEL);
                }
            }

            if (ConfirmTxt != null)
            {
                str = model.GetString(phrase + DialogConsts.CONFIRM, substitutions);
                if (str != null && ConfirmTxt != null)
                {
                    ConfirmTxt.text = str;
                }
                else
                {
                    ConfirmTxt.text = model.GetString(DialogConsts.DEFAULT_CONFIRM);
                }
            }
        }
Exemplo n.º 2
0
        //This is how the localized text is put into all of the text boxes in the dialog
        public void SetPhrase()
        {
            Core.LocalizationModel localizationModel = AmbitionApp.GetModel <Core.LocalizationModel>();
            string phrase = "sell_gossip_dialog";

            //Setting up the dictionary for the necessary substitutions
            Dictionary <string, string> dialogSubstitutions = new Dictionary <string, string>();

            dialogSubstitutions.Add("$GOSSIPNAME", _gossip.Name());
            dialogSubstitutions.Add("$GOSSIPPRICE", "£" + _gossip.LivreValue().ToString("### ###"));
            dialogSubstitutions.Add("$CAUGHTODDS", localizationModel.GetString("gossip_caught_odds." + (int)(Mathf.Clamp(_inventoryModel.GossipSoldOrPeddled, 0, 9))));

            //Performing the substitutions themselves
            BodyText.text  = localizationModel.GetString(phrase + DialogConsts.BODY, dialogSubstitutions);
            TitleText.text = localizationModel.GetString(phrase + DialogConsts.TITLE, dialogSubstitutions);
            string str;

            if (DismissText != null)
            {
                str = localizationModel.GetString(phrase + DialogConsts.CANCEL, dialogSubstitutions);
                if (str != null && DismissText != null)
                {
                    DismissText.text = str;
                }
                else
                {
                    DismissText.text = localizationModel.GetString(DialogConsts.DEFAULT_CANCEL);
                }
            }

            if (SellText != null)
            {
                str = localizationModel.GetString(phrase + DialogConsts.CONFIRM, dialogSubstitutions);
                if (str != null && SellText != null)
                {
                    SellText.text = str;
                }
                else
                {
                    SellText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM);
                }
            }
        }
Exemplo n.º 3
0
        //This is how the localized text is put into all of the text boxes in the dialog
        public void SetPhrase()
        {
            Core.LocalizationModel localizationModel = AmbitionApp.GetModel <Core.LocalizationModel>();
            string phrase = "peddle_influence_dialog";

            //Setting up the dictionary for the necessary substitutions
            Dictionary <string, string> dialogSubstitutions = new Dictionary <string, string>();

            dialogSubstitutions.Add("$GOSSIPNAME", _gossip.Name());
            dialogSubstitutions.Add("$FACTION", _gossip.Faction);
            dialogSubstitutions.Add("$SHIFTAMOUNT", _gossip.PoliticalEffectValue().ToString());
            dialogSubstitutions.Add("$CAUGHTODDS", localizationModel.GetString("gossip_caught_odds." + (int)(Mathf.Clamp(_inventoryModel.GossipSoldOrPeddled, 0, 9))));

            //Performing the substitutions themselves
            BodyText.text  = localizationModel.GetString(phrase + DialogConsts.BODY, dialogSubstitutions);
            TitleText.text = localizationModel.GetString(phrase + DialogConsts.TITLE, dialogSubstitutions);
            string str;

            if (DismissText != null)
            {
                str = localizationModel.GetString(phrase + DialogConsts.CANCEL, dialogSubstitutions);
                if (str != null && DismissText != null)
                {
                    DismissText.text = str;
                }
                else
                {
                    DismissText.text = localizationModel.GetString(DialogConsts.DEFAULT_CANCEL);
                }
            }

            if (IncreaseStatText != null)
            {
                if (_gossip.PowerShiftEffect())//If it's a power shift
                {
                    str = localizationModel.GetString(phrase + ".increase_power", dialogSubstitutions);
                    if (str != null && IncreaseStatText != null)
                    {
                        IncreaseStatText.text = str;
                    }
                    else
                    {
                        IncreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM);
                    }
                }
                else   //If it's an allegiance shift
                {
                    str = localizationModel.GetString(phrase + ".increase_allegiance", dialogSubstitutions);
                    if (str != null && IncreaseStatText != null)
                    {
                        IncreaseStatText.text = str;
                    }
                    else
                    {
                        IncreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM);
                    }
                }
            }

            if (DecreaseStatText != null)
            {
                if (_gossip.PowerShiftEffect())//If it's a power shift
                {
                    str = localizationModel.GetString(phrase + ".decrease_power", dialogSubstitutions);
                    if (str != null && DecreaseStatText != null)
                    {
                        DecreaseStatText.text = str;
                    }
                    else
                    {
                        DecreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM);
                    }
                }
                else //If it's an allegiance shift
                {
                    str = localizationModel.GetString(phrase + ".decrease_allegiance", dialogSubstitutions);
                    if (str != null && DecreaseStatText != null)
                    {
                        DecreaseStatText.text = str;
                    }
                    else
                    {
                        DecreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM);
                    }
                }
            }
        }