Esempio n. 1
0
 public void OnShowScreen(GameScreenType type)
 {
     if (this.toggleMap.ContainsKey(type) && this.toggleMap[type] != null)
     {
         this.toggleMap[type].State = true;
     }
 }
Esempio n. 2
0
        private static void SetToGameScreen(GameScreenType gameScreen)
        {
            var tag          = string.Format("GameScreen_{0}", gameScreen);
            var gameScreenGo = GameObject.FindGameObjectWithTag(tag);
            var gsPos        = gameScreenGo.transform.position;
            var position     = new Vector3(gsPos.x, gsPos.y, -10f);

            Camera.main.transform.position = position;
        }
        public void AddScreen(GameScreenType screenType, IGameScreen gameScreen)
        {
            if (this.Contains(screenType))
            {
                throw new GameScreenTypeException("gameScreen", "The screen already exists.");
            }

            this.screens[screenType] = gameScreen;
        }
        public IGameScreen GetScreen(GameScreenType screenType)
        {
            if (!this.Contains(screenType))
            {
                throw new GameScreenTypeException("screenType", "There is no such screen.");
            }

            return this.screens[screenType];
        }
        public IGameScreen DeleteScreen(GameScreenType screenType)
        {
            if (!this.Contains(screenType))
            {
                throw new GameScreenTypeException("screenType", "There is no such screen.");
            }

            var screen = this.screens[screenType];
            this.screens.Remove(screenType);
            return screen;
        }
Esempio n. 6
0
        public SectorData SectorData; //TODO Potentially convert it to array of sector data object to describe whole "universe"

        public GameData SetDefaults()
        {
            //Stats Data
            StatsData = new StatsData();

            //Last Cam Position
            ActiveGameScreen = GameScreenType.HQView; //TODO default to NONE?

            //Sector Data
            SectorData = new SectorData();

            return(this);
        }
Esempio n. 7
0
        public void ButtonsEnable(GameScreenType gameScreen)
        {
            switch (gameScreen)
            {
            case GameScreenType.None:
                break;

            case GameScreenType.HQView:
                ButtonEnable(HqViewController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.Generator:
                ButtonEnable(GeneratorController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.Workshop:
                ButtonEnable(HqViewController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.HQUpgrade:
                ButtonEnable(WorkshopController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.Lab:
                ButtonEnable(LabController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.Portal:
                ButtonEnable(PortalController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.Artifact:
                ButtonEnable(ArtifactController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.PixelClusterAlpha:
                ButtonEnable(PixelClusterAlphaController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.PixelClusterBeta:
                ButtonEnable(PixelClusterBetaController.Inst.GetButtonsVisibility());
                break;

            case GameScreenType.PixelClusterGamma:
                ButtonEnable(PixelClusterGammaController.Inst.GetButtonsVisibility());
                break;

            default: throw new ArgumentOutOfRangeException("gameScreen", gameScreen, null);
            }
        }
        /// <summary>
        /// Navigates to a new screen
        /// </summary>
        /// <param name="type">game screen type</param>
        public void NavigateToScreen(GameScreenType type)
        {
            var transition = new MonoGame.Extended.Screens.Transitions.FadeTransition(this.GraphicsDevice, Color.Black, 0.5f);

            switch (type)
            {
            case GameScreenType.StartGameScreen:
                this.screenManager.LoadScreen(new StartGameScreen(this), transition);
                break;

            case GameScreenType.IngameScreen:
                this.screenManager.LoadScreen(new IngameScreen(this), transition);
                break;

            default:
                Debug.Assert(false, "game screen type not handled yet!");
                break;
            }
        }
Esempio n. 9
0
        public static void MoveToGameScreen(GameScreenType moveTo, bool instant)
        {
            //Prevent moving from current screent to same screen
            if (GameController.ActiveGameScreen == moveTo)
            {
                return;
            }

            //If INSTANT flag is on - move instantly
            if (instant)
            {
                SetToGameScreen(moveTo);
                return;
            }

            //From Game Screen
            var fromTag        = string.Format("GameScreen_{0}", GameController.ActiveGameScreen);
            var fromGameScreen = GameObject.FindGameObjectWithTag(fromTag);
            var fromPos        = fromGameScreen.transform.position;

            //To Game Screen
            var toTag        = string.Format("GameScreen_{0}", moveTo);
            var toGameScreen = GameObject.FindGameObjectWithTag(toTag);
            var toPos        = toGameScreen.transform.position;

            //Find point between those 2 Game Screens
            var midPoint = toPos.x > fromPos.x ? new Vector3(toPos.x, fromPos.y, -10f) : new Vector3(fromPos.x, toPos.y, -10f);
            var path     = new Vector3[] { midPoint, new Vector3(toPos.x, toPos.y, -10f) };

            //Set vars
            _movingTo = moveTo;
            GameController.ActiveGameScreen = GameScreenType.None;

            //Tween
            //TODO: Picked ease types: easeOutQuad, easeInCubic, easeOutQuart, easeOutQuint, easeOutExpo, easeInOutExpo, spring,
            var parms = new Hashtable();

            parms.Add("path", path);
            parms.Add("easeType", EaseType.easeInOutExpo.ToString());
            parms.Add("oncomplete", "OnCameraMoveCompleted");
            parms.Add("time", 1f);
            iTween.MoveTo(Camera.main.gameObject, parms);
        }
Esempio n. 10
0
        public void Start()
        {
            //===== GAME START =====
            //===== GAME START =====
            //===== GAME START =====

            //----- LOAD DATA -----
            GameSave.Load();
            var gameData = GameSave.Get();

            ActiveGameScreen = gameData.ActiveGameScreen;

            //----- SET ALL STATISTICS -----
            StatsController.Inst.Init(gameData.StatsData);

            //----- INITIALIZE SCREENS -----
            InitGameScreens(gameData.SectorData);

            //----- POSITION CAMERA -----
            CameraController.MoveToGameScreen(gameData.ActiveGameScreen, true);

            //----- UPDATE UI VIEW -----
            UIController.Inst.ButtonsEnable(ActiveGameScreen);
        }
Esempio n. 11
0
 /// <summary>
 /// Consctructor for Screen objects. Takes a GameScreenType enum as argument
 /// </summary>
 /// <param name="type">The Type of the Screen object</param>
 protected Screen(GameScreenType type)
 {
     this.Type = type;
 }
Esempio n. 12
0
 /// <summary>
 /// Reload a game screen of the specified <see cref="GameScreenType"/>.
 /// <remarks>
 /// This method reinitializes the game screen by calling its constructor.
 /// It will reset all data.
 /// </remarks>
 /// </summary>
 /// <typeparam name="T">The type of the game screen.</typeparam>
 /// <param name="type">The <see cref="GameScreenType"/>.</param>
 public void ReloadScreen <T>(GameScreenType type) where T : GameScreen
 {
     gameScreens[type] = (GameScreen)Activator.CreateInstance(typeof(T));
     gameScreens[type].LoadContent(spriteBatch);
 }
 public void SetScreen(GameScreenType screenType, IGameScreen gameScreen)
 {
     if (gameScreen.Type != screenType)
     {
         throw new GameScreenTypeException("gameScreen", "The screen is not the same type.");
     }
     this.screens[screenType] = gameScreen;
 }
 public bool Contains(GameScreenType screenType)
 {
     return this.screens.ContainsKey(screenType);
 }
Esempio n. 15
0
 /// <summary>
 /// Get a game screen of the specified <see cref="GameScreenType"/>.
 /// </summary>
 /// <typeparam name="T">The type of the game screen to cast to.</typeparam>
 /// <param name="type">The type of the <see cref="GameScreenType"/> to retrieve.</param>
 /// <returns>A <see cref="GameScreen"/> of type <typeparamref name="T"/>.</returns>
 public T GetGameScreen <T>(GameScreenType type) where T : GameScreen => (T)gameScreens[type];
        public static void switchScreens(GameScreenType newType, string levelName)
        {
            if (manager == null)
            {
                return;
            }

            if (newType == GameScreenType.SplashScreen)
            {
                currentNode = new SplashScreenState(manager);
            }
            else if (newType == GameScreenType.Credits)
            {
                currentNode = new CreditsScreenState(manager);
            }
            else if (newType == GameScreenType.Level && levelName != null)
            {
                Game1.levelLoader.Unload();
                currentNode = new LevelState(Game1.levelLoader, levelName);
            }
            else if (newType == GameScreenType.Menu)
            {
                switch (levelName)
                {
                    case "TitleScreenMenu":
                        currentNode = new TitleScreenMenuState(manager, false, true);
                        break;
                    case "TitleScreenMenu_fromOptions":
                        currentNode = new TitleScreenMenuState(manager, true, false);
                        break;
                    case "TitleScreenMenu_fromLevelSelect":
                        currentNode = new TitleScreenMenuState(manager, true, false);
                        break;
                    case "TitleScreenMenu_fromPause":
                        currentNode = new TitleScreenMenuState(manager, false, true);
                        ((TitleScreenMenuState)currentNode).showPressButtonDialog = false;
                        break;
                    case "GameOptionsMenu":
                        currentNode = new OptionsMenuState(manager);
                        break;
                    case "LevelSelectMenu":
                        currentNode = new LevelSelectMenuState(manager);
                        break;
                    case "BetaMenu":
                        currentNode = new BetaMenuState(manager);
                        break;
                    default:
                        break;
                }
            }
            else
            {
                //
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Switch the active game screen to the specified <see cref="GameScreenType"/>.
 /// </summary>
 /// <param name="type">The new <see cref="GameScreenType"/>.</param>
 public void SwitchScreen(GameScreenType type)
 {
     activeGameScreenType = type;
     gameScreens[activeGameScreenType].OnScreenSwitched();
 }