コード例 #1
0
        public string GetStatText(OutfitVO outfit, string stat)
        {
            if (outfit == null)
            {
                return(null);
            }
            Dictionary <string, string> phrases = AmbitionApp.GetPhrases("outfit." + stat);

            if (phrases.Count == 0)
            {
                return("");
            }
            int value = outfit.GetIntStat(stat);

            switch (stat)
            {
            case ItemConsts.NOVELTY:
                value = (int)(.099f * phrases.Count * value);
                break;

            case ItemConsts.MODESTY:
            case ItemConsts.LUXURY:
                value = (int)Mathf.Floor(.00499f * phrases.Count * (value + 100));
                break;
            }
            return(new List <string>(phrases.Values)[value]);
        }
コード例 #2
0
        public string Localize(DateTime date)
        {
            Dictionary <string, string> subs = new Dictionary <string, string>();

            Substitutions[LocalizationConsts.MONTH]      = AmbitionApp.GetPhrases("month")["month." + (date.Month - 1)];
            Substitutions[LocalizationConsts.DAY]        = date.Day.ToString();
            Substitutions[LocalizationConsts.YEAR]       = date.Year.ToString();
            Substitutions[LocalizationConsts.WEEKDAY]    = AmbitionApp.GetPhrases("weekday")["weekday." + (int)(date.DayOfWeek)];
            Substitutions[LocalizationConsts.SHORT_DATE] = AmbitionApp.Localize("short_date", Substitutions);
            return(AmbitionApp.Localize("date", Substitutions));
        }
コード例 #3
0
        private void OnEnable()
        {
            FactionModel model = AmbitionApp.GetModel <FactionModel>();
            DateTime     date  = AmbitionApp.Calendar.StartDate.AddDays(model.LastUpdated);
            Dictionary <string, string> months = AmbitionApp.GetPhrases("month");
            Dictionary <string, string> subs   = new Dictionary <string, string>();

            months.TryGetValue(CalendarConsts.MONTH_LOC + (date.Month - 1), out string monthName);
            subs["%DAY%"]   = date.Day.ToString();
            subs["%MONTH%"] = monthName;
            subs["%YEAR%"]  = date.Year.ToString();
            string dateText = AmbitionApp.Localize(CalendarConsts.DATE, subs);

            subs.Clear();
            subs["$N"]    = (AmbitionApp.Calendar.Day - model.LastUpdated).ToString();
            subs["$DATE"] = dateText;
            Updated.text  = AmbitionApp.Localize(LAST_UPDATED_LOC, subs);
            Array.ForEach(List, i => i.Data = model.Standings.Find(f => f.Faction == i.Faction));
        }
コード例 #4
0
 private string GetRandomText(string phrase)
 {
     string[] phrases = AmbitionApp.GetPhrases(phrase);
     return(Util.RNG.TakeRandom(phrases));
 }
コード例 #5
0
        public void Execute(PartyVO party)
        {
            CharacterModel characters = AmbitionApp.GetModel <CharacterModel>();
            GameModel      game       = AmbitionApp.Game;
            CalendarModel  calendar   = AmbitionApp.Calendar;
            IncidentModel  story      = AmbitionApp.Story;
            PartyModel     model      = AmbitionApp.GetModel <PartyModel>();

            if (string.IsNullOrEmpty(party.ID) || !model.LoadParty(party.ID, out party))
            {
                party.ID = null;
                if (party.Faction == FactionType.None)
                {
                    List <FactionType> factions = new List <FactionType>(AmbitionApp.Politics.Factions.Keys);
                    factions.Remove(FactionType.None);
                    party.Faction = RNG.TakeRandom(factions);
                }
            }

            if (string.IsNullOrEmpty(party.Host))
            {
                string               gender = RNG.Generate(2) < 1 ? "male" : "female";
                string[]             host   = new string[3];
                IEnumerable <string> locs   = AmbitionApp.GetPhrases(gender + "_title").Values;
                host[0]    = RNG.TakeRandom(locs);
                locs       = AmbitionApp.GetPhrases(gender + "_name").Values;
                host[1]    = RNG.TakeRandom(locs);
                locs       = AmbitionApp.GetPhrases("last_name").Values;
                host[2]    = RNG.TakeRandom(locs);
                party.Host = string.Join(" ", host);
            }

            if (party.Size == PartySize.None)
            {
                ChapterVO chapter = AmbitionApp.Game.GetChapter();
                int       chance  = RNG.Generate(chapter.TrivialPartyChance + chapter.DecentPartyChance + chapter.GrandPartyChance);
                if (chance < chapter.GrandPartyChance)
                {
                    party.Size = PartySize.Grand;
                }
                else if (chance < chapter.DecentPartyChance + chapter.GrandPartyChance)
                {
                    party.Size = PartySize.Decent;
                }
                else
                {
                    party.Size = PartySize.Trivial;
                }
            }

            if (party.phrases?.Length != 4)
            {
                party.phrases    = new int[4];
                party.phrases[0] = GetRandomPhrase(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower());
                party.phrases[1] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_INTRO);
                party.phrases[2] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_ADJECTIVE);
                party.phrases[3] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_NOUN);
            }

            switch (party.RSVP)
            {
            case RSVP.Accepted:
            case RSVP.Required:
                AmbitionApp.SendMessage(PartyMessages.ACCEPT_INVITATION, party);
                break;

            case RSVP.Declined:
                AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, party);
                break;

            default:
                if (party.Day >= 0)
                {
                    AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, party);
                }
                break;
            }
        }
コード例 #6
0
 private int GetRandomPhrase(string key) => RNG.Generate(AmbitionApp.GetPhrases(key).Count);
コード例 #7
0
        void Start()
        {
            Dictionary <string, string> conversationIntroList = AmbitionApp.GetPhrases("conversation_intro");

            DialogText.text = conversationIntroList[Util.RNG.TakeRandom(conversationIntroList.Values)];
        }