Пример #1
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;
        }
Пример #2
0
        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);
                    }
                }
            }
        }