public void Initialize(RendezVO rendezvous) { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(rendezvous.Character); LocalizationModel localization = AmbitionApp.GetModel <LocalizationModel>(); string faction = (character?.Faction ?? FactionType.None).ToString(); string invitee = !rendezvous.IsCaller ? AmbitionApp.Localize(AmbitionApp.Game.playerID + ".shortname") : (character?.Formal ?? false) ? localization.GetFormalName(character, rendezvous.Character) : localization.GetShortName(character, rendezvous.Character); Dictionary <string, string> subs = new Dictionary <string, string>() { { "$NAME", invitee }, { "$RENDEZVOUSDATE", AmbitionApp.GetModel <LocalizationModel>().Localize(AmbitionApp.Calendar.StartDate.AddDays(rendezvous.Day)) }, { "$RENDEZVOUSLOCATION", AmbitionApp.Localize(ParisConsts.LABEL + rendezvous.Location) } }; string characterID = rendezvous.IsCaller ? AmbitionApp.Game.playerID : rendezvous.Character; _rendezvous = rendezvous; // To force it to work with the RSVP animation, the title is the letter and the body is the signature TitleTxt.text = AmbitionApp.Localize("rendezvous." + characterID.ToLower() + ".rsvp.body", subs); BodyTxt.text = _rendezvous.IsCaller ? AmbitionApp.Localize(AmbitionApp.Game.playerID + ".name") : (character?.Formal ?? false) ? localization.GetFormalName(character, rendezvous.Character) : localization.GetShortName(character, rendezvous.Character); Seal.sprite = InvitationConfig.GetSprite("seal." + faction); Stamp.sprite = InvitationConfig.GetSprite(faction); FavorBonus.sprite = InvitationConfig.GetSprite(faction); FavorPenalty.sprite = InvitationConfig.GetSprite(faction); FavorReward.SetActive(!_rendezvous.IsCaller && AmbitionApp.Calendar.Day < rendezvous.Created + 1); // Prompt response bonus SetText(rendezvous.RSVP, _rendezvous.IsCaller); DeclinePenalty?.SetActive(!_rendezvous.IsCaller); }
public void Execute(string faction) { PartyModel model = AmbitionApp.GetModel <PartyModel>(); EnemyVO e = new EnemyVO(); _phrases = AmbitionApp.GetModel <LocalizationModel>(); // TODO: Find Preset Enemy in model e.Faction = faction; EnemyInventory.enemyInventory.Add(e); e.Like = model.Interests[Util.RNG.Generate(0, model.Interests.Length)]; e.Gender = (Util.RNG.Generate(0, 2) == 0) ? Gender.Male : Gender.Female; if (e.Gender == Gender.Female) { e.Title = rndStr("female_title"); e.FirstName = rndStr("female_name"); } else { e.Title = rndStr("male_title"); e.FirstName = rndStr("male_name"); } e.LastName = rndStr("last_name"); e.imageInt = Util.RNG.Generate(0, (e.Gender == Gender.Female ? 4 : 5)); e.FlavorText = "This person is a great big jerk"; }
void Start() { LocalizationModel model = AmbitionApp.GetModel <LocalizationModel>(); string[] conversationIntroList = model.GetList("conversation_intro"); DialogText.text = conversationIntroList[Util.RNG.Generate(conversationIntroList.Length)]; }
private void OnEnable() { PartyModel party = AmbitionApp.GetModel <PartyModel>(); CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); CalendarEvent cEvent = party.Party as CalendarEvent ?? characters.Rendezvous as CalendarEvent; FactionType faction = FactionType.None; LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); int exhaustion = AmbitionApp.Game.Exhaustion; int[] penalties = AmbitionApp.Game.ExhaustionPenalties; int exhaustionPenalty; LoadOutGameObject.SetActive(cEvent != null); if (cEvent is PartyVO) { string str = AmbitionApp.Localize(PartyConstants.PARTY_DESCRIPTION + cEvent.ID); PartyVO pty = (PartyVO)cEvent; CharacterVO host = characters.GetCharacter(pty.Host); NameText.text = loc.GetPartyName(pty); ButtonText.text = AmbitionApp.Localize("calendar.btn.party"); faction = (cEvent as PartyVO).Faction; DescriptionText.text = string.IsNullOrEmpty(str) ? loc.GetFormalName(host, pty.Host) + " " + loc.GetPartyInvitation(pty, host) : str; TooltipText.text = AmbitionApp.Localize("party_" + faction.ToString().ToLower() + "_likes_and_dislikes"); } else if (cEvent is RendezVO) { CharacterVO character = characters.GetCharacter(((RendezVO)cEvent).Character); faction = character?.Faction ?? FactionType.None; NameText.text = AmbitionApp.Localize(CharacterConsts.LOC_NAME + cEvent.ID); ButtonText.text = AmbitionApp.Localize("calendar.btn.rendezvous"); DescriptionText.text = AmbitionApp.Localize(ParisConsts.DESCRIPTION + (cEvent as RendezVO).Location); TooltipText.text = AmbitionApp.Localize("rendezvous_" + faction.ToString().ToLower() + "_likes_and_dislikes"); } else { TooltipText.text = null; } FactionSymbol.enabled = faction != FactionType.None; PlayerStatus.gameObject.SetActive(exhaustion != 0); ExhaustionLabel.text = AmbitionApp.Localize(exhaustion > 0 ? EXHAUSTED_LOC : WELL_RESTED_LOC); exhaustionPenalty = exhaustion < 0 ? AmbitionApp.Game.WellRestedBonus : exhaustion >= penalties.Length ? penalties[penalties.Length - 1] : penalties[exhaustion]; subs[EFFECT_TOKEN] = exhaustionPenalty > 0 ? (" + " + exhaustionPenalty) : exhaustionPenalty.ToString(); ExhaustionValue.text = AmbitionApp.Localize(STATUS_EFFECT_LOC, subs); FactionSymbol.sprite = FactionSymbols.GetSprite(faction.ToString()); ExhaustionIcon.sprite = exhaustion < 0 ? ExhaustionIcons[0] : exhaustion < ExhaustionIcons.Length ? ExhaustionIcons[exhaustion] : ExhaustionIcons[ExhaustionIcons.Length]; ExhaustionValue.color = exhaustion < 0 ? RestedBonusColor : ExhaustionPenaltyColor; }
public void Awake() { LocalizationModel model = AmbitionApp.GetModel <LocalizationModel>(); AmbitionApp.Subscribe <string>(GameMessages.SHOW_HEADER, SetHeaderTitle); AmbitionApp.Subscribe <string>(GameMessages.SCENE_LOADED, HandleSceneLoaded); AmbitionApp.Subscribe(GameMessages.HIDE_HEADER, ClearOverlays); SetHeaderTitle(model.HeaderTitlePhrase); }
public override void OnOpen() { base.OnOpen(); LocalizationModel localization = AmbitionApp.GetModel <LocalizationModel>(); BodyText.text = localization.GetString(DIALOG_PHRASE + DialogConsts.BODY); TitleText.text = localization.GetString(DIALOG_PHRASE + DialogConsts.TITLE); tabsController = GameObject.Find("MainScreenTabsContainer").GetComponent <MainScreenTabsController>(); }
public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentModel story = AmbitionApp.Story; PartyVO party = AmbitionApp.GetModel <PartyModel>().Party; IncidentVO incident = story.GetIncident(party?.IntroIncident); LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); AmbitionApp.Game.Activity = ActivityType.Party; model.Turn = -1; model.Incidents = null; if (party == null) { model.Turns = 0; } else { string[] names = Enum.GetNames(typeof(PartySize)); int index = Array.IndexOf(names, party.Size.ToString()); if (index < 0) { index = 0; } if (index < model.NumTurnsByPartySize.Length) { model.Turns = model.NumTurnsByPartySize[index]; } else { model.Turns = model.NumTurnsByPartySize[model.NumTurnsByPartySize.Length - 1]; } if (party.RequiredIncidents?.Length > model.Turns) { model.Turns = party.RequiredIncidents.Length; } } if (incident == null) { IncidentVO[] incidents = AmbitionApp.Story.GetIncidents(IncidentType.PartyIntro); IncidentVO[] candidates = Array.FindAll(incidents, i => Array.IndexOf(i.Factions, party.Faction) >= 0); if (candidates.Length == 0) { candidates = Array.FindAll(incidents, i => ((i.Factions?.Length ?? 0) == 0 || (i.Factions.Length == 1 && i.Factions[0] == FactionType.None))); } incident = Util.RNG.TakeRandom(candidates); } loc.SetPartyOutfit(AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO); loc.SetParty(party); AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident); }
private void HandleReputation(ReputationVO rep) { LocalizationModel phrases = AmbitionApp.GetModel <LocalizationModel>(); string str = "Reputation Level Benefits\n"; for (int i = 1; i < rep.Level; i++) { str += phrases.GetString("reputation_text." + i.ToString() + "\n"); } _text.text = str; }
public static string Localize(string key) { LocalizationModel model = AmbitionApp.GetModel <LocalizationModel>(); string result = App.Service <LocalizationSvc>().GetString(key, model.Substitutions); #if DEBUG if (string.IsNullOrEmpty(result)) { Debug.LogWarning("Warning: No localizations found for key \"" + key + "\""); } #endif return(result); }
public override void OnEnter() { CalendarModel cal = AmbitionApp.Calendar; PartyVO[] parties = cal.GetOccasions <PartyVO>(cal.Day - 1); PartyVO party = Array.Find(parties, p => p.RSVP == RSVP.New); if (party != null) { CommodityVO penalty = new CommodityVO(CommodityType.Credibility, AmbitionApp.GetModel <PartyModel>().IgnoreInvitationPenalty); Dictionary <string, string> subs = new Dictionary <string, string>(); LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); party.RSVP = RSVP.Declined; subs["$PARTYNAME"] = loc.GetPartyName(party); subs["$CREDIBILITY"] = penalty.Value.ToString(); AmbitionApp.OpenDialog(DialogConsts.MISSED_RSVP_DIALOG, subs); AmbitionApp.SendMessage(penalty); } else { RendezVO[] dates = cal.GetOccasions <RendezVO>(cal.Day - 1); RendezVO date = Array.Find(dates, d => d.RSVP == RSVP.New); if (date != null) { CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); CharacterVO character = characters.GetCharacter(date.Character); bool isPenalized = !date.IsCaller; date.RSVP = RSVP.Declined; if (character != null) { character.LiaisonDay = -1; } AmbitionApp.SendMessage(date); if (isPenalized) { int penalty = characters.MissedRendezvousPenalty; CommodityVO favorPenalty = new CommodityVO() { Type = CommodityType.Favor, ID = date.Character, Value = penalty }; AmbitionApp.SendMessage(favorPenalty); Dictionary <string, string> subs = new Dictionary <string, string>(); subs["$SHORTNAME"] = AmbitionApp.GetModel <LocalizationModel>().GetShortName(character, date.Character); subs["$FAVOR"] = penalty.ToString(); AmbitionApp.OpenDialog(DialogConsts.MISSED_RENDEZVOUS_DIALOG, subs); } } } }
private void HandleSnapShot(byte[] snapshot) { LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); GameModel model = AmbitionApp.GetModel <GameModel>(); IncidentModel incident = AmbitionApp.GetModel <IncidentModel>(); string path = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.SAVE_FILE); List <string[]> saves; string result; string saveID = loc?.HeaderTitlePhrase; string snapshotPath = DateTime.Now.Ticks.ToString() + ".jpg"; if (File.Exists(path)) { result = File.ReadAllText(path); saves = JsonConvert.DeserializeObject <List <string[]> >(result); } else { saves = new List <string[]>(); } if (!string.IsNullOrEmpty(saveID)) { saveID = AmbitionApp.Localize(saveID); saveID = string.IsNullOrEmpty(saveID) ? model.PlayerName + " - " + loc.HeaderTitlePhrase + " - " + DateTime.Now.ToString() : model.PlayerName + " - " + saveID + " - " + DateTime.Now.ToString(); } else { saveID = model.PlayerName + " - " + DateTime.Now.ToString(); } string[] savedGame = new string[] { saveID, snapshotPath, AmbitionApp.GetService <ModelSvc>().Save() }; if (snapshot != null) { snapshotPath = Path.Combine(UnityEngine.Application.persistentDataPath, snapshotPath); System.IO.File.WriteAllBytes(snapshotPath, snapshot); } model.SaveSlotID = saves.Count; saves.Add(savedGame); result = JsonConvert.SerializeObject(saves); File.WriteAllText(path, result); }
// Use this for initialization public void Initialize(List <PartyVO> parties) { LocalizationModel localization = AmbitionApp.GetModel <LocalizationModel>(); _parties = parties; TitleText.text = localization.GetString(DialogConsts.RSVP_CHOICE_DIALOG + DialogConsts.TITLE); BodyText.text = localization.GetString(DialogConsts.RSVP_CHOICE_DIALOG + DialogConsts.BODY); Text party1ButtonText = this.transform.Find("Party1Button").Find("Text").GetComponent <Text>(); party1ButtonText.text = _parties[0].Name; Text party2ButtonText = this.transform.Find("Party2Button").Find("Text").GetComponent <Text>(); party2ButtonText.text = _parties[1].Name; }
public string GetFactionBenefits(string FactionID) { string str = ""; FactionVO faction; if (Factions.TryGetValue(FactionID, out faction)) { LocalizationModel phrases = AmbitionApp.GetModel <LocalizationModel>(); FactionID = FactionID.ToLower().Replace(' ', '_'); for (int i = faction.Level; i >= 0; i--) { str += phrases.GetString(FactionID + "." + i.ToString()); } } return(str); }
public static string Localize(string key, Dictionary <string, string> substitutions) { LocalizationModel model = AmbitionApp.GetModel <LocalizationModel>(); if (substitutions == null) { return(App.Service <LocalizationSvc>().GetString(key, model.Substitutions)); } foreach (KeyValuePair <string, string> kvp in model.Substitutions) { if (!substitutions.ContainsKey(kvp.Key)) { substitutions[kvp.Key] = kvp.Value; } } return(App.Service <LocalizationSvc>().GetString(key, substitutions)); }
public void Initialize(PartyVO p) { LocalizationModel localization = AmbitionApp.GetModel <LocalizationModel>(); TitleText.text = localization.GetString("rsvp_cancel_dialog.title"); _party = p; Dictionary <string, string> subs = new Dictionary <string, string>() { { "$PARTYSIZE", AmbitionApp.GetString("party_importance." + ((int)p.Importance).ToString()) }, { "$HOSTNAME", p.Host }, { "$FACTION", AmbitionApp.GetString(p.Faction) } }; if (p.Date == AmbitionApp.GetModel <CalendarModel>().Today) { BodyText.text = localization.GetString("rsvp_cancel_dayof_dialog.title", subs); } else { BodyText.text = localization.GetString("rsvp_cancel_dialog.body", subs); } }
public string GetDateString(DateTime d) { LocalizationModel localization = AmbitionApp.GetModel <LocalizationModel>(); return(d.Day.ToString() + " " + localization.GetList("month")[d.Month - 1] + ", " + d.Year.ToString()); }
public override void OnEnterState() { PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RoomVO room = model.Room; GuestVO guest; GuestVO[] guests = model.Guests; _phrases = AmbitionApp.GetModel <LocalizationModel>(); // This ensures that previous guest formations stay consistent if (guests == null || guests.Length == 0) { // TODO: Determine how to vary this number guests = new GuestVO[4]; } for (int i = guests.Length - 1; i >= 0; i--) { if (guests[i] == null) { guest = new GuestVO(); if (RNG.Generate(2) == 0) { guest.Gender = Gender.Female; guest.Title = GetRandomDescriptor("female_title"); guest.FirstName = GetRandomDescriptor("female_name"); } else { guest.Gender = Gender.Male; guest.Title = GetRandomDescriptor("male_title"); guest.FirstName = GetRandomDescriptor("male_name"); } guest.LastName = GetRandomDescriptor("last_name"); guest.LastName = "aeiouAEIOU".Contains(guest.LastName.Substring(0, 1)) ? (" d'" + guest.LastName) : (" de " + guest.LastName); guests[i] = guest; } } if (!room.Cleared) { int likeIndex; GuestDifficultyVO stats = partyModel.GuestDifficultyStats[room.Difficulty - 1]; string[] interests = partyModel.Interests; if (room.Actions != null) { AmbitionApp.SendMessage(room.Actions); } foreach (GuestVO g in guests) { g.Opinion = RNG.Generate(stats.Opinion[0], stats.Opinion[1]); likeIndex = RNG.Generate(interests.Length); g.Like = interests[likeIndex]; g.Dislike = interests[(likeIndex + 1) % interests.Length]; } // All Variety of Likes final check if (Array.TrueForAll(guests, g => g.Like == guests[0].Like)) { guest = RNG.TakeRandom(guests); likeIndex = RNG.Generate(interests.Length); guest.Like = interests[likeIndex]; guest.Dislike = interests[(likeIndex + 1) % interests.Length]; } } model.Guests = guests; model.Round = 0; model.Remark = null; model.FreeRemarkCounter = partyModel.FreeRemarkCounter; model.Repartee = false; model.RemarksBought = 0; }