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); }
// Chooses all of the new Daily locations whose requirements have been met // This ensures that the same locations aren't available on two consecutive days public void Execute(string[] pins) { ParisModel paris = AmbitionApp.Paris; if (paris.Daily == null && AmbitionApp.GetModel <CharacterModel>().Rendezvous == null && AmbitionApp.CheckRequirements(paris.ExploreParisRequirements)) { GameModel game = AmbitionApp.Game; LocationVO location = null; List <string> subset = new List <string>(); int num = paris.NumDailies; foreach (string pinID in pins) { location = paris.GetLocation(pinID); if (location != null && location.IsDiscoverable && !paris.Rendezvous.Contains(pinID) && (!location.IsOneShot || !paris.Completed.Contains(pinID)) && AmbitionApp.CheckRequirements(location.Requirements)) { if (!string.IsNullOrWhiteSpace(location.SceneID) || AmbitionApp.CheckIncidentEligible(location.IntroIncident)) { subset.Add(pinID); } else if (location.StoryIncidents != null) { foreach (string incidentID in location.StoryIncidents) { if (AmbitionApp.CheckIncidentEligible(incidentID)) { subset.Add(pinID); break; } } } } } if (subset.Count > num) { pins = Util.RNG.Shuffle(subset); paris.Daily = new string[num]; for (int i = num - 1; i >= 0; i--) { paris.Daily[i] = pins[i]; } } else { paris.Daily = subset.ToArray(); } } }
public override void OnEnter() { LocationVO location = AmbitionApp.Paris.GetLocation(); IncidentVO incident = GetLocationIncident(location); AmbitionApp.Game.Activity = ActivityType.Paris; if (incident != null) { incident.Date = AmbitionApp.Calendar.Today; AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident); } }
public override void OnEnter() { RendezVO vous = AmbitionApp.Calendar.GetOccasions <RendezVO>()[0]; AmbitionApp.GetModel <GameModel>().Activity = ActivityType.Rendezvous; LocationVO location = AmbitionApp.Paris.GetLocation(vous.Location); IncidentVO incident; // This will crash if the rendezvous location is badly configured foreach (string ID in location.StoryIncidents) { AmbitionApp.Story.Incidents.TryGetValue(ID, out incident); if (incident != null && AmbitionApp.CheckIncidentEligible(incident)) { AmbitionApp.Story.Schedule(incident); return; } } // TODO: Evaluate Outfit for Rendezvous }
private IncidentVO GetLocationIncident(LocationVO location) { ParisModel paris = AmbitionApp.Paris; if (location == null || paris.IsComplete(location.ID)) { return(null); } AmbitionApp.GetModel <LocalizationModel>().SetLocation(location.ID); if (AmbitionApp.CheckIncidentEligible(location.IntroIncident)) { return(AmbitionApp.Story.GetIncident(location.IntroIncident)); } foreach (string incidentID in location.StoryIncidents) { if (AmbitionApp.CheckIncidentEligible(incidentID)) { return(AmbitionApp.Story.GetIncident(incidentID)); } } return(null); }
public override void OnEnter() { ParisModel paris = AmbitionApp.Paris; string location = paris.Location; if (!string.IsNullOrEmpty(location)) { LocationVO vo = AmbitionApp.Paris.GetLocation(); bool completed = vo.IsOneShot; if (completed) { if (!paris.Completed.Contains(location)) { paris.Completed.Add(location); } paris.Exploration.Remove(location); paris.Rendezvous.Remove(location); } else { completed = paris.Completed.Contains(location); } if (!completed) { if (vo.IsRendezvous) { paris.Exploration.Remove(location); paris.Rendezvous.Add(location); } else if (!AmbitionApp.Paris.Exploration.Contains(location)) { paris.Rendezvous.Remove(location); paris.Exploration.Add(location); } } } }
public void Execute(string savedGameData) { GameModel game = AmbitionApp.Game; if (!game.Initialized) { AmbitionApp.Execute <InitGameCmd>(); } UFlowSvc uflow = AmbitionApp.GetService <UFlowSvc>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentModel story = AmbitionApp.Story; ParisModel paris = AmbitionApp.Paris; PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.GetService <ModelSvc>().Restore(savedGameData); PlayerConfig config = Resources.Load <PlayerConfig>(Filepath.PLAYERS + game.playerID); AmbitionApp.Execute <RestorePlayerCmd, PlayerConfig>(config); LocationVO location = paris.GetLocation(paris.Location); AmbitionApp.CloseAllDialogs(); AmbitionApp.SendMessage(AudioMessages.STOP_AMBIENT); AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC); uflow.Reset(); story.RestoreIncident(); foreach (string tutorialID in game.Tutorials) { AmbitionApp.Execute <TutorialReward, CommodityVO>(new CommodityVO() { Type = CommodityType.Tutorial, ID = tutorialID }); } UMachine flow = calendar.Day == 0 ? uflow.Instantiate(FlowConsts.GAME_CONTROLLER) : uflow.Instantiate(FlowConsts.DAY_FLOW_CONTROLLER); string sceneID = null; switch (game.Activity) { case ActivityType.Estate: if (story.Moment == null) { flow = RestoreEstate(flow, out sceneID); } else { flow = Restore(flow, MORNING_INCIDENT); } break; case ActivityType.Party: flow = Restore(flow, PARTY_STATE); if (story.Moment == null) { if (partyModel.TurnsLeft > 0) { Restore(flow, PARTY_MAP); sceneID = SceneConsts.MAP_SCENE; } else { Restore(flow, AFTER_PARTY); sceneID = SceneConsts.AFTER_PARTY_SCENE; } } else if (partyModel.Turn < 0) { flow = Restore(flow, PARTY_INTRO); } else if (partyModel.TurnsLeft > 0) { flow = Restore(flow, PARTY_ROOM); } else { flow = Restore(flow, PARTY_OUTTRO); } break; case ActivityType.Evening: flow = Restore(flow, EVENING_STATE); break; case ActivityType.Paris: flow = Restore(flow, PARIS_STATE); if (story.Moment != null) { flow = Restore(flow, PARIS_INCIDENT); } else { sceneID = location?.SceneID ?? SceneConsts.PARIS_SCENE; Restore(flow, sceneID == SceneConsts.PARIS_SCENE ? PARIS_STATE : PARIS_SCENE); } break; case ActivityType.Rendezvous: flow = Restore(flow, RENDEZVOUS_STATE); flow = Restore(flow, RENDEZVOUS_INCIDENT); break; } if (story.Moment != null) { Restore(flow, MOMENT); sceneID = SceneConsts.INCIDENT_SCENE; } if (!string.IsNullOrEmpty(sceneID)) { AmbitionApp.SendMessage(GameMessages.LOAD_SCENE, sceneID); } uflow.Execute(); AmbitionApp.SendMessage(GameMessages.GAME_LOADED); }