protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCharacterSheetWindow: Could not load native texture.");
            }

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Character portrait
            NativePanel.Components.Add(characterPortrait);
            characterPortrait.Position = new Vector2(200, 8);

            // Setup labels
            nameLabel    = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 4), NativePanel);
            raceLabel    = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 14), NativePanel);
            classLabel   = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(46, 24), NativePanel);
            levelLabel   = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(45, 34), NativePanel);
            goldLabel    = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(39, 44), NativePanel);
            fatigueLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(57, 54), NativePanel);
            healthLabel  = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(52, 64), NativePanel);
            //encumbranceLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(90, 74), NativePanel);

            // Setup stat labels
            Vector2 pos = new Vector2(150, 17);

            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                statLabels[i] = DaggerfallUI.AddDefaultShadowedTextLabel(pos, NativePanel);
                pos.y        += 24f;
            }

            // Primary skills button
            Button primarySkillsButton = DaggerfallUI.AddButton(new Rect(11, 106, 115, 8), NativePanel);

            primarySkillsButton.OnMouseClick += PrimarySkillsButton_OnMouseClick;

            // Major skills button
            Button majorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 116, 115, 8), NativePanel);

            majorSkillsButton.OnMouseClick += MajorSkillsButton_OnMouseClick;

            // Minor skills button
            Button minorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 126, 115, 8), NativePanel);

            minorSkillsButton.OnMouseClick += MinorSkillsButton_OnMouseClick;

            // Miscellaneous skills button
            Button miscSkillsButton = DaggerfallUI.AddButton(new Rect(11, 136, 115, 8), NativePanel);

            miscSkillsButton.OnMouseClick += MiscSkillsButton_OnMouseClick;

            // Inventory button
            Button inventoryButton = DaggerfallUI.AddButton(new Rect(3, 151, 65, 12), NativePanel);

            inventoryButton.OnMouseClick += InventoryButton_OnMouseClick;
            //inventoryButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;

            // Spellbook button
            Button spellBookButton = DaggerfallUI.AddButton(new Rect(69, 151, 65, 12), NativePanel);

            spellBookButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;

            // Logbook button
            Button logBookButton = DaggerfallUI.AddButton(new Rect(3, 165, 65, 12), NativePanel);

            logBookButton.OnMouseClick += LogBookButton_OnMouseClick;
            //logBookButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;

            // History button
            Button historyButton = DaggerfallUI.AddButton(new Rect(69, 165, 65, 12), NativePanel);

            historyButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;

            // Exit button
            Button exitButton = DaggerfallUI.AddButton(new Rect(50, 179, 39, 19), NativePanel);

            exitButton.OnMouseClick += ExitButton_OnMouseClick;

            // Attribute popup text
            pos = new Vector2(141, 6);
            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                Rect rect = new Rect(pos.x, pos.y, 28, 20);
                AddAttributePopupButton((DFCareer.Stats)i, rect);
                pos.y += 24f;
            }

            statsRollout = new StatsRollout(true);
            statsRollout.OnStatChanged += StatsRollout_OnStatChanged;

            // Update player paper doll for first time
            UpdatePlayerValues();
            characterPortrait.Refresh();
        }
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCharacterSheetWindow: Could not load native texture.");
            }

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Character portrait
            NativePanel.Components.Add(characterPortrait);
            characterPortrait.Position = new Vector2(200, 8);

            // Setup labels
            nameLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 4), NativePanel);
            raceLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 14), NativePanel);
            classLabel       = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(46, 24), NativePanel);
            levelLabel       = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(45, 34), NativePanel);
            goldLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(39, 44), NativePanel);
            fatigueLabel     = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(57, 54), NativePanel);
            healthLabel      = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(52, 64), NativePanel);
            encumbranceLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(90, 74), NativePanel);

            // Setup stat labels
            Vector2 panelPos = new Vector2(141, 17);

            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                statPanels[i] = DaggerfallUI.AddPanel(new Rect(panelPos.x, panelPos.y, 28, 6), NativePanel);
                statLabels[i] = DaggerfallUI.AddDefaultShadowedTextLabel(Vector2.zero, statPanels[i]);
                statLabels[i].HorizontalAlignment = HorizontalAlignment.Center;
                panelPos.y += 24f;
            }

            // Name button
            Button nameButton = DaggerfallUI.AddButton(new Rect(4, 3, 132, 8), NativePanel);

            nameButton.OnMouseClick += NameButton_OnMouseClick;
            nameButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetName);

            // Level button
            Button levelButton = DaggerfallUI.AddButton(new Rect(4, 33, 132, 8), NativePanel);

            levelButton.OnMouseClick += LevelButton_OnMouseClick;
            levelButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetLevel);

            // Gold button
            Button goldButton = DaggerfallUI.AddButton(new Rect(4, 43, 132, 8), NativePanel);

            goldButton.OnMouseClick += GoldButton_OnMouseClick;
            goldButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetGold);

            // Health button
            Button healthButton = DaggerfallUI.AddButton(new Rect(4, 63, 128, 8), NativePanel);

            healthButton.OnMouseClick += HealthButton_OnMouseClick;
            healthButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetHealth);

            // Affiliations button
            Button affiliationsButton = DaggerfallUI.AddButton(new Rect(3, 84, 130, 8), NativePanel);

            affiliationsButton.OnMouseClick += AffiliationsButton_OnMouseClick;
            affiliationsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetAffiliations);

            // Primary skills button
            Button primarySkillsButton = DaggerfallUI.AddButton(new Rect(11, 106, 115, 8), NativePanel);

            primarySkillsButton.OnMouseClick += PrimarySkillsButton_OnMouseClick;
            primarySkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetPrimarySkills);

            // Major skills button
            Button majorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 116, 115, 8), NativePanel);

            majorSkillsButton.OnMouseClick += MajorSkillsButton_OnMouseClick;
            majorSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMajorSkills);

            // Minor skills button
            Button minorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 126, 115, 8), NativePanel);

            minorSkillsButton.OnMouseClick += MinorSkillsButton_OnMouseClick;
            minorSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMinorSkills);

            // Miscellaneous skills button
            Button miscSkillsButton = DaggerfallUI.AddButton(new Rect(11, 136, 115, 8), NativePanel);

            miscSkillsButton.OnMouseClick += MiscSkillsButton_OnMouseClick;
            miscSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMiscSkills);

            // Inventory button
            Button inventoryButton = DaggerfallUI.AddButton(new Rect(3, 151, 65, 12), NativePanel);

            inventoryButton.OnMouseClick    += InventoryButton_OnMouseClick;
            inventoryButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetInventory);
            inventoryButton.OnKeyboardEvent += InventoryButton_OnKeyboardEvent;

            // Spellbook button
            Button spellBookButton = DaggerfallUI.AddButton(new Rect(69, 151, 65, 12), NativePanel);

            spellBookButton.OnMouseClick    += SpellBookButton_OnMouseClick;
            spellBookButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetSpellbook);
            spellBookButton.OnKeyboardEvent += SpellBookButton_OnKeyboardEvent;

            // Logbook button
            Button logBookButton = DaggerfallUI.AddButton(new Rect(3, 165, 65, 12), NativePanel);

            logBookButton.OnMouseClick    += LogBookButton_OnMouseClick;
            logBookButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetLogbook);
            logBookButton.OnKeyboardEvent += LogBookButton_OnKeyboardEvent;

            // History button
            Button historyButton = DaggerfallUI.AddButton(new Rect(69, 165, 65, 12), NativePanel);

            historyButton.OnMouseClick    += HistoryButton_OnMouseClick;
            historyButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetHistory);
            historyButton.OnKeyboardEvent += HistoryButton_OnKeyboardEvent;

            // Exit button
            Button exitButton = DaggerfallUI.AddButton(new Rect(50, 179, 39, 19), NativePanel);

            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            // Attribute popup text
            Vector2 pos = new Vector2(141, 6);

            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                Rect rect = new Rect(pos.x, pos.y, 28, 20);
                AddAttributePopupButton((DFCareer.Stats)i, rect);
                pos.y += 24f;
            }

            statsRollout = new StatsRollout(true);
            statsRollout.OnStatChanged += StatsRollout_OnStatChanged;

            // Update player paper doll for first time
            UpdatePlayerValues();
            characterPortrait.Refresh();

            // Store toggle closed binding for this window
            toggleClosedBinding = InputManager.Instance.GetBinding(InputManager.Actions.CharacterSheet);
        }
示例#3
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            // Load native textures
            nativeTexture       = DaggerfallUI.GetTextureFromImg(nativeImgName);
            nativeDaggerTexture = DaggerfallUI.GetTextureFromImg(nativeDaggerImgName);
            if (!nativeTexture || !nativeDaggerTexture)
            {
                throw new Exception("CreateCharCustomClass: Could not load native texture.");
            }

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Add stats rollout
            statsRollout          = new StatsRollout(false, true);
            statsRollout.Position = new Vector2(0, 0);
            NativePanel.Components.Add(statsRollout);

            // Add name textbox
            nameTextBox.Position = new Vector2(100, 5);
            nameTextBox.Size     = new Vector2(214, 7);
            NativePanel.Components.Add(nameTextBox);

            // Initialize character class
            createdClass = new DFCareer();
            createdClass.HitPointsPerLevel         = defaultHpPerLevel;
            createdClass.SpellPointMultiplier      = DFCareer.SpellPointMultipliers.Times_0_50;
            createdClass.SpellPointMultiplierValue = .5f;

            // Initiate UI components
            font = DaggerfallUI.DefaultFont;
            SetupButtons();
            hpLabel          = DaggerfallUI.AddTextLabel(font, new Vector2(285, 55), createdClass.HitPointsPerLevel.ToString(), NativePanel);
            daggerPanel.Size = new Vector2(24, 9);
            daggerPanel.BackgroundTexture = nativeDaggerTexture;
            NativePanel.Components.Add(daggerPanel);
            UpdateDifficulty();

            // Setup help dictionary
            helpDict = new Dictionary <string, int>
            {
                { HardStrings.helpAttributes, 2402 },
                { HardStrings.helpClassName, 2401 },
                { HardStrings.helpGeneral, 2400 },
                { HardStrings.helpReputations, 2406 },
                { HardStrings.helpSkillAdvancement, 2407 },
                { HardStrings.helpSkills, 2403 },
                { HardStrings.helpSpecialAdvantages, 2404 },
                { HardStrings.helpSpecialDisadvantages, 2405 }
            };

            // Setup skills dictionary
            skillsDict = new Dictionary <string, DFCareer.Skills>();
            foreach (DFCareer.Skills skill in Enum.GetValues(typeof(DFCareer.Skills)))
            {
                skillsDict.Add(DaggerfallUnity.Instance.TextProvider.GetSkillName(skill), skill);
            }
            skillsDict.Remove(string.Empty); // Don't include "none" skill value.
            skillsList = new List <string>(skillsDict.Keys);
            skillsList.Sort();               // Sort skills alphabetically a la classic.

            IsSetup = true;
        }
示例#4
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("CreateCharAddBonusStats: Could not load native texture.");
            }

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Add stats rollout
            statsRollout                = new StatsRollout();
            statsRollout.Position       = new Vector2(0, 0);
            statsRollout.OnStatChanged += StatsRollout_OnStatChanged;
            NativePanel.Components.Add(statsRollout);

            // Add secondary stat labels
            font = DaggerfallUI.DefaultFont;
            damageModifierLabel      = DaggerfallUI.AddTextLabel(font, new Vector2(83, 22), string.Empty, NativePanel);
            maxEncumbranceLabel      = DaggerfallUI.AddTextLabel(font, new Vector2(103, 32), string.Empty, NativePanel);
            spellPointsLabel         = DaggerfallUI.AddTextLabel(font, new Vector2(112, 49), string.Empty, NativePanel);
            magicResistLabel         = DaggerfallUI.AddTextLabel(font, new Vector2(121, 71), string.Empty, NativePanel);
            toHitModifierLabel       = DaggerfallUI.AddTextLabel(font, new Vector2(97, 93), string.Empty, NativePanel);
            hitPointsModifierLabel   = DaggerfallUI.AddTextLabel(font, new Vector2(101, 110), string.Empty, NativePanel);
            healingRateModifierLabel = DaggerfallUI.AddTextLabel(font, new Vector2(122, 120), string.Empty, NativePanel);

            // Fix secondary stat shadow colors to match game
            damageModifierLabel.ShadowColor      = DaggerfallUI.DaggerfallAlternateShadowColor1;
            maxEncumbranceLabel.ShadowColor      = DaggerfallUI.DaggerfallAlternateShadowColor1;
            spellPointsLabel.ShadowColor         = DaggerfallUI.DaggerfallAlternateShadowColor1;
            magicResistLabel.ShadowColor         = DaggerfallUI.DaggerfallAlternateShadowColor1;
            toHitModifierLabel.ShadowColor       = DaggerfallUI.DaggerfallAlternateShadowColor1;
            hitPointsModifierLabel.ShadowColor   = DaggerfallUI.DaggerfallAlternateShadowColor1;
            healingRateModifierLabel.ShadowColor = DaggerfallUI.DaggerfallAlternateShadowColor1;

            // Add "Reroll" button
            Button rerollButton = DaggerfallUI.AddButton(new Rect(263, 147, 39, 22), NativePanel);

            rerollButton.OnMouseClick += RerollButton_OnMouseClick;

            // Add "Save Roll" button
            Button saveRoll = DaggerfallUI.AddButton(new Rect(162, 162, 71, 9), NativePanel);

            saveRoll.OnMouseClick += SaveRoll_OnMouseClick;

            // Add "Load Roll" button
            Button loadRoll = DaggerfallUI.AddButton(new Rect(162, 171, 71, 9), NativePanel);

            loadRoll.OnMouseClick += LoadRoll_OnMouseClick;

            // Add "OK" button
            Button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel);

            okButton.OnMouseClick += OkButton_OnMouseClick;

            IsSetup = true;
        }