public CharUiMainWidget(CharUiParams uiParams) : base(uiParams.CharUiMainWindow)
    {
        _normalBackground  = new WidgetImage("art/interface/char_ui/main_window.img");
        _ironmanBackground = new WidgetImage("art/interface/char_ui/ironman_main_window.img");
        SetSize(_normalBackground.GetPreferredSize());

        _translation = Tig.FS.ReadMesFile("mes/0_char_ui_text.mes");
        var pcCreationMes = Tig.FS.ReadMesFile("mes/pc_creation.mes");

        var rerollsLabel = pcCreationMes[10001];

        _pointBuyLabel = pcCreationMes[10015];

        var attributeModeStyle = new TigTextStyle(new ColorRect(new PackedLinearColorA(0xFF5A7390)));

        attributeModeStyle.kerning  = 1;
        attributeModeStyle.tracking = 3;

        var attributeCountStyle = attributeModeStyle.Copy();

        attributeCountStyle.textColor = new ColorRect(PackedLinearColorA.White);

        _attributeRollModeLabel  = new WidgetText(rerollsLabel, "char-ui-attribute-mode");
        _attributeRollCountLabel = new WidgetText("", "char-ui-attribute-rerolls");
    }
Exemplo n.º 2
0
    public CharUiTopButton(CharUiParams uiParams, int sheetPage)
    {
        _sheetPage = sheetPage;

        ResourceRef <ITexture> ResolveTexture(CharUiTexture textureId)
        {
            return(Tig.Textures.Resolve(uiParams.TexturePaths[textureId], false));
        }

        Rectangle rectangle;

        switch (sheetPage)
        {
        case 5:
            rectangle        = uiParams.CharUiSelectSkillsButton;
            _normalTexture   = ResolveTexture(CharUiTexture.ButtonSkillsUnselected);
            _hoverTexture    = ResolveTexture(CharUiTexture.ButtonSkillsHover);
            _selectedTexture = ResolveTexture(CharUiTexture.ButtonSkillsSelected);
            _pressedTexture  = ResolveTexture(CharUiTexture.ButtonSkillsClick);
            break;

        case 6:
            rectangle        = uiParams.CharUiSelectFeatsButton;
            _normalTexture   = ResolveTexture(CharUiTexture.ButtonFeatsUnselected);
            _hoverTexture    = ResolveTexture(CharUiTexture.ButtonFeatsHover);
            _selectedTexture = ResolveTexture(CharUiTexture.ButtonFeatsSelected);
            _pressedTexture  = ResolveTexture(CharUiTexture.ButtonFeatsClick);
            break;

        case 7:
            rectangle        = uiParams.CharUiSelectSpellsButton;
            _normalTexture   = ResolveTexture(CharUiTexture.ButtonSpellsUnselected);
            _hoverTexture    = ResolveTexture(CharUiTexture.ButtonSpellsHover);
            _selectedTexture = ResolveTexture(CharUiTexture.ButtonSpellsSelected);
            _pressedTexture  = ResolveTexture(CharUiTexture.ButtonSpellsClick);
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        SetPos(rectangle.Location);
        SetSize(rectangle.Size);

        _arcTopTexture = ResolveTexture(CharUiTexture.ButtonArcTopSelected);
    }
Exemplo n.º 3
0
    public CharInventoryButton(CharUiParams uiParams, int inventoryIdx)
    {
        _inventoryIdx = inventoryIdx;

        Rectangle rectangle;

        switch (inventoryIdx)
        {
        case 0:
            rectangle = uiParams.CharUiSelectInventory0Button;
            break;

        case 1:
            rectangle = uiParams.CharUiSelectInventory1Button;
            break;

        case 2:
            rectangle = uiParams.CharUiSelectInventory2Button;
            break;

        case 3:
            rectangle = uiParams.CharUiSelectInventory3Button;
            break;

        case 4:
            rectangle = uiParams.CharUiSelectInventory4Button;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        SetPos(rectangle.Location);
        SetSize(rectangle.Size);

        _borderTexture    = Tig.Textures.Resolve(uiParams.TexturePaths[CharUiTexture.ButtonContainerSelected], false);
        _arcTopTexture    = Tig.Textures.Resolve(uiParams.TexturePaths[CharUiTexture.ButtonArcTopSelected], false);
        _arcBottomTexture =
            Tig.Textures.Resolve(uiParams.TexturePaths[CharUiTexture.ButtonArcBottomSelected], false);
        _bagIconTexture = Tig.Textures.Resolve(uiParams.TexturePaths[CharUiTexture.BagTemp], false);
    }
Exemplo n.º 4
0
    public CharSheetUi()
    {
        _uiParams = new CharUiParams(
            Tig.FS.ReadMesFile("art/interface/char_ui/0_char_ui.mes"),
            Tig.FS.ReadMesFile("art/interface/char_ui/0_char_ui_textures.mes")
            );
        _translations = Tig.FS.ReadMesFile("mes/0_char_ui_text.mes");

        Globals.UiStyles.LoadStylesFile("ui/char_ui_styles.json");

        _mainWidget         = new CharUiMainWidget(_uiParams);
        _mainWidget.Visible = false; // Initially invisible

        char_ui_main_nav_editor_window = new WidgetContainer(_uiParams.CharUiMainNavEditorWindow);
        _mainWidget.Add(char_ui_main_nav_editor_window);

        char_ui_main_name_button = new WidgetDynamicLabel(GetCharacterNameText)
        {
            X        = 17,
            Y        = 12,
            Width    = 196,
            Height   = 12,
            StyleIds = ImmutableList.Create("char-ui-dialog-title")
        };
        _mainWidget.Add(char_ui_main_name_button);

        CreateExitButton();

        _mainWidget.Add(new CharUiClassLevel()
        {
            X      = 262,
            Y      = 12,
            Width  = 300,
            Height = 12
        });

        _mainWidget.Add(new WidgetDynamicLabel(GetAlignmentGenderRaceText)
        {
            X        = 247,
            Y        = 29,
            Width    = 198,
            Height   = 16,
            StyleIds = ImmutableList.Create("char-ui-align-gender-race")
        });

        _mainWidget.Add(new WidgetDynamicLabel(GetWorshipDisplayText)
        {
            X        = 460,
            Y        = 29,
            Width    = 190,
            Height   = 16,
            StyleIds = ImmutableList.Create("char-ui-worship")
        });

        for (int i = 0; i < 5; i++)
        {
            var button = new CharInventoryButton(_uiParams, i);
            if (i == 0)
            {
                button.SetClickHandler(() => SelectInventoryTab(0));
                // TODO: Click handlers for the other bags were never implemented apparently
            }

            _mainWidget.Add(button);
        }

        var skillsButton = new CharUiTopButton(_uiParams, 5);

        skillsButton.SetClickHandler(SelectSkillsTab);
        _mainWidget.Add(skillsButton);

        var featsButton = new CharUiTopButton(_uiParams, 6);

        featsButton.SetClickHandler(SelectFeatsTab);
        _mainWidget.Add(featsButton);

        var spellsButton = new CharUiTopButton(_uiParams, 7);

        spellsButton.SetClickHandler(SelectSpellsTab);
        _mainWidget.Add(spellsButton);

        Skills = new CharSheetSkillsUi();
        _mainWidget.Add(Skills.Container);
        Inventory = new CharSheetInventoryUi();
        _mainWidget.Add(Inventory.Widget);
        Feats = new CharSheetFeatsUi();
        _mainWidget.Add(Feats.Container);
        Spells = new CharSheetSpellsUi();
        _mainWidget.Add(Spells.Container);
        Looting = new CharSheetLootingUi();
        Stats   = new CharSheetStatsUi(_uiParams.CharUiMainWindow);
        _mainWidget.Add(Stats.Container);
        Portrait = new CharSheetPortraitUi(_uiParams.CharUiMainWindow);
        _mainWidget.Add(Portrait.Container);
        LevelUp = new CharSheetLevelUpUi();
        Help    = new CharSheetHelpUi();
        _mainWidget.Add(Help.Container);
    }