Example #1
0
        public void Initialize()
        {
            string saveFile      = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.SAVE_FILE);
            string _autosavefile = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.AUTOSAVE);

            AmbitionApp.Game.Activity = ActivityType.Title;
            if (File.Exists(saveFile))
            {
                string          result = File.ReadAllText(saveFile);
                List <string[]> saves  = JsonConvert.DeserializeObject <List <string[]> >(result);
                if (saves == null)
                {
                    ErrorEventArgs error = new ErrorEventArgs(ErrorEventArgs.ErrorType.save_file, saveFile);
                    AmbitionApp.SendMessage(GameMessages.ERROR, error);
                    LoadGameBtn.gameObject.SetActive(File.Exists(saveFile));
                }
                else
                {
                    LoadGameBtn.gameObject.SetActive(saves.Count > 0);
                }
            }
            else
            {
                LoadGameBtn.gameObject.SetActive(false);
            }
            ContinueGameBtn?.gameObject.SetActive(File.Exists(_autosavefile));
            AmbitionApp.Subscribe <float>(GameMessages.FADE_OUT, HandleFade);
            AmbitionApp.SendMessage(AudioMessages.PLAY_MUSIC, StartupSound);
        }
Example #2
0
 void OnEnable()
 {
     _text  = _text ?? GetComponent <Text>();
     _livre = -1;
     AmbitionApp.Subscribe <int>(GameConsts.LIVRE, HandleLivre);
     HandleLivre(AmbitionApp.Game.Livre);
 }
Example #3
0
        void Awake()
        {
            _text = this.GetComponentInChildren <Text>();
            AmbitionApp.Subscribe <PartyVO>(HandleParty);

            HandleParty(AmbitionApp.GetModel <PartyModel>().Party);
        }
Example #4
0
 protected void InitGuest()
 {
     _index = transform.GetSiblingIndex();
     AmbitionApp.Subscribe <CharacterVO[]>(HandleGuests);
     AmbitionApp.Subscribe <CharacterVO>(HandleGuest);
     this.gameObject.SetActive(false);
 }
Example #5
0
 private void OnEnable()
 {
     AmbitionApp.Subscribe <RemarkVO>(HandleRemark);
     AmbitionApp.Subscribe <CharacterVO>(PartyMessages.GUEST_TARGETED, HandleGuestTargeted);
     AmbitionApp.Subscribe <int>(GameConsts.INTOXICATION, HandleIntoxication);
     On = false;
 }
Example #6
0
 void Awake()
 {
     AmbitionApp.Subscribe <MomentVO>(HandleMoment);
     AmbitionApp.Subscribe <IncidentVO>(IncidentMessages.START_INCIDENT, HandleIncident);
     AmbitionApp.Subscribe <string>(IncidentMessages.END_INCIDENT, HandleEndIncident);
     AmbitionApp.Subscribe <TransitionVO[]>(HandleTransitions);
 }
Example #7
0
 private void GoToRoom()
 {
     StopAllCoroutines();
     Fader.enabled = false;
     AmbitionApp.SendMessage(GameMessages.FADE_OUT);
     AmbitionApp.Subscribe(GameMessages.FADE_OUT_COMPLETE, OnFadeOut);
 }
 void Awake()
 {
     AmbitionApp.Subscribe <ItemVO>(InventoryMessages.DISPLAY_ITEM, HandleItemDisplay);
     AmbitionApp.Subscribe(InventoryMessages.BUY_ITEM, BlankStats); //Gotta wipe the slate once the item's been moved
     AmbitionApp.Subscribe(InventoryMessages.SELL_ITEM, BlankStats);
     BlankStats();
 }
Example #9
0
 void OnEnable()
 {
     AmbitionApp.Subscribe <GuestVO>(PartyMessages.GUEST_TARGETED, HandleTargeted);
     AmbitionApp.Subscribe <GuestVO>(PartyMessages.GUEST_SELECTED, HandleSelected);
     AmbitionApp.Subscribe <RemarkVO>(HandleRemark);
     AmbitionApp.Subscribe <int>(GameConsts.INTOXICATION, HandleIntoxication);
 }
Example #10
0
        private void Awake()
        {
            PartyModel model = AmbitionApp.GetModel <PartyModel>();

            if (Map == null)
            {
                Map = model.LoadMap(transform.transform);
            }
            if (Map == null)
            {
                PrefabMap prefab = Array.Find(Maps, m => m.ID.ToLower() == model.Party.Faction.ToString().ToLower());
                if (prefab.Prefab == null)
                {
                    prefab = RNG.TakeRandom(Maps);
                }
                GameObject obj = Instantiate <GameObject>(prefab.Prefab, transform.transform);
                Map = obj.GetComponent <MapView>();
            }
            if (Map != null)
            {
                _rooms         = Map.GetComponentsInChildren <RoomView>();
                model.NumRooms = _rooms.Length;
                AmbitionApp.Subscribe <IncidentVO[]>(PartyMessages.SELECT_INCIDENTS, HandleIncidents);
                if (!string.IsNullOrEmpty(Map.Music.Name))
                {
                    AmbitionApp.SendMessage(AudioMessages.PLAY_MUSIC, Map.Music.Name);
                }
            }
        }
Example #11
0
 void Awake()
 {
     _text     = GetComponent <Text>();
     _calendar = AmbitionApp.GetModel <CalendarModel>();
     AmbitionApp.Subscribe <DateTime>(HandleDate);
     HandleDate(_calendar.Today);
 }
Example #12
0
 void OnEnable()
 {
     _month = AmbitionApp.Calendar.Today.Month;
     AmbitionApp.Subscribe <PartyVO>(HandlePartyUpdated);
     AmbitionApp.Calendar.Observe(HandleRefresh);
     AmbitionApp.Subscribe <RendezVO>(HandleRendezvous);
 }
Example #13
0
 void OnEnable()
 {
     _script = GetComponent <SpotlightView>();
     AmbitionApp.Subscribe <GuestVO>(PartyMessages.GUEST_TARGETED, HandleGuest);
     StopAllCoroutines();
     StartCoroutine(FlashCR());
 }
Example #14
0
        override public void Initialize()
        {
            MapModel model = AmbitionApp.GetModel <MapModel>();

            _room = Array.Find(model.Map.Rooms, r => r.HostHere);
            AmbitionApp.Subscribe(PartyMessages.SHOW_MAP, HandleMap);
            HandleMap();
        }
Example #15
0
 void Awake()
 {
     _model   = AmbitionApp.GetModel <MapModel>();
     _buttons = new Dictionary <RoomVO, RoomButton>();
     AmbitionApp.Subscribe(PartyMessages.SHOW_MAP, ShowMap);
     AmbitionApp.Subscribe(PartyMessages.SHOW_ROOM, Lock);
     AmbitionApp.Subscribe <string>(GameMessages.DIALOG_CLOSED, Unlock);
 }
Example #16
0
        void OnEnable()
        {
            int initialStat = GetInitialStat();

            FillImage.fillAmount = .01f * (float)initialStat;
            AmbitionApp.Subscribe <int>(GetMessageID(), HandleUpdate);
            UpdateText(initialStat);
        }
Example #17
0
 // Creates a private material used to the effect
 void Awake()
 {
     _material = new Material(Effect);
     AmbitionApp.Subscribe(GameMessages.FADE_OUT, HandleFadeOut);
     AmbitionApp.Subscribe(GameMessages.FADE_IN, HandleFadeIn);
     AmbitionApp.Subscribe <float>(GameMessages.FADE_OUT, HandleFadeOut);
     AmbitionApp.Subscribe <float>(GameMessages.FADE_IN, HandleFadeIn);
 }
 // Use this for initialization
 void Awake()
 {
     BlankStats();
     SetUpDictionary();
     AmbitionApp.Subscribe <Gossip>(InventoryMessages.DISPLAY_GOSSIP, HandleGossipStats);
     AmbitionApp.Subscribe(InventoryMessages.PEDDLE_GOSSIP, BlankStats); //Gotta wipe the slate once the item's been moved
     AmbitionApp.Subscribe(InventoryMessages.SELL_GOSSIP, BlankStats);
 }
Example #19
0
 private void Awake()
 {
     _gossip = null;
     BlankStats();
     AmbitionApp.Subscribe <Gossip>(InventoryMessages.DISPLAY_GOSSIP, DisplayGossip);
     AmbitionApp.Subscribe(InventoryMessages.SELL_GOSSIP, BlankStats);
     AmbitionApp.Subscribe(InventoryMessages.PEDDLE_GOSSIP, BlankStats);
 }
Example #20
0
 void Awake()
 {
     _background = gameObject.GetComponent <Image>();
     //AmbitionApp.Subscribe<IncidentVO>(IncidentMessages.START_INCIDENT, HandleIncident); This isn't working because Start Incident is the same message that creates this modal.
     //It never has a chance to listen for the message, because the message already happened
     AmbitionApp.Subscribe <MomentVO>(HandleMoment);
     SetIncidentTitle();
 }
Example #21
0
 void Awake()
 {
     _text   = GetComponentInChildren <Text>();
     _option = gameObject.transform.GetSiblingIndex();
     _btn    = gameObject.GetComponent <Button>();
     _btn.onClick.AddListener(OnClick);
     AmbitionApp.Subscribe <TransitionVO[]>(HandleTransitions);
 }
Example #22
0
        void OnEnable()
        {
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            AmbitionApp.Subscribe <DateTime>(CalendarMessages.VIEW_MONTH, HandleMonth);
            _btn.onClick.AddListener(HandleClick);
            _date = calendar.Today;
            _date.AddDays(1 - _date.Day);
        }
Example #23
0
        public void Awake()
        {
            LocalizationModel model = AmbitionApp.GetModel <LocalizationModel>();

            AmbitionApp.Subscribe <string>(GameMessages.SHOW_HEADER, SetHeaderTitle);
            AmbitionApp.Subscribe <string>(GameMessages.SCENE_LOADED, HandleSceneLoaded);
            AmbitionApp.Subscribe(GameMessages.HIDE_HEADER, ClearOverlays);
            SetHeaderTitle(model.HeaderTitlePhrase);
        }
Example #24
0
 void Start()
 {
     AmbitionApp.Subscribe(GameMessages.FADE_OUT, HandleFadeOut);
     AmbitionApp.Subscribe(GameMessages.FADE_IN, HandleFadeIn);
     AmbitionApp.Subscribe <float>(GameMessages.FADE_OUT, HandleFadeOut);
     AmbitionApp.Subscribe <float>(GameMessages.FADE_IN, HandleFadeIn);
     AmbitionApp.Subscribe(GameMessages.INTERRUPT_FADE, HandleInterruptFade);
     _blockerAlpha = FaderImage.color.a;
 }
Example #25
0
 void Awake()
 {
     _image    = GetComponent <Image>();
     _index    = transform.GetSiblingIndex();
     _animator = GetComponent <Animator>();
     AmbitionApp.Subscribe <RemarkVO[]>(HandleHand);
     AmbitionApp.Subscribe <RemarkVO>(HandleRemark);
     _savedPosition = RemarkViews[_index].localPosition;
 }
Example #26
0
 void Start()
 {
     Cursor.SetCursor(CursorRest, HotSpot, CursorMode);
     AmbitionApp.Subscribe <string>(GameMessages.SCENE_LOADED, HandleSceneLoaded);
     AmbitionApp.Subscribe <string>(GameMessages.DIALOG_OPENED, HandleDialogOpened);
     AmbitionApp.Subscribe <string>(GameMessages.DIALOG_CLOSED, HandleDialogClosed);
     AmbitionApp.Subscribe(GameMessages.FADE_OUT, HandleFadeOut);
     AmbitionApp.Subscribe <float>(GameMessages.FADE_OUT, HandleFadeOut);
     HandleSceneLoaded(sceneMediator.SceneID);
 }
 private void Awake()
 {
     AmbitionApp.Subscribe(InventoryMessages.BUY_ITEM, PopulateInventory); //Gotta wipe the slate once the item's been moved
     AmbitionApp.Subscribe(InventoryMessages.SELL_ITEM, PopulateInventory);
     AmbitionApp.Subscribe <string>(InventoryMessages.SORT_INVENTORY, SortInventory);
     SetSortTypes();
     SwitchToOutfitInventory();
     MerchantCheck();
     PopulateInventory();
 }
Example #28
0
 private void Awake()
 {
     AmbitionApp.Subscribe(InventoryMessages.PEDDLE_GOSSIP, PopulateInventory); //Gotta wipe the slate once the item's been moved
     AmbitionApp.Subscribe(InventoryMessages.SELL_GOSSIP, PopulateInventory);
     AmbitionApp.Subscribe <string>(InventoryMessages.SORT_INVENTORY, SortInventory);
     _inventorymodel.GossipSoldOrPeddled = 0; //This is used for determining if the player was caught selling gossip
     SetSortTypes();
     HideGossipSortList();
     SortInventory("Tier"); //Contains Populate Inventory in it already
 }
Example #29
0
        void Awake()
        {
            InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
            ItemVO         outfit;

            inventory.Equipped.TryGetValue(ItemConsts.OUTFIT, out outfit);
            _button = gameObject.GetComponent <Button>();
            AmbitionApp.Subscribe <ItemVO>(InventoryMessages.EQUIPPED, HandleOutfit);
            HandleOutfit(outfit);
        }
 void Awake()
 {
     if (!AmbitionApp.IsActiveMachine(TutorialConsts.TUTORIAL_MACHINE))
     {
         Destroy(this);
     }
     else
     {
         AmbitionApp.Subscribe(PartyMessages.SHOW_ROOM, HandleTutorialRoom);
     }
 }