コード例 #1
0
 public void Init(AddNewPlayer addNewPlayer, StartNewGame startNewGame, InitDefusing initDefusing,
                  SetNewDefuseAttempt setNewDefuseAttempt,
                  TryToDefuse tryToDefuse,
                  ChangeCurrentView changeCurrentView,
                  AllPlayerControllers allPlayerControllers, IUIController uiController,
                  NetworkBehaviourChecker networkBehaviourChecker,
                  ISpotTheDefuserNetworkDiscovery spotTheDefuserNetworkDiscovery)
 {
     _initDefusing                   = initDefusing;
     _setNewDefuseAttempt            = setNewDefuseAttempt;
     _spotTheDefuserNetworkDiscovery = spotTheDefuserNetworkDiscovery;
     _networkBehaviourChecker        = networkBehaviourChecker;
     _changeCurrentView              = changeCurrentView;
     _startNewGame                   = startNewGame;
     _addNewPlayer                   = addNewPlayer;
     _tryToDefuse          = tryToDefuse;
     _allPlayerControllers = allPlayerControllers;
     _uiController         = uiController;
 }
コード例 #2
0
        public void Init()
        {
            var allPlayers   = Substitute.For <AllPlayers>();
            var defusingTime = Substitute.For <IDefusingTime>();
            var defusingTimerUpdatedListener = Substitute.For <IDefusingTimerUpdatedListener>();
            var defuseFailedListener         = Substitute.For <IDefuseFailedListener>();
            var defuseSucceededListener      = Substitute.For <IDefuseSucceededListener>();
            var defusingState = Substitute.For <DefusingState>(
                defusingTime, defusingTimerUpdatedListener, defuseFailedListener
                );
            var stdRandom  = Substitute.For <IRandom>();
            var deviceInfo = Substitute.For <IDeviceInfo>();

            _uiController = Substitute.For <IUIController>();

            _addNewPlayer        = Substitute.For <AddNewPlayer>(allPlayers, null);
            _setNewDefuseAttempt = Substitute.For <SetNewDefuseAttempt>(stdRandom, allPlayers,
                                                                        Substitute.For <AllBombs>(stdRandom, new IBomb[0], deviceInfo),
                                                                        defusingState, new DefuserCounter(),
                                                                        Substitute.For <INewDefuseAttemptSetListener>());
            _initDefusing = Substitute.For <InitDefusing>(defusingState);
            _startNewGame = Substitute.For <StartNewGame>(Substitute.For <INewGameStartedListener>());
            _tryToDefuse  = Substitute.For <TryToDefuse>(
                defusingState, defuseSucceededListener, defuseFailedListener,
                Substitute.For <IAnalyticsSubmitter>()
                );
            _changeCurrentView = Substitute.For <ChangeCurrentView>(Substitute.For <IViewManager>());

            _networkBehaviourChecker = Substitute.For <NetworkBehaviourChecker>();

            _allPlayerControllers = new AllPlayerControllers(allPlayers);

            _spotTheDefuserNetworkDiscovery = Substitute.For <ISpotTheDefuserNetworkDiscovery>();

            _playerController = new GameObject().AddComponent <PlayerController>();
            _playerController.Init(_addNewPlayer, _startNewGame, _initDefusing, _setNewDefuseAttempt, _tryToDefuse,
                                   _changeCurrentView, _allPlayerControllers, _uiController, _networkBehaviourChecker,
                                   _spotTheDefuserNetworkDiscovery);
        }