Exemple #1
0
    private void SwitchPanel(MainMenuState panel)
    {
        switch (panel)
        {
        case MainMenuState.Login:
            loginPanel.gameObject.SetActive(true);
            registrPanel.gameObject.SetActive(false);
            bottomPanel.gameObject.SetActive(true);

            FieldsNullifier();
            Message.MessageToUser("Welcome!", MessageKind.Confirm);
            break;

        case MainMenuState.Registr:
            loginPanel.gameObject.SetActive(false);
            registrPanel.gameObject.SetActive(true);
            bottomPanel.gameObject.SetActive(false);

            FieldsNullifier();
            Message.MessageToUser("Enter fields", MessageKind.Confirm);
            break;

        default:
            break;
        }
    }
Exemple #2
0
    private void Update()
    {
        switch (transition)
        {
        case UITransitionState.EasingIn:
            timeCounter = Mathf.Clamp01(timeCounter + Time.deltaTime * transitionSpeed);
            if (timeCounter >= 1)
            {
                transition = UITransitionState.Steady;
            }
            break;

        case UITransitionState.EasingOut:
            timeCounter = Mathf.Clamp01(timeCounter - Time.deltaTime * transitionSpeed);
            if (timeCounter <= 0)
            {
                state      = nextState;
                transition = UITransitionState.EasingIn;
                return;
            }
            break;

        default:
            break;
        }

        if (Input.GetKeyDown(KeyCode.F5))
        {
            state       = MainMenuState.Title;
            transition  = UITransitionState.EasingIn;
            timeCounter = 0;
        }
    }
Exemple #3
0
 public LoadingProceedCommandHandler(GameStateMachine gameStateMachine,
                                     LoadingState loadingState, MainMenuState mainMenuState)
 {
     _gameStateMachine = gameStateMachine;
     _mainMenuState    = mainMenuState;
     _loadingState     = loadingState;
 }
    public IEnumerator UnlockNextWorldNow()
    {
        while (menuState != MainMenuState.LevelSelect)
        {
            yield return(new WaitForEndOfFrame());
        }

        menuState = MainMenuState.Between;

        HideLevelSelect(true);

        yield return(new WaitForSeconds(1.0f));

        if (WorldCompleteSound != null)
        {
            source.volume = Settings.Current.MasterVolume * Settings.Current.SoundVolume;
            source.clip   = WorldCompleteSound;
            source.Play();
        }

        if (WorldCompletePrefab != null)
        {
            GameObject.Instantiate(WorldCompletePrefab, new Vector3(482.2004f, 248.8504f, -116.0667f), Quaternion.identity);
        }

        yield return(new WaitForSeconds(1.0f));

        NextWorld(true);

        menuState = MainMenuState.WorldSelect;
    }
        public override void Update(GameTime gameTime, Input input)
        {
            bool keyboardSelect = KeyboardSelect(input); //select with number keys, and don't do it twice if you click

            if (input.LeftPress && escReminderRect.Contains(input.MousePos))
            {
                Game.EscMenuBool = true;
                return;
            }

            if (!input.Hovered)
            {
                int lineNum = optionsBox.LineSelection(input);
                if (lineNum > -1)
                {
                    if (input.LeftPress && !keyboardSelect)
                    {
                        Options[lineNum].Execute();
                    }
                }
            }

            if (State != MainMenuState.Main && input.KeyPress(Keys.Back) && !input.Backed)
            {
                State = MainMenuState.Main;
                input.CaptureBack();
            }
        }
Exemple #6
0
        static MetaGame()
        {
            var mainMenuState = new MainMenuState(StateMachine, MainGame.Instance);

            StateMachine.States.Add(mainMenuState);

            var mainGameState = new MainGameState(StateMachine, MainGame.Instance);

            StateMachine.States.Add(mainGameState);

            if (Program.SkipIntro)
            {
                StateMachine.AddTransition(new Transition <GameState>("start", null, mainMenuState));
            }
            else
            {
                var borneGamesLogoState = new BorneGamesLogoState(StateMachine, MainGame.Instance);
                var titleState          = new TitleState(StateMachine, MainGame.Instance);
                StateMachine.States.Add(borneGamesLogoState);
                StateMachine.States.Add(titleState);

                StateMachine.AddTransition(new Transition <GameState>("start", null, borneGamesLogoState));
                StateMachine.AddTransition(new Transition <GameState>("next", borneGamesLogoState, titleState,
                                                                      Mode.PushPop));
                StateMachine.AddTransition(new Transition <GameState>("next", titleState, mainMenuState, Mode.PushPop));
            }

            StateMachine.AddTransition(new Transition <GameState>("start", mainMenuState, mainGameState, Mode.PushPop));

            StateMachine.AddTransition(new Transition <GameState>("exit", mainMenuState, null));
        }
Exemple #7
0
 public override void Resume()
 {
     if (Managers.Register.PlayTutorialFirst)
     {
         this.OptionsList.Add(0, "Comenzar");
         this.OptionsList.Add(1, "Opciones");
         this.OptionsList.Add(2, "Salir");
     }
     else
     {
         this.OptionsList.Add(0, "Continuar");
         this.OptionsList.Add(1, "Tutorial");
         this.OptionsList.Add(2, "Opciones");
         this.OptionsList.Add(3, "Salir");
     }
     this.TotalOptions = (uint)this.OptionsList.Count;
     using (Dictionary <int, string> .KeyCollection.Enumerator enumerator = this.OptionsList.Keys.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             int           current       = enumerator.Current;
             MainMenuState mainMenuState = this;
             string        str           = mainMenuState.FullText + this.OptionsList[current] + Environment.NewLine;
             mainMenuState.FullText = str;
         }
     }
 }
    protected void Start()
    {
        switch (NextStateToLoad)
        {
        case MainMenuState.LevelSelect:
            ShowPageInstant("WorldToLevelSelect", NextStateToLoad);
            lastWorldSelected = worldSelected;
            InitLevelSelect();
            break;

        case MainMenuState.WorldSelect:
            ShowPageInstant("MenuToWorldSelect", NextStateToLoad);
            InitLevelSelect();
            break;

        case MainMenuState.Menu:
            ShowPageInstant("TitleToMenu", NextStateToLoad);
            break;

        case MainMenuState.Options:
            ShowPageInstant("MenuToOptions", NextStateToLoad);
            break;

        default:
            StartCoroutine(PlayAnimation(animation, "Title_Intro", false, () =>
            {
                menuState = MainMenuState.Title;
            }));
            break;
        }
    }
Exemple #9
0
 public override void Enter(params object[] args)
 {
     _state      = MainMenuState.MainMenu;
     _characters = Game.Instance.LoadPlayerCharacters(_account.Id);
     _script.Globals["Characters"] = typeof(List <AiGEntity>);
     _script.Call(_script.Globals["enter"], _characters, _account.Id);
 }
Exemple #10
0
    public void SetMenuState(MainMenuState state)
    {
        mainMenuState = state;
        switch (mainMenuState)
        {
        case MainMenuState.Menu:
            UnloadLobby();
            break;

        case MainMenuState.HostWaiting:
            break;

        case MainMenuState.ClientWaiting:
            LoadLobby();
            waitingScreen.GetComponentInChildren <Text>().text = "Choose your character";
            LoadButtons();
            break;

        case MainMenuState.CharacterSelect:
            waitingScreen.SetActive(true);
            waitingScreen.GetComponentInChildren <Text>().text = "Choose your character";
            LoadButtons();
            break;

        case MainMenuState.InGame:
            //switch scenes.
            break;

        default:
            break;
        }
    }
 public StartGameCommandHandler(GameStateMachine gameStateMachine,
                                GameplayState gameplayState, MainMenuState mainMenuState)
 {
     _gameStateMachine = gameStateMachine;
     _gameplayState    = gameplayState;
     _mainMenuState    = mainMenuState;
 }
Exemple #12
0
        private void Click(string _text)
        {
            if (_text == "Exit")
            {
                Application.Quit();
            }
            else if (_text == "StartSingleplayer")
            {
                m_animator.SetTrigger("GoToLevelRoom");
                m_state = MainMenuState.LEVEL;
            }
            else if (_text == "StartMultiplayer")
            {
                m_multiplayerMenu.SetActive(true);
                m_state = MainMenuState.MULTIPLAYER;
            }

            if (_text == "Level01")
            {
                SceneManager.LoadScene("Level1");
            }
            else if (_text == "Level02")
            {
                SceneManager.LoadScene("Level2");
            }
        }
 public void StartViewingCompany(int storeNumber, int buildingNumber)
 {
     //CloseAllMainMenuStates(true);
     currentMainMenuState = MainMenuState.viewingCompany;
     windowController.saveGamesUIGrouping.SaveGameUIOffscreen();
     windowController.viewingCompanyUIGrouping.ViewingCompanyOnScreen(storeNumber, buildingNumber);
 }
Exemple #14
0
 public virtual void Init()
 {
     ConnectDialogState       = new ConnectDialogState(this);
     EscDialogState           = new EscDialogState(this);
     LoadingDialogState       = new LoadingDialogState(this);
     ModelSelectDialogState   = new ModelSelectDialogState(this);
     MainMenuState            = new MainMenuState(this);
     EscConfirmDialogState    = new EscConfirmDialogState(this);
     UIAdjustDialogState      = new UIAdjustDialogState(this);
     StartupDialogState       = new StartupDialogState(this);
     LevelDialogState         = new LevelDialogState(this);
     UpdateDialogState        = new UpdateDialogState(this);
     DlcDialogState           = new DlcDialogState(this);
     DlcManagerDialogState    = new DlcManagerDialogState(this);
     WorldTemplateDialogState = new WorldTemplateDialogState(this);
     MainLobbyDialogState     = new MainLobbyDialogState(this);
     RoomOptionDialogState    = new CreateRoomDialogState(this);
     ServerListDialogState    = new ServerListDialogState(this);
     RecordDialogState        = new RecordDialogState(this);
     HostEditDialogState      = new HostEditDialogState(this);
     SettingDialogState       = new SettingDialogState(this);
     LoginDialogState         = new LoginDialogState(this);
     WeaponSelectDialogState  = new WeaponSelectDialogState(this);
     CampSelectDialogState    = new CampSelectDialogState(this);
     MatchDialogState         = new MatchDialogState(this);
     BattleResultDialogState  = new BattleResultDialogState(this);
     SfxDialogState           = new SfxDialogState(this);
     RobotDialogState         = new RobotDialogState(this);
     RoleSelectDialogState    = new RoleSelectDialogState(this);
     WeaponDialogState        = new WeaponDialogState(this);
 }
Exemple #15
0
 public void Start()
 {
     state = MainMenuState.Main;
     controller.EnableCustomGestures(Gesture.GestureType.TYPESCREENTAP, true);
     controller.EnableCustomGestures(Gesture.GestureType.TYPEKEYTAP, true);
     UpdateButtons();
 }
Exemple #16
0
    public FSM_GameFlow(int fsmID) : base(fsmID)
    {
        // create state

        //Init
        InitState state_Init = new InitState((int)GameFlowState_ID.Init);

        state_Init.Initialize(this, null, () => { });

        //MainMenu
        MainMenuState state_MainMenu = new MainMenuState((int)GameFlowState_ID.MainMenu);

        state_MainMenu.Initialize(this, null, () => { });

        //SelectDiff
        SelectDifficultyState state_SelectDiff = new SelectDifficultyState((int)GameFlowState_ID.SelectDiff);

        state_SelectDiff.Initialize(this, null, () => { });

        //GamePlaying
        GamePlayingState state_GamePlaying = new GamePlayingState((int)GameFlowState_ID.GamePlaying);

        state_GamePlaying.Initialize(this, null, () => { });

        //GameOver
        GameOverState state_GameOver = new GameOverState((int)GameFlowState_ID.GameOver);

        state_GameOver.Initialize(this, null, () => { });

        //ShowScore
        ShowScoreState state_ShowScore = new ShowScoreState((int)GameFlowState_ID.ShowScore);

        state_ShowScore.Initialize(this, null, () => { });
    }
Exemple #17
0
 public void BackToMainMenu()
 {
     state = MainMenuState.Main;
     startGameScene.SetActive(false);
     classifier = Game.GetClassifier(Game.NothingState());
     UpdateButtons();
 }
Exemple #18
0
 public void LoadGame()
 {
     state = MainMenuState.Loading;
     startGameScene.SetActive(false);
     loadingScene.SetActive(true);
     Application.LoadLevel(2);
 }
        void Start()
        {
            CurrentSceneStateProperty.Where(css => css != null).Subscribe(css =>
            {
                if (IsCampaignRunning)
                {
                    CurrentCampaign.CurrentScene = css;
                }

                if (SceneManager != null && SceneManager.TransitionManager != null)
                {
                    SceneManager.NextScene.Value = css.SceneName;
                }
                else
                {
                    TransitionHelper.LoadScene(css.SceneName);
                }
            }).AddTo(this);

            IsCampaignRunningProperty.Subscribe(running => {
                if (running)
                {
                    CurrentCampaign.SessionStarted = DateTime.Now;
                    CurrentSceneState = CurrentCampaign.CurrentScene;
                }
                else
                {
                    CurrentSceneState = new MainMenuState();
                }
            }).AddTo(this);
        }
Exemple #20
0
 private void SetState(MainMenuState state)
 {
     this.m_State          = state;
     this.m_StateStartTime = Time.time;
     this.OnEnterState(state);
     this.UpdateButtons(true);
 }
Exemple #21
0
        public override void Handle(string command)
        {
            switch (_state)
            {
            case MainMenuState.MainMenu:
                if (command == "help" || command == "?")
                {
                    Game.Instance.SendMessage(_account.Id, "You asked for <#orange>main help<#>.");
                }
                else if (command == "money")
                {
                    Game.Instance.SendMessage(_account.Id, "You asked for <#lightgreen>main $MONEY<#>.");
                }
                else if (command == "c")
                {
                    _connection.RemoveHandler();
                    _connection.AddHandler <NewCharacterHandler>();
                    _connection.Handler.Enter();
                }
                else if (command == "p")
                {
                    _state = MainMenuState.ChoosingCharacter;
                    _script.Call(_script.Globals["printCharacters"]);
                }
                break;

            case MainMenuState.ChoosingCharacter:
                int idx;
                if (!int.TryParse(command, out idx))
                {
                    if (command == "q")
                    {
                        _state = MainMenuState.MainMenu;
                        _connection.Handler.Enter();
                    }
                    else
                    {
                        Game.Instance.SendMessage(_account.Id, "Please only enter a number or press \"<#white>q<#>\" to go back.");
                    }
                    break;
                }
                AiGEntity chosenCharacter = null;
                try
                {
                    chosenCharacter = _characters[idx - 1];
                    if (chosenCharacter != null)
                    {
                        Game.Instance.SendMessage(_account.Id, $"You chose {chosenCharacter.Name}");
                        _connection.RemoveHandler();
                        _connection.AddHandler <GameplayHandler>();
                        _connection.Handler.Enter(chosenCharacter.Id);
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    Game.Instance.SendMessage(_account.Id, "Invalid selection.  Please try again.");
                }
                break;
            }
        }
Exemple #22
0
    ////////////////////////////////////////////////////////////////////

    private void Initialize()
    {
        if (mainMenuState != null)
        {
            return;
        }
        mainMenuState = new MainMenuState();

        if (multiplayerState != null)
        {
            return;
        }
        multiplayerState = new MultiplayerState();

        if (trainingState != null)
        {
            return;
        }
        trainingState = new TrainingState();

        if (trainingSettingsState != null)
        {
            return;
        }
        trainingSettingsState = new TrainingSettingsState();
    }
Exemple #23
0
    private void Start()
    {
        var mainMenuState = new MainMenuState();
        var stateMachine  = new StateMachine(mainMenuState);

        StartCoroutine(stateMachine.Execute().GetEnumerator());
    }
Exemple #24
0
        public Game1()
        {
            var graphics = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";

            ScreenRectangle = new Rectangle(0, 0, 1280, 720);

            graphics.PreferredBackBufferWidth  = ScreenRectangle.Width;
            graphics.PreferredBackBufferHeight = ScreenRectangle.Height;

            var gameStateManager = new GameStateManager(this);

            Components.Add(gameStateManager);

            this.IsMouseVisible = true;

            TitleIntroState   = new TitleIntroState(this);
            StartMenuState    = new MainMenuState(this);
            GamePlayState     = new GamePlayState(this);
            ConversationState = new ConversationState(this);
            BattleState       = new BattleState(this);
            BattleOverState   = new BattleOverState(this);
            DamageState       = new DamageState(this);
            LevelUpState      = new LevelUpState(this);

            // begin game at TitleIntroState
            gameStateManager.ChangeState((TitleIntroState)TitleIntroState, PlayerIndex.One);

            CharacterManager = CharacterManager.Instance;
        }
Exemple #25
0
    public void SetState(MainMenuState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("AppMgr", "SetState", "状态切换到:" + state, true);

        preState = curState;

        StateExit(preState);

        curState = state;

        switch (curState)
        {
        case MainMenuState.login:
            LoginPanelTrm.gameObject.SetActive(true);
            break;

        case MainMenuState.stage:
            StagePanelTrm.gameObject.SetActive(true);
            break;

        case MainMenuState.nil:
            break;
        }
    }
Exemple #26
0
    public void Initialize()
    {
        _states = new Dictionary <EGameState, AGameState>();

        InitializeState initializeState = new InitializeState();

        initializeState.Initialize(EGameState.INITIALIZE);
        _states.Add(EGameState.INITIALIZE, initializeState);

        LoadingState loadingState = new LoadingState();

        loadingState.Initialize(EGameState.LOADING);
        _states.Add(EGameState.LOADING, loadingState);

        MainMenuState mainMenuState = new MainMenuState();

        mainMenuState.Initialize(EGameState.MAINMENU);
        _states.Add(EGameState.MAINMENU, mainMenuState);

        GameState gameState = new GameState();

        gameState.Initialize(EGameState.GAME);
        _states.Add(EGameState.GAME, gameState);

        _currentStateType = EGameState.INITIALIZE;
        CurrentState.EnterState();
    }
    void SetUpChoosePlayer()
    {
        // Set thenumber of players chosen
        if (selectedPlayerCount == 2)
        {
            PlayerPrefs.SetInt("numPlayers", 2);
            selectedPlayerCount = 2;
            Debug.Log("Choose 2 players");
            teamOneSmall.SetActive(true);
            teamOneLarge.SetActive(false);
            teamTwoSmall.SetActive(true);
            teamTwoLarge.SetActive(false);
        }
        else
        {
            PlayerPrefs.SetInt("numPlayers", 4);
            selectedPlayerCount = 4;
            Debug.Log("Choose 4 players");
            teamOneSmall.SetActive(false);
            teamOneLarge.SetActive(true);
            teamTwoSmall.SetActive(false);
            teamTwoLarge.SetActive(true);
        }

        // Set the current Menu State
        currentState = MainMenuState.CHOOSE_PLAYER;
        mmCamController.MoveToCharacterSelect();
        canSelectCharacter = true;
    }
Exemple #28
0
    private static GameState ResolveState(GameStateEnum state, GameController controller, GameState previous)
    {
        GameState result;

        switch (state)
        {
        case GameStateEnum.Help:
            result = new HelpState(controller, previous);
            break;

        case GameStateEnum.HighScores:
            throw new NotImplementedException();

        case GameStateEnum.InGame:
            result = new InGameState(controller, previous);
            break;

        case GameStateEnum.MainMenu:
            result = new MainMenuState(controller, previous);
            break;

        case GameStateEnum.MapSelection:
            throw new NotImplementedException();

        case GameStateEnum.PlaceUnits:
            throw new NotImplementedException();

        default:
            throw new InvalidProgramException("Unreacheable path.");
        }

        return(result);
    }
    private void OnSwitch(MainMenuState state)
    {
        switch (state)
        {
        case MainMenuState.Main:
            SwitchToMain();
            break;

        case MainMenuState.GameSelection:
            SwitchToGameSelection();
            break;

        case MainMenuState.LevelSelection:
            SwitchToLevelSelection();
            break;

        case MainMenuState.Options:
            SwitchToOptions();
            break;

        case MainMenuState.Credits:
            SwitchToCredits();
            break;

        case MainMenuState.NewGameWarning:
            SwitchToNewGameWarning();
            break;
        }
    }
        /// <summary>
        /// Updates the screen. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            bool signedIntoLive = false;

            if (Gamer.SignedInGamers.Count > 0)
            {
                foreach (SignedInGamer signedInGamer in Gamer.SignedInGamers)
                {
                    if (signedInGamer.IsSignedInToLive)
                    {
                        signedIntoLive = true;
                        break;
                    }
                }
                State = signedIntoLive ? MainMenuState.SignedInLive :
                        MainMenuState.SignedInLocal;
            }
            else
            {
                State = MainMenuState.SignedOut;
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
Exemple #31
0
	public PopMenuState( GameController context ) : base( context ) 
	{
		this.uiManager = new UIManager();
		sub_state = new SubMenuState(context, this, uiManager);
		main_state = new MainMenuState(context, this, uiManager);

		this.openSFX = Resources.Load("SFX/OpenMenu") as AudioClip;
	}
    public void ScrollUp()
    {
        enumLength = Enum.GetValues( typeof( MainMenuState ) ).Length;
        int index = (int)mainMenuState;
        index = (index + enumLength - 1) % enumLength;
        mainMenuState = (MainMenuState)index;

        string name = Enum.GetName (typeof(MainMenuState), index);
        cs.SetScreenText("\n\nGo to "+name+"?");
    }
Exemple #33
0
 //Constructor
 public MainMenuScreen(Rectangle viewPort)
 {
     this.z_MainScreenPicture1 = null;
     this.z_MainScreenPicture2 = null;
     this.z_MainScreenPicture3 = null;
     this.z_MainScreenPicture4 = null;
     this.z_MainScreenPicture5 = null;
     this.z_MainScreenPicture6 = null;
     this.z_CurrentState = MainMenuState.Missions;
     this.z_viewPort = viewPort;
     this.z_isLoaded = false;
 }
Exemple #34
0
        public override void Initialize()
        {
            menuBackground = new menuItem();

            menuItems = new menuItem[int_NumOfOptions];
            for (int i = 0; i < int_NumOfOptions; i++)
            {
               menuItems[i] = new menuItem();
            }

            CurrentWorkerState = MainMenuState.NEWGAME;
        }
	void Awake()
	{
		Instance = this;

		mainMenuState = new MainMenuState(this);
		levelSelectionState = new LevelSelectionState(this);
		levelGameState = new LevelGameState(this);
		levelLoseState = new LevelLoseState(this);
		levelWonState = new LevelWonState(this);
		levelExitState = new ExitGameState(this);

		if (!levelManager)
		{
			levelManager = LevelsManager.Instance;
		}
	}
    // Update is called once per frame
    void Update()
    {
        switch (currentState)
        {
            case MainMenuState.FadingIn:
                if (!fadeScript.FadingToClear)
                {
                    EnableMainButtons();
                    currentState = MainMenuState.Idle;
                }
                break;

            case MainMenuState.ShowHelp:
                if(Input.GetButtonDown("Back"))
                {
                    help.SetActive(false);
                    EnableMainButtons();
                }
                break;

            case MainMenuState.SelectingPlayers:
                if (Input.GetButtonDown("Back"))
                {
                    DisablePlayerSelectionButtons();
                    playerSelection.SetActive(false);
                    EnableMainButtons();                               
                }
                break;

            case MainMenuState.FadingToGame:
                if(!fadeScript.FadingToColor)
                {
                    rsc.gameMng.StartNewGame(playersNumber);
                }
                break;

            case MainMenuState.FadingToCredits:
                if (!fadeScript.FadingToColor)
                {
                    SceneManager.LoadScene("Credits");
                }
                break;
        }
    }
Exemple #37
0
 private void UpdateUIForSaveCreationFailed(Exception ex)
 {
     State = MainMenuState.Normal;
     AccumErrors = AccumErrors + "CRITICAL ERROR CREATING ACCOUNT: Reported Error:\r\n" +
                   Utils.GenerateReportFromException(ex) + "\r\n";
     if (hasSentErrorEmail)
         return;
     new Thread(() => Utils.SendErrorEmail(ex, "Account Creation Error ", ""))
     {
         IsBackground = true,
         Name = "SaveAccCreationErrorReportThread"
     }.Start();
     hasSentErrorEmail = true;
 }
Exemple #38
0
 private void HookUpCreationEvents()
 {
     loginScreen.RequestGoBack += () => State = MainMenuState.Normal;
     loginScreen.StartNewGameForUsernameAndPass += (username, pass) =>
     {
         if (SaveFileManager.AddUser(username, pass))
         {
             var filePathForLogin = SaveFileManager.GetFilePathForLogin(username, pass);
             ExitScreen();
             resetOS();
             if (!Settings.soundDisabled)
                 ScreenManager.playAlertSound();
             try
             {
                 ScreenManager.AddScreen(new OS
                 {
                     SaveGameUserName = filePathForLogin,
                     SaveUserAccountName = username
                 }, ScreenManager.controllingPlayer);
             }
             catch (Exception ex)
             {
                 UpdateUIForSaveCreationFailed(ex);
             }
         }
         else
         {
             loginScreen.ResetForNewAccount();
             loginScreen.WriteToHistory(" ERROR: Username invalid or already in use.");
         }
     };
     loginScreen.LoadGameForUserFileAndUsername += (userFile, username) =>
     {
         ExitScreen();
         resetOS();
         OS.WillLoadSave = SaveFileManager.StorageMethods[0].FileExists(userFile);
         var os = new OS();
         os.SaveGameUserName = userFile;
         os.SaveUserAccountName = username;
         try
         {
             ScreenManager.AddScreen(os, ScreenManager.controllingPlayer);
         }
         catch (XmlException ex)
         {
             UpdateUIForSaveCorruption(userFile, ex);
         }
         catch (FormatException ex)
         {
             UpdateUIForSaveCorruption(userFile, ex);
         }
         catch (NullReferenceException ex)
         {
             UpdateUIForSaveCorruption(userFile, ex);
         }
         catch (FileNotFoundException ex)
         {
             UpdateUIForSaveMissing(userFile, ex);
         }
     };
     attractModeScreen.Start += () =>
     {
         try
         {
             ExitScreen();
             resetOS();
             ScreenManager.playAlertSound();
             ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer);
         }
         catch (Exception ex)
         {
             Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt");
         }
     };
 }
Exemple #39
0
 private void drawMainMenuButtons(bool canRun)
 {
     var num1 = 135;
     int num2;
     if (Button.doButton(1, 180, num2 = num1 + 65, 450, 50, "New Session", buttonColor) && canRun)
     {
         State = MainMenuState.NewUser;
         loginScreen.ResetForNewAccount();
     }
     int num3;
     if (
         Button.doButton(1102, 180, num3 = num2 + 65, 450, 28,
             canLoad
                 ? "Continue with account [" + SaveFileManager.LastLoggedInUser.Username + "]"
                 : "No Accounts", canLoad ? buttonColor : Color.Black) && canLoad)
         loginScreen.LoadGameForUserFileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername,
             SaveFileManager.LastLoggedInUser.Username);
     int num4;
     if (Button.doButton(11, 180, num4 = num3 + 39, 450, 50, "Login", canLoad ? buttonColor : Color.Black))
     {
         if (canLoad)
         {
             try
             {
                 State = MainMenuState.Login;
                 loginScreen.ResetForLogin();
             }
             catch (Exception ex)
             {
                 Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt");
             }
         }
     }
     int num5;
     if (Button.doButton(3, 180, num5 = num4 + 65, 450, 50, "Settings", buttonColor))
         ScreenManager.AddScreen(new OptionsMenu(), ScreenManager.controllingPlayer);
     int num6;
     var y = num6 = num5 + 65;
     if (Settings.isServerMode)
     {
         if (Button.doButton(4, 180, y, 450, 50, "Start Relay Server", buttonColor))
             ScreenManager.AddScreen(new ServerScreen(), ScreenManager.controllingPlayer);
         y += 65;
     }
     if (Settings.AllowAdventureMode)
     {
         if (Button.doButton(5, 180, y, 450, 50, "Adventure Session", buttonColor))
         {
             ExitScreen();
             resetOS();
             Settings.IsInAdventureMode = true;
             if (!Settings.soundDisabled)
                 ScreenManager.playAlertSound();
             ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer);
         }
         y += 65;
     }
     if (Button.doButton(15, 180, y, 450, 28, "Exit", exitButtonColor))
     {
         MusicManager.stop();
         Game1.threadsExiting = true;
         Game1.getSingleton().Exit();
     }
     var num7 = y + 30;
     if (!PlatformAPISettings.RemoteStorageRunning)
     {
         TextItem.doFontLabel(new Vector2(180f, num7), "WARNING: Error connecting to Steam Cloud",
             GuiData.smallfont, Color.DarkRed, float.MaxValue, float.MaxValue);
         num7 += 20;
     }
     if (string.IsNullOrWhiteSpace(AccumErrors))
         return;
     TextItem.doFontLabel(new Vector2(180f, num7), AccumErrors, GuiData.smallfont, Color.DarkRed, float.MaxValue,
         float.MaxValue);
     var num8 = num7 + 20;
 }
    // Update is called once per frame
    void Update()
    {
        //Debug.Log("Current Menu State: " + m_MMState);
        switch(m_MMState)
        {

        case MainMenuState.Idle:
           	 break;
        case MainMenuState.ShowMenu:
            ShowMenuAction();
             break;

        case MainMenuState.Start:
             StartAction();
             break;
        case MainMenuState.Options:
            //transform.FindChild("ButtonOptions").GetComponent<ButtonOptions>().SetOptionsWindow();
            OptionsAction();
            m_MMState = MainMenuState.Idle;
        break;

        }
        m_MMState = MainMenuState.Idle;
    }
 // Use this for initialization
 void Start()
 {
     m_InitalPos = transform.position;
     m_MMState = (GameManager.isInGame)? MainMenuState.Idle : MainMenuState.ShowMenu;
 }
 public void OnClickHelp()
 {
     DisableMainButtons();
     help.SetActive(true);
     currentState = MainMenuState.ShowHelp;
 }
 public void SetMainMenuState(MainMenuState _s)
 {
     m_MMState = _s;
 }
Exemple #44
0
 private void UpdateUIForSaveMissing(string saveName, Exception ex)
 {
     State = MainMenuState.Normal;
     AccumErrors = AccumErrors + "ACCOUNT FILE NOT FOUND: Account " + saveName +
                   " appears to be missing. It may have been moved or deleted. Reported Error:\r\n" +
                   Utils.GenerateReportFromException(ex) + "\r\n";
     if (hasSentErrorEmail)
         return;
     new Thread(() => Utils.SendErrorEmail(ex, "Save Missing ", ""))
     {
         IsBackground = true,
         Name = "SaveMissingErrorReportThread"
     }.Start();
     hasSentErrorEmail = true;
 }
 public static void SetState(MainMenuState newState)
 {
     mainMenuState = newState;
 }
Exemple #46
0
        /// <summary>
        /// Goes to the "next" option
        /// </summary>
        private void CycleForward()
        {
            if (CurrentWorkerState == MainMenuState.EXIT)
            {
                CurrentWorkerState = MainMenuState.NEWGAME;
            }
            else
            {
                CurrentWorkerState++;
            }

            for (int i = 0; i < int_NumOfOptions; i++)
            {
                if (i == (int)CurrentWorkerState)
                {
                    menuItems[i].t2d_Texture = menuItems[i].t2d_Texture_Highlight;
                }
                else
                {
                    menuItems[i].t2d_Texture = menuItems[i].t2d_Texture_Original;
                }
            }
        }
Exemple #47
0
 public void setCurrentState(MainMenuState newState)
 {
     this.z_CurrentState = newState;
 }
Exemple #48
0
 /// <summary>
 /// Puts the worker state on void
 /// </summary>
 public void MenuVoid()
 {
     PreviousWorkerState = CurrentWorkerState;
     CurrentWorkerState = MainMenuState.VOID;
 }
 public void Select2Players()
 {
     playersNumber = 2;
     DisablePlayerSelectionButtons();
     currentState = MainMenuState.FadingToGame;
     fadeScript.StartFadingToColor();     
 }
Exemple #50
0
 // Use this for initialization
 void Start()
 {
     //Let the state machine run and boot into the main menu
     gameShouldRun = true;
     MainMenuState menuState = new MainMenuState();
     menuState.game = this;
     stateMachine.Push(menuState);
     UnityEngine.Debug.Log("Game Started");
 }
Exemple #51
0
        /// <summary>
        /// Updates the screen. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            State = MainMenuState.Network;

            if (_gameplayScreen != null)
            {
                if (_gameplayScreen.ScreenState == ScreenState.Dead)
                {
                    _gameSessionFactory.Dispose();
                    _gameplayScreen = null;
                }
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
 public void OnClickCredits()
 {
     currentState = MainMenuState.FadingToCredits;
     fadeScript.StartFadingToColor();      
 }
 public void OnClickStart()
 {
     if (loadResources.isDone)
     {
         rsc.gameMng.StartPreloadingFirstLevel();
         DisableMainButtons();
         playerSelection.SetActive(true);
         EnablePlayerSelectionButtons();
         currentState = MainMenuState.SelectingPlayers;
     }
 }
Exemple #54
0
        //Update Method
        public void update(KeyboardState currentKeyboardState, KeyboardState previousKeyboardState)
        {
            //Don't update anything if the MainMenu is not loaded
            if (!this.z_isLoaded)
                return;

            if (previousKeyboardState.IsKeyUp(Keys.Escape) && currentKeyboardState.IsKeyDown(Keys.Escape))
                this.z_CurrentState = MainMenuState.Exit;

            //Implement the other states/input later
            //Save some lines of code -->
            //By checking that none of the keys are being held down here
            if (previousKeyboardState.IsKeyUp(Keys.Up) && previousKeyboardState.IsKeyUp(Keys.Down) &&
                previousKeyboardState.IsKeyUp(Keys.Right) && previousKeyboardState.IsKeyUp(Keys.Left))
            {
                switch (this.z_CurrentState)
                {
                    //If state is Missions, can only move right and down
                    //right is ship state
                    //down is Achievements state
                    case MainMenuState.Missions:
                        {
                            //if player wants to go right
                            if (currentKeyboardState.IsKeyDown(Keys.Right))
                            {
                                this.z_CurrentState = MainMenuState.Ship;
                            }
                            //if player wants to go down
                            if (currentKeyboardState.IsKeyDown(Keys.Down))
                            {
                                this.z_CurrentState = MainMenuState.Achievements;
                            }
                            break;
                        }
                    //If state is Ship, can move left, right, and down
                    //left is missions
                    //right is store
                    //down is options
                    case MainMenuState.Ship:
                        {
                            //if player wants to go right
                            if (currentKeyboardState.IsKeyDown(Keys.Right))
                                this.z_CurrentState = MainMenuState.Store;

                            //if player wants to go down
                            if (currentKeyboardState.IsKeyDown(Keys.Down))
                                this.z_CurrentState = MainMenuState.Options;

                            //if player wants to go left
                            if (currentKeyboardState.IsKeyDown(Keys.Left))
                                this.z_CurrentState = MainMenuState.Missions;

                            break;
                        }
                        //If state is Store, can move only left and down
                        //Left is Ship
                        //Down is Back
                    case MainMenuState.Store:
                        {
                            //if player wants to go Left
                            if (currentKeyboardState.IsKeyDown(Keys.Left))
                                this.z_CurrentState = MainMenuState.Ship;

                            //if player wants to go Down
                            if (currentKeyboardState.IsKeyDown(Keys.Down))
                                this.z_CurrentState = MainMenuState.Back;

                            break;
                        }
                        //If state is Achievements, can only move up and right
                        //Up is missons
                        //Right is Options
                    case MainMenuState.Achievements:
                        {
                            //if player wants to go right
                            if (currentKeyboardState.IsKeyDown(Keys.Right))
                                this.z_CurrentState = MainMenuState.Options;

                            //if player wants to go Up
                            if (currentKeyboardState.IsKeyDown(Keys.Up))
                                this.z_CurrentState = MainMenuState.Missions;

                            break;
                        }
                        //If State is Options, can move left, Up, and right
                        //left is achievements
                        //Up is Ship
                        //Right is Back
                    case MainMenuState.Options:
                        {
                            //if player wants to go Left
                            if (currentKeyboardState.IsKeyDown(Keys.Left))
                                this.z_CurrentState = MainMenuState.Achievements;

                            //if player wants to go Up
                            if (currentKeyboardState.IsKeyDown(Keys.Up))
                                this.z_CurrentState = MainMenuState.Ship;

                            //if player wants to go right
                            if (currentKeyboardState.IsKeyDown(Keys.Right))
                                this.z_CurrentState = MainMenuState.Back;

                            break;
                        }
                        //If state is back, can move left and up
                        //left is Options
                        //Up is Store
                    case MainMenuState.Back:
                        {
                            //if player wants to go Left
                            if (currentKeyboardState.IsKeyDown(Keys.Left))
                                this.z_CurrentState = MainMenuState.Options;

                            //if player wants to go Up
                            if (currentKeyboardState.IsKeyDown(Keys.Up))
                                this.z_CurrentState = MainMenuState.Store;

                            break;
                        }
                    default:
                        break;
                }
            }
        }
Exemple #55
0
 private void UpdateUIForSaveCorruption(string saveName, Exception ex)
 {
     State = MainMenuState.Normal;
     AccumErrors = AccumErrors + "ACCOUNT FILE CORRUPTION: Account " + saveName +
                   " appears to be corrupted, and will not load. Reported Error:\r\n" +
                   Utils.GenerateReportFromException(ex) + "\r\n";
     if (hasSentErrorEmail)
         return;
     new Thread(() => Utils.SendErrorEmail(ex, "Save Corruption ", ""))
     {
         IsBackground = true,
         Name = "SaveCorruptErrorReportThread"
     }.Start();
     hasSentErrorEmail = true;
 }
Exemple #56
0
 public void SwitchState(MainMenuState a_state)
 {
     menuState = a_state;
 }
Exemple #57
0
 // Use this for initialization
 void Start()
 {
     menuState = MainMenuState.Intro;
     gunObject = GameObject.Find("GunObject");
     mainCam = GameObject.Find("Main Camera");
 }
 internal static void RunTutorial()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     mainMenuState = MainMenuState.TUTORIAL;
 }
 void Start()
 {
     DisableMainButtons();      
     currentState = MainMenuState.FadingIn;
     fadeScript.StartFadingToClear(Color.black, 1f);
 }
        internal static void RightArrowButtonFunction()
        {
            AudioController.ButtonClick3SoundEffectInstance.Play();
            if (tutorialCounter == mTutorialImages.Length - 1)
            {
                GameController.gameState = GameState.MAIN_MENU;
                mainMenuState = MainMenuState.NONE;
                tutorialCounter = 0;
            }

            else
            {
                tutorialCounter++;
            }
        }