示例#1
0
 void Start()
 {
     foreach (LocalizedTextField row in LocalizedText)
     {
         row.TextField.text = AmbitionApp.Localize(row.LocalizationKey);
     }
 }
示例#2
0
        public void Initialize(PartyVO party)
        {
            PartyModel model = AmbitionApp.GetModel <PartyModel>();
            Dictionary <string, string> subs = new Dictionary <string, string>();
            CharacterVO host = AmbitionApp.GetModel <CharacterModel>().GetCharacter(party.Host);

            _party = party;

            TitleTxt.text = AmbitionApp.Localization.GetFormalName(host, party.Host);
            SetRSVPText(party.RSVP);
            GossipImage.sprite   = Stamp.sprite = InvitationConfig.GetSprite(party.Faction.ToString());
            BodyTxt.text         = AmbitionApp.Localization.GetPartyInvitation(party, host);
            GossipRewardTxt.text = AmbitionApp.Localize("rsvp.gossip.reward", new Dictionary <string, string>()
            {
                { "%f", AmbitionApp.Localize(party.Faction.ToString().ToLower()) }
            });
            CredRewardTxt.text = AmbitionApp.Localize("rsvp.credibility.bonus", new Dictionary <string, string>()
            {
                { "%n", model.AcceptInvitationBonus.ToString() }
            });
            CredPenaltyTxt.text = AmbitionApp.Localize("rsvp.credibility.penalty", new Dictionary <string, string>()
            {
                { "%n", model.IgnoreInvitationPenalty.ToString() }
            });
            CredReward.SetActive(AmbitionApp.Calendar.Day == party.Created);
            Seal.sprite = InvitationConfig.GetSprite("seal." + party.Faction.ToString().ToLower());
        }
示例#3
0
        public override void OnOpen(GossipVO gossip)
        {
            GossipModel model = AmbitionApp.Gossip;
            int         day   = AmbitionApp.Calendar.Day;

            _gossip = gossip;
            _price  = model.GetValue(_gossip, day);
            _shift  = model.GetShift(_gossip, day);

            Dictionary <string, string> subs = new Dictionary <string, string>();

            subs["$SHIFTAMOUNT"] = AmbitionApp.Localize("shift_degree." + _shift);
            subs["$GOSSIPNAME"]  = AmbitionApp.Gossip.GetName(_gossip);
            subs["$GOSSIPPRICE"] = _price.ToString("£### ###");
            subs["$CAUGHTODDS"]  = AmbitionApp.Localize("gossip_caught_odds." + AmbitionApp.Gossip.GossipActivity.ToString());
            subs["$FACTION"]     = AmbitionApp.Localize(_gossip.Faction.ToString().ToLower());
            //Performing the substitutions themselves
            BodyText.text = AmbitionApp.Localize(GossipConsts.PEDDLE_INFLUENCE_LOC + DialogConsts.BODY, subs);

            if (gossip.IsPower)
            {
                IncreaseStatText.text = AmbitionApp.Localize(GossipConsts.PEDDLE_INFLUENCE_INC_POWER_LOC, subs)
                                        ?? AmbitionApp.Localize(DialogConsts.DEFAULT_CONFIRM);
                DecreaseStatText.text = AmbitionApp.Localize(GossipConsts.PEDDLE_INFLUENCE_DEC_POWER_LOC, subs)
                                        ?? AmbitionApp.Localize(DialogConsts.DEFAULT_CONFIRM);
            }
            else
            {
                IncreaseStatText.text = AmbitionApp.Localize(GossipConsts.PEDDLE_INFLUENCE_INC_ALLEGIANCE_LOC, subs)
                                        ?? AmbitionApp.Localize(DialogConsts.DEFAULT_CONFIRM);
                DecreaseStatText.text = AmbitionApp.Localize(GossipConsts.PEDDLE_INFLUENCE_DEC_ALLEGIANCE_LOC, subs)
                                        ?? AmbitionApp.Localize(DialogConsts.DEFAULT_CONFIRM);
            }
        }
示例#4
0
        private void SetHeaderTitle(string title)
        {
            AmbitionApp.GetModel <LocalizationModel>().HeaderTitlePhrase = title;
            string text = AmbitionApp.Localize(title);

            Title.text = string.IsNullOrEmpty(text) ? title : text;
        }
示例#5
0
 public override void OnOpen(IncidentVO incident)
 {
     _incident                    = incident;
     _rewardItems                 = new Dictionary <string, RewardItem>();
     _rewardRanges                = new Dictionary <string, Vector2Int>();
     LocationNameText.text        = AmbitionApp.Localize(incident.ID + ".name");
     LocationDescriptionText.text = AmbitionApp.Localize(incident.ID + ".description");
     if (incident?.Nodes != null && incident.Nodes.Length > 0)
     {
         BackgroundConfig.BackgroundMap bg;
         foreach (MomentVO moment in incident.Nodes)
         {
             if (moment.Background != null)
             {
                 bg = Array.Find(BGConfig.Backgrounds, b => b.IncidentBackground == moment.Background);
                 if (bg.ModalBackground != null)
                 {
                     LocationImage.sprite = bg.ModalBackground;
                     break;
                 }
             }
         }
         RewardsList.SetIncident(incident);
     }
 }
示例#6
0
        public override void OnOpen(LocationConfig config)
        {
            bool          rendezvousMode = AmbitionApp.GetModel <CharacterModel>().CreateRendezvousMode;
            ParisModel    paris          = AmbitionApp.Paris;
            IncidentModel story          = AmbitionApp.Story;
            LocationVO    location       = paris.SaveLocation(config);

            _incident = story.GetIncident(config.IntroIncidentConfig?.name);

            _location                    = config.name;
            LocationNameText.text        = AmbitionApp.Localize(ParisConsts.LABEL + _location);
            LocationDescriptionText.text = AmbitionApp.Localize(ParisConsts.DESCRIPTION + _location);
            LocationImage.sprite         = config.LocationModalSprite;
            GoButtonText.text            = AmbitionApp.Localize(rendezvousMode
                ? ParisConsts.PICK_LOC_BTN_LABEL
                : ParisConsts.GO_LOC_BTN_LABEL);

            if (!AmbitionApp.CheckIncidentEligible(_incident) && config.StoryIncidentConfigs != null)
            {
                foreach (IncidentConfig icon in config.StoryIncidentConfigs)
                {
                    if (AmbitionApp.CheckIncidentEligible(icon?.name))
                    {
                        _incident = story.GetIncident(icon.name);
                    }
                }
            }

            List.SetIncident(_incident);
        }
示例#7
0
        private void Start()
        {
            CalendarModel calendar = AmbitionApp.Calendar;
            GameModel     model    = AmbitionApp.GetModel <GameModel>();

            AmbitionApp.SendMessage(GameMessages.HIDE_HEADER);
            AmbitionApp.SendMessage(AudioMessages.STOP_AMBIENT);
            AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC);
            ChapterVO chapter = Array.Find(model.Chapters, d => d.Date == calendar.Today);

            if (chapter.Splash != null)
            {
                Splash.sprite = chapter.Splash;
            }
            Title.text = AmbitionApp.Localize(chapter.ID);
            Date.text  = AmbitionApp.GetModel <LocalizationModel>().Date;
            if (!string.IsNullOrWhiteSpace(chapter.Sting.Name))
            {
                AmbitionApp.SendMessage(AudioMessages.PLAY, chapter.Sting);
            }
            else if (!string.IsNullOrWhiteSpace(AudioSting.Name))
            {
                AmbitionApp.SendMessage(AudioMessages.PLAY, AudioSting);
            }
        }
示例#8
0
 public string GetItemName(ItemVO item)
 {
     return(item == null ? ""
         : string.IsNullOrEmpty(item.Name)
         ? AmbitionApp.Localize(item.ID + ItemConsts.ITEM_LOC_NAME)
         : item.Name);
 }
示例#9
0
        public void SetDialog(string phrase, Dictionary <string, string> substitutions = null, Action onConfirm = null)
        {
            string txt;

            _onConfirm = onConfirm;
            ConfirmBtn.SetActive(onConfirm != null);

            //string dismissToken = _onConfirm == null ? DialogConsts.
            BodyTxt.text  = AmbitionApp.Localize(phrase + DialogConsts.BODY, substitutions);
            TitleTxt.text = AmbitionApp.Localize(phrase + DialogConsts.TITLE, substitutions);

            if (DismissTxt != null)
            {
                txt             = AmbitionApp.Localize(phrase + DialogConsts.CANCEL, substitutions);
                DismissTxt.text = !string.IsNullOrEmpty(txt)
                    ? txt
                    : _onConfirm != null
                    ? AmbitionApp.Localize(DialogConsts.DEFAULT_CANCEL)
                    : AmbitionApp.Localize(DialogConsts.DEFAULT_CLOSE);
            }

            if (ConfirmTxt != null)
            {
                txt             = AmbitionApp.Localize(phrase + DialogConsts.CONFIRM, substitutions);
                ConfirmTxt.text = string.IsNullOrEmpty(txt)
                    ? AmbitionApp.Localize(DialogConsts.DEFAULT_CONFIRM)
                    : txt;
            }
        }
示例#10
0
        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);
        }
示例#11
0
        private void Start()
        {
            CalendarEvent e = AmbitionApp.GetNextEvent(14);

            NextPartyObject.SetActive(e != null);
            if (e != null)
            {
                bool        isParty   = e is PartyVO;
                CharacterVO character = isParty ? null : AmbitionApp.GetModel <CharacterModel>().GetCharacter(e.ID);
                string      str       = (isParty ? ((PartyVO)e).Faction : character?.Faction ?? FactionType.None).ToString();
                FactionSymbol.sprite = FactionSymbols.GetSprite(str);
                TooltipText.text     = isParty
                    ? AmbitionApp.Localize("party_" + str.ToLower() + "_likes_and_dislikes")
                    : AmbitionApp.Localize("rendezvous_" + str.ToLower() + "_likes_and_dislikes");
                if (isParty)
                {
                    NameText.text = AmbitionApp.GetModel <LocalizationModel>().GetPartyName(e as PartyVO);
                }
                else
                {
                    str           = AmbitionApp.Localize(CharacterConsts.LOC_NAME + (e as RendezVO)?.Character);
                    NameText.text = string.IsNullOrEmpty(str) ? (e as RendezVO)?.Character : str;
                }
                if (DateText != null)
                {
                    DateTime date = AmbitionApp.Calendar.StartDate.AddDays(e.Day);
                    DateText.text = date.Day.ToString() + "/" + date.Month.ToString();
                }
            }
        }
示例#12
0
 public void SetTransition(TransitionVO transition, string text)
 {
     _transition = transition;
     _text.text  = text;
     if (transition.Flags == null)
     {
         Array.ForEach(Flags, f => gameObject.SetActive(false));
     }
     else
     {
         IncidentFlag flag;
         int          len = _transition.Flags.Length;
         Dictionary <string, string> subs = new Dictionary <string, string>();
         for (int i = Flags.Length - 1; i >= 0; i--)
         {
             bool active = i < len;
             Flags[i].gameObject.SetActive(active);
             if (active)
             {
                 flag            = _transition.Flags[i];
                 Flags[i].sprite = Array.Find(Icons, f => f.Type == flag.Type).Icon;
                 Flags[i].SetNativeSize();
                 subs["#"]        = flag.Value.ToString();
                 Tooltips[i].text = AmbitionApp.Localize((string.IsNullOrWhiteSpace(flag.Phrase)
                     ? flag.Type.ToString()
                     : flag.Phrase), subs);
             }
         }
         StartCoroutine(ForceUpdate());
     }
 }
示例#13
0
        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;
        }
示例#14
0
 public void SetMerchantMode(bool isMerchant)
 {
     IsMerchant             = isMerchant;
     BuyButtonText.text     = AmbitionApp.Localize(isMerchant ? "purchase" : "sell");
     BuyButtonCostText.text = "";
     BuyButton.interactable = false;
     AmbitionApp.SendMessage(InventoryMessages.UPDATE_MERCHANT);
 }
示例#15
0
        public string GetShortName(CharacterVO character, string defaultName)
        {
            string result = character == null
                ? null
                : AmbitionApp.Localize(CharacterConsts.LOC_SHORT_NAME + character.ID);

            return(string.IsNullOrEmpty(result) ? defaultName : result);
        }
示例#16
0
        public string GetCharacterName(string characterID)
        {
            CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(characterID);

            return(character != null
                   ? AmbitionApp.Localize(CharacterConsts.LOC_NAME + character.ID)
                   : characterID);
        }
示例#17
0
 //To Do: Clean this up when CommodityVO uses RewardVO instead
 private string _commodityName(CommodityVO commodity)
 {
     switch (commodity.Type.ToString())
     {
     case "Gossip":
         return(AmbitionApp.Localize("commodity." + commodity.Type.ToString().ToLower() + ".name"));
     }
     return(AmbitionApp.Localize("commodity." + commodity.ID + ".name"));
 }
示例#18
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));
        }
示例#19
0
        public void Submit()
        {
            string subject = AmbitionApp.Localize("error." + _args.Type.ToString() + ".subject");
            string body    = AmbitionApp.Localize("error." + _args.Type.ToString(), _args.Substitutions);
            Dictionary <string, string> subs = new Dictionary <string, string>();

            subs["$E"] = body;
            body       = AmbitionApp.Localize("error.message_body", subs) + "\n\nError: " + _args.Type.ToString();
            Application.OpenURL("mailto:" + SENDER + "?subject=" + Escape(subject) + "&body=" + Escape(body));
            Close();
        }
示例#20
0
        private void SetRSVPText(RSVP rsvp)
        {
            string txt   = rsvp == RSVP.Declined ? "rsvp.declined" : "rsvp.accepted";
            bool   isNew = rsvp == RSVP.New;

            AcceptedTxt.text    = AmbitionApp.Localize(txt);
            AcceptedTxt.color   = rsvp == RSVP.Declined ? DeclineColor : AcceptColor;
            AcceptedTxt.enabled = !isNew;
            AcceptBtn.SetActive(isNew);
            DeclineBtn.SetActive(isNew);
        }
示例#21
0
 IEnumerator ListenForFullscreenChange()
 {
     while (true)
     {
         if (Screen.fullScreen != _isFullscreen)
         {
             _isFullscreen           = Screen.fullScreen;
             FullscreenBtnLabel.text = AmbitionApp.Localize(_isFullscreen ? "options.windowed" : "options.fullscreen");
         }
         yield return(null);
     }
 }
示例#22
0
        IEnumerator SaveGameDelay()
        {
            CancelBtn.interactable    = false;
            OverwriteBtn.interactable = false;
            CreateBtn.interactable    = false;
            StatusTxt.text            = AmbitionApp.Localize("game_menu.saving");
            StatusTxt.enabled         = true;
            AmbitionApp.SendMessage(GameMessages.SAVE_GAME);
            yield return(new WaitForSeconds(1f));

            Close();
            AmbitionApp.CloseDialog(DialogConsts.GAME_MENU);
        }
示例#23
0
        // Use this for initialization
        public override void OnOpen(List <PartyVO> parties)
        {
            _parties = parties;

            TitleText.text = AmbitionApp.Localize(DialogConsts.RSVP_CHOICE_DIALOG + DialogConsts.TITLE);
            BodyText.text  = AmbitionApp.Localize(DialogConsts.RSVP_CHOICE_DIALOG + DialogConsts.BODY);

            Text party1ButtonText = this.transform.Find("Party1Button").Find("Text").GetComponent <Text>();

            party1ButtonText.text = _parties[0].ID;
            Text party2ButtonText = this.transform.Find("Party2Button").Find("Text").GetComponent <Text>();

            party2ButtonText.text = _parties[1].ID;
        }
示例#24
0
        void HandleTransitions(TransitionVO[] transitions)
        {
            int    index = -1;
            int    max;
            string loc = null;
            bool   show;

            _transitions.Clear();
            foreach (TransitionVO trans in transitions)
            {
                if (AmbitionApp.CheckRequirements(trans.Requirements))
                {
                    if (!trans.xor)
                    {
                        _transitions.Add(trans);
                    }
                    else if (index < 0)
                    {
                        index = _transitions.Count;
                        _transitions.Add(trans);
                    }
                    else if (_transitions[index].Requirements.Length == 0)
                    {
                        _transitions[index] = trans;
                    }
                }
            }

            max = _transitions.Count;

            for (int i = _buttons.Length - 1; i >= 0; --i)
            {
                show = i < max;
                if (show)
                {
                    index = Array.IndexOf(_incident.LinkData, _transitions[i]);
                    loc   = AmbitionApp.Localize(_incident.ID + ".link." + index.ToString());
                    show  = !string.IsNullOrEmpty(loc);
                }
                _buttons[i].gameObject.SetActive(show);
                if (show)
                {
                    _buttons[i].SetTransition(_transitions[i], loc);
                }
            }

            _hitTarget.raycastTarget = _transitions.Count < 2;
            Ellipse.SetActive(_transitions.Count < 2);
            _animator.SetBool(ACTIVE, true);
        }
示例#25
0
        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);
        }
示例#26
0
        public string GetPartyName(PartyVO party)
        {
            //Dictionary<string, string> subs = new Dictionary<string, string>();
            //CharacterVO character = AmbitionApp.GetModel<CharacterModel>().GetCharacter(party.Host);
            //if (party.phrases.Length > 0)
            //    subs["$REASON"] = AmbitionApp.Localize(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower() + "." + party.phrases[0]);
            //subs["$IMPORTANCE"] = AmbitionApp.Localize(PartyConstants.PARTY_IMPORTANCE + (int)party.Size);
            //subs["$HOST"] = GetFormalName(character, party.Host);
            string result = AmbitionApp.Localize(PartyConstants.PARTY_NAME + party.ID);

            return(string.IsNullOrEmpty(result)
                ? AmbitionApp.Localize(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower() + "." + party.phrases[0])
                   //? AmbitionApp.Localize(PartyConstants.PARTY_NAME_DEFAULT, subs)
                : result);
        }
示例#27
0
        void Start()
        {
            PartyModel model = AmbitionApp.GetModel <PartyModel>();

            _inventory = AmbitionApp.GetModel <InventoryModel>();
            List <GossipVO> gossipList  = AmbitionApp.Gossip.Gossip;
            int             gossipIndex = gossipList.Count - 1;

            PartyText.text     = AmbitionApp.Localize(PartyConstants.PARTY_NAME + model.Party.ID);
            FactionIcon.sprite = FactionIconConfig.GetSprite(model.Party.Faction.ToString());
            List <RewardItem> rewards = AmbitionApp.CreateRewardListItems(model.Rewards, listItem);
            OutfitVO          outfit  = _inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO;

            if (outfit != null)
            {
                int novelty = outfit.Novelty - model.BaseNoveltyLoss - model.CumulativeNoveltyLoss * outfit.TimesWorn;
                if (novelty < 0)
                {
                    novelty = 0;
                }
                OutfitText.text        = AmbitionApp.Localization.GetItemName(outfit);
                NoveltySlider.value    = novelty;
                NoveltySliderText.text = novelty.ToString();
            }
            string host = AmbitionApp.Localize(PartyConstants.PARTY_HOST + model.Party.Host);

            if (string.IsNullOrEmpty(host))
            {
                host = model.Party.Host;
            }
            Dictionary <string, string> subs = new Dictionary <string, string>()
            {
                { HOST_TOKEN, host }
            };

            PartyHostText.text = AmbitionApp.Localize("after_party_dialog.host", subs);
            for (int i = rewards.Count - 1; i >= 0; --i)
            {
                if (rewards[i].Data.Type == CommodityType.Gossip)
                {
                    rewards[i].SetGossip(gossipList[gossipIndex]);
                    --gossipIndex;
                }
            }
        }
示例#28
0
        IEnumerator StartRewards()
        {
            BarkConfig config;
            GameObject obj;
            BarkView   bark;
            Dictionary <string, string> subs = new Dictionary <string, string>();
            CharacterModel model             = AmbitionApp.GetModel <CharacterModel>();
            Sprite         icon;
            CommodityVO    reward;

            while (_queue.Count > 0)
            {
                reward = _queue[0];
                _queue.RemoveAt(0);
                if (reward.Value != 0 && Array.Exists(Barks, b => b.Type == reward.Type))
                {
                    if (!string.IsNullOrEmpty(reward.ID))
                    {
                        CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(reward.ID);
                        subs[NAME]    = AmbitionApp.Localization.GetFormalName(model.GetCharacter(reward.ID), reward.ID);
                        subs[FACTION] = AmbitionApp.Localize(reward.ID.ToLower());
                        icon          = Icons.GetSprite(character != null
                            ? ("seal." + character.Faction.ToString().ToLower())
                            : ("seal.none"));
                    }
                    else
                    {
                        icon = null;
                    }
                    config = Array.Find(Barks, b => b.Type == reward.Type);
                    obj    = Instantiate <GameObject>(Bark.gameObject, Bark.transform.parent, true);
                    bark   = obj.GetComponent <BarkView>();
                    if (reward.Value > 0)
                    {
                        bark.SetBark(AmbitionApp.Localize(config.GainLocalization, subs), config.GainColor, icon);
                    }
                    else if (reward.Value < 0)
                    {
                        bark.SetBark(AmbitionApp.Localize(config.LossLocalization, subs), config.LossColor, icon);
                    }
                    bark.gameObject.SetActive(true);
                    yield return(new WaitForSeconds(SpawnDelay));
                }
            }
        }
示例#29
0
        IEnumerator ShowTooltip(float duration)
        {
            for (float t = 0; t < Delay; t += Time.deltaTime)
            {
                yield return(null);
            }
            GameObject         obj         = Instantiate <GameObject>(Prefab, this.transform, false);
            ResourceTooltipLoc tutorialTxt = obj.GetComponent <ResourceTooltipLoc>();

            if (tutorialTxt != null)
            {
                tutorialTxt.TutorialText.text = AmbitionApp.Localize(TooltipLoc);
            }
            for (float t = 0; t < duration; t += Time.deltaTime)
            {
                yield return(null);
            }
            StartCoroutine(FadeOut());
        }
示例#30
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));
        }