コード例 #1
0
        public void Execute()
        {
            List <QuestVO> quests = AmbitionApp.Gossip.Quests;

            if (quests.Count > 0)
            {
                AmbitionApp.Execute <FailQuestCmd, QuestVO>(quests[quests.Count - 1]);
            }
        }
コード例 #2
0
        public void Execute(string playerID)
        {
            PlayerConfig config = Resources.Load <PlayerConfig>(Filepath.PLAYERS + playerID);

            if (config != null)
            {
                InventoryModel inventory = AmbitionApp.Inventory;
                AmbitionApp.Execute <RestorePlayerCmd, PlayerConfig>(config);
                AmbitionApp.Game.Livre = config.Livre;
                foreach (ItemConfig def in config.Inventory)
                {
                    inventory.Inventory.Add(inventory.Instantiate(def.name));
                }
            }
        }
コード例 #3
0
        public override void OnEnterState()
        {
            CalendarModel  calendar = AmbitionApp.GetModel <CalendarModel>();
            DateTime       today    = calendar.Today;
            List <PartyVO> parties  = calendar.GetEvents <PartyVO>(today).Where(p => p.RSVP == RSVP.New).ToList();

            if (Util.RNG.Generate(0, 3) == 0)            // Chance of a random future engagement
            {
                PartyVO party = new PartyVO
                {
                    InvitationDate = today,
                    Date           = today.AddDays(Util.RNG.Generate(1, 8) + Util.RNG.Generate(1, 8)), // +2d8 days
                    RSVP           = RSVP.New
                };
                AmbitionApp.Execute <InitPartyCmd, PartyVO>(party);
                parties.Add(party);
            }
            parties.ForEach(p => AmbitionApp.OpenDialog(RSVPDialog.DIALOG_ID, p));
        }
コード例 #4
0
        public void Execute(CommodityVO reward)
        {
            if (reward.ID != null)
            {
                PartyConfig config = UnityEngine.Resources.Load <PartyConfig>("Parties/" + reward.ID);
                if (config != null && config.Party != null)
                {
                    CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();
                    PartyVO       party    = config.Party;
                    AmbitionApp.Execute <InitPartyCmd, PartyVO>(party);
                    party.RSVP           = (RSVP)reward.Value;
                    party.InvitationDate = calendar.Today;

                    if (default(DateTime) == party.Date)
                    {
                        party.Date = calendar.Today;
                    }

                    calendar.Schedule(party);

                    if (party.RSVP == RSVP.Accepted && party.Date == calendar.Today)
                    {
                        AmbitionApp.GetModel <PartyModel>().Party = party;
                    }
                }
                else
                {
                    UnityEngine.Debug.Log("Warning: PartyReward.cs: No party with ID \"" + reward.ID + "\" exists!");
                }
                config = null;
                UnityEngine.Resources.UnloadUnusedAssets();
            }
            else
            {
                UnityEngine.Debug.Log("Warning: PartyReward.cs: No party ID specified!");
            }
        }
コード例 #5
0
        public void Execute(string playerID)
        {
            GameModel game = AmbitionApp.Game;

            if (!game.Initialized)
            {
                AmbitionApp.Execute <InitGameCmd>();
            }
            IncidentModel incidentModel = AmbitionApp.GetModel <IncidentModel>();
            CalendarModel calendar      = AmbitionApp.GetModel <CalendarModel>();

            AmbitionApp.Execute <InitPlayerCmd, string>(playerID);
            List <IncidentVO> incidents = new List <IncidentVO>(incidentModel.Incidents.Values);

            foreach (IncidentVO incident in incidents)
            {
                if (incident.IsScheduled)
                {
                    incidentModel.Schedule(incident, incident.Date);
                }
            }
            IncidentVO incdent = incidentModel.UpdateIncident();

            game.Tutorials = new List <string>()
            {
                TutorialConsts.TUTORIAL_INCIDENT,
                TutorialConsts.TUTORIAL_CREDIBILITY,
                TutorialConsts.TUTORIAL_EXHAUSTION,
                TutorialConsts.TUTORIAL_PERIL,
                TutorialConsts.TUTORIAL_ALLEGIANCE,
                TutorialConsts.TUTORIAL_POWER,
                TutorialConsts.TUTORIAL_LIVRE
            };
            AmbitionApp.UFlow.Register <IncidentTutorialController>(TutorialConsts.TUTORIAL_INCIDENT);
            AmbitionApp.UFlow.Invoke(FlowConsts.GAME_CONTROLLER);
            AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public override void OnClose()
 {
     AmbitionApp.Execute <BorrowMoneyCmd>();
     base.OnClose();
 }
コード例 #8
0
ファイル: InitGameCmd.cs プロジェクト: rasmus-z/DeWinter
        public void Execute(PlayerConfig config)
        {
            AmbitionApp.RegisterModel <LocalizationModel>();
            AmbitionApp.RegisterModel <GameModel>();
            AmbitionApp.RegisterModel <FactionModel>();
            AmbitionApp.RegisterModel <InventoryModel>();
            AmbitionApp.RegisterModel <ServantModel>();
            AmbitionApp.RegisterModel <CalendarModel>();
            AmbitionApp.RegisterModel <PartyModel>();
            AmbitionApp.RegisterModel <CharacterModel>();
            AmbitionApp.RegisterModel <QuestModel>();
            AmbitionApp.RegisterModel <MapModel>();
            AmbitionApp.RegisterModel <ConversationModel>();
            AmbitionApp.RegisterModel <ParisModel>();

            // Initialize Selected Player
            AmbitionApp.GetModel <GameModel>().PlayerName = config.name;
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            Array.ForEach(config.Incidents, i => calendar.Schedule(i.Incident));

            AmbitionApp.RegisterCommand <SellItemCmd, ItemVO>(InventoryMessages.SELL_ITEM);
            AmbitionApp.RegisterCommand <BuyItemCmd, ItemVO>(InventoryMessages.BUY_ITEM);
            AmbitionApp.RegisterCommand <GrantRewardCmd, CommodityVO>();
            AmbitionApp.RegisterCommand <GrantRewardsCmd, CommodityVO[]>();
            AmbitionApp.RegisterCommand <CheckMilitaryReputationCmd, FactionVO>();
            AmbitionApp.RegisterCommand <IntroServantCmd, ServantVO>(ServantMessages.INTRODUCE_SERVANT);
            AmbitionApp.RegisterCommand <HireServantCmd, ServantVO>(ServantMessages.HIRE_SERVANT);
            AmbitionApp.RegisterCommand <FireServantCmd, ServantVO>(ServantMessages.FIRE_SERVANT);
            AmbitionApp.RegisterCommand <QuitCmd>(GameMessages.QUIT_GAME);
            AmbitionApp.RegisterCommand <GoToRoomCmd, RoomVO>(MapMessage.GO_TO_ROOM);
            AmbitionApp.RegisterCommand <InvokeMachineCmd, string>(PartyMessages.START_PARTY, "PartyController");
            AmbitionApp.RegisterCommand <UpdatePartyCmd, PartyVO>();
            AmbitionApp.RegisterCommand <SelectDateCmd, DateTime>(CalendarMessages.SELECT_DATE);
            AmbitionApp.RegisterCommand <AdvanceDayCmd>(CalendarMessages.NEXT_DAY);
            AmbitionApp.RegisterCommand <CreateEnemyCmd, string>(GameMessages.CREATE_ENEMY);
            AmbitionApp.RegisterCommand <AdjustFactionCmd, AdjustFactionVO>(FactionConsts.ADJUST_FACTION);
            AmbitionApp.RegisterCommand <EquipItemCmd, ItemVO>(InventoryMessages.EQUIP);
            AmbitionApp.RegisterCommand <UnequipItemCmd, ItemVO>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <UnequipSlotCmd, string>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <AddLocationCmd, string>(ParisMessages.ADD_LOCATION);
            AmbitionApp.RegisterCommand <RemoveLocationCmd, string>(ParisMessages.REMOVE_LOCATION);
            AmbitionApp.RegisterCommand <InvokeMachineCmd, string>(IncidentMessages.START_INCIDENT, "IncidentController");
            AmbitionApp.RegisterCommand <GoToPartyCmd, PartyVO>(PartyMessages.GO_TO_PARTY);
            AmbitionApp.RegisterCommand <RestockMerchantCmd, DateTime>();

            // Party
            AmbitionApp.RegisterCommand <TargetGuestCmd, GuestVO>(PartyMessages.TARGET_GUEST);
            AmbitionApp.RegisterCommand <SelectGuestCmd, GuestVO>(PartyMessages.SELECT_GUEST);
            AmbitionApp.RegisterCommand <EnemyAttackCmd, EnemyVO>(PartyMessages.GUEST_SELECTED);
            AmbitionApp.RegisterCommand <GuestSelectedCmd, GuestVO>(PartyMessages.GUEST_SELECTED);
            AmbitionApp.RegisterCommand <GuestIgnoredCmd, GuestVO>(PartyMessages.GUEST_IGNORED);
            AmbitionApp.RegisterCommand <CharmGuestCmd, GuestVO>(PartyMessages.GUEST_CHARMED);
            AmbitionApp.RegisterCommand <OffendGuestCmd, GuestVO>(PartyMessages.GUEST_OFFENDED);
            AmbitionApp.RegisterCommand <AmbushCmd, RoomVO>(PartyMessages.AMBUSH);
            AmbitionApp.RegisterCommand <FillHandCmd>(PartyMessages.FILL_REMARKS);
            AmbitionApp.RegisterCommand <RefillDrinkCmd>(PartyMessages.REFILL_DRINK);
            AmbitionApp.RegisterCommand <GrantRemarkCmd>(PartyMessages.FREE_REMARK);
            AmbitionApp.RegisterCommand <BurnCmd, int>(PartyMessages.BURN_REMARKS);
            AmbitionApp.RegisterCommand <DiscardCmd, RemarkVO>(PartyMessages.DISCARD);
            AmbitionApp.RegisterCommand <ReshuffleCmd, int>(PartyMessages.RESHUFFLE_REMARKS);
            AmbitionApp.RegisterCommand <DrawCmd, int>(PartyMessages.DRAW_REMARKS);
            AmbitionApp.RegisterCommand <DrawOneCmd>(PartyMessages.DRAW_REMARK);
            AmbitionApp.RegisterCommand <SetFashionCmd, PartyVO>(PartyMessages.PARTY_STARTED);
            AmbitionApp.RegisterCommand <FactionTurnModifierCmd, PartyVO>(PartyMessages.PARTY_STARTED);
            AmbitionApp.RegisterCommand <RoomChoiceCmd, RoomVO>();
            AmbitionApp.RegisterCommand <EndPartyCmd>(PartyMessages.END_PARTY);

            AmbitionApp.RegisterCommand <PayDayCmd, DateTime>();
            AmbitionApp.RegisterCommand <RestockMerchantCmd, DateTime>();
            AmbitionApp.RegisterCommand <CheckLivreCmd, int>(GameConsts.LIVRE);

            // Paris
            AmbitionApp.RegisterCommand <RestAtHomeCmd>(ParisMessages.REST);
            AmbitionApp.RegisterCommand <ChooseLocationCmd, LocationPin>(ParisMessages.GO_TO_LOCATION);
            AmbitionApp.RegisterCommand <LoadLocationCmd>(ParisMessages.LOAD_LOCATION);

            // Initially enabled for TUTORIAL
            AmbitionApp.RegisterCommand <StartTutorialCmd>(GameMessages.START_TUTORIAL);
            AmbitionApp.RegisterCommand <SkipTutorialCmd>(GameMessages.SKIP_TUTORIAL);

            // Rewards
            AmbitionApp.RegisterReward <LivreReward>(CommodityType.Livre);
            AmbitionApp.RegisterReward <RepReward>(CommodityType.Reputation);
            AmbitionApp.RegisterReward <GossipReward>(CommodityType.Gossip);
            AmbitionApp.RegisterReward <EnemyReward>(CommodityType.Enemy);
            AmbitionApp.RegisterReward <ItemReward>(CommodityType.Item);
            AmbitionApp.RegisterReward <ServantReward>(CommodityType.Servant);
            AmbitionApp.RegisterReward <MessageReward>(CommodityType.Message);
            AmbitionApp.RegisterReward <IncidentReward>(CommodityType.Incident);
            AmbitionApp.RegisterReward <LocationReward>(CommodityType.Location);
            AmbitionApp.RegisterReward <PartyReward>(CommodityType.Party);

            AmbitionApp.Execute <RegisterPartyControllerCmd>();
            AmbitionApp.Execute <RegisterConversationControllerCmd>();
            AmbitionApp.Execute <RegisterEstateControllerCmd>();
            AmbitionApp.Execute <RegisterIncidentControllerCmd>();
            AmbitionApp.Execute <RegisterGuestActionControllerCmd>();
            AmbitionApp.Execute <RegisterParisControllerCmd>();

            AmbitionApp.InvokeMachine("EstateController");
        }
コード例 #9
0
 public void PickCharacter()
 {
     AmbitionApp.Execute <InitGameCmd, PlayerConfig>(_selected);
 }
コード例 #10
0
 public void NewGame()
 {
     AmbitionApp.Execute <NewGameCmd, string>(Players[0]);
 }
コード例 #11
0
 public void Continue()
 {
     AmbitionApp.SendMessage(AudioMessages.PLAY, ClickSound);
     AmbitionApp.Execute <ContinueGameCmd>();
 }