CreateNewGame() public method

public CreateNewGame ( ) : void
return void
Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            /*
             * Context context = this;
             * createHeroes(context.Resources);
             */
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Game);

            NewGame       newGame = NewGame.CreateNewGame();
            EnumGameLevel level   = (EnumGameLevel)Intent.GetIntExtra("level", -1);

            newGame.setLevel(level);
            LinearLayout HeroPanel = FindViewById <LinearLayout>(Resource.Id.HeroPanel);

            for (int i = 0; i < HeroPanel.ChildCount; ++i)
            {
                LinearLayout dziecko = (LinearLayout)HeroPanel.GetChildAt(i);
                showHero.Add(new GUIHero(dziecko));
            }
            Context    context    = this;
            Controller controller = new Controller(newGame, this);

            controller.createHeroes(context.Resources);
            controller.createDicePool(context.Resources);
            Console.WriteLine("tu jestem!!!");
            controller.createThreat(context.Resources);
            // Create your application here
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Key was pressed in new game menu
    /// </summary>
    /// <param name="keyPressed">Key pressed.</param>
    public IEnumerator GamePanelKeypress(string keyPressed)
    {
        if (keyPressed.Equals("up"))
        {
            selectedItem--;

            // for now, the item is just 0
            if (selectedItem < 0)
            {
                // set the selected item at the end
                // right now, we have 2 save files
                selectedItem = saveFilesItems.Length - 1;
            }



            saveFilesItems [selectedItem].Select();
        }
        else if (keyPressed.Equals("down"))
        {
            selectedItem++;

            if (selectedItem >= saveFilesItems.Length)
            {
                selectedItem = 0;
            }

            saveFilesItems [selectedItem].Select();
        }
        else if (keyPressed.Equals("forward"))
        {
            if (currentState == MENU_STATES.NEW_GAME)
            {
                // if we have a sting source, play sting
                if (stingPlayer != null)
                {
                    stingPlayer.playSelectItemSound();
                }

                WaitingForTime pauseItem = gameObject.AddComponent <WaitingForTime> ();
                ScreenFader    sf        = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>();

                StartCoroutine(sf.FadeToBlack());
                yield return(StartCoroutine(pauseItem.WaitForTime(0.9f)));

                // just overwrite the game here - we'll later on want to do a confirm if we have
                // a legitimate game at this location
                // for now, just overwrite.
                NewGame newGame = new NewGame(selectedItem);
                newGame.CreateNewGame();
            }
            else if (currentState == MENU_STATES.LOAD && SaveLoad.savedGames [selectedItem] != null)
            {
                // if we have a sting source, play sting
                if (stingPlayer != null)
                {
                    stingPlayer.playLoadGameSound();
                }

                // load game here
                SaveLoad.Load(selectedItem);

                WaitingForTime pauseItem = gameObject.AddComponent <WaitingForTime> ();
                ScreenFader    sf        = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>();

                StartCoroutine(sf.FadeToBlack());
                yield return(StartCoroutine(pauseItem.WaitForTime(0.9f)));

                // toolbox scene
                SceneManager.LoadScene("LoadingScene");
            }
            else if (currentState == MENU_STATES.LOAD && SaveLoad.savedGames [selectedItem] == null)
            {
                // display tiny error message briefly?
                // if we have a sting source, play sting
                if (stingPlayer != null)
                {
                    stingPlayer.playBackButtonSound();
                }
            }
        }
        else if (keyPressed.Equals("back"))
        {
            ShowMainMenu();
        }
    }