Inheritance: MonoBehaviour
Exemple #1
0
    // Update is called once per frame (slower)
    void FixedUpdate()
    {
        // exit if there is no change
        if (last_screen == screen)
        {
            return;
        }

        this.last_screen = screen;

        mainmenu_panel.SetActive(false);
        tutorials_panel.SetActive(false);
        back_button_panel.SetActive(false);
        confirm_button_panel.SetActive(false);

        switch (this.screen)
        {
        case MainMenuScreen.MAIN_MENU:
            this.mainmenu_panel.SetActive(true);
            break;

        case MainMenuScreen.TUTORIALS:
            this.tutorials_panel.SetActive(true);
            this.back_button_panel.SetActive(true);
            this.back = BackCall.MAIN_MENU;
            break;

        case MainMenuScreen.UNKNOWN:
        default:

            break;
        }
    }
Exemple #2
0
        public MainMenuState(StateContext context, ITinyMessengerHub messengerHub, ILogger logger, IRubiksCubeFactory rubiksCubeFactory)
            : base(context, messengerHub, logger)
        {
            this.rubiksCubeFactory = rubiksCubeFactory;

            screen = new MainMenuScreen(AdvanceToGame, QuitGame);
        }
Exemple #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // collection of players
            players = new List <Player>()
            {
                new Player(PlayerIndex.One, Content),
                new Player(PlayerIndex.Two, Content),
                new Player(PlayerIndex.Three, Content),
                new Player(PlayerIndex.Four, Content)
            };

            // collection of screens
            mainMenuScreen = new MainMenuScreen(GameState.OnMainMenu);
            mainGameScreen = new MainGameScreen(GameState.RunningGame);
            gameOverScreen = new GameOverScreen(GameState.OnGameOver);
            screens        = new Dictionary <GameState, BaseScreen>()
            {
                { mainMenuScreen.GameState, mainMenuScreen },
                { mainGameScreen.GameState, mainGameScreen },
                { gameOverScreen.GameState, gameOverScreen }
            };

            base.Initialize();

            //CREATE THE MEDIA PLAYER
            MediaPlayer.Volume = 1.0f;
            MediaPlayer.Play(mainMenuScreen.menuMusic);
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Font          = Fonts.Ariel14Bold;
            ScreenManager = new ScreenManager(this);
            var splashScreen = new LogoScreen();
            var menu         = new MainMenuScreen();
            var gameplay     = new GameplayScreen();
            var gameOver     = new GameOverScreen();
            var credits      = new CreditsScreen();

            if (DEV_MODE)
            {
                gameplay.Activate();
            }
            else
            {
                splashScreen.Activate();
            }
            ScreenManager.AddScreen(GameScreens.SplashScreen, splashScreen);
            ScreenManager.AddScreen(GameScreens.MainMenu, menu);
            ScreenManager.AddScreen(GameScreens.GamePlay, gameplay);
            ScreenManager.AddScreen(GameScreens.GameOver, gameOver);
            ScreenManager.AddScreen(GameScreens.Credits, credits);
            base.Initialize();
        }
        private void SetupScreen()
        {
            var chatMenu = new ChatMenuScreen(_chatUi);
            var mainMenu = new MainMenuScreen(_chatUi);

            mainMenu.MenuItems = new List <MenuItem>
            {
                new MenuItem("0", "Connect", (_) => { _chatClient.Connect(_configuration); }, null),
                new MenuItem("1", "List chat rooms", (_) => { _chatUi.PrintAvailableRooms(_chatClient.GetChatRooms()); }, null),
                new MenuItem("2", "Subscribe chat room", (room) => _chatClient.SubscribeChatRoom(room).Wait(), null),
                new MenuItem("3", "Unsubscribe chat room", (room) => _chatClient.UnsubscribeChatRoom(room).Wait(), null),
                new MenuItem("4", "Enter chat room", (room) => _chatClient.EnterChatRoom(room, _chatUi.PrintMessage).Wait(), chatMenu),
                new MenuItem("5", "Leave chat room", (_) => _chatClient.LeaveChatRoom().Wait(), null),
                new MenuItem("6", "Disconnect", (_) => _chatClient.Disconnect().Wait(), null),
            };

            chatMenu.MenuItems = new List <MenuItem>
            {
                new MenuItem("10", "Connect", (_) => _chatClient.Connect(_configuration), null),
                new MenuItem("11", "List signed users", (_) => { _chatUi.PrintSignedUsers(_chatClient.GetRegisteredUsers()); }, null),
                new MenuItem("12", "List online users", (_) => { _chatUi.PrintOnlineUsers(_chatClient.GetOnlineUsers()); }, null),
                new MenuItem("13", "Publish message", (msg) => _chatClient.PublishMessage(msg), null),
                new MenuItem("14", "Leave room", (_) => _chatClient.LeaveChatRoom(), mainMenu),
                new MenuItem("15", "Disconnect", (_) => _chatClient.Disconnect(), null),
            };

            _currentScreen = mainMenu;
        }
Exemple #6
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     this.mainMenuScreen = new MainMenuScreen();
     
     base.Initialize();
 }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

#if WINDOWS
            //Set window defaults. Parent game can override in constructor
            Window.AllowUserResizing  = true;
            Window.ClientSizeChanged += WindowClientSizeChanged;
#endif

            Demo1Screen    demo1          = new Demo1Screen();
            Demo2Screen    demo2          = new Demo2Screen();
            Demo3Screen    demo3          = new Demo3Screen();
            Demo4Screen    demo4          = new Demo4Screen();
            Demo5Screen    demo5          = new Demo5Screen();
            Demo6Screen    demo6          = new Demo6Screen();
            Demo7Screen    demo7          = new Demo7Screen();
            Demo8Screen    demo8          = new Demo8Screen();
            Demo9Screen    demo9          = new Demo9Screen();
            MainMenuScreen mainMenuScreen = new MainMenuScreen();
            mainMenuScreen.AddMainMenuItem(demo1.GetTitle(), demo1);
            mainMenuScreen.AddMainMenuItem(demo2.GetTitle(), demo2);
            mainMenuScreen.AddMainMenuItem(demo3.GetTitle(), demo3);
            mainMenuScreen.AddMainMenuItem(demo4.GetTitle(), demo4);
            mainMenuScreen.AddMainMenuItem(demo5.GetTitle(), demo5);
            mainMenuScreen.AddMainMenuItem(demo6.GetTitle(), demo6);
            mainMenuScreen.AddMainMenuItem(demo7.GetTitle(), demo7);
            mainMenuScreen.AddMainMenuItem(demo8.GetTitle(), demo8);
            mainMenuScreen.AddMainMenuItem(demo9.GetTitle(), demo9);
            mainMenuScreen.AddMainMenuItem("Exit", null, true);

            ScreenManager.AddScreen(new BackgroundScreen(), null);
            ScreenManager.AddScreen(mainMenuScreen, null);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(2.0)), null);
        }
        private SplashScreenLoading(ScreenManager screenManager, bool loadingIsSlow,
                                MainMenuScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Exemple #9
0
        public MainMenuScreen CreateMainMenuScreen()
        {
            MainMenuScreen mainMenuScreen = new MainMenuScreen(content);

            mainMenuScreen.QuitButtonClicked    += (sender, e) => Quit();
            mainMenuScreen.NewGameButtonClicked += (sender, e) => LoadScenariosScreen();
            return(mainMenuScreen);
        }
Exemple #10
0
        private void Init()
        {
            Engine.EncounteredError += Throw;

            MainMenuScreen mainMenu = new MainMenuScreen();

            Push(mainMenu);
        }
Exemple #11
0
        /// <summary>
        /// The base update loop calls update loops corresponding to the current game state
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values</param>
        protected override void Update(GameTime gameTime)
        {
            // Update the game time
            GameTime = gameTime;

            // Switch over the current state
            switch (State)
            {
            // Call the corresponding update functions for each menu
            case GameState.MainMenu:
                MainMenuScreen.Update();
                break;

            case GameState.Instructions:
                InstructionsScreen.Update();
                break;

            case GameState.ModeSelection:
                ModeSelectionScreen.Update();
                break;

            // Game Modes
            case GameState.ClassicGameplay:
                // Create a new gameplay screen if it is null
                if (gameplayScreen == null)
                {
                    gameplayScreen = new GameplayScreen();
                }

                // Update the gameplay screen
                gameplayScreen.Update();
                break;

            // The gameplay screens are identical and differ only in the EnemyManager (what enemies spawn)
            // and PlayerShip (how the player is controlled), meaning GameplayScreen can be used generically
            // in handling all operations regarding drawing and updating gameplay
            case GameState.FreeGameplay:
                if (gameplayScreen == null)
                {
                    gameplayScreen = new GameplayScreen();
                }

                gameplayScreen.Update();
                break;
            }

            // Check to see if the game state is not in gameplay
            if (State != GameState.ClassicGameplay && State != GameState.FreeGameplay)
            {
                // Set the gameplay screen to null since the player ship controls and enemies are agnostic
                // to the current scene. The gameplay screen prevents updates to the player and enemies but
                // will still draw them unless the gameplay screen is reset entirely
                gameplayScreen = null;
            }

            // Update the root update loop
            base.Update(gameTime);
        }
        /// <summary>
        /// Creates a new highscore screen instance.
        /// </summary>
        public HighScoreScreen(MainMenuScreen mainMenuScreen)
        {
            EnabledGestures = GestureType.Tap;

            IsPopup = true;
            this.mainMenuScreen = mainMenuScreen;
            numberPlaceMapping = new Dictionary<int, string>();
            initializeMapping();
        }
Exemple #13
0
        protected override void Initialize()
        {
            base.Initialize();

            GameLevel     simpleTest    = new GameLevel();
            GameLevel1    gameLevel1    = new GameLevel1();
            SimpleDemo1   simpleDemo1   = new SimpleDemo1();
            SimpleDemo2   simpleDemo2   = new SimpleDemo2();
            SimpleDemo3   simpleDemo3   = new SimpleDemo3();
            SimpleDemo4   simpleDemo4   = new SimpleDemo4();
            SimpleDemo5   simpleDemo5   = new SimpleDemo5();
            SimpleDemo6   simpleDemo6   = new SimpleDemo6();
            SimpleDemo7   simpleDemo7   = new SimpleDemo7();
            SimpleDemo8   simpleDemo8   = new SimpleDemo8();
            SimpleDemo9   simpleDemo9   = new SimpleDemo9();
            SimpleDemo10  simpleDemo10  = new SimpleDemo10();
            AdvancedDemo1 advancedDemo1 = new AdvancedDemo1();
            AdvancedDemo2 advancedDemo2 = new AdvancedDemo2();
            AdvancedDemo3 advancedDemo3 = new AdvancedDemo3();
            AdvancedDemo4 advancedDemo4 = new AdvancedDemo4();
            AdvancedDemo5 advancedDemo5 = new AdvancedDemo5();


            MenuScreen menuScreen = new MenuScreen("Samples");

            menuScreen.AddMenuItem(simpleTest.GetTitle(), EntryType.Screen, simpleTest, "1");
            menuScreen.AddMenuItem(gameLevel1.GetTitle(), EntryType.Screen, gameLevel1, "2");
            menuScreen.AddMenuItem(simpleDemo1.GetTitle(), EntryType.Screen, simpleDemo1, "3");
            menuScreen.AddMenuItem(simpleDemo2.GetTitle(), EntryType.Screen, simpleDemo2, "4");
            menuScreen.AddMenuItem(simpleDemo3.GetTitle(), EntryType.Screen, simpleDemo3, "5");
            menuScreen.AddMenuItem(simpleDemo4.GetTitle(), EntryType.Screen, simpleDemo4, "6");
            menuScreen.AddMenuItem(simpleDemo5.GetTitle(), EntryType.Screen, simpleDemo5, "7");
            menuScreen.AddMenuItem(simpleDemo6.GetTitle(), EntryType.Screen, simpleDemo6, "8");
            menuScreen.AddMenuItem(simpleDemo7.GetTitle(), EntryType.Screen, simpleDemo7, "9");
            menuScreen.AddMenuItem(simpleDemo8.GetTitle(), EntryType.Screen, simpleDemo8, "10");
            menuScreen.AddMenuItem(simpleDemo9.GetTitle(), EntryType.Screen, simpleDemo9, "11");
            menuScreen.AddMenuItem(simpleDemo10.GetTitle(), EntryType.Screen, simpleDemo10, "12");
            menuScreen.AddMenuItem(advancedDemo1.GetTitle(), EntryType.Screen, advancedDemo1, "13");
            menuScreen.AddMenuItem(advancedDemo2.GetTitle(), EntryType.Screen, advancedDemo2, "14");
            menuScreen.AddMenuItem(advancedDemo3.GetTitle(), EntryType.Screen, advancedDemo3, "15");
            menuScreen.AddMenuItem(advancedDemo4.GetTitle(), EntryType.Screen, advancedDemo4, "16");
            menuScreen.AddMenuItem(advancedDemo5.GetTitle(), EntryType.Screen, advancedDemo5, "17");


            menuScreen.AddMenuItem("", EntryType.Separator, null, "");
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null, "");

            MainMenuScreen mainMenuScreen = new MainMenuScreen("MainMenu");

            mainMenuScreen.AddMenuItem(EntryType.Screen, menuScreen);
            mainMenuScreen.AddMenuItem(EntryType.ExitItem, null);

            ScreenManager.AddScreen(background = new BackgroundScreen());
            ScreenManager.AddScreen(mainMenuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
Exemple #14
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            dragonDrop = new DragonDrop <IDragAndDropItem>(this, viewport);

            Components.Add(dragonDrop);

            // the main menu
            mMenuScr = new MainMenuScreen();
            screenManager.AddScreen(mMenuScr, null);
        }
Exemple #15
0
        // Methods

        /// <summary>
        ///     Loads the main menu screen
        /// </summary>
        public void LoadHome()
        {
            ObstacleType.Init();

            DrawingPanel.Background = ResourceManager.Instance.LoadImageBrush("#bg.jpg");
            _screenMainMenu         = new MainMenuScreen();
            Canvas.SetTop(_screenMainMenu, 0);
            Canvas.SetLeft(_screenMainMenu, 0);
            DrawingPanel.Children.Add(_screenMainMenu);
        }
Exemple #16
0
        public GameStateManager()
        {
            spriteBatch = new SpriteBatch(GameLoop.gameInstance.GraphicsDevice);

            currentGameState = GameState.MainMenu;
            mainMenuScreen   = new MainMenuScreen();
            menuScreen       = new MenuScreen();
            quitScreen       = new QuitScreen();

            Default = this;
        }
Exemple #17
0
        private void AddInitialScreens()
        {
            MainMenuScreen mms = new MainMenuScreen(this);

            mms.ContentPasser(Content);
            mms.SongStart();

            _screenManager.AddScreen(new BackgroundScreen(), null);
            _screenManager.AddScreen(mms, null);
            //_screenManager.AddScreen(new SplashScreen(), null);
        }
Exemple #18
0
        private void LoadMainMenu()
        {
            List <Texture2D> textures = new List <Texture2D>();

            textures.Add(Content.Load <Texture2D>(@"Images/MainMenu/NewGame"));
            textures.Add(Content.Load <Texture2D>(@"Images/MainMenu/LoadGame"));
            textures.Add(Content.Load <Texture2D>(@"Images/MainMenu/HighScores"));
            textures.Add(Content.Load <Texture2D>(@"Images/MainMenu/settings"));
            textures.Add(Content.Load <Texture2D>(@"Images/MainMenu/LogOut"));
            _mainMenu = new MainMenuScreen(5, textures);
        }
Exemple #19
0
        public static bool AddUnusedPostsToMainMenu(MainMenuScreen __instance)
        {
            foreach (UnityEngine.Transform child in UnityEngine.GameObject.Find("MainMenuSceneProto1").transform)
            {
                if (child.gameObject.name.StartsWith("Post"))
                {
                    child.gameObject.SetActive(true);
                }
            }

            return(true);
        }
Exemple #20
0
    // Use this for initialization
    void Start()
    {
        gameHUD         = GetComponentInParent <GameHUD>();
        howToPlayScreen = GameObject.Find("How To Play Screen").GetComponent <HowToPlayScreen>();
        mainMenuScreen  = GameObject.Find("Main Menu Screen").GetComponent <MainMenuScreen>();
        creditsScreen   = GameObject.Find("Credits Screen").GetComponent <CreditsScreen>();

        // Title Screen Text
        pauseText = GetComponentInChildren <Text>();

        // Resume Button
        resume       = transform.Search("Resume Button").gameObject;
        resumeSprite = resume.GetComponent <Image>();
        resumeBtn    = resume.GetComponent <Button>();
        resumeText   = resumeBtn.GetComponentInChildren <Text>();
        resumeBtn.onClick.AddListener(ResumeClicked);

        // How to Play Button
        howToPlay       = transform.Search("How To Play Button").gameObject;
        howToPlaySprite = howToPlay.GetComponent <Image>();
        howToPlayBtn    = howToPlay.GetComponent <Button>();
        howToPlayText   = howToPlayBtn.GetComponentInChildren <Text>();
        howToPlayBtn.onClick.AddListener(HowToPlayClicked);

        // Sound Toggle Button
        sound          = transform.Search("Sound Button").gameObject;
        soundprite     = sound.GetComponent <Image>();
        soundBtn       = sound.GetComponent <Button>();
        soundText      = soundBtn.GetComponentInChildren <Text>();
        soundText.text = GameDataManager.Instance.IsSound ? SOUND_ON_TEXT : SOUND_OFF_TEXT;
        soundBtn.onClick.AddListener(SoundToggleClicked);

        // Credits Button
        credits       = transform.Search("Credits Button").gameObject;
        creditsSprite = credits.GetComponent <Image>();
        creditsBtn    = credits.GetComponent <Button>();
        creditsText   = creditsBtn.GetComponentInChildren <Text>();
        creditsBtn.onClick.AddListener(CreditsClick);

        // Quit Button
        quit       = transform.Search("Quit Button").gameObject;
        quitSprite = quit.GetComponent <Image>();
        quitBtn    = quit.GetComponent <Button>();
        quitText   = quitBtn.GetComponentInChildren <Text>();
        quitBtn.onClick.AddListener(QuitClicked);

        blanket = transform.Search("Blanket").GetComponent <Image>();

        ready = true;

        Hide();
    }
Exemple #21
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            mTitleScreen    = new TitleScreen(this.graphics, this.Content, new EventHandler(TitleScreenEvent));
            mMainMenuScreen = new MainMenuScreen(this.graphics, this.Content, new EventHandler(MainMenuScreenEvent));
            mGameScreen     = new GameScreen(this.graphics, this.Content, new EventHandler(GameScreenEvent));
            mPauseScreen    = new PauseScreen(this.graphics, this.Content, new EventHandler(PauseScreenEvent));

            mCurrentScreen = mTitleScreen;
        }
Exemple #22
0
        private void InitalizeScreens()
        {
            gameScreen = new GameScreen();
            gameScreen.Initialize(this, playerReference, sadakoReference, inventoryHandler, locationHandler, eventHandler, roomDatabase, tileDatabase);

            mainMenuScreen = new MainMenuScreen();
            mainMenuScreen.Initialize(this, playerReference, sadakoReference, inventoryHandler, locationHandler, eventHandler, roomDatabase, tileDatabase);

            pauseScreen = new PauseScreen();
            pauseScreen.Initialize(this, playerReference, sadakoReference, inventoryHandler, locationHandler, eventHandler, roomDatabase, tileDatabase);

            currentScreen = mainMenuScreen;
        }
        protected override void LoadContent()
        {
            base.LoadContent();
            SetupLevels();
            LoadFromFile();
            LoadSettings();

            //GameplayScreen s = new GameplayScreen("uluru", 11);
            MainMenuScreen s = new MainMenuScreen();

            s.Initialize(Content);
            ScreenManager.Get.AddScreen(s);
        }
Exemple #24
0
    // Handles click on back button
    public void Back()
    {
        switch (this.back)
        {
        case BackCall.MAIN_MENU:
            this.screen = MainMenuScreen.MAIN_MENU;
            break;

        case BackCall.UNKNOWN:
        default:
            break;
        }
    }
Exemple #25
0
    public void ToMainMenu(MainMenuScreen screen)
    {
        loginScreen.SetActive(screen == MainMenuScreen.Login);
        lobbyScreen.SetActive(screen == MainMenuScreen.Lobby);
        roomScreen.SetActive(screen == MainMenuScreen.Room);

        if (HUD.Paused)
        {
            HUD.Instance.Pause();
        }

        gameUI.SetActive(false);
        mainMenuUI.SetActive(true);
    }
Exemple #26
0
        public Engine()
        {
            //Setting up the Roguelike Console
            Program.rootConsole.Render += Render;
            Program.rootConsole.Update += Update;

            actualScreen = new MainMenuScreen();
            player       = new Player("Player");
            rng          = new SuperRandom();



            mapList = new List <GameMap>();
            mapList.Add(MapGenerator.GenerateDungeon(generalMapWidth, generalMapHeight));
            currentMapIndex = 0;
        }
Exemple #27
0
        private static void AddOrder()
        {
            var mainMenuScreen = new MainMenuScreen();
            var coffeeType     = mainMenuScreen.CaptureCoffeeType();

            var coffeeFactory = ServiceLocator.GetService <ICoffeeFactory>();
            var coffee        = coffeeFactory.Create(coffeeType);

            var addOnScreen = new AddOnScreen();

            coffee = addOnScreen.CaptureAddOns(coffee);

            var orderService = ServiceLocator.GetService <IOrderService>();

            orderService.AddToOrder(coffee);
        }
Exemple #28
0
        static void DrawNeeded(int screen, MainMenuScreen MainMenu1, NewGameScreen NewGameMenu1)
        {
            switch (screen)
            {
            case 1:
                MainMenu1.Draw();
                break;

            case 2:
                NewGameMenu1.Draw();
                break;


            default: break;
            }
        }
Exemple #29
0
    // Use this for initialization
    void Start()
    {
        this.confirm = ConfirmCall.UNKNOWN;
        this.back    = BackCall.UNKNOWN;
        this.screen  = MainMenuScreen.MAIN_MENU;

        // convert text file to texts (string array)
        tutorial_menu_texts = tutorial_text_file.text.Split(
            new string[] {
            "--END--\r\n"
        },
            System.StringSplitOptions.None);

        // Get text and title from tutorial panel
        this.tutorial_text_title = Utilities.GetChildrenByName(this.tutorial_panel, "Title");
        this.tutorial_text       = Utilities.GetChildrenByName(this.tutorial_panel, "Text");
    }
        public static void RegisterUiMenus()
        {
            //Caching images requires us to start the spritebatch
            UiStateManager.Begin();
            //ORDER MATTERS!!

            //UI
            hotbarUI = new HotbarScreen();
            GameClient.Instance.RegisterGui(hotbarUI);

#if !DEBUG
            //If this is a release build, we add the debug UI on top of the hotbar but beneath all other UI elements
            debugUI = new DebugScreen();
            GameClient.Instance.RegisterGui(debugUI);
#endif

            pauseUI = new PauseScreen();
            GameClient.Instance.RegisterGui(pauseUI);

            mainMenuUI = new MainMenuScreen();
            GameClient.Instance.RegisterGui(mainMenuUI);

            multiplayerUI = new MultiplayerScreen();
            GameClient.Instance.RegisterGui(multiplayerUI);

            optionsUI = new OptionsScreen();
            GameClient.Instance.RegisterGui(optionsUI);

            languageUI = new LanguageScreen();
            GameClient.Instance.RegisterGui(languageUI);

            statsUI = new StatisticsScreen();
            GameClient.Instance.RegisterGui(statsUI);

            loadingUI = new LoadingScreen();
            GameClient.Instance.RegisterGui(loadingUI);

#if DEBUG
            //If we're in debug mode, the debug UI is added last for debugging reasons
            debugUI = new DebugScreen();
            GameClient.Instance.RegisterGui(debugUI);
#endif

            UiStateManager.End();
        }
Exemple #31
0
 private void SetActiveScreenInternal(Type screen_type)
 {
     for (int i = 0; i < this.m_Screens.Count; i++)
     {
         MainMenuScreen mainMenuScreen = this.m_Screens[i];
         Type           type           = mainMenuScreen.GetType();
         if (type == screen_type)
         {
             this.m_Screens[i].gameObject.SetActive(true);
             this.m_Screens[i].OnShow();
         }
         else
         {
             this.m_Screens[i].gameObject.SetActive(false);
             this.m_Screens[i].OnHide();
         }
     }
 }
Exemple #32
0
    public void Load(Action onLoadedCallback, object passedParams)
    {
        MainMenuLoadParams loadParams = (MainMenuLoadParams)passedParams;

        onJoinGame = loadParams.OnJoinGame;
        launchGame = loadParams.OnLaunchGame;

        Transform gameUiLayer = GameObject.Find("GameUILayer").transform;

        mainMenuUi     = GameObject.Instantiate(Resources.Load <GameObject>("MainMenu"), gameUiLayer);
        mainMenuScreen = mainMenuUi.GetComponent <MainMenuScreen>();

        Service.WebRequests.GetGamesList((response) =>
        {
            LobbyData lobbyData = JsonUtility.FromJson <LobbyData>(response);
            mainMenuScreen.Initialize(lobbyData, JoinGame, JoinGameInProgress, CreateGame);
            onLoadedCallback();
        });
    }
Exemple #33
0
        //private static bool AltComboPressed(KeyboardState state, Microsoft.Xna.Framework.Input.Keys key)
        //{
        //    return (state.IsKeyDown(key) && (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt)));
        //}

        //private void GameForm_KeyDown(object sender, KeyEventArgs e)
        //{
        //    if (e.Alt && (e.KeyCode == System.Windows.Forms.Keys.F4))
        //    {
        //        e.Handled = true;
        //    }
        //}

        protected override void Initialize()
        {
            //第二步
            //if (Platform.PlatFormType != PlatFormType.UWP)
            //{
            Session.ChangeDisplay(true);
            //}

            //基本材質初始化
            Session.TextureRecs = TextureRecsManager.AllTextureRectangles();

            if (Platform.PlatFormType == PlatFormType.Win || Platform.PlatFormType == PlatFormType.Desktop)
            {
                Platform.Current.SetWindowAllowUserResizing(true);
            }

            //try
            //{
            this.mainMenuScreen = new MainMenuScreen();
            //}
            //catch (Exception ex)
            //{
            //    GameTools.SendErrMsg("MainMenuScreen", ex);
            //}


            Session.globalVariablesBasic = new GlobalVariables();
            Session.globalVariablesBasic.InitialGlobalVariables();

            Session.parametersBasic = new Parameters();
            Session.parametersBasic.InitializeGameParameters();

            //this.jiazaitishi.Close();
            ////全屏的判断放到初始化代码中
            //if (Session.GlobalVariables.FullScreen)
            //{
            //    this.ToggleFullScreen();
            //}

            this.Window.ClientSizeChanged += this.Window_ClientSizeChanged;

            base.Initialize();
        }
Exemple #34
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // collection of players
            players = new List<Player>()
            {
                new Player(PlayerIndex.One, Content),
                new Player(PlayerIndex.Two, Content),
                new Player(PlayerIndex.Three, Content),
                new Player(PlayerIndex.Four, Content)
            };

            // collection of screens
            mainMenuScreen = new MainMenuScreen(GameState.OnMainMenu);
            mainGameScreen = new MainGameScreen(GameState.RunningGame);
            gameOverScreen = new GameOverScreen(GameState.OnGameOver);
            screens = new Dictionary<GameState, BaseScreen>()
            {
                {mainMenuScreen.GameState, mainMenuScreen},
                {mainGameScreen.GameState, mainGameScreen},
                {gameOverScreen.GameState, gameOverScreen}
            };

            base.Initialize();

            //CREATE THE MEDIA PLAYER
            MediaPlayer.Volume = 1.0f;
            MediaPlayer.Play(mainMenuScreen.menuMusic);
        }
	public void Init () {
		Instance = this;
		EnableResume (false);
	}
Exemple #36
0
        protected override void Initialize()
        {
            //SoundEffectManger
            SoundEffectManager soundeffectmanager = new SoundEffectManager(this);
            this.Services.AddService(typeof(ISoundEffect), soundeffectmanager);
           

            //Scrolling background
            scrollingbackground = new ScrollingBackground();
            this.Services.AddService(typeof(IScrollingBackground), scrollingbackground);
            screenManager.AddScreen(scrollingbackground);         
            
            //Visualiser
            visualiser = new Visualiser();
            screenManager.AddScreen(visualiser);
            this.Services.AddService(typeof(IVisualiser), visualiser);
            
            
            //PopUp
            popupmanager = new PopUpManager();
            this.Services.AddService(typeof(IPopUpManager), popupmanager);
            screenManager.AddScreen(popupmanager);

            //HUD
            hud = new HUD();
            screenManager.AddScreen(hud);
            this.Services.AddService(typeof(IHUD), hud);

            //HookPointManger
            HookPointManager hookpointmanager = new HookPointManager();
            screenManager.AddScreen(hookpointmanager);
            
            //GameScreen
            SwingSetsGameScreen ssgs = new SwingSetsGameScreen(this);
            
            //Trail
            ssgs.trail = new Trail(this);
            this.Components.Add(ssgs.trail);

            //Menu Screen
            MainMenuScreen mainmenuscreen = new MainMenuScreen(new MusicSelectScreen(new LevelSelectScreen(ssgs)));
            screenManager.AddScreen(mainmenuscreen);
            base.Initialize();
            ssgs.LoopCompleted += hud.FireLoopCompleted;
            ssgs.LoopCompleted += visualiser.FireLoopCompleted;
            ssgs.LoopCompleted += popupmanager.FireLoopCompleted;
            ssgs.LoopCompleted += hookpointmanager.FireLoopCompleted;
        }
Exemple #37
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            game = this;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            mainMenuScreen = new MainMenuScreen(game);
            cursor = new Cursor(game);
            table = new Table(game);
            puck = new Puck(game);
            paddle = new Paddle(game);
        }
Exemple #38
0
        /// <summary>
        /// Loads content for the game.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            this.mainMenu = new MainMenuScreen();
            this.gameOverScreen = new GameOverScreen();
            this.loadScreen = new LoadScreen();
            this.ingameMenu = new IngameMenu();
            this.saveScreen = new SaveScreen();
            this.battleUI = new BattleUI();
            this.fadeScreen = new FadeScreen();

            this.gameOverScreen.Visible = false;
            this.loadScreen.Visible = false;
            this.ingameMenu.Visible = false;
            this.saveScreen.Visible = false;
            this.battleUI.Visible = false;
            this.fadeScreen.Visible = false;

            this.UIElements.Add(this.mainMenu);
            this.UIElements.Add(this.gameOverScreen);
            this.UIElements.Add(this.loadScreen);
            this.UIElements.Add(this.ingameMenu);
            this.UIElements.Add(this.saveScreen);
            this.UIElements.Add(this.battleUI);
            this.UIElements.Add(this.fadeScreen);

            this.character = new CharacterController();

            this.camera = new Camera();

            this.debugText = new StaticText(this.DefaultFont);
            this.debugText.Position = new Vector2(20, 20);
            this.debugText.Visible = false;

            this.UIElements.Add(debugText);
        }
Exemple #39
0
 public void switchTo (MainMenuScreen screen) 
 {
     //Debug.Log(string.Format("switchTo({0})", screen.ToString()));
     switch (screen) {
         case MainMenuScreen.CONTROLS:
             deselect ();
             mainMenuItems.gameObject.SetActive(false);
             controlItems.gameObject.SetActive(true);
             languageItems.gameObject.SetActive(false);
             soundItems.gameObject.SetActive(false);
             learnMoreItems.gameObject.SetActive(false);
             copyItemsFrom(controlItems);
             selectItem(0);
             break;
         case MainMenuScreen.LANGUAGES:
             deselect ();
             mainMenuItems.gameObject.SetActive(false);
             controlItems.gameObject.SetActive(false);
             languageItems.gameObject.SetActive(true);
             soundItems.gameObject.SetActive(false);
             learnMoreItems.gameObject.SetActive(false);
             copyItemsFrom(languageItems);
             selectItem(0);
             break;
         case MainMenuScreen.SOUNDOPTIONS:
             deselect ();
             mainMenuItems.gameObject.SetActive(false);
             controlItems.gameObject.SetActive(false);
             languageItems.gameObject.SetActive(false);
             soundItems.gameObject.SetActive(true);
             learnMoreItems.gameObject.SetActive(false);
             copyItemsFrom(soundItems);
             selectItem(0);
             break;
         case MainMenuScreen.LEARNMOREOPTIONS:
             deselect ();
             mainMenuItems.gameObject.SetActive(false);
             controlItems.gameObject.SetActive(false);
             languageItems.gameObject.SetActive(false);
             soundItems.gameObject.SetActive(false);
             learnMoreItems.setPlatform();
             learnMoreItems.gameObject.SetActive(true);
             copyItemsFrom(learnMoreItems);
             selectItem(0);
             break;
         case MainMenuScreen.DEFAULT:
         default:
             deselect ();
             mainMenuItems.gameObject.SetActive(true);
             controlItems.gameObject.SetActive(false);
             languageItems.gameObject.SetActive(false);
             soundItems.gameObject.SetActive(false);
             learnMoreItems.gameObject.SetActive(false);
             copyItemsFrom(mainMenuItems);
             selectItem(0);
             break;
     }
 }