Example #1
0
        private void appearArrangement(IPlayerArrangementTarget arrangementTarget, GameObject prefab, bool isReserve = false)
        {
            arrangementTarget.ArrangementPositions.ForEach(arrangementPosition => {
                var instance = Object.AppearToFloor(prefab, gameObject, new Vector3(
                                                        arrangementPosition.x * ArrangementAnnotater.ArrangementWidth,
                                                        0,
                                                        arrangementPosition.z * ArrangementAnnotater.ArrangementHeight
                                                        ));

                Debug.Assert(instance != null, "Arrangement が生成されていません");
                Debug.Assert(instance.GetComponent <ArrangementView> () != null, "Arrangement の ArrangementView が設定されておりません。");

                var arrangementView = instance.GetComponent <ArrangementView> ();

                // 選択時の挙動を追加
                if (!isReserve)
                {
                    arrangementView.OnSelect
                    .Subscribe(_ => {
                        // 予約状態の場合はメニューを出さない。
                        if (arrangementTarget.PlayerArrangementTargetModel.State == ArrangementTargetState.Reserve)
                        {
                            return;
                        }
                        // メニューを変更する
                        GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateArrangementMenuSelectMode(arrangementTarget));
                    });
                }

                this.instances.Add(instance);
            });
        }
Example #2
0
        public void OnEnter()
        {
            GameManager.Instance.TimeManager.Pause();

            // 変化前の情報
            Currency     prevCurrency        = GameManager.Instance.Wallet.Current;
            Satisfaction currentSatisfaction = this.satisfactionCalculater.CalcFieldSatisfaction();

            // 日銭の計算と付与を行う
            var dailyEarn = dailyEarnCalculater.CalcEarnFromSatisfaction();

            GameManager.Instance.Wallet.Push(dailyEarn);
            GameManager.Instance.EffectManager.PlayEarnEffect(dailyEarn, GameManager.Instance.MouseHomeManager.HomePostion);

            // 変化後の計算
            Currency nextCurrency = GameManager.Instance.Wallet.Current;

            // 一日の終りダイアログを出す
            this.DoDailyEnd();
            GameManager.Instance.GameUIManager.DailyEndPresenter.Show();
            GameManager.Instance.GameUIManager.DailyEndPresenter.SetCurrentChangeInfo(prevCurrency, nextCurrency, currentSatisfaction);
            this.disposable = GameManager.Instance.GameUIManager.DailyEndPresenter.OnClose
                              .SelectMany(_ => {
                // 一日の始まりダイアログを出す
                this.DoDailyStart();
                GameManager.Instance.GameUIManager.DailyStartPresenter.Show();
                return(GameManager.Instance.GameUIManager.DailyStartPresenter.OnClose);
            })
                              .Subscribe(_ => {
                // 選択画面に移動する
                GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
            });
        }
Example #3
0
 public void OnEnter()
 {
     GameManager.Instance.GameUIManager.OnegaiPresenter.Show();
     GameManager.Instance.TimeManager.Pause();
     this.disposable = GameManager.Instance.GameUIManager.OnegaiPresenter.OnClose
                       .Subscribe(_ => {
         GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
     });
 }
Example #4
0
 public void OnUpdate()
 {
     if (GameManager.Instance.GameUIManager.DailyEndPresenter.IsShow())
     {
         return;
     }
     if (GameManager.Instance.GameUIManager.DailyStartPresenter.IsShow())
     {
         return;
     }
     // どちらも表示していなかったら、選択画面に移動する
     GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
 }
Example #5
0
        public void OnUpdate()
        {
            if (!GameManager.Instance.MonoSelectManager.HasSelectedMonoInfo)
            {
                return;
            }

            Debug.Assert(GameManager.Instance.MouseStockManager.IsConsume(), "オーダーできないのにモノが選択されました。");

            // なんかここで入れてあげるのは違う気もする
            this.context.SelectMonoInfo(GameManager.Instance.MonoSelectManager.SelectedMonoInfo);

            GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateArrangementMode());
        }
        public void Initialize()
        {
            // バックボタンを押した時
            backButton.onClick.AddListener(() => {
                GameManager.Instance.ArrangementManager.UnReserveArrangementAll();
                GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateMenuSelectMode());
            });
            // スタートボタンを押した時
            startButton.onClick.AddListener(() => {
                GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
            });

            this.Close();
        }
Example #7
0
        public void UpdateByFrame()
        {
            if (!this.isInitialize)
            {
                var span = DayTextConverter.ConvertSpan(GameManager.Instance.TimeManager.ElapsedTime);
                this.prevDay      = span.Days;
                this.isInitialize = true;
            }

            if (this.IsOverDay())
            {
                GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateDailyChangeMode());
                this.OverDay();
            }
        }
        public AppearCharacterViewModel(AppearCharacterView appearCharacterView, PlayerAppearCharacterViewModel playerAppearCharacterViewModel)
        {
            this.appearCharacterView            = appearCharacterView;
            this.PlayerAppearCharacterViewModel = playerAppearCharacterViewModel;

            // キャラクタがタップされた時
            disposables.Add(appearCharacterView.OnSelectObservable
                            .SelectMany(_ => {
                var conversationMode = GameModeGenerator.GenerateConversationMode(this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel.ConversationModel);
                GameManager.Instance.GameModeManager.EnqueueChangeModeWithHistory(conversationMode);
                return(GameManager.Instance.GameModeManager.GetModeEndObservable(conversationMode));
            })
                            .SelectMany(_ => {
                if (this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel.RewardModel == null)
                {
                    return(new ImmediatelyObservable <int>(_));
                }
                if (this.PlayerAppearCharacterViewModel.IsReceiveReward)
                {
                    return(new ImmediatelyObservable <int>(_));
                }
                if (this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel.RewardModel.RewardAmounts.Count <= 0)
                {
                    return(new ImmediatelyObservable <int>(_));
                }

                // 受け取り済みにする
                GameManager.Instance.AppearCharacterManager.ToReeiveRewards(this.PlayerAppearCharacterViewModel);

                var rewardMode = GameModeGenerator.GenerateReceiveRewardMode(this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel.RewardModel);
                GameManager.Instance.GameModeManager.EnqueueChangeModeWithHistory(rewardMode);
                return(GameManager.Instance.GameModeManager.GetModeEndObservable(rewardMode));
            })
                            .Subscribe(_ => {
                // TODO 終了後に撤退の動作を始める
                // 予約から消す必要があれば消す
                if (GameManager.Instance.DailyAppearCharacterRegistManager.IsRemoveReserve(this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel))
                {
                    GameManager.Instance.DailyAppearCharacterRegistManager.RemoveReserve(this.PlayerAppearCharacterViewModel.PlayerAppearCharacterReserveModel);
                }
            }));
        }
Example #9
0
        public void Initialize(IPlayerMonoInfoRepository playerMonoInfoRepository)
        {
            this.playerMonoInfoRepository = playerMonoInfoRepository;

            Debug.Assert(this.tabButtons.Count > 0, "タブの項目がありません");
            Debug.Assert(this.tabButtons.Count == this.displayMonoType.Count, "ボタンとタイプの個数が異なります。");

            for (int buttonIndex = 0; buttonIndex < this.tabButtons.Count; buttonIndex++)
            {
                var button   = this.tabButtons[buttonIndex];
                var monoType = this.displayMonoType[buttonIndex];

                button.onClick.AddListener(() => {
                    this.SelectTab(button, monoType);
                });
            }

            closeButton.onClick.AddListener(() => {
                GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
            });

            this.Close();
        }
Example #10
0
 private void DoFinishProcess()
 {
     GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateSelectMode());
     this.Close();
 }
Example #11
0
 public override void OnSelect(RaycastHit hit)
 {
     // 別で読んだほうがいいが、、とりあえず
     GameManager.Instance.GameModeManager.EnqueueChangeMode(GameModeGenerator.GenerateOnegaiSelectMode());
 }
 public void Inititialize()
 {
     this.mousePurchaseButton.onClick.AddListener(() => {
         if (!GameManager.Instance.GameModeManager.IsMousePurchaseMode)
         {
             GameManager.Instance.GameModeManager.EnqueueChangeModeWithHistory(GameModeGenerator.GenerateMousePurchaseMode());
         }
     });
 }
Example #13
0
        private void Start()
        {
            // コンテキストマップ
            ContextMap.Initialize();
            PlayerContextMap.Initialize();

            // レポジトリ
            var onegaiRepository                       = OnegaiRepository.GetRepository(ContextMap.DefaultMap);
            var eventRepository                        = EventRepository.GetRepository(ContextMap.DefaultMap);
            var monoInfoRepository                     = new MonoInfoRepository(ContextMap.DefaultMap);
            var mousePurchaceTableRepository           = new MousePurchaceTableRepository(ContextMap.DefaultMap);
            var conversationRepository                 = new ConversationRepository(ContextMap.DefaultMap);
            var rewardRepository                       = new RewardRepository(ContextMap.DefaultMap);
            var appearCharacterRepository              = new AppearCharacterRepository(ContextMap.DefaultMap);
            var playerOnegaiRepository                 = PlayerOnegaiRepository.GetRepository(ContextMap.DefaultMap, PlayerContextMap.DefaultMap);
            var playerEventRepository                  = PlayerEventRepository.GetRepository(ContextMap.DefaultMap, PlayerContextMap.DefaultMap);
            var playerMonoInfoRepository               = PlayerMonoInfoRepository.GetRepository(ContextMap.DefaultMap, PlayerContextMap.DefaultMap);
            var playerMouseStockRepository             = new PlayerMouseStockRepository(PlayerContextMap.DefaultMap);
            var playerMonoViewRepository               = new PlayerMonoViewRepository(monoInfoRepository, PlayerContextMap.DefaultMap);
            var playerArrangementTargetRepository      = new PlayerArrangementTargetRepository(monoInfoRepository, playerMonoViewRepository, PlayerContextMap.DefaultMap);
            var playerMouseViewRepository              = new PlayerMouseViewRepository(playerArrangementTargetRepository, PlayerContextMap.DefaultMap);
            var playerInfoRepository                   = new PlayerInfoRepository(PlayerContextMap.DefaultMap);
            var playerAppearCharacterReserveRepository = new PlayerAppearCharacterReserveRepository(appearCharacterRepository, conversationRepository, rewardRepository, PlayerContextMap.DefaultMap);
            var playerAppearCharacterViewRepository    = new PlayerAppearCharacterViewRepository(playerAppearCharacterReserveRepository, PlayerContextMap.DefaultMap);

            // ゲームのコンテキストマップ
            GameContextMap.Initialize(playerArrangementTargetRepository);

            // instance
            this.inputManager         = new InputManager();
            this.wallet               = new Wallet(new Currency(0), playerInfoRepository);                            // 所持金の初期値も外出ししたい
            this.arrangementItemStore = new ArrangementItemStore(new ArrangementItemAmount(0), playerInfoRepository); // 所持アイテムの初期値も外出ししたい
            this.arrangementManager   = new ArrangementManager(this.rootObject, playerOnegaiRepository, playerArrangementTargetRepository);
            this.monoManager          = new MonoManager(this.rootObject, playerMonoViewRepository);
            this.effectManager        = new EffectManager(mainCamera, rootEffectUI);
            this.gameModeManager      = new GameModeManager();
            this.gameModeManager.EnqueueChangeModeWithHistory(GameModeGenerator.GenerateSelectMode());
            this.fieldRaycastManager = new FieldRaycastManager(this.mainCamera);
            //            this.mouseSelectManager = new MouseSelectManager();
            this.monoSelectManager                 = new MonoSelectManager();
            this.timeManager                       = new TimeManager(playerInfoRepository);
            this.mouseHomeManager                  = new MouseHomeManager(this.rootObject);
            this.onegaiHomeManager                 = new OnegaiHomeManager(this.rootObject);
            this.mouseStockManager                 = new MouseStockManager(this.rootObject, playerMouseStockRepository, playerMouseViewRepository);
            this.dailyActionManager                = new DailyActionManager();
            this.eventManager                      = new EventManager(playerEventRepository);
            this.constantlyEventPusher             = new ConstantlyEventPusher(playerOnegaiRepository);
            this.appearCharacterManager            = new AppearCharacterManager(this.rootObject, playerAppearCharacterViewRepository);
            this.dailyAppearCharacterRegistManager = new DailyAppearCharacterRegistManager(playerAppearCharacterReserveRepository);
            this.onegaiMediaterManager             = new OnegaiMediaterManager(playerOnegaiRepository);
            this.onegaiManager                     = new OnegaiManager(playerOnegaiRepository);
            this.monoReleaseManager                = new MonoReleaseManager(playerMonoInfoRepository);
            this.reserveAmountManager              = new ReserveAmountManager();
            this.cameraMoveManager                 = new CameraMoveManager(this.mainCamera.transform);

            // initialize
            this.arrangementPresenter.Initialize(playerArrangementTargetRepository);
            this.gameUIManager.Initialize(onegaiRepository, playerOnegaiRepository, monoInfoRepository, playerMonoInfoRepository, mousePurchaceTableRepository, playerMouseStockRepository);
            this.mouseHomeManager.Initialize();
            this.onegaiHomeManager.Initialize();
            this.inputManager.Initialize();

            // Service
            var initializePlayerInfoService = new InitializePlayerInfoService(playerInfoRepository);

            initializePlayerInfoService.Execute();
            var onegaiUnLockService = new OnegaiUnLockService(onegaiRepository, playerOnegaiRepository);

            onegaiUnLockService.Execute();
            var onegaiUnLockChacheService = new OnegaiUnLockChacheService(playerOnegaiRepository);

            onegaiUnLockChacheService.Execute();
            var eventUnLockService = new EventUnLockService(eventRepository, playerEventRepository);

            eventUnLockService.Execute();
            var initialArrangementService = new InitialArrangementService(playerArrangementTargetRepository);

            initialArrangementService.Execute();
            var initializeOrderedMouseService = new InitializeOrderedMouseService(playerMouseViewRepository);

            initializeOrderedMouseService.Execute();
            var initializeAppearCharacterService = new InitializeAppearCharacterService(playerAppearCharacterReserveRepository, playerAppearCharacterViewRepository);

            initializeAppearCharacterService.Execute();
        }
Example #14
0
 public void GoToEvent()
 {
     GameManager.Instance.GameModeManager.EnqueueChangeModeWithHistory(GameModeGenerator.GenerateEventMode());
     this.IsToEvent = false;
 }