mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-12 15:27:31 -05:00
Merged PR - Added UI toggle box
* ui stuff * More ui stuff * Toggleable stuff * Some debug messages
This commit is contained in:
parent
3a0cbe4b8e
commit
2cd64677f2
@ -4,6 +4,10 @@
|
||||
{
|
||||
Wide,
|
||||
Medium,
|
||||
Cancel
|
||||
Narrow,
|
||||
Cancel,
|
||||
// Game UI
|
||||
Run,
|
||||
Menu
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,16 @@ namespace OpenDiablo2.Common.Models
|
||||
public int XSegments { get; internal set; }
|
||||
public string ResourceName { get; internal set; }
|
||||
public string PaletteName { get; internal set; }
|
||||
public bool Toggleable { get; internal set; } = false;
|
||||
|
||||
public static Dictionary<eButtonType, ButtonLayout> Values = new Dictionary<eButtonType, ButtonLayout>
|
||||
{
|
||||
{eButtonType.Wide, new ButtonLayout { XSegments = 2, ResourceName = ResourcePaths.WideButtonBlank, PaletteName = Palettes.Units } },
|
||||
{eButtonType.Medium, new ButtonLayout{ XSegments = 1, ResourceName=ResourcePaths.MediumButtonBlank, PaletteName = Palettes.Units } },
|
||||
{eButtonType.Cancel, new ButtonLayout {XSegments = 1,ResourceName = ResourcePaths.CancelButton,PaletteName = Palettes.Units } }
|
||||
{eButtonType.Narrow, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.NarrowButtonBlank,PaletteName = Palettes.Units } },
|
||||
{eButtonType.Cancel, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.CancelButton,PaletteName = Palettes.Units } },
|
||||
{eButtonType.Run, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.RunButton,PaletteName = Palettes.Units, Toggleable = true } },
|
||||
{eButtonType.Menu, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.MenuButton,PaletteName = Palettes.Units, Toggleable = true } },
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,116 +1,121 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenDiablo2.Common
|
||||
{
|
||||
public static class ResourcePaths
|
||||
{
|
||||
// --- Loading Screen ---
|
||||
public static string LoadingScreen = "data\\global\\ui\\Loading\\loadingscreen.dc6";
|
||||
|
||||
// --- Main Menu ---
|
||||
public static string GameSelectScreen = "data\\global\\ui\\FrontEnd\\gameselectscreenEXP.dc6";
|
||||
public static string Diablo2LogoFireLeft = "data\\global\\ui\\FrontEnd\\D2logoFireLeft.DC6";
|
||||
public static string Diablo2LogoFireRight = "data\\global\\ui\\FrontEnd\\D2logoFireRight.DC6";
|
||||
public static string Diablo2LogoBlackLeft = "data\\global\\ui\\FrontEnd\\D2logoBlackLeft.DC6";
|
||||
public static string Diablo2LogoBlackRight = "data\\global\\ui\\FrontEnd\\D2logoBlackRight.DC6";
|
||||
|
||||
// --- Character Select Screen ---
|
||||
public static string CharacterSelectBackground = "data\\global\\ui\\FrontEnd\\charactercreationscreenEXP.dc6";
|
||||
public static string CharacterSelectCampfire = "data\\global\\ui\\FrontEnd\\fire.DC6";
|
||||
|
||||
public static string CharacterSelectBarbarianUnselected = "data\\global\\ui\\FrontEnd\\barbarian\\banu1.DC6";
|
||||
public static string CharacterSelectBarbarianUnselectedH = "data\\global\\ui\\FrontEnd\\barbarian\\banu2.DC6";
|
||||
public static string CharacterSelectBarbarianSelected = "data\\global\\ui\\FrontEnd\\barbarian\\banu3.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalk = "data\\global\\ui\\FrontEnd\\barbarian\\bafw.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\barbarian\\BAFWs.DC6";
|
||||
public static string CharacterSelectBarbarianBackWalk = "data\\global\\ui\\FrontEnd\\barbarian\\babw.DC6";
|
||||
|
||||
public static string CharacterSelecSorceressUnselected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU1.DC6";
|
||||
public static string CharacterSelecSorceressUnselectedH = "data\\global\\ui\\FrontEnd\\sorceress\\SONU2.DC6";
|
||||
public static string CharacterSelecSorceressSelected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3.DC6";
|
||||
public static string CharacterSelecSorceressSelectedOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3s.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalk= "data\\global\\ui\\FrontEnd\\sorceress\\SOFW.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOFWs.DC6";
|
||||
public static string CharacterSelecSorceressBackWalk = "data\\global\\ui\\FrontEnd\\sorceress\\SOBW.DC6";
|
||||
public static string CharacterSelecSorceressBackWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOBWs.DC6";
|
||||
|
||||
public static string CharacterSelectNecromancerUnselected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU1.DC6";
|
||||
public static string CharacterSelectNecromancerUnselectedH = "data\\global\\ui\\FrontEnd\\necromancer\\NENU2.DC6";
|
||||
public static string CharacterSelecNecromancerSelected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3.DC6";
|
||||
public static string CharacterSelecNecromancerSelectedOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3s.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEFW.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEFWs.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEBW.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEBWs.DC6";
|
||||
|
||||
public static string CharacterSelectPaladinUnselected = "data\\global\\ui\\FrontEnd\\paladin\\PANU1.DC6";
|
||||
public static string CharacterSelectPaladinUnselectedH = "data\\global\\ui\\FrontEnd\\paladin\\PANU2.DC6";
|
||||
public static string CharacterSelecPaladinSelected = "data\\global\\ui\\FrontEnd\\paladin\\PANU3.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalk = "data\\global\\ui\\FrontEnd\\paladin\\PAFW.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\paladin\\PAFWs.DC6";
|
||||
public static string CharacterSelecPaladinBackWalk = "data\\global\\ui\\FrontEnd\\paladin\\PABW.DC6";
|
||||
|
||||
|
||||
public static string CharacterSelectAmazonUnselected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU1.DC6";
|
||||
public static string CharacterSelectAmazonUnselectedH = "data\\global\\ui\\FrontEnd\\amazon\\AMNU2.DC6";
|
||||
public static string CharacterSelecAmazonSelected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU3.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMFW.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\amazon\\AMFWs.DC6";
|
||||
public static string CharacterSelecAmazonBackWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMBW.DC6";
|
||||
|
||||
public static string CharacterSelectAssassinUnselected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU1.DC6";
|
||||
public static string CharacterSelectAssassinUnselectedH = "data\\global\\ui\\FrontEnd\\assassin\\ASNU2.DC6";
|
||||
public static string CharacterSelectAssassinSelected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU3.DC6";
|
||||
public static string CharacterSelectAssassinForwardWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASFW.DC6";
|
||||
public static string CharacterSelectAssassinBackWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASBW.DC6";
|
||||
|
||||
public static string CharacterSelectDruidUnselected = "data\\global\\ui\\FrontEnd\\druid\\DZNU1.dc6";
|
||||
public static string CharacterSelectDruidUnselectedH = "data\\global\\ui\\FrontEnd\\druid\\DZNU2.dc6";
|
||||
public static string CharacterSelectDruidSelected = "data\\global\\ui\\FrontEnd\\druid\\DZNU3.DC6";
|
||||
public static string CharacterSelectDruidForwardWalk = "data\\global\\ui\\FrontEnd\\druid\\DZFW.DC6";
|
||||
public static string CharacterSelectDruidBackWalk = "data\\global\\ui\\FrontEnd\\druid\\DZBW.DC6";
|
||||
|
||||
// --- Game ---
|
||||
public static string GamePanels = "data\\global\\ui\\PANEL\\800ctrlpnl7.dc6";
|
||||
public static string GameGlobeOverlap = "data\\global\\ui\\PANEL\\overlap.DC6";
|
||||
public static string HealthMana = "data\\global\\ui\\PANEL\\hlthmana.DC6";
|
||||
public static string GameSmallMenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6"; // TODO: Used for inventory popout
|
||||
public static string SkillIcon = "data\\global\\ui\\PANEL\\Skillicon.DC6"; // TODO: Used for skill icon button
|
||||
|
||||
// --- Mouse Pointers ---
|
||||
public static string CursorDefault = "data\\global\\ui\\CURSOR\\ohand.DC6";
|
||||
|
||||
// --- Fonts ---
|
||||
public static string Font6 = "data\\local\\font\\latin\\font6";
|
||||
public static string Font8 = "data\\local\\font\\latin\\font8";
|
||||
public static string Font16 = "data\\local\\font\\latin\\font16";
|
||||
public static string Font24 = "data\\local\\font\\latin\\font24";
|
||||
public static string Font30 = "data\\local\\font\\latin\\font30";
|
||||
public static string FontFormal12 = "data\\local\\font\\latin\\fontformal12";
|
||||
public static string FontFormal11 = "data\\local\\font\\latin\\fontformal11";
|
||||
public static string FontFormal10 = "data\\local\\font\\latin\\fontformal10";
|
||||
public static string FontExocet10 = "data\\local\\font\\latin\\fontexocet10";
|
||||
public static string FontExocet8 = "data\\local\\font\\latin\\fontexocet8";
|
||||
|
||||
// --- UI ---
|
||||
public static string WideButtonBlank = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
|
||||
public static string MediumButtonBlank = "data\\global\\ui\\FrontEnd\\MediumButtonBlank.dc6";
|
||||
public static string CancelButton = "data\\global\\ui\\FrontEnd\\CancelButtonBlank.dc6";
|
||||
public static string TextBox2 = "data\\global\\ui\\FrontEnd\\textbox2.dc6";
|
||||
|
||||
// --- Data ---
|
||||
// TODO: Doesn't sound right :)
|
||||
public static string EnglishTable = "data\\local\\lng\\eng\\English.txt";
|
||||
public static string ExpansionStringTable = "data\\local\\lng\\eng\\expansionstring.tbl";
|
||||
public static string LevelPreset = "data\\global\\excel\\LvlPrest.txt";
|
||||
public static string LevelType = "data\\global\\excel\\LvlTypes.txt";
|
||||
|
||||
// --- Maps ---
|
||||
public static string MapAct1TownE1 = "data\\global\\tiles\\ACT1\\Town\\townE1.ds1";
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenDiablo2.Common
|
||||
{
|
||||
public static class ResourcePaths
|
||||
{
|
||||
// --- Loading Screen ---
|
||||
public static string LoadingScreen = "data\\global\\ui\\Loading\\loadingscreen.dc6";
|
||||
|
||||
// --- Main Menu ---
|
||||
public static string GameSelectScreen = "data\\global\\ui\\FrontEnd\\gameselectscreenEXP.dc6";
|
||||
public static string Diablo2LogoFireLeft = "data\\global\\ui\\FrontEnd\\D2logoFireLeft.DC6";
|
||||
public static string Diablo2LogoFireRight = "data\\global\\ui\\FrontEnd\\D2logoFireRight.DC6";
|
||||
public static string Diablo2LogoBlackLeft = "data\\global\\ui\\FrontEnd\\D2logoBlackLeft.DC6";
|
||||
public static string Diablo2LogoBlackRight = "data\\global\\ui\\FrontEnd\\D2logoBlackRight.DC6";
|
||||
|
||||
// --- Character Select Screen ---
|
||||
public static string CharacterSelectBackground = "data\\global\\ui\\FrontEnd\\charactercreationscreenEXP.dc6";
|
||||
public static string CharacterSelectCampfire = "data\\global\\ui\\FrontEnd\\fire.DC6";
|
||||
|
||||
public static string CharacterSelectBarbarianUnselected = "data\\global\\ui\\FrontEnd\\barbarian\\banu1.DC6";
|
||||
public static string CharacterSelectBarbarianUnselectedH = "data\\global\\ui\\FrontEnd\\barbarian\\banu2.DC6";
|
||||
public static string CharacterSelectBarbarianSelected = "data\\global\\ui\\FrontEnd\\barbarian\\banu3.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalk = "data\\global\\ui\\FrontEnd\\barbarian\\bafw.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\barbarian\\BAFWs.DC6";
|
||||
public static string CharacterSelectBarbarianBackWalk = "data\\global\\ui\\FrontEnd\\barbarian\\babw.DC6";
|
||||
|
||||
public static string CharacterSelecSorceressUnselected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU1.DC6";
|
||||
public static string CharacterSelecSorceressUnselectedH = "data\\global\\ui\\FrontEnd\\sorceress\\SONU2.DC6";
|
||||
public static string CharacterSelecSorceressSelected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3.DC6";
|
||||
public static string CharacterSelecSorceressSelectedOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3s.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalk= "data\\global\\ui\\FrontEnd\\sorceress\\SOFW.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOFWs.DC6";
|
||||
public static string CharacterSelecSorceressBackWalk = "data\\global\\ui\\FrontEnd\\sorceress\\SOBW.DC6";
|
||||
public static string CharacterSelecSorceressBackWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOBWs.DC6";
|
||||
|
||||
public static string CharacterSelectNecromancerUnselected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU1.DC6";
|
||||
public static string CharacterSelectNecromancerUnselectedH = "data\\global\\ui\\FrontEnd\\necromancer\\NENU2.DC6";
|
||||
public static string CharacterSelecNecromancerSelected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3.DC6";
|
||||
public static string CharacterSelecNecromancerSelectedOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3s.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEFW.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEFWs.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEBW.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEBWs.DC6";
|
||||
|
||||
public static string CharacterSelectPaladinUnselected = "data\\global\\ui\\FrontEnd\\paladin\\PANU1.DC6";
|
||||
public static string CharacterSelectPaladinUnselectedH = "data\\global\\ui\\FrontEnd\\paladin\\PANU2.DC6";
|
||||
public static string CharacterSelecPaladinSelected = "data\\global\\ui\\FrontEnd\\paladin\\PANU3.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalk = "data\\global\\ui\\FrontEnd\\paladin\\PAFW.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\paladin\\PAFWs.DC6";
|
||||
public static string CharacterSelecPaladinBackWalk = "data\\global\\ui\\FrontEnd\\paladin\\PABW.DC6";
|
||||
|
||||
|
||||
public static string CharacterSelectAmazonUnselected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU1.DC6";
|
||||
public static string CharacterSelectAmazonUnselectedH = "data\\global\\ui\\FrontEnd\\amazon\\AMNU2.DC6";
|
||||
public static string CharacterSelecAmazonSelected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU3.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMFW.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\amazon\\AMFWs.DC6";
|
||||
public static string CharacterSelecAmazonBackWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMBW.DC6";
|
||||
|
||||
public static string CharacterSelectAssassinUnselected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU1.DC6";
|
||||
public static string CharacterSelectAssassinUnselectedH = "data\\global\\ui\\FrontEnd\\assassin\\ASNU2.DC6";
|
||||
public static string CharacterSelectAssassinSelected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU3.DC6";
|
||||
public static string CharacterSelectAssassinForwardWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASFW.DC6";
|
||||
public static string CharacterSelectAssassinBackWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASBW.DC6";
|
||||
|
||||
public static string CharacterSelectDruidUnselected = "data\\global\\ui\\FrontEnd\\druid\\DZNU1.dc6";
|
||||
public static string CharacterSelectDruidUnselectedH = "data\\global\\ui\\FrontEnd\\druid\\DZNU2.dc6";
|
||||
public static string CharacterSelectDruidSelected = "data\\global\\ui\\FrontEnd\\druid\\DZNU3.DC6";
|
||||
public static string CharacterSelectDruidForwardWalk = "data\\global\\ui\\FrontEnd\\druid\\DZFW.DC6";
|
||||
public static string CharacterSelectDruidBackWalk = "data\\global\\ui\\FrontEnd\\druid\\DZBW.DC6";
|
||||
|
||||
// --- Game ---
|
||||
public static string GamePanels = "data\\global\\ui\\PANEL\\800ctrlpnl7.dc6";
|
||||
public static string GameGlobeOverlap = "data\\global\\ui\\PANEL\\overlap.DC6";
|
||||
public static string HealthMana = "data\\global\\ui\\PANEL\\hlthmana.DC6";
|
||||
public static string GameSmallMenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6"; // TODO: Used for inventory popout
|
||||
public static string SkillIcon = "data\\global\\ui\\PANEL\\Skillicon.DC6"; // TODO: Used for skill icon button
|
||||
|
||||
// --- Mouse Pointers ---
|
||||
public static string CursorDefault = "data\\global\\ui\\CURSOR\\ohand.DC6";
|
||||
|
||||
// --- Fonts ---
|
||||
public static string Font6 = "data\\local\\font\\latin\\font6";
|
||||
public static string Font8 = "data\\local\\font\\latin\\font8";
|
||||
public static string Font16 = "data\\local\\font\\latin\\font16";
|
||||
public static string Font24 = "data\\local\\font\\latin\\font24";
|
||||
public static string Font30 = "data\\local\\font\\latin\\font30";
|
||||
public static string FontFormal12 = "data\\local\\font\\latin\\fontformal12";
|
||||
public static string FontFormal11 = "data\\local\\font\\latin\\fontformal11";
|
||||
public static string FontFormal10 = "data\\local\\font\\latin\\fontformal10";
|
||||
public static string FontExocet10 = "data\\local\\font\\latin\\fontexocet10";
|
||||
public static string FontExocet8 = "data\\local\\font\\latin\\fontexocet8";
|
||||
|
||||
// --- UI ---
|
||||
public static string WideButtonBlank = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
|
||||
public static string MediumButtonBlank = "data\\global\\ui\\FrontEnd\\MediumButtonBlank.dc6";
|
||||
public static string CancelButton = "data\\global\\ui\\FrontEnd\\CancelButtonBlank.dc6";
|
||||
public static string NarrowButtonBlank = "data\\global\\ui\\FrontEnd\\NarrowButtonBlank.dc6";
|
||||
public static string TextBox2 = "data\\global\\ui\\FrontEnd\\textbox2.dc6";
|
||||
|
||||
// --- GAME UI ---
|
||||
public static string RunButton = "data\\global\\ui\\PANEL\\runbutton.dc6";
|
||||
public static string MenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6";
|
||||
|
||||
// --- Data ---
|
||||
// TODO: Doesn't sound right :)
|
||||
public static string EnglishTable = "data\\local\\lng\\eng\\English.txt";
|
||||
public static string ExpansionStringTable = "data\\local\\lng\\eng\\expansionstring.tbl";
|
||||
public static string LevelPreset = "data\\global\\excel\\LvlPrest.txt";
|
||||
public static string LevelType = "data\\global\\excel\\LvlTypes.txt";
|
||||
|
||||
// --- Maps ---
|
||||
public static string MapAct1TownE1 = "data\\global\\tiles\\ACT1\\Town\\townE1.ds1";
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ namespace OpenDiablo2.Core.UI
|
||||
public delegate void OnActivateDelegate();
|
||||
public OnActivateDelegate OnActivate { get; set; }
|
||||
|
||||
public delegate void OnToggleDelegate(bool isToggled);
|
||||
public OnToggleDelegate OnToggle { get; set; }
|
||||
|
||||
private Point location = new Point();
|
||||
public Point Location
|
||||
{
|
||||
@ -39,6 +42,8 @@ namespace OpenDiablo2.Core.UI
|
||||
private bool pressed = false;
|
||||
private bool active = false; // When true, button is actively being focus pressed
|
||||
private bool activeLock = false; // When true, something else is being pressed so ignore everything
|
||||
private bool toggled = false;
|
||||
|
||||
private Point labelOffset = new Point();
|
||||
|
||||
private bool enabled = true;
|
||||
@ -94,6 +99,15 @@ namespace OpenDiablo2.Core.UI
|
||||
}
|
||||
}
|
||||
|
||||
public bool Toggle()
|
||||
{
|
||||
toggled = !toggled;
|
||||
|
||||
OnToggle?.Invoke(toggled);
|
||||
|
||||
return toggled;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!enabled)
|
||||
@ -126,7 +140,15 @@ namespace OpenDiablo2.Core.UI
|
||||
active = false;
|
||||
|
||||
if (hovered)
|
||||
{
|
||||
OnActivate?.Invoke();
|
||||
|
||||
if (buttonLayout.Toggleable)
|
||||
{
|
||||
Toggle();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (!active && mouseInfoProvider.LeftMouseDown)
|
||||
{
|
||||
@ -142,7 +164,22 @@ namespace OpenDiablo2.Core.UI
|
||||
|
||||
public void Render()
|
||||
{
|
||||
renderWindow.Draw(sprite, buttonLayout.XSegments, 1, pressed ? 1 : 0);
|
||||
var frame = 0;
|
||||
|
||||
if(toggled && pressed)
|
||||
{
|
||||
frame = 3;
|
||||
}
|
||||
else if(pressed)
|
||||
{
|
||||
frame = 1;
|
||||
}
|
||||
else if(toggled)
|
||||
{
|
||||
frame = 2;
|
||||
}
|
||||
|
||||
renderWindow.Draw(sprite, buttonLayout.XSegments, 1, frame);
|
||||
var offset = pressed ? -2 : 0;
|
||||
|
||||
label.Location = new Point(location.X + offset + labelOffset.X, location.Y - offset + labelOffset.Y);
|
||||
|
@ -8,12 +8,16 @@ using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Attributes;
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using OpenDiablo2.Core.GameState_;
|
||||
using OpenDiablo2.Core.UI;
|
||||
|
||||
namespace OpenDiablo2.Scenes
|
||||
{
|
||||
[Scene("Game")]
|
||||
public sealed class Game : IScene
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly IRenderWindow renderWindow;
|
||||
private readonly IResourceManager resourceManager;
|
||||
private readonly IMapEngine mapEngine;
|
||||
@ -24,12 +28,15 @@ namespace OpenDiablo2.Scenes
|
||||
|
||||
private ISprite panelSprite, healthManaSprite, gameGlobeOverlapSprite;
|
||||
|
||||
private Button runButton, menuButton;
|
||||
|
||||
public Game(
|
||||
IRenderWindow renderWindow,
|
||||
IResourceManager resourceManager,
|
||||
IMapEngine mapEngine,
|
||||
IRenderWindow renderWindow,
|
||||
IResourceManager resourceManager,
|
||||
IMapEngine mapEngine,
|
||||
IGameState gameState,
|
||||
IKeyboardInfoProvider keyboardInfoProvider
|
||||
IKeyboardInfoProvider keyboardInfoProvider,
|
||||
Func<eButtonType, Button> createButton
|
||||
)
|
||||
{
|
||||
this.renderWindow = renderWindow;
|
||||
@ -38,9 +45,28 @@ namespace OpenDiablo2.Scenes
|
||||
this.gameState = gameState;
|
||||
this.keyboardInfoProvider = keyboardInfoProvider;
|
||||
|
||||
|
||||
panelSprite = renderWindow.LoadSprite(ResourcePaths.GamePanels, Palettes.Act1);
|
||||
healthManaSprite = renderWindow.LoadSprite(ResourcePaths.HealthMana, Palettes.Act1);
|
||||
gameGlobeOverlapSprite = renderWindow.LoadSprite(ResourcePaths.GameGlobeOverlap, Palettes.Act1);
|
||||
|
||||
runButton = createButton(eButtonType.Run);
|
||||
runButton.Location = new Point(256, 570);
|
||||
runButton.OnToggle = OnRunToggle;
|
||||
|
||||
menuButton = createButton(eButtonType.Menu);
|
||||
menuButton.Location = new Point(393, 561);
|
||||
menuButton.OnToggle = OnMenuToggle;
|
||||
}
|
||||
|
||||
private void OnMenuToggle(bool isToggled)
|
||||
{
|
||||
log.Debug("Menu Toggle: " + isToggled);
|
||||
}
|
||||
|
||||
private void OnRunToggle(bool isToggled)
|
||||
{
|
||||
log.Debug("Run Toggle: " + isToggled);
|
||||
}
|
||||
|
||||
public void Render()
|
||||
@ -75,10 +101,15 @@ namespace OpenDiablo2.Scenes
|
||||
renderWindow.Draw(healthManaSprite, 1, new Point(692, 588));
|
||||
renderWindow.Draw(gameGlobeOverlapSprite, 1, new Point(693, 591));
|
||||
|
||||
runButton.Render();
|
||||
menuButton.Render();
|
||||
}
|
||||
|
||||
public void Update(long ms)
|
||||
{
|
||||
runButton.Update();
|
||||
menuButton.Update();
|
||||
|
||||
var seconds = (float)ms / 1000f;
|
||||
var xMod = 0f;
|
||||
var yMod = 0f;
|
||||
|
Loading…
Reference in New Issue
Block a user