private void HandleSelect(CharacterVO guest) { if (_remark != null && guest != null && guest == _guest) { //if (_remark.Interest == _guest.Like) //{ // if (_animator != null) // _animator.SetTrigger("Positive Remark"); // if (PositiveEffect != null) // PositiveEffect.Play(); //} //else if (_remark.Interest == _guest.Dislike) //{ // if (_animator != null) // _animator.SetTrigger("Negative Remark"); // if (NegativeEffect != null) // NegativeEffect.Play(); //} //else //{ // if (_animator != null) // _animator.SetTrigger("Neutral Remark"); //} } }
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 static bool Check(RequirementVO req) { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(req.ID); int check = (character?.Acquainted ?? false) ? 1 : 0; return(RequirementsSvc.Check(req, check)); }
override protected void HandleGuest(CharacterVO guest) { if (guest != null && guest == _guest) { //if (guest.State != GuestState.Offended) //{ // float amount = (_guest.Opinion >= 100) ? 1f : ((float)_guest.Opinion) * .01f; // if (gameObject.activeInHierarchy) // { // StopAllCoroutines(); // StartCoroutine(FillMeter(amount)); // } // else // { // OpinionIndicator.fillAmount = amount; // } // InterestIcon.sprite = InterestSprites.GetSprite(_guest.Like); // InterestIconBorder.sprite = BorderSprites.GetSprite(_guest.State.ToString()); //} //else //{ // gameObject.SetActive(false); //} } }
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()); }
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(); } } }
public RoomVO(RoomVO room) { Name = room.Name; Background = room.Background; Incident = room.Incident ?? _incident?.GetIncident(); Guests = room.Guests == null ? null : new CharacterVO[room.NumGuests]; for (int i = NumGuests - 1; i >= 0; i--) { Guests[i] = new CharacterVO(room.Guests[i]); } if (room.Actions != null) { Actions = new CommodityVO[room.Actions.Length]; for (int i = Actions.Length - 1; i >= 0; i--) { Actions[i] = new CommodityVO(room.Actions[i]); } } if (room.Rewards != null) { Rewards = new CommodityVO[room.Rewards.Length]; for (int i = Rewards.Length - 1; i >= 0; i--) { Rewards[i] = new CommodityVO(room.Rewards[i]); } } }
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 string GetCharacterName(string characterID) { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(characterID); return(character != null ? AmbitionApp.Localize(CharacterConsts.LOC_NAME + character.ID) : characterID); }
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); }
public void SetCharacter(CharacterVO character, Sprite icon = null) { Character = character; NameText.text = AmbitionApp.GetModel <LocalizationModel>().GetFullName(character) ?? character.ID; if (icon != null) { Portrait.sprite = icon; } }
public void SetEvents(PartyVO[] parties, RendezVO[] liaisons) { RendezVO rendez = liaisons.Length == 0 ? null : Array.Find(liaisons, l => l.IsAttending) ?? Array.Find(liaisons, l => l.RSVP == RSVP.New) ?? liaisons[0]; PartyVO party1 = parties.Length == 0 ? null : Array.Find(parties, p => p.IsAttending) ?? Array.Find(parties, p => p.RSVP == RSVP.New) ?? parties[0]; PartyVO party2 = rendez != null ? party1 : Array.Find(parties, p => p != party1); bool showRespond = !Array.Exists(parties, p => p.IsAttending) && !Array.Exists(liaisons, r => r.IsAttending) && (Array.Exists(parties, p => p.RSVP == RSVP.New) || Array.Exists(liaisons, p => p.RSVP == RSVP.New && !p.IsCaller)); if (rendez != null) { party1 = null; } RespondIndicator.gameObject.SetActive(showRespond); // Party2 Icon is centered Party2Icon.gameObject.SetActive(party1 != null); if (party1 != null) { Party2Icon.sprite = CalendarSpriteConfig.GetSprite(party1.Faction.ToString()); Party2RSVPIcon.gameObject.SetActive(party1.RSVP != RSVP.New); Party2RSVPIcon.sprite = CalendarSpriteConfig.GetSprite(party1.IsAttending ? ACCEPTED : DECLINED); } // Party1 Icon is in corner Party1Icon.gameObject.SetActive(party2 != null); if (party2 != null) { Party1Icon.sprite = CalendarSpriteConfig.GetSprite(party2.Faction.ToString()); Party1RSVPIcon.gameObject.SetActive(party2.RSVP != RSVP.New); Party1RSVPIcon.sprite = CalendarSpriteConfig.GetSprite(party2.IsAttending ? ACCEPTED : DECLINED); } // Liaison is centered liaisonIcon.gameObject.SetActive(rendez != null); if (rendez != null) { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(rendez.Character); liaisonIcon.sprite = LiaisonConfig.GetSprite(character?.Faction.ToString()); liaisonResponse.gameObject.SetActive(rendez.RSVP != RSVP.New); liaisonResponse.sprite = CalendarSpriteConfig.GetSprite(rendez.IsAttending ? ACCEPTED : DECLINED); } }
private void HandleGuestTargeted(CharacterVO guest) { if (guest == null) { On = false; } else if (guest == _guest) { On = !_intoxicated; } }
public void Execute(string location) { CharacterModel model = AmbitionApp.GetModel <CharacterModel>(); if (model.CreateRendezvousMode) { CharacterVO character = model.GetCharacter(model.CreateRendezvous.Character); character.LiaisonDay = model.CreateRendezvous.Day; model.CreateRendezvous.Location = location; AmbitionApp.Calendar.Schedule(model.CreateRendezvous, model.CreateRendezvous.Day); model.CreateRendezvous = null; } }
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); } } } }
public static bool Check(RequirementVO req) { RendezVO rendez = AmbitionApp.GetEvent() as RendezVO; if (rendez == null) { return(false); } CharacterModel model = AmbitionApp.GetModel <CharacterModel>(); CharacterVO character = model.GetCharacter(rendez.Character); return(RequirementsSvc.Check(req, character?.Favor ?? 0)); }
public int GetOutfitFavor(string characterID, OutfitVO outfit) { CharacterVO character = GetCharacter(characterID); if (character == null) { return(0); } AmbitionApp.GetModel <FactionModel>().Factions.TryGetValue(character.Faction, out FactionVO faction); int score = 200 - Math.Abs(outfit.Modesty - faction.Modesty) - Math.Abs(outfit.Luxury - faction.Luxury); return((int)Math.Floor(score * outfit.Novelty * .00333333)); }
protected override void HandleGuest(CharacterVO guest) { /* if (guest != null && guest == Guest) * { * // Only do this work if the state is changing. * if (_avatar.ID == null || _avatar.ID != Guest.Avatar) * { * if (Guest.Avatar != null) _avatar.ID = Guest.Avatar; * else * { * AvatarVO[] avatars = _avatar.Collection.Find(Guest.Gender, "party"); * _avatar.ID = Guest.Avatar = Util.RNG.TakeRandom(avatars).ID; * } * Guest.Gender = _avatar.Avatar.Gender; * } * * if (guest.State != GuestState.Offended) * { * if (_isIntoxicated) _pose = "neutral"; * else switch (guest.State) * { * case GuestState.Bored: * _pose = "bored"; * break; * case GuestState.Charmed: * _pose = "charmed"; * break; * case GuestState.Interested: * _pose = "approval"; * break; * case GuestState.PutOff: * _pose = "putout"; * break; * default: * _pose = "neutral"; * break; * } * if (_pose != _avatar.Pose) * _avatar.Pose = _pose; * if (_avatar.Sprite == null) * _avatar.Pose = _pose = "neutral"; * } * else * { * gameObject.SetActive(false); * } * } */ }
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)); } } }
public void Execute(CommodityVO commodity) { CharacterModel model = AmbitionApp.GetModel <CharacterModel>(); CharacterVO character = model.GetCharacter(commodity.ID); if (character != null) { character.Acquainted = commodity.Value > 0; model.Broadcast(); if (!character.IsDateable && character.IsRendezvousScheduled) { RendezVO[] rendezs = AmbitionApp.Calendar.GetOccasions <RendezVO>(character.LiaisonDay); RendezVO rendez = Array.Find(rendezs, r => r.Character == commodity.ID); AmbitionApp.Calendar.Remove(rendez); } } }
private void HandleSelected(CharacterVO guest) { /* * if (_animator == null) return; * if (_remark != null && guest != null && Guest == guest) * { * if (_remark.Interest == Guest.Like) * { * _animator.SetTrigger("Positive Remark"); * } * else if (_remark.Interest == Guest.Dislike) * { * _animator.SetTrigger("Negative Remark"); * } * else * { * _animator.SetTrigger("Neutral Remark"); * } * } */ }
private void HandleTargeted(CharacterVO guest) { /* * if (_animator == null) return; * if (guest == null) _avatar.Pose = _pose; * else if (!_isIntoxicated && _remark != null && Guest == guest) * { * if (_remark.Interest == Guest.Like) * { * _avatar.Pose = "charmed"; * } * else if (_remark.Interest == Guest.Dislike) * { * _avatar.Pose = "putout"; * } * else * { * _avatar.Pose = "approval"; * } * } */ }
override protected void HandleGuest(CharacterVO guest) { if (guest != null && guest == _guest) { bool activate = false; //guest.Action != null; gameObject.SetActive(activate); if (activate) { //GuestActionVO action = guest.Action; //foreach (ActionMap map in Actions) //{ // activate = map.ActionType == action.Type; // map.View.SetActive(activate); // if (activate) // { // icon = map.View.GetComponent<GuestActionIcon>(); // if (icon != null) icon.SetAction(action); // } //} } } }
public static bool Check(RequirementVO req) { var party = AmbitionApp.GetModel <PartyModel>().Party; // outfit reaction credibility shift ItemVO outfit = AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit); CalendarEvent e = AmbitionApp.GetEvent(); FactionType faction; if (e is PartyVO) { faction = ((PartyVO)e).Faction; } else { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(((RendezVO)e).Character); faction = character?.Faction ?? FactionType.Military; } int value = AmbitionApp.Inventory.GetFactionBonus(outfit, faction); return(RequirementsSvc.Check(req, value)); }
public string GetPartyInvitation(PartyVO party, CharacterVO host) { Dictionary <string, string> subs = new Dictionary <string, string>(); string result; subs["$HOST"] = GetFormalName(host, party.Host); if (party.phrases?.Length > 1) { subs["$INTRO"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_INTRO + party.phrases[0]); } if (party.phrases?.Length > 2) { subs["$ADJECTIVE"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_ADJECTIVE + party.phrases[1]); } if (party.phrases?.Length > 3) { subs["$NOUN"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_NOUN + party.phrases[2]); } result = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF, subs); subs.Clear(); subs["$FLUFF"] = result; subs["$PLAYER"] = AmbitionApp.Game.PlayerName; subs["$PRONOUN"] = host == null || host.Gender == Gender.NonBinary || host.Gender == Gender.Unknown ? AmbitionApp.Localize("their") : host.Gender == Gender.Male ? AmbitionApp.Localize("his") : AmbitionApp.Localize("her"); subs["$DATE"] = Localize(AmbitionApp.Calendar.StartDate.AddDays(party.Day)); subs["$SIZE"] = AmbitionApp.Localize(PartyConstants.PARTY_SIZE + (int)party.Size); subs["$PARTY"] = GetPartyName(party); result = AmbitionApp.Localize(PartyConstants.PARTY_INVITATION + party.ID, subs); return(string.IsNullOrEmpty(result) ? AmbitionApp.Localize(PartyConstants.PARTY_INVITATION_LOC, subs) : result); }
public void Execute(CommodityVO favor) { CharacterModel model = AmbitionApp.GetModel <CharacterModel>(); CharacterVO character = model.GetCharacter(favor.ID); if (character != null) { character.Favor += favor.Value; if (character.Favor < 0) { character.Favor = 0; } else if (character.Favor > 100) { character.Favor = 100; } } #if DEBUG else { Debug.LogWarningFormat("FavorReward.Execute: unrecognized character ID '{0}", favor.ID); } #endif }
protected abstract void HandleGuest(CharacterVO guest);
public string GetFullName(CharacterVO character) { return(AmbitionApp.Localize(CharacterConsts.LOC_FULL_NAME + character.ID)); }
protected override void HandleGuest(CharacterVO guest) { }
// Returns a Sprite corresponding to the guest's approval // TODO: This may eventually be completely handled by Mecanim public Sprite GetSprite(CharacterVO guest) => null;