Ejemplo n.º 1
0
 public Main(CoroutineProvider coroutineProvider, IGameStateFactory gameStateFactory, SignalBus signalBus)
 {
     _coroutineProvider = coroutineProvider;
     _gameStateFactory  = gameStateFactory;
     _signalBus         = signalBus;
     _initGameState     = _gameStateFactory.Create <InitGameState>();
     _signalBus.Subscribe <GameSignals.GotoStateSignal>(m => TriggerStateSwitch(m));
 }
        public Match3SimulationController(SignalBus signalBus, EntityManager entityManager, BoardModel boardModel, GameStateModel gameStateModel, CoroutineProvider coroutineProvider)
        {
            this.gameStateModel    = gameStateModel;
            this.boardModel        = boardModel;
            this.entityManager     = entityManager;
            this.signalBus         = signalBus;
            this.coroutineProvider = coroutineProvider;

            EntitiesHelper.Initialize(entityManager);
        }
Ejemplo n.º 3
0
    //---------------------------------------------------------------------------------------------------------------
    void Awake() //_Game uses only awake, so it will be initiated before everything else.
    {
        InitStarted = true;
        DontDestroyOnLoad(gameObject);


        Application.runInBackground           = true;
        Application.backgroundLoadingPriority = ThreadPriority.Low;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#if UNITY_STANDALONE
        Screen.SetResolution((int)(Screen.height * 9 / 16f), Screen.height, false);
#endif
        Application.targetFrameRate = 60;


        // Easy Mobile part. Remove if not used.
        //if (!RuntimeManager.IsInitialized())
        //{
        //  Debug.Log("starting EasyMobile");
        //  RuntimeManager.Init();

        //  if (!RuntimeManager.IsInitialized())
        //  {
        //    Debug.LogError("Easy Mobile not initialized.");
        //  }
        //}

        StateManager    = GetComponentInChildren <StateManager>();
        AudioManager    = GetComponentInChildren <AudioManager>();
        PoolManager     = GetComponentInChildren <PoolManager>();
        UiManager       = GetComponentInChildren <UIManager>();
        TutorialManager = GetComponentInChildren <TutorialManager>();

        Swipe       = GetComponentInChildren <SwipeManager>();
        Game_Camera = GetComponentInChildren <Game_Camera>();
        Game_Canvas = GetComponentInChildren <Game_Canvas>();


        // LocParam = GetComponentInChildren<LocParam>();

        //  IAPManager = GetComponentInChildren<IAPManager>();
        AdsManager = GetComponentInChildren <AdsManager>();


        Settings          = new Settings();
        Events            = new Events();
        CoroutineProvider = new CoroutineProvider(this);
        TimeScale         = new TimeScaleProvider();
        TimerManager      = new TimerManager(TimeScale);
        Tracking          = new TrackingManager();


        GameBase.UnityDataInitializer.CopyUnityData();
    }
Ejemplo n.º 4
0
        private void RequestAuthorization()
        {
            Log.Debug("Checking internet...");

            InternetReachabilityController.Check(reachable =>
            {
                Log.Debug(log =>
                {
                    log.Debug(reachable ? "Internet is reachable" : "Internet not reachable");
                    log.Debug("Requesting authorization...");
                });

                CoroutineProvider.StartCoroutine(RequestAuthorizationCoroutine(AuthorizationOptions, reachable), out _coroutine);
            });
        }
Ejemplo n.º 5
0
    /// <summary>
    /// Initialize this instance.
    /// We must follow special sequnce.
    /// 仅且仅初始化一次
    /// </summary>
    public static void Initialize(EngineCfg cfg)
    {
        ConsoleEx.DebugLog("Core Engine is initializing ....", ConsoleEx.YELLOW);
        //Initial sequnce
        DevFSM  = DeviceFSM.Instance;
        GameFSM = GamePlayFSM.Instance;
        EngCfg  = cfg;

        if (GameFSM.InitOK == Consts.FAILURE)
        {
            //Have one NetMQContext ONLY. This will be used to created ALL sockets within the process.
            ZeroMQ = NetMQContext.Create();

            //DataPersisteManager should be initialize first. and tell the non-account path
            DPM = LocalIOManager.getInstance(DeviceInfo.PersistRootPath);
            //Unity UI Basically Manager
            EntityMgr = new EntityManager();
            //Timer should run.
            TimerEng = new TimerMaster();
            //Sound manager.
            SoundEng = SoundEngine.GetSingleton();
            //EventCenter must initialize later than Network Engine
            NetEng = new NetworkEngine();
            //EventCenter also must initialize later than Aysnc Engine
            AsyncEng = AsyncTask.Current;
            //Coroutine
            Coroutine = CoroutineProvider.Instance();

            EVC    = new EventCenter(NetEng.httpEngine, NetEng.SockEngine, EntityMgr);
            ResEng = new Loader();

            Data = new DataCore();

            //register some vars.
            CoreParam();
        }
        else
        {
            //TODO: 此分支是初始化一次OK后,注销之后进入的分支情况
        }

        RegisterInterface();
        ConsoleEx.DebugLog("Core Engine is initialized ....", ConsoleEx.YELLOW);
        GameFSM.OnInitOk();
    }
Ejemplo n.º 6
0
 public GameFlowDirector(CoroutineProvider coroutineProvider, IGameStateMachine gameStateMachine)
 {
     _coroutineProvider = coroutineProvider;
     _gameStateMachine  = gameStateMachine;
 }
Ejemplo n.º 7
0
 public SimpleAssetProvider(CoroutineProvider coroutineProvider)
 {
     _coroutineProvider = coroutineProvider;
 }
Ejemplo n.º 8
0
 public void PreDestroy()
 {
     CoroutineProvider.StopCoroutine(ref _coroutine);
     AsyncResolver.CancelCall(ref _callId);
 }
Ejemplo n.º 9
0
 public DummyStarter(GameModel gameModel, CoroutineProvider coroutineProvider, IAssetService assetService)
 {
     _gameModel         = gameModel;
     _coroutineProvider = coroutineProvider;
     _assetService      = assetService;
 }
Ejemplo n.º 10
0
 public AppStarter(CoroutineProvider coroutineProvider, IGameStateMachine gameStateMachine, GameStateFactory gameStateFactory)
 {
     _coroutineProvider = coroutineProvider;
     _gameStateMachine  = gameStateMachine;
     _gameStateFactory  = gameStateFactory;
 }