public DeitySystem()
    {
        var doc = WidgetDoc.Load("ui/pc_creation/deity_ui.json");

        Container         = doc.GetRootContainer();
        Container.Visible = false;

        _deityButtons = new Dictionary <DeityId, WidgetButton>();
        foreach (var deityId in GameSystems.Deity.PlayerSelectableDeities)
        {
            var buttonIndex = _deityButtons.Count;
            var button      = new WidgetButton(new Rectangle(
                                                   48 + 171 * (buttonIndex / 10),
                                                   25 + 21 * (buttonIndex % 10),
                                                   162,
                                                   12
                                                   ));
            button.SetStyle("deity-button");
            button.Text          = GameSystems.Deity.GetName(deityId).ToUpper();
            button.OnMouseEnter += msg => ShowDeityHelp(deityId);
            button.OnMouseExit  += msg => UpdateDescriptionBox();
            button.SetClickHandler(() => SelectDeity(deityId));
            Container.Add(button);
            _deityButtons[deityId] = button;
        }
    }
示例#2
0
    public void Show()
    {
        mListBox.Clear();

        int       y             = 0;
        const int NUM_SCENARIOS = 0;

        for (int i = 0; i < NUM_SCENARIOS; i++)
        {
            var button = new WidgetButton();
            button.Text = "Arena";
            button.SetId("Arena");
            var innerWidth = mListBox.GetInnerWidth();
            button.Width = innerWidth;
            button.SetAutoSizeWidth(false);
            button.SetStyle("mm-setpieces-list-button");
            button.Y = y;
            btnIds.Add(button);
            var idx = i;
            button.SetClickHandler(() => Select(idx));
            y += button.Height;
            mListBox.Add(button);
        }

        mWidget.Show();
    }
示例#3
0
    public ActionBarUi()
    {
        _pulseAnimation = GameSystems.Vagrant.AllocateActionBar();
        // These values were configurable in a MES file before
        GameSystems.Vagrant.ActionBarSetPulseValues(_pulseAnimation, 64, 255, 0.125f);

        _combatBarFill        = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Fill.tga", false);
        _combatBarHighlight   = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Highlight.tga", false);
        _combatBarHighlight2  = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Highlight2.tga", false);
        _combatBarGrey        = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_GREY.tga", false);
        _combatBarFillInvalid = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Fill_INVALID.tga", false);

        _window      = new WidgetContainer(8, 117, 50, 260);
        _window.Name = "combat_ui_debug_output_window";

        // Hide or show the entire action bar based on combat status
        _window.Visible = false;
        GameSystems.Combat.OnCombatStatusChanged += combatStatus => { _window.Visible = combatStatus; };

        var actionBarImage = new WidgetImage("art/interface/COMBAT_UI/combatbar.img");

        _window.AddContent(actionBarImage);

        var actionBar = new WidgetContainer(new Rectangle(13, 15, 22, 170));

        _window.Add(actionBar);
        actionBar.Name            = "action bar";
        actionBar.OnBeforeRender += () => UiCombatActionBarRender(actionBar);

        // Add a full sized button on top of the action bar to handle tooltips and help requests
        var actionBarButton = new WidgetButton();

        actionBarButton.SetStyle(new WidgetButtonStyle());
        actionBarButton.SetSizeToParent(true);
        actionBarButton.SetClickHandler(OnActionBarButtonClick);
        actionBarButton.TooltipStyle    = "action-bar-tooltip";
        actionBarButton.OnBeforeRender += () =>
        {
            // Use the time update message (one per frame) to update the tooltip text
            actionBarButton.TooltipText = GetActionBarTooltipText();
        };
        actionBar.Add(actionBarButton);

        var nextTurn = new WidgetButton(new Rectangle(0, 194, 50, 50));

        nextTurn.SetStyle(new WidgetButtonStyle
        {
            NormalImagePath   = "art/interface/COMBAT_UI/Action-End-Turn.tga",
            HoverImagePath    = "art/interface/COMBAT_UI/Action-End-Turn-Hover.tga",
            PressedImagePath  = "art/interface/COMBAT_UI/Action-End-Turn-Click.tga",
            DisabledImagePath = "art/interface/COMBAT_UI/Action-End-Turn-Disabled.tga",
        });
        nextTurn.Name            = "next_turn";
        nextTurn.OnBeforeRender += () => OnBeforeRenderNextTurn(nextTurn);
        nextTurn.SetClickHandler(OnNextTurnClick);
        _window.Add(nextTurn);
    }
    public WidgetSlider(int x, int y, [CallerFilePath]
                        string filePath = null, [CallerLineNumber]
                        int lineNumber  = -1) : base(x, y, filePath, lineNumber)
    {
        // Size of the slider itself
        Width  = 177;
        Height = 27;

        var leftButton = new WidgetButton();

        leftButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-left"));
        leftButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        leftButton.SetRepeat(true);
        leftButton.Width  = 27;
        leftButton.Height = 27;

        var rightButton = new WidgetButton();

        rightButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-right"));
        rightButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        rightButton.SetRepeat(true);
        rightButton.Width  = 27;
        rightButton.Height = 27;
        rightButton.X      = Width - rightButton.Width;

        var track = new WidgetButton();

        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-track"));
        track.SetClickHandler((x, y) =>
        {
            if (x < _handleButton.X)
            {
                SetValue(GetValue() - Quantum);
            }
            else if (x >= _handleButton.X + _handleButton.Width)
            {
                SetValue(GetValue() + Quantum);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetSliderHandle(this);

        handle.Y = 2;

        _leftButton   = leftButton;
        _rightButton  = rightButton;
        _track        = track;
        _handleButton = handle;

        Add(track);
        Add(leftButton);
        Add(rightButton);
        Add(handle);
    }
    public WidgetScrollBar() : base(0, 0)
    {
        var upButton = new WidgetButton();

        upButton.SetParent(this);
        upButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-up"));
        upButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        upButton.SetRepeat(true);

        var downButton = new WidgetButton();

        downButton.SetParent(this);
        downButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-down"));
        downButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        downButton.SetRepeat(true);

        var track = new WidgetButton();

        track.SetParent(this);
        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-track"));
        track.SetClickHandler((x, y) =>
        {
            // The y value is in relation to the track, we need to add it's own Y value,
            // and compare against the current position of the handle
            y += mTrack.Y;
            if (y < mHandleButton.Y)
            {
                SetValue(GetValue() - 5);
            }
            else if (y >= mHandleButton.Y + mHandleButton.Height)
            {
                SetValue(GetValue() + 5);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetScrollBarHandle(this);

        handle.SetParent(this);
        handle.Height = 100;

        Width = Math.Max(upButton.Width, downButton.Width);

        mUpButton     = upButton;
        mDownButton   = downButton;
        mTrack        = track;
        mHandleButton = handle;

        Add(track);
        Add(upButton);
        Add(downButton);
        Add(handle);
    }
示例#6
0
    private void CreateExitButton()
    {
        var exitButton = new WidgetButton(_uiParams.CharUiMainExitButton);

        exitButton.SetAutoSizeHeight(false);
        exitButton.SetAutoSizeWidth(false);
        exitButton.SetStyle(new WidgetButtonStyle
        {
            DisabledImagePath = _uiParams.TexturePaths[CharUiTexture.MainExitButtonDisabled],
            HoverImagePath    = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverOn],
            NormalImagePath   = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverOff],
            PressedImagePath  = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverPressed]
        });
        exitButton.SetClickHandler(ExitClicked);
        _mainWidget.Add(exitButton);
    }
示例#7
0
    public void Show()
    {
        mListBox.Clear();
        btnIds.Clear();
        seenIndices.Clear();


        for (var i = 0; i < movieIds.Count; i++)
        {
            if (IsMovieSeen(movieIds[i], -1))
            {
                seenIndices.Add(i);
            }
        }

        int y = 0;

        for (int i = 0; i < seenIndices.Count; i++)
        {
            var movieInd = seenIndices[i];

            var button = new WidgetButton();
            button.Text = mMovieNames[movieInd];
            button.SetId(mMovieNames[movieInd]);
            var innerWidth = mListBox.GetInnerWidth();
            button.Width = innerWidth;
            button.SetAutoSizeWidth(false);
            button.SetStyle("mm-cinematics-list-button");
            button.Y = y;
            //var pBtn = button.get();
            btnIds.Add(button);
            var selectIdx = i;
            button.SetClickHandler(() => Select(selectIdx));
            y += button.Height;
            mListBox.Add(button);
        }

        mWidget.Show();
    }