Ejemplo n.º 1
0
        public PlayersScreen(Scheme scheme, InputType[] inputTypes, InputTypeSelectDelegate selectDelegate, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 521, 363);

            // scheme view
            contentView.AddView(new SchemeView(scheme, SchemeView.Style.Large));

            // input type selector
            int  maxPlayers         = inputTypes.Length;
            View inputTypeContainer = new View(226, 0, 286, 0);
            Font font = Helper.fontButton;

            for (int i = 0; i < maxPlayers; ++i)
            {
                InputTypeView typeView = new InputTypeView(i, inputTypes[i], font, inputTypeContainer.width, font.FontHeight());
                typeView.selectDelegate = selectDelegate;
                inputTypeContainer.AddView(typeView);
            }
            inputTypeContainer.LayoutVer(0);
            inputTypeContainer.ResizeToFitViewsHor();
            contentView.AddView(inputTypeContainer);

            AddView(contentView);

            // buttons
            View buttons = new View(0.5f * width, contentView.y + contentView.height, 0, 0);

            buttons.alignX = View.ALIGN_CENTER;

            Button button = new TempButton("BACK");

            button.id             = (int)ButtonId.Back;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button                = new TempButton("START!");
            button.id             = (int)ButtonId.Start;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);
            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }
 private void InputTypeSelectDelegate(InputTypeView view, bool forward)
 {
     InputType inputType = view.GetSelectedType();
     InputType newInputType = forward ? NextInputType(inputType) : PrevInputType(inputType);
     if (newInputType != inputType)
     {
         SetInputState(inputType, InputState.Available);
         SetInputType(view.index, newInputType);
         view.SetSelectedType(newInputType);
     }
 }
        public PlayersScreen(Scheme scheme, InputType[] inputTypes, InputTypeSelectDelegate selectDelegate, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 521, 363);

            // scheme view
            contentView.AddView(new SchemeView(scheme, SchemeView.Style.Large));

            // input type selector
            int maxPlayers = inputTypes.Length;
            View inputTypeContainer = new View(226, 0, 286, 0);
            Font font = Helper.fontButton;
            for (int i = 0; i < maxPlayers; ++i)
            {
                InputTypeView typeView = new InputTypeView(i, inputTypes[i], font, inputTypeContainer.width, font.FontHeight());
                typeView.selectDelegate = selectDelegate;
                inputTypeContainer.AddView(typeView);
            }
            inputTypeContainer.LayoutVer(0);
            inputTypeContainer.ResizeToFitViewsHor();
            contentView.AddView(inputTypeContainer);

            AddView(contentView);

            // buttons
            View buttons = new View(0.5f * width, contentView.y + contentView.height, 0, 0);
            buttons.alignX = View.ALIGN_CENTER;

            Button button = new TempButton("BACK");
            button.id = (int)ButtonId.Back;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button = new TempButton("START!");
            button.id = (int)ButtonId.Start;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);
            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }