Esempio n. 1
0
        public void Init()
        {
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);

            _eventWindow = _uiManager.GetWindow(UIWindowEnum.EVENT) as EventWindow;

            _mainScreenStateManager = _uiManager.Get_MainScreenStateManager();
            Assert.AreNotEqual(null, _mainScreenStateManager);

            _playerManager = Core.Instance.GetService <PlayerManager>();
            Assert.AreNotEqual(null, _playerManager);

            _uiAnimatorManager = Core.Instance.GetService <UIAnimatorManager>();
            Assert.AreNotEqual(null, _uiAnimatorManager);

            _audioService = Core.Instance.GetService <AudioService>();
            Assert.AreNotEqual(null, _audioService);

            _header = _uiManager.GetWindow(UIWindowEnum.HEADER) as Header;

            _scorePanel = _uiManager.GetWindow(UIWindowEnum.SCORE) as ScorePanel;

            InitEvents();

            _scorePanel.FillShop();
        }
Esempio n. 2
0
        public void Init()
        {
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);
            _chooseCarWindow = _uiManager.GetWindow(Enums.UIWindowEnum.CHOOSE_CAR) as ChooseCarWindow;
            Assert.AreNotEqual(null, _chooseCarWindow);
            _networkManager = Core.Instance.GetService <NetworkManager>();
            Assert.AreNotEqual(null, _networkManager);
            _multiplayerWindow = _uiManager.GetWindow(UIWindowEnum.MAIN_MULTIPLAYER) as MultiplayerWindow;
            Assert.AreNotEqual(null, _multiplayerWindow);

            _playerManager = Core.Instance.GetService <PlayerManager>();
            Assert.AreNotEqual(null, _playerManager);
        }
Esempio n. 3
0
        // I_STATES

        public void Enable()
        {
            _gameManager = Core.Instance.GetService <GameManager>();
            Assert.AreNotEqual(null, _gameManager);

            _statesManager = Core.Instance.GetService <StatesManager>();
            Assert.AreNotEqual(null, _statesManager);

            //
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);

            _mainScreenStateManager = _uiManager.Get_MainScreenStateManager();
            Assert.AreNotEqual(null, _mainScreenStateManager);

            _gameWindow = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as GameWindowAsyncMultiplayer;
            Assert.AreNotEqual(null, _gameWindow);

            _pauseWindow = _uiManager.GetWindow(UIWindowEnum.PAUSE_ASYNC) as PauseWindow;
            Assert.AreNotEqual(null, _pauseWindow);

            _audioService = Core.Instance.GetService <AudioService>();
            Assert.AreNotEqual(null, _audioService);
            //

            Debug.Log("Enable GAME_ASYNC");

            EventManager._init.Game.MenuButton.Resume += Resume;
            _pauseWindow.OnMenuClick += Menu;

            _gameManager.CreateGameHandler();

            //

            Assert.AreNotEqual(null, _gameWindow._objBackground);

            _gameWindow._objBackground.SetActive(false);

            // -------------------------------------------
            //

            // -------------------------------------------

            //
            _uiManager.ShowWindow(UIWindowEnum.SPLASH, true);
            _mainScreenStateManager.SwitchState(MainScreenStatesEnum.GAME_ASYNC);
        }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     _uiManager         = Core.Instance.GetService <UIManager>();
     _chooseTrackWindow = _uiManager.GetWindow(UIWindowEnum.CHOOSE_TRACK) as ChooseTrackWindow;
     Assert.AreNotEqual(null, NotificationsCanvas);
     Assert.AreNotEqual(null, GameAnswerCanvas);
     Assert.AreNotEqual(null, GameAnswerText);
 }
Esempio n. 5
0
        // I_STATE

        public void Enable()
        {
            if (_core == null)
            {
                _core           = Core.Instance;
                _networkManager = _core.GetService <NetworkManager>();
                _statesManager  = _core.GetService <StatesManager>();
                _playerManager  = _core.GetService <PlayerManager>();

                _uiManager    = _core.GetService <UIManager>();
                _splashScreen = _uiManager.GetWindow(UIWindowEnum.SPLASH) as SplashScreen;
            }

            _core.GetService <UIManager>().ShowWindow(UIWindowEnum.SPLASH, true);
            _statesManager.SwitchState(StatesEnum.Auth);
        }
Esempio n. 6
0
        public void Init(UpgradeItem item)
        {
            _uiManager       = Core.Instance.GetService <UIManager>();
            _chooseCarWindow = _uiManager.GetWindow(UIWindowEnum.CHOOSE_CAR) as ChooseCarWindow;

            //
            thisButton = gameObject.GetComponent <Button>();
            thisButton.interactable = true;
            this.item  = item;
            this.type  = item.UpgradeType;
            this.order = item.upgradeOrder;
            this.price = item.price.gold;

            priceLabel.text = String.Format("{0}", price);

            SetStatus();
        }
Esempio n. 7
0
        public void Init()
        {
            //NotificationManager.CancelAll();
            _uim   = Core.Instance.GetService <UIManager>();
            header = _uim.GetWindow(UIWindowEnum.HEADER) as Header;

            currentX2Minutes = (nowStamp - X2StartStamp) / 60;
            RegistrationNotification((X2EndStamp - nowStamp));
            currentX3Minutes = (nowStamp - X3StartStamp) / 60;
            RegistrationNotification((X3EndStamp - nowStamp));
            currentX4Minutes = (nowStamp - X4StartStamp) / 60;
            RegistrationNotification((X4EndStamp - nowStamp));
            SetOffAnim(GameObject.Find("CountImage2").GetComponent <Image>(), 2);
            Core.Instance.StartCor(StartX2Bonus());
            SetOffAnim(GameObject.Find("CountImage3").GetComponent <Image>(), 3);
            Core.Instance.StartCor(StartX3Bonus());
            SetOffAnim(GameObject.Find("CountImage4").GetComponent <Image>(), 4);
            Core.Instance.StartCor(StartX4Bonus());
        }
Esempio n. 8
0
        // METHODS

        private void InitVariables()
        {
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);

            _multiplayerWindow = _uiManager.GetWindow(UIWindowEnum.MAIN_MULTIPLAYER) as MultiplayerWindow;
            Assert.AreNotEqual(null, _multiplayerWindow);

            _chooseCarWindow = _uiManager.GetWindow(UIWindowEnum.CHOOSE_CAR) as ChooseCarWindow;
            Assert.AreNotEqual(null, _chooseCarWindow);

            _treeWindow = _uiManager.GetWindow(UIWindowEnum.TREE_UPGRADE) as TreeWindow;
            Assert.AreNotEqual(null, _treeWindow);

            _settingsWindow = _uiManager.GetWindow(UIWindowEnum.SETTINGS) as SettingsWindow;
            Assert.AreNotEqual(null, _settingsWindow);

            _chooseTrackWindow = _uiManager.GetWindow(UIWindowEnum.CHOOSE_TRACK) as ChooseTrackWindow;
            Assert.AreNotEqual(null, _chooseTrackWindow);

            //
            _gameWindowAsync = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as _AsyncMulty.GameWindowAsyncMultiplayer;
            Assert.AreNotEqual(null, _gameWindowAsync);

            _gameWindowSingleplayer = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_SINGLE) as _Single.GameWindowSingleplayer;
            Assert.AreNotEqual(null, _gameWindowSingleplayer);

            // tutorial

            _gameWindowTutorial = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_TUTORIAL) as _Tutorial.GameWindowTutorial;
            Assert.AreNotEqual(null, _gameWindowTutorial);

            _statisticPanel = _uiManager.GetWindow(UIWindowEnum.STATISTIC) as StatisticPanel;
            Assert.AreNotEqual(null, _statisticPanel);

            _scorePanel = _uiManager.GetWindow(UIWindowEnum.SCORE) as ScorePanel;
            Assert.AreNotEqual(null, _scorePanel);

            _eventWindow = _uiManager.GetWindow(UIWindowEnum.EVENT) as EventWindow;
            Assert.AreNotEqual(null, _eventWindow);
        }
Esempio n. 9
0
        public void Enable()
        {
            Debug.Log("MAIN_MULTIPLAYER_WINDOW  Enable");
            _audioService = Core.Instance.GetService <AudioService>();

            _uiManager = Core.Instance.GetService <UIManager>();
            _header    = _uiManager.GetWindow(UIWindowEnum.HEADER) as Header;
            _header.Show();
            _sPlayerP = Core.Instance.GetService <SafePlayerPrefs>();

            _mainScreenStateManager = _uiManager.Get_MainScreenStateManager();

            _eventSecvice = Core.Instance.GetService <EventService>();

            _notificationWindow = _uiManager.NotificationWindow;

            _enternetWindow = _uiManager.GetWindow(UIWindowEnum.IS_ENTERNET) as EnternetWindow;

            if (_core == null)
            {
                _core = Core.Instance;
            }
            _audioService.StartMenuMusic();

            _gameManager   = _core.GetService <GameManager>();
            _playerManager = _core.GetService <PlayerManager>();

            _multiplayerWindow = (MultiplayerWindow)_uiManager.GetWindow(UIWindowEnum.MAIN_MULTIPLAYER);
            //chooseCarWindow = (ChooseCarWindow)_uim.GetWindow(UIWindowEnum.CHOOSECAR);

            _multiplayerWindow.OnPlay       += OnPlayGame;
            _multiplayerWindow.OnRandomGame += OnRandomGame;

            //
            _gameManager.OnGamesUpdated  += OnUpdateGamesList;
            _gameManager.OnFriendsUpdate += OnUpdateFriendList;


            if (_eventSecvice.IsEventComplete())
            {
                Debug.Log("IsEventComplete");
                _uiManager.ShowWindow(UIWindowEnum.SPLASH, true);
                _eventSecvice.ShowCompleteAnim(() => {
                    if (_playerManager.IsDone != -1)
                    {
                        _gameManager.LoadGames(() => { _notificationWindow.ShowYouOpenTrack(_playerManager.IsDone); _playerManager.IsDone = -1; });
                    }
                    else
                    {
                        _gameManager.LoadGames();
                    }
                });
            }
            else
            {
                if (_playerManager.IsDone != -1)
                {
                    _gameManager.LoadGames(() => { _notificationWindow.ShowYouOpenTrack(_playerManager.IsDone); _playerManager.IsDone = -1; });
                }
                else
                {
                    _gameManager.LoadGames();
                }
            }
        }
Esempio n. 10
0
        public void Awake()
        {
            Debug.Log("Awake BaseCar");
            _audioService = Core.Instance.GetService <AudioService>();
            Assert.AreNotEqual(null, _audioService);

            //Auto init particles
            #region
            if (transform.Find("NitroParticles"))
            {
                var tempNtiroParticles = transform.Find("NitroParticles").GetComponentsInChildren(typeof(ParticleSystem), true);
                if (tempNtiroParticles.Length > 0)
                {
                    foreach (ParticleSystem tempPart in tempNtiroParticles)
                    {
                        nitroParticles.Add(tempPart);
                    }
                }
            }

            if (transform.Find("SmokeParticles"))
            {
                var tempSmokeParticles = transform.Find("SmokeParticles").GetComponentsInChildren(typeof(ParticleSystem), true);
                if (tempSmokeParticles.Length > 0)
                {
                    foreach (ParticleSystem tempPart in tempSmokeParticles)
                    {
                        smokeParticles.Add(tempPart);
                    }
                }
            }
            #endregion



            //Color Block
            #region
            var colorMeshsTemp = transform.GetComponentsInChildren(typeof(MeshRenderer), true);

            foreach (MeshRenderer colorMesh in colorMeshsTemp)
            {
                if (colorMesh.materials.Length > 1)
                {
                    colorMeshs.Add(colorMesh);
                }
            }


            if (colorMeshs[0].materials[0].name.Replace(" (Instance)", "") == "Car_Cuzov")
            {
                colorMat = new Material(colorMeshs[0].materials[0]);
                mainMat  = new Material(colorMeshs[0].materials[1]);
            }
            else if (colorMeshs[0].materials[1].name.Replace(" (Instance)", "") == "Car_Cuzov")
            {
                colorMat = new Material(colorMeshs[0].materials[1]);
                mainMat  = new Material(colorMeshs[0].materials[0]);
            }
            #endregion


            #region createing cardrop audio emitter

            _audioService.CreateCarDropEmitter();



            #endregion

            #region createing engine audio emitter
            _audioService.CreateCarEngineEmitter(engineEmitterName, engineParam1, engineParam2);
            #endregion

            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);
            _gameWindow = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as GameWindowAsyncMultiplayer;
            Assert.AreNotEqual(null, _gameWindow);
        }
Esempio n. 11
0
        // I_SERVICE

        public void Init()
        {
            Games = new List <GameData>();

            //
            _networkManager = Core.Instance.GetService <NetworkManager>();
            Assert.AreNotEqual(null, _networkManager);

            _playerManager = Core.Instance.GetService <PlayerManager>();
            Assert.AreNotEqual(null, _playerManager);

            _statesManager = Core.Instance.GetService <StatesManager>();
            Assert.AreNotEqual(null, _statesManager);

            //
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);

            _chooseTrackWindow = _uiManager.GetWindow(UIWindowEnum.CHOOSE_TRACK) as ChooseTrackWindow;
            Assert.AreNotEqual(null, _chooseTrackWindow);

            _mainScreenStateManager = _uiManager.Get_MainScreenStateManager();
            Assert.AreNotEqual(null, _mainScreenStateManager);

            _splashScreen = _uiManager.GetWindow(UIWindowEnum.SPLASH) as SplashScreen;
            Assert.AreNotEqual(null, _splashScreen);

            _multiplayerWindow = _uiManager.GetWindow(UIWindowEnum.MAIN_MULTIPLAYER) as MultiplayerWindow;
            Assert.AreNotEqual(null, _multiplayerWindow);



            _safePlayerPrefs = Core.Instance.GetService <SafePlayerPrefs>();
            Assert.AreNotEqual(null, _safePlayerPrefs);

            _header = _uiManager.GetWindow(UIWindowEnum.HEADER) as Header;
            Assert.AreNotEqual(null, _header);

            _enternetWindow = _uiManager.GetWindow(UIWindowEnum.IS_ENTERNET) as EnternetWindow;
            Assert.AreNotEqual(null, _enternetWindow);

            _carParent = GameObject.Find("CarParent").transform;
            _podiumNew = _carParent.Find("PodiumNew").gameObject;



            // =======================================================
            //

            /*
             * TrackNamesById = new Dictionary<int, string>()
             * {
             *  {0,     ""    },
             *  {1,     ""     },
             *  {2,     ""    },
             *  {3,     ""      },
             *  {4,     ""    },
             *  {5,     "West_Indian_1"     },
             *  {6,     ""     },
             *  {7,     ""      },
             *  {8,     "West _Town_2"      },
             *  {9,     ""     },
             *  {10,    "West_Shahta_1"     },
             *  {11,    "West _Canyon_1"    },
             *  {12,    "West_Tornado"      },
             *  {13,    "Island"            },
             *  {14,    "West_Tunnel_3"     },
             *  {15,    "West_Mountains_2"   },
             *  {16,    "West _Koleso_2"   },
             *  {17,    "West _Canyon_2"   },
             *
             *
             *  {99,    "Tutorial1"   },
             *  {100,    "Tutorial2"   },
             * };
             */



            //

            /*
             * TrackTimeById = new Dictionary<int, TrackTimePrice>()
             * {
             *  {0,    new TrackTimePrice{Time = 120 , Price= 20  } },
             *  {1,    new TrackTimePrice{Time = 120 , Price = 21  } },
             *  {2,    new TrackTimePrice{Time = 120 , Price = 22  } },
             *  {3,    new TrackTimePrice{Time = 120 , Price = 23  } },
             *  {4,    new TrackTimePrice{Time = 120 , Price = 24  } },
             *  {5,    new TrackTimePrice{Time = 120 , Price = 25  } },
             *  {6,    new TrackTimePrice{Time = 120 , Price = 26  } },
             *  {7,    new TrackTimePrice{Time = 120 , Price= 27  } },
             *  {8,    new TrackTimePrice{Time = 120 , Price = 28  } },
             *  {9,    new TrackTimePrice{Time = 120 , Price= 29  } },
             *  {10,   new TrackTimePrice{Time = 120 , Price = 30  } },
             *  {11,   new TrackTimePrice{Time = 100 , Price = 31  } },
             *  {12,   new TrackTimePrice{Time = 72 , Price = 32  } },
             *  {13,   new TrackTimePrice{Time = 93 , Price = 33  } },
             *  {14,   new TrackTimePrice{Time = 74 , Price = 34  } },
             *  {15,   new TrackTimePrice{Time = 95 , Price = 35  } },
             *  {16,   new TrackTimePrice{Time = 76 , Price = 36  } },
             *  {17,   new TrackTimePrice{Time = 87 , Price = 37  } },
             *
             * };
             */
            // =======================================================

            _multiplayerWindow.OnSingleNew    += CreateNewSingleplayerGame;
            _multiplayerWindow.OnNewGame      += CreateNewGame;
            _multiplayerWindow.OnNewGameForFB += CreateNewGameForFB;
            IsEntryPointLoad = true;
        }
Esempio n. 12
0
        public void Enable()
        {
            //Get UI, cache ref
            if (_core == null)
            {
                _core = Core.Instance;
                _nm   = _core.GetService <NetworkManager>();


                _pm                 = _core.GetService <PlayerManager>();
                _uim                = _core.GetService <UIManager>();
                _enternetWindow     = _uim.GetWindow(UIWindowEnum.IS_ENTERNET) as EnternetWindow;
                authificationWindow = (AuthentificationWindow)_uim.GetWindow(UIWindowEnum.AUTHENTIFICATION);
            }


            //_pm.OnUserLoaded += OnUserLoaded;

            authificationWindow.OnLogin      += OnLoginSend;
            authificationWindow.OnRegistered += OnRegisterSend;

            var savedPlayerName = PlayerPrefs.GetString(PPKeys.name);
            var savedPlayerPass = PlayerPrefs.GetString(PPKeys.pass);

            if (string.IsNullOrEmpty(savedPlayerName) || string.IsNullOrEmpty(savedPlayerPass))
            {
                PlayerPrefs.SetString(PPKeys.name, "");         // ???????
                PlayerPrefs.SetString(PPKeys.pass, "");
                authificationWindow.Show();
                Debug.Log("Enable Auth");
            }
            else
            {
                _uim.ShowWindow(UIWindowEnum.SPLASH, true);
                _nm.Authentication(savedPlayerName, savedPlayerPass,
                                   (obj, error) =>
                {
                    //Core.Instance.GetService<SafePlayerPrefs>().DeleteDataForLogOut();

                    if (error != "timeout")
                    {
                        PlayerPrefs.SetString(PPKeys.name, "");        // ???????
                        PlayerPrefs.SetString(PPKeys.pass, "");        // ???????
                        Core.Instance.GetService <StatesManager>().SwitchState(StatesEnum.Auth);
                    }
                    else
                    {
                        _enternetWindow.ShowErrorEnternet(() => { Core.Instance.GetService <StatesManager>().SwitchState(StatesEnum.Auth); }, "Try Again");
                        authificationWindow.Show();
                    }

                    Debug.Log("Enable Auth");

                    _uim.ShowWindow(UIWindowEnum.SPLASH, false);
                },
                                   (obj) =>
                {
                    GoToNextState();
                }

                                   );
            }
        }