Esempio n. 1
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);
        }
Esempio n. 2
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;
        }