Exemplo n.º 1
0
        public override void Initialize()
        {
            base.Initialize();

            Manager.Scene.AddEntity(new PlayerSignedOut());

            // Escena de fondo:
            Manager.Scene.AddEntity(new GreyInfectiontitleScene());

            // Sombreamos el fondo:
            Manager.Scene.AddEntity(new BackBox());

            // Titulo:
            Label title = new Label();

            Manager.Scene.AddEntity(title);
            title.Caption  = Session.Strings["levmenu_title"];
            title.Location = new Vector2(Manager.Graphics.ScreenSafeArea.X, Manager.Graphics.ScreenSafeArea.Y + 100);

            // Rejilla de niveles:
            GridButtonGroup grid = new GridButtonGroup();

            grid.Columns      = 8;
            grid.Rows         = 4;
            grid.ButtonWidth  = 136;
            grid.ButtonHeight = 86;
            grid.Location     = new Vector2(Manager.Graphics.ScreenSafeArea.X + 30, Manager.Graphics.ScreenSafeArea.Y + 200);
            grid.OnExit      += OnExitState;
            Manager.Scene.AddEntity(grid);

            LevelSelectionButton button;

            for (int i = 0; i < 32; i++)
            {
                button = new LevelSelectionButton();
                button.ConfirmFXWaitToEnd = true;
                grid.Add(button);
                button.OnGridEnter += OnEnterLevel;
            }

            // Indicaciones de input:
            InputHintLabel inputHint = new InputHintLabel();

            Manager.Scene.AddEntity(inputHint);
            inputHint.Button   = InputHintLabel.GamepadButtonChar.A;
            inputHint.Caption  = Session.Strings["button_select"];
            inputHint.Location = new Vector2(340, Manager.Graphics.ScreenSafeArea.Bottom - 42);

            inputHint = new InputHintLabel();
            Manager.Scene.AddEntity(inputHint);
            inputHint.Button   = InputHintLabel.GamepadButtonChar.B;
            inputHint.Caption  = Session.Strings["button_back"];
            inputHint.Location = new Vector2(600, Manager.Graphics.ScreenSafeArea.Bottom - 42);

            inputHint = new InputHintLabel();
            Manager.Scene.AddEntity(inputHint);
            inputHint.Button   = InputHintLabel.GamepadButtonChar.LeftThumb;
            inputHint.Caption  = Session.Strings["button_move"];
            inputHint.Location = new Vector2(850, Manager.Graphics.ScreenSafeArea.Bottom - 42);
        }
 void MoveFocusTo( LevelSelectionButton newFocusedButton )
 {
     if (newFocusedButton != null)
     {
         focusedButton = newFocusedButton;
     }
 }
Exemplo n.º 3
0
 public void SetSelectedLevel(int _levelID)
 {
     foreach (LevelSelectionButton tempLevelSelectionButton in levelList)
     {
         tempLevelSelectionButton.OnUnselected();
     }
     levelList[_levelID - 1].isSelected = true;
     currentSelectedButton = levelList[_levelID - 1];
 }
Exemplo n.º 4
0
    public void PlayGame()
    {
        string[] possibleLevels = SerializeUtility.GetAllLevels();

        foreach (string possibleLevel in possibleLevels)
        {
            LevelSelectionButton levelSelectionButton = Instantiate(levelSelectionButtonPrefab, levelSelectionButtonsParent.transform).GetComponent <LevelSelectionButton>();
            levelSelectionButton.SetLevel(possibleLevel);
        }

        levelSelectionPanel.SetActive(true);
    }
Exemplo n.º 5
0
    private void SetScrollView()
    {
        RemoveScrollViewSet();
        scrollRect.verticalNormalizedPosition = 0;
        string[] levelNames = conCurrentLevel.LevelLibrary.GetAllLevelNames();
        if (difficultyFilterSet)
        {
            levelNames = conCurrentLevel.LevelLibrary.GetAllLevelNames(difficultyFilter);
        }

        Vector2 lastPos     = new Vector2();
        float   buttonYSize = 0;
        float   offset      = 10;

        for (int i = 0; i < levelNames.Length; i++)
        {
            string levelName       = levelNames[i];
            LevelSelectionButton b = Instantiate(buttonPrefab);
            b.SetLevelButton(levelName);
            b.transform.SetParent(buttonHolder, false);
            levelButtons.Add(b);
            float realOffset = offset;
            if (buttonYSize == 0)
            {
                buttonYSize = b.Size.y;
            }
            if (i != 0)
            {
                realOffset += b.Size.y;
            }
            lastPos.y -= realOffset;
            ((RectTransform)b.transform).anchoredPosition = lastPos;
            lastPos = ((RectTransform)b.transform).anchoredPosition;
        }
        buttonHolder.sizeDelta = new Vector2(buttonHolder.sizeDelta.x, levelNames.Length * (buttonYSize + offset) + offset);
    }