public static IsConsumeResult IsConsume(ArrangementResourceAmount amount, bool withReserve = true) { if (!GameManager.Instance.MouseStockManager.IsConsume(amount.MouseOrderAmount, withReserve)) { return(new IsConsumeResult(false, string.Format("MouseOrderAmount:{0}/{1}", amount.MouseOrderAmount, GameManager.Instance.MouseStockManager.MouseStockCount), ErrorReason.NoMouse)); } if (!GameManager.Instance.Wallet.IsConsume(amount.Currency, withReserve)) { return(new IsConsumeResult(false, string.Format("Currency:{0}/{1}", amount.Currency, GameManager.Instance.Wallet.Current), ErrorReason.NoCurrency)); } if (!GameManager.Instance.ArrangementItemStore.IsConsume(amount.ArrangementItemAmount, withReserve)) { return(new IsConsumeResult(false, string.Format("ArrangementItemStore:{0}/{1}", amount.ArrangementItemAmount, GameManager.Instance.ArrangementItemStore.Current), ErrorReason.NoArrangementItem)); } var monoIds = amount.ArrangementCount.GetCountedMonoInfos(); var monoRepository = new MonoInfoRepository(ContextMap.DefaultMap); var arrangementMaxCount = monoRepository.GetMaxCount(monoIds); foreach (var monoId in monoIds) { var currentCount = GameManager.Instance.ArrangementManager.GetAppearMonoCountById(monoId, withReserve); var maxCount = arrangementMaxCount.GetMaxCount(monoId); if (maxCount <= currentCount) { return(new IsConsumeResult(false, string.Format("currentCount:{0}:{1}/{2}", monoId, currentCount, maxCount), ErrorReason.NoArrangement)); } } return(new IsConsumeResult(true, "success", ErrorReason.UnKnown)); }
public static PlayerMonoInfoRepository GetRepository(ContextMap contextMap, PlayerContextMap playerContextMap) { IMonoInfoRepository MonoInfoRepository = new MonoInfoRepository(contextMap); return(new PlayerMonoInfoRepository(MonoInfoRepository, playerContextMap)); }
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(); }