Esempio n. 1
0
        public UIControlConfig(
            UIMenu openOnClose,
            string title,
            float xpos,
            float ypos,
            float wide              = -1f,
            float high              = -1f,
            string conString        = "",
            InputProfile conProfile = null)
            : base(title, xpos, ypos, wide, high, conString, conProfile)
        {
            this._openOnClose = openOnClose;
            List <string> stringList1 = new List <string>()
            {
                "P1   ",
                "P2   ",
                "P3   ",
                "P4"
            };
            List <string> stringList2 = new List <string>()
            {
                "GAMEPAD",
                "KEYBOARD",
                "PAD + KEYS"
            };
            BitmapFont bitmapFont = new BitmapFont("smallBiosFontUI", 7, 5);
            UIBox      uiBox      = new UIBox(isVisible: false);

            this._configuringToggle = new UIMenuItemToggle("", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.SwitchConfigType)), new FieldBinding((object)this, nameof(inputConfigType)), multi: this.inputTypes, compressedMulti: true, tiny: true);
            uiBox.Add((UIComponent)this._configuringToggle, true);
            UIText uiText1 = new UIText(" ", Color.White);

            this._controlElements.Add(new UIControlElement("|DGBLUE|{LEFT", "LEFT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|/RIGHT", "RIGHT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|}UP", "UP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|~DOWN", "DOWN", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|START", "START", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|ACCEPT", "SELECT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|JUMP", "JUMP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|GRAB", "GRAB", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|TRIP", "RAGDOLL", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|FIRE", "SHOOT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|STRAFE", "STRAFE", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGBLUE|QUACK", "QUACK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGGREEN|L STICK", "LSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGGREEN|R STICK", "RSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGGREEN|L TRIGGER", "LTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            this._controlElements.Add(new UIControlElement("|DGGREEN|R TRIGGER", "RTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume")));
            uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true);
            UIMenuItem uiMenuItem = new UIMenuItem("|RED|REVERT TO DEFAULT", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.ResetToDefault)));

            uiMenuItem.SetFont(bitmapFont);
            uiBox.Add((UIComponent)uiMenuItem, true);
            UIText uiText2 = new UIText(" ", Color.White);

            uiText2.SetFont(bitmapFont);
            uiBox.Add((UIComponent)uiText2, true);
            UIText uiText3 = new UIText("PERSONAL CONTROLS CAN BE", Color.White);

            uiText3.SetFont(bitmapFont);
            uiBox.Add((UIComponent)uiText3, true);
            UIText uiText4 = new UIText("SET IN PROFILE SCREEN", Color.White);

            uiText4.SetFont(bitmapFont);
            uiBox.Add((UIComponent)uiText4, true);
            this._controlBox = uiBox;
            this._playerBoxes.Add(uiBox);
            this.Add((UIComponent)this._playerBoxes[0], true);
            this._confirmMenu = new UIMenu("SAVE CHANGES?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT");
            this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenuSaving))), true);
            this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenu))), true);
            this._confirmMenu.Add((UIComponent) new UIMenuItem("CANCEL!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this)), true);
            this._confirmMenu.Close();
        }
        public UIMenuItemToggle(
            string text,
            UIMenuAction action        = null,
            FieldBinding field         = null,
            Color c                    = default(Color),
            FieldBinding filterBinding = null,
            List <string> multi        = null,
            bool compressedMulti       = false,
            bool tiny                  = false)
            : base(action)
        {
            if (c == new Color())
            {
                c = Colors.MenuOption;
            }
            BitmapFont f = (BitmapFont)null;

            if (tiny)
            {
                f = new BitmapFont("smallBiosFontUI", 7, 5);
            }
            UIDivider uiDivider = new UIDivider(true, 0.0f);

            if (text != "")
            {
                UIText uiText = new UIText(text, c);
                if (tiny)
                {
                    uiText.SetFont(f);
                }
                uiText.align = UIAlign.Left;
                uiDivider.leftSection.Add((UIComponent)uiText, true);
            }
            if (multi != null)
            {
                this._multiToggleElement       = new UIMultiToggle(-1f, -1f, field, multi, compressedMulti);
                this._multiToggleElement.align = compressedMulti ? UIAlign.Right : UIAlign.Right;
                if (text != "")
                {
                    uiDivider.rightSection.Add((UIComponent)this._multiToggleElement, true);
                }
                else
                {
                    uiDivider.leftSection.Add((UIComponent)this._multiToggleElement, true);
                    this._multiToggleElement.align = UIAlign.Left;
                }
                if (tiny)
                {
                    this._multiToggleElement.SetFont(f);
                }
                this._multiToggle = multi;
                this._compressed  = compressedMulti;
            }
            else
            {
                UIOnOff uiOnOff = new UIOnOff(-1f, -1f, field, filterBinding);
                if (tiny)
                {
                    uiOnOff.SetFont(f);
                }
                uiOnOff.align = UIAlign.Right;
                uiDivider.rightSection.Add((UIComponent)uiOnOff, true);
            }
            this.rightSection.Add((UIComponent)uiDivider, true);
            if (tiny)
            {
                this._arrow = new UIImage("littleContextArrowRight");
            }
            else
            {
                this._arrow = new UIImage("contextArrowRight");
            }
            this._arrow.align   = UIAlign.Right;
            this._arrow.visible = false;
            this.leftSection.Add((UIComponent)this._arrow, true);
            this._field       = field;
            this._filterField = filterBinding;
        }