mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-12 12:26:31 -05:00
code refactoring, added close button to panels, adjustment of items positions (#38)
* refactoring of minipanel * Yet another refactoring of panels * removed unnecessary fields * panel location is now relative to the panel position * resource paths refactoring
This commit is contained in:
parent
8e81f0cbbc
commit
5d404cbaa0
@ -10,6 +10,8 @@
|
||||
// Game UI
|
||||
Run,
|
||||
Menu,
|
||||
GoldCoin,
|
||||
Close,
|
||||
MinipanelCharacter,
|
||||
MinipanelInventory,
|
||||
MinipanelSkill,
|
||||
|
42
OpenDiablo2.Common/Extensions/EnumExtensions.cs
Normal file
42
OpenDiablo2.Common/Extensions/EnumExtensions.cs
Normal file
@ -0,0 +1,42 @@
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenDiablo2.Common.Extensions
|
||||
{
|
||||
public static class EnumExtensions
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static Point GetOffset(this ePanelFrameType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case ePanelFrameType.Left:
|
||||
return new Point(80, 63);
|
||||
case ePanelFrameType.Right:
|
||||
return new Point(400, 63);
|
||||
case ePanelFrameType.Center:
|
||||
return new Point(0, 0);
|
||||
}
|
||||
|
||||
log.Warn($"Unknown panel positon, {value}");
|
||||
return default(Point);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,20 @@
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
{
|
||||
public interface ICharacterPanel : IPanel
|
||||
{
|
||||
|
@ -1,4 +1,20 @@
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
{
|
||||
public interface IGameHUD
|
||||
{
|
||||
@ -7,8 +23,9 @@
|
||||
bool IsRightPanelVisible { get; }
|
||||
|
||||
bool IsMouseOver();
|
||||
void OpenPanel(IPanel panel);
|
||||
void TogglePanel(IPanel panel);
|
||||
void OpenPanels(IPanel leftPanel, IPanel rightPanel);
|
||||
void ClosePanels();
|
||||
|
||||
void Render();
|
||||
void Update();
|
||||
|
@ -1,4 +1,20 @@
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
{
|
||||
public interface IInventoryPanel : IPanel
|
||||
{
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
{
|
||||
public delegate void PanelSelectedEvent(IPanel panel);
|
||||
public delegate void OnPanelToggledEvent(IPanel panel);
|
||||
|
||||
public interface IMiniPanel : IDisposable
|
||||
{
|
||||
event PanelSelectedEvent PanelSelected;
|
||||
event OnPanelToggledEvent OnPanelToggled;
|
||||
|
||||
bool IsMouseOver();
|
||||
void UpdatePanelLocation();
|
||||
|
@ -1,10 +1,30 @@
|
||||
using OpenDiablo2.Common.Enums;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using System;
|
||||
|
||||
namespace OpenDiablo2.Common.Interfaces
|
||||
{
|
||||
public delegate void OnPanelClosedEvent(IPanel panel);
|
||||
|
||||
public interface IPanel : IDisposable
|
||||
{
|
||||
event OnPanelClosedEvent OnPanelClosed;
|
||||
|
||||
eButtonType PanelType { get; }
|
||||
ePanelFrameType FrameType { get; }
|
||||
void Render();
|
||||
|
@ -30,6 +30,8 @@ namespace OpenDiablo2.Common.Models
|
||||
|
||||
{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 } },
|
||||
{eButtonType.GoldCoin, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.GoldCoinButton,PaletteName = Palettes.Units } },
|
||||
{eButtonType.Close, new ButtonLayout {XSegments = 1, ResourceName = ResourcePaths.SquareButton,PaletteName = Palettes.Units, BaseFrame = 10 } },
|
||||
}.ToImmutableDictionary();
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,7 @@
|
||||
<Compile Include="Enums\Mobs\eMobFlags.cs" />
|
||||
<Compile Include="Enums\Mobs\eStatModifierType.cs" />
|
||||
<Compile Include="Exceptions\OpenDiablo2Exception.cs" />
|
||||
<Compile Include="Extensions\EnumExtensions.cs" />
|
||||
<Compile Include="Interfaces\Drawing\ICharacterRenderer.cs" />
|
||||
<Compile Include="Interfaces\ICache.cs" />
|
||||
<Compile Include="Interfaces\IItemManager.cs" />
|
||||
|
@ -1,154 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OpenDiablo2.Common
|
||||
{
|
||||
public static class ResourcePaths
|
||||
{
|
||||
// --- Loading Screen ---
|
||||
public static string LoadingScreen { get; } = "data\\global\\ui\\Loading\\loadingscreen.dc6";
|
||||
public const string LoadingScreen = @"data\global\ui\Loading\loadingscreen.dc6";
|
||||
|
||||
// --- Main Menu ---
|
||||
public static string GameSelectScreen { get; } = "data\\global\\ui\\FrontEnd\\gameselectscreenEXP.dc6";
|
||||
public static string Diablo2LogoFireLeft { get; } = "data\\global\\ui\\FrontEnd\\D2logoFireLeft.DC6";
|
||||
public static string Diablo2LogoFireRight { get; } = "data\\global\\ui\\FrontEnd\\D2logoFireRight.DC6";
|
||||
public static string Diablo2LogoBlackLeft { get; } = "data\\global\\ui\\FrontEnd\\D2logoBlackLeft.DC6";
|
||||
public static string Diablo2LogoBlackRight { get; } = "data\\global\\ui\\FrontEnd\\D2logoBlackRight.DC6";
|
||||
public const string GameSelectScreen = @"data\global\ui\FrontEnd\gameselectscreenEXP.dc6";
|
||||
public const string Diablo2LogoFireLeft = @"data\global\ui\FrontEnd\D2logoFireLeft.DC6";
|
||||
public const string Diablo2LogoFireRight = @"data\global\ui\FrontEnd\D2logoFireRight.DC6";
|
||||
public const string Diablo2LogoBlackLeft = @"data\global\ui\FrontEnd\D2logoBlackLeft.DC6";
|
||||
public const string Diablo2LogoBlackRight = @"data\global\ui\FrontEnd\D2logoBlackRight.DC6";
|
||||
|
||||
// --- Character Select Screen ---
|
||||
public static string CharacterSelectBackground { get; } = "data\\global\\ui\\FrontEnd\\charactercreationscreenEXP.dc6";
|
||||
public static string CharacterSelectCampfire { get; } = "data\\global\\ui\\FrontEnd\\fire.DC6";
|
||||
public const string CharacterSelectBackground = @"data\global\ui\FrontEnd\charactercreationscreenEXP.dc6";
|
||||
public const string CharacterSelectCampfire = @"data\global\ui\FrontEnd\fire.DC6";
|
||||
|
||||
public static string CharacterSelectBarbarianUnselected { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu1.DC6";
|
||||
public static string CharacterSelectBarbarianUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu2.DC6";
|
||||
public static string CharacterSelectBarbarianSelected { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu3.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\bafw.DC6";
|
||||
public static string CharacterSelectBarbarianForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\BAFWs.DC6";
|
||||
public static string CharacterSelectBarbarianBackWalk { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\babw.DC6";
|
||||
public const string CharacterSelectBarbarianUnselected = @"data\global\ui\FrontEnd\barbarian\banu1.DC6";
|
||||
public const string CharacterSelectBarbarianUnselectedH = @"data\global\ui\FrontEnd\barbarian\banu2.DC6";
|
||||
public const string CharacterSelectBarbarianSelected = @"data\global\ui\FrontEnd\barbarian\banu3.DC6";
|
||||
public const string CharacterSelectBarbarianForwardWalk = @"data\global\ui\FrontEnd\barbarian\bafw.DC6";
|
||||
public const string CharacterSelectBarbarianForwardWalkOverlay = @"data\global\ui\FrontEnd\barbarian\BAFWs.DC6";
|
||||
public const string CharacterSelectBarbarianBackWalk = @"data\global\ui\FrontEnd\barbarian\babw.DC6";
|
||||
|
||||
public static string CharacterSelecSorceressUnselected { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU1.DC6";
|
||||
public static string CharacterSelecSorceressUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU2.DC6";
|
||||
public static string CharacterSelecSorceressSelected { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3.DC6";
|
||||
public static string CharacterSelecSorceressSelectedOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3s.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalk{ get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOFW.DC6";
|
||||
public static string CharacterSelecSorceressForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOFWs.DC6";
|
||||
public static string CharacterSelecSorceressBackWalk { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOBW.DC6";
|
||||
public static string CharacterSelecSorceressBackWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOBWs.DC6";
|
||||
public const string CharacterSelecSorceressUnselected = @"data\global\ui\FrontEnd\sorceress\SONU1.DC6";
|
||||
public const string CharacterSelecSorceressUnselectedH = @"data\global\ui\FrontEnd\sorceress\SONU2.DC6";
|
||||
public const string CharacterSelecSorceressSelected = @"data\global\ui\FrontEnd\sorceress\SONU3.DC6";
|
||||
public const string CharacterSelecSorceressSelectedOverlay = @"data\global\ui\FrontEnd\sorceress\SONU3s.DC6";
|
||||
public const string CharacterSelecSorceressForwardWalk = @"data\global\ui\FrontEnd\sorceress\SOFW.DC6";
|
||||
public const string CharacterSelecSorceressForwardWalkOverlay = @"data\global\ui\FrontEnd\sorceress\SOFWs.DC6";
|
||||
public const string CharacterSelecSorceressBackWalk = @"data\global\ui\FrontEnd\sorceress\SOBW.DC6";
|
||||
public const string CharacterSelecSorceressBackWalkOverlay = @"data\global\ui\FrontEnd\sorceress\SOBWs.DC6";
|
||||
|
||||
public static string CharacterSelectNecromancerUnselected { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU1.DC6";
|
||||
public static string CharacterSelectNecromancerUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU2.DC6";
|
||||
public static string CharacterSelecNecromancerSelected { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3.DC6";
|
||||
public static string CharacterSelecNecromancerSelectedOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3s.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEFW.DC6";
|
||||
public static string CharacterSelecNecromancerForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEFWs.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalk { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEBW.DC6";
|
||||
public static string CharacterSelecNecromancerBackWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEBWs.DC6";
|
||||
public const string CharacterSelectNecromancerUnselected = @"data\global\ui\FrontEnd\necromancer\NENU1.DC6";
|
||||
public const string CharacterSelectNecromancerUnselectedH = @"data\global\ui\FrontEnd\necromancer\NENU2.DC6";
|
||||
public const string CharacterSelecNecromancerSelected = @"data\global\ui\FrontEnd\necromancer\NENU3.DC6";
|
||||
public const string CharacterSelecNecromancerSelectedOverlay = @"data\global\ui\FrontEnd\necromancer\NENU3s.DC6";
|
||||
public const string CharacterSelecNecromancerForwardWalk = @"data\global\ui\FrontEnd\necromancer\NEFW.DC6";
|
||||
public const string CharacterSelecNecromancerForwardWalkOverlay = @"data\global\ui\FrontEnd\necromancer\NEFWs.DC6";
|
||||
public const string CharacterSelecNecromancerBackWalk = @"data\global\ui\FrontEnd\necromancer\NEBW.DC6";
|
||||
public const string CharacterSelecNecromancerBackWalkOverlay = @"data\global\ui\FrontEnd\necromancer\NEBWs.DC6";
|
||||
|
||||
public static string CharacterSelectPaladinUnselected { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU1.DC6";
|
||||
public static string CharacterSelectPaladinUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU2.DC6";
|
||||
public static string CharacterSelecPaladinSelected { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU3.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PAFW.DC6";
|
||||
public static string CharacterSelecPaladinForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PAFWs.DC6";
|
||||
public static string CharacterSelecPaladinBackWalk { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PABW.DC6";
|
||||
public const string CharacterSelectPaladinUnselected = @"data\global\ui\FrontEnd\paladin\PANU1.DC6";
|
||||
public const string CharacterSelectPaladinUnselectedH = @"data\global\ui\FrontEnd\paladin\PANU2.DC6";
|
||||
public const string CharacterSelecPaladinSelected = @"data\global\ui\FrontEnd\paladin\PANU3.DC6";
|
||||
public const string CharacterSelecPaladinForwardWalk = @"data\global\ui\FrontEnd\paladin\PAFW.DC6";
|
||||
public const string CharacterSelecPaladinForwardWalkOverlay = @"data\global\ui\FrontEnd\paladin\PAFWs.DC6";
|
||||
public const string CharacterSelecPaladinBackWalk = @"data\global\ui\FrontEnd\paladin\PABW.DC6";
|
||||
|
||||
|
||||
public static string CharacterSelectAmazonUnselected { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU1.DC6";
|
||||
public static string CharacterSelectAmazonUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU2.DC6";
|
||||
public static string CharacterSelecAmazonSelected { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU3.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMFW.DC6";
|
||||
public static string CharacterSelecAmazonForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMFWs.DC6";
|
||||
public static string CharacterSelecAmazonBackWalk { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMBW.DC6";
|
||||
public const string CharacterSelectAmazonUnselected = @"data\global\ui\FrontEnd\amazon\AMNU1.DC6";
|
||||
public const string CharacterSelectAmazonUnselectedH = @"data\global\ui\FrontEnd\amazon\AMNU2.DC6";
|
||||
public const string CharacterSelecAmazonSelected = @"data\global\ui\FrontEnd\amazon\AMNU3.DC6";
|
||||
public const string CharacterSelecAmazonForwardWalk = @"data\global\ui\FrontEnd\amazon\AMFW.DC6";
|
||||
public const string CharacterSelecAmazonForwardWalkOverlay = @"data\global\ui\FrontEnd\amazon\AMFWs.DC6";
|
||||
public const string CharacterSelecAmazonBackWalk = @"data\global\ui\FrontEnd\amazon\AMBW.DC6";
|
||||
|
||||
public static string CharacterSelectAssassinUnselected { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU1.DC6";
|
||||
public static string CharacterSelectAssassinUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU2.DC6";
|
||||
public static string CharacterSelectAssassinSelected { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU3.DC6";
|
||||
public static string CharacterSelectAssassinForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASFW.DC6";
|
||||
public static string CharacterSelectAssassinBackWalk { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASBW.DC6";
|
||||
public const string CharacterSelectAssassinUnselected = @"data\global\ui\FrontEnd\assassin\ASNU1.DC6";
|
||||
public const string CharacterSelectAssassinUnselectedH = @"data\global\ui\FrontEnd\assassin\ASNU2.DC6";
|
||||
public const string CharacterSelectAssassinSelected = @"data\global\ui\FrontEnd\assassin\ASNU3.DC6";
|
||||
public const string CharacterSelectAssassinForwardWalk = @"data\global\ui\FrontEnd\assassin\ASFW.DC6";
|
||||
public const string CharacterSelectAssassinBackWalk = @"data\global\ui\FrontEnd\assassin\ASBW.DC6";
|
||||
|
||||
public static string CharacterSelectDruidUnselected { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU1.dc6";
|
||||
public static string CharacterSelectDruidUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU2.dc6";
|
||||
public static string CharacterSelectDruidSelected { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU3.DC6";
|
||||
public static string CharacterSelectDruidForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZFW.DC6";
|
||||
public static string CharacterSelectDruidBackWalk { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZBW.DC6";
|
||||
public const string CharacterSelectDruidUnselected = @"data\global\ui\FrontEnd\druid\DZNU1.dc6";
|
||||
public const string CharacterSelectDruidUnselectedH = @"data\global\ui\FrontEnd\druid\DZNU2.dc6";
|
||||
public const string CharacterSelectDruidSelected = @"data\global\ui\FrontEnd\druid\DZNU3.DC6";
|
||||
public const string CharacterSelectDruidForwardWalk = @"data\global\ui\FrontEnd\druid\DZFW.DC6";
|
||||
public const string CharacterSelectDruidBackWalk = @"data\global\ui\FrontEnd\druid\DZBW.DC6";
|
||||
|
||||
// -- Character Selection
|
||||
public static string CharacterSelectionBackground { get; } = "data\\global\\ui\\CharSelect\\characterselectscreenEXP.dc6";
|
||||
public const string CharacterSelectionBackground = @"data\global\ui\CharSelect\characterselectscreenEXP.dc6";
|
||||
|
||||
// --- Game ---
|
||||
public static string GamePanels { get; } = "data\\global\\ui\\PANEL\\800ctrlpnl7.dc6";
|
||||
public static string GameGlobeOverlap { get; } = "data\\global\\ui\\PANEL\\overlap.DC6";
|
||||
public static string HealthMana { get; } = "data\\global\\ui\\PANEL\\hlthmana.DC6";
|
||||
public static string GameSmallMenuButton { get; } = "data\\global\\ui\\PANEL\\menubutton.DC6"; // TODO: Used for inventory popout
|
||||
public static string SkillIcon { get; } = "data\\global\\ui\\PANEL\\Skillicon.DC6"; // TODO: Used for skill icon button
|
||||
public const string GamePanels = @"data\global\ui\PANEL\800ctrlpnl7.dc6";
|
||||
public const string GameGlobeOverlap = @"data\global\ui\PANEL\overlap.DC6";
|
||||
public const string HealthMana = @"data\global\ui\PANEL\hlthmana.DC6";
|
||||
public const string GameSmallMenuButton = @"data\global\ui\PANEL\menubutton.DC6"; // TODO: Used for inventory popout
|
||||
public const string SkillIcon = @"data\global\ui\PANEL\Skillicon.DC6"; // TODO: Used for skill icon button
|
||||
|
||||
// --- Mouse Pointers ---
|
||||
public static string CursorDefault { get; } = "data\\global\\ui\\CURSOR\\ohand.DC6";
|
||||
public const string CursorDefault = @"data\global\ui\CURSOR\ohand.DC6";
|
||||
|
||||
// --- Fonts ---
|
||||
public static string Font6 { get; } = "data\\local\\font\\latin\\font6";
|
||||
public static string Font8 { get; } = "data\\local\\font\\latin\\font8";
|
||||
public static string Font16 { get; } = "data\\local\\font\\latin\\font16";
|
||||
public static string Font24 { get; } = "data\\local\\font\\latin\\font24";
|
||||
public static string Font30 { get; } = "data\\local\\font\\latin\\font30";
|
||||
public static string FontFormal12 { get; } = "data\\local\\font\\latin\\fontformal12";
|
||||
public static string FontFormal11 { get; } = "data\\local\\font\\latin\\fontformal11";
|
||||
public static string FontFormal10 { get; } = "data\\local\\font\\latin\\fontformal10";
|
||||
public static string FontExocet10 { get; } = "data\\local\\font\\latin\\fontexocet10";
|
||||
public static string FontExocet8 { get; } = "data\\local\\font\\latin\\fontexocet8";
|
||||
public const string Font6 = @"data\local\font\latin\font6";
|
||||
public const string Font8 = @"data\local\font\latin\font8";
|
||||
public const string Font16 = @"data\local\font\latin\font16";
|
||||
public const string Font24 = @"data\local\font\latin\font24";
|
||||
public const string Font30 = @"data\local\font\latin\font30";
|
||||
public const string FontFormal12 = @"data\local\font\latin\fontformal12";
|
||||
public const string FontFormal11 = @"data\local\font\latin\fontformal11";
|
||||
public const string FontFormal10 = @"data\local\font\latin\fontformal10";
|
||||
public const string FontExocet10 = @"data\local\font\latin\fontexocet10";
|
||||
public const string FontExocet8 = @"data\local\font\latin\fontexocet8";
|
||||
|
||||
// --- UI ---
|
||||
public static string WideButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
|
||||
public static string MediumButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\MediumButtonBlank.dc6";
|
||||
public static string CancelButton { get; } = "data\\global\\ui\\FrontEnd\\CancelButtonBlank.dc6";
|
||||
public static string NarrowButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\NarrowButtonBlank.dc6";
|
||||
public static string TextBox2 { get; } = "data\\global\\ui\\FrontEnd\\textbox2.dc6";
|
||||
public static string TallButtonBlank { get; } = "data\\global\\ui\\CharSelect\\TallButtonBlank.dc6";
|
||||
public const string WideButtonBlank = @"data\global\ui\FrontEnd\WideButtonBlank.dc6";
|
||||
public const string MediumButtonBlank = @"data\global\ui\FrontEnd\MediumButtonBlank.dc6";
|
||||
public const string CancelButton = @"data\global\ui\FrontEnd\CancelButtonBlank.dc6";
|
||||
public const string NarrowButtonBlank = @"data\global\ui\FrontEnd\NarrowButtonBlank.dc6";
|
||||
public const string TextBox2 = @"data\global\ui\FrontEnd\textbox2.dc6";
|
||||
public const string TallButtonBlank = @"data\global\ui\CharSelect\TallButtonBlank.dc6";
|
||||
|
||||
// --- GAME UI ---
|
||||
public static string MinipanelSmall { get; } = "data\\global\\ui\\PANEL\\minipanel_s.dc6";
|
||||
public static string MinipanelButton { get; } = "data\\global\\ui\\PANEL\\minipanelbtn.DC6";
|
||||
public const string MinipanelSmall = @"data\global\ui\PANEL\minipanel_s.dc6";
|
||||
public const string MinipanelButton = @"data\global\ui\PANEL\minipanelbtn.DC6";
|
||||
|
||||
public static string Frame { get; } = "data\\global\\ui\\PANEL\\800borderframe.dc6";
|
||||
public static string InventoryCharacterPanel { get; } = "data\\global\\ui\\PANEL\\invchar.DC6";
|
||||
public const string Frame = @"data\global\ui\PANEL\800borderframe.dc6";
|
||||
public const string InventoryCharacterPanel = @"data\global\ui\PANEL\invchar.DC6";
|
||||
|
||||
public static string RunButton { get; } = "data\\global\\ui\\PANEL\\runbutton.dc6";
|
||||
public static string MenuButton { get; } = "data\\global\\ui\\PANEL\\menubutton.DC6";
|
||||
public const string RunButton = @"data\global\ui\PANEL\runbutton.dc6";
|
||||
public const string MenuButton = @"data\global\ui\PANEL\menubutton.DC6";
|
||||
public const string GoldCoinButton = @"data\global\ui\panel\goldcoinbtn.dc6";
|
||||
public const string SquareButton = @"data\global\ui\panel\buysellbtn.dc6";
|
||||
|
||||
public static string ArmorPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_armor.DC6";
|
||||
public static string BeltPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_belt.DC6";
|
||||
public static string BootsPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_boots.DC6";
|
||||
public static string HelmGlovePlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_helm_glove.DC6";
|
||||
public static string RingAmuletPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_ring_amulet.DC6";
|
||||
public static string WeaponsPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_weapons.DC6";
|
||||
public const string ArmorPlaceholder = @"data\global\ui\PANEL\inv_armor.DC6";
|
||||
public const string BeltPlaceholder = @"data\global\ui\PANEL\inv_belt.DC6";
|
||||
public const string BootsPlaceholder = @"data\global\ui\PANEL\inv_boots.DC6";
|
||||
public const string HelmGlovePlaceholder = @"data\global\ui\PANEL\inv_helm_glove.DC6";
|
||||
public const string RingAmuletPlaceholder = @"data\global\ui\PANEL\inv_ring_amulet.DC6";
|
||||
public const string WeaponsPlaceholder = @"data\global\ui\PANEL\inv_weapons.DC6";
|
||||
|
||||
// --- Data ---
|
||||
// TODO: Doesn't sound right :)
|
||||
public static string EnglishTable { get; } = "data\\local\\lng\\eng\\English.txt";
|
||||
public static string ExpansionStringTable { get; } = "data\\local\\lng\\eng\\expansionstring.tbl";
|
||||
public static string LevelPreset { get; } = "data\\global\\excel\\LvlPrest.txt";
|
||||
public static string LevelType { get; } = "data\\global\\excel\\LvlTypes.txt";
|
||||
public static string LevelDetails { get; } = "data\\global\\excel\\Levels.txt";
|
||||
public const string EnglishTable = @"data\local\lng\eng\English.txt";
|
||||
public const string ExpansionStringTable = @"data\local\lng\eng\expansionstring.tbl";
|
||||
public const string LevelPreset = @"data\global\excel\LvlPrest.txt";
|
||||
public const string LevelType = @"data\global\excel\LvlTypes.txt";
|
||||
public const string LevelDetails = @"data\global\excel\Levels.txt";
|
||||
|
||||
// --- Animations ---
|
||||
public static string ObjectData { get; } = "data\\global\\objects";
|
||||
public static string AnimationData { get; } = "data\\global\\animdata.d2";
|
||||
public static string PlayerAnimationBase { get; } = "data\\global\\CHARS";
|
||||
public const string ObjectData = @"data\global\objects";
|
||||
public const string AnimationData = @"data\global\animdata.d2";
|
||||
public const string PlayerAnimationBase = @"data\global\CHARS";
|
||||
|
||||
// --- Inventory Data ---
|
||||
public static string Weapons { get; } = "data\\global\\excel\\weapons.txt";
|
||||
public static string Armor { get; } = "data\\global\\excel\\armor.txt";
|
||||
public static string Misc { get; } = "data\\global\\excel\\misc.txt";
|
||||
public const string Weapons = @"data\global\excel\weapons.txt";
|
||||
public const string Armor = @"data\global\excel\armor.txt";
|
||||
public const string Misc = @"data\global\excel\misc.txt";
|
||||
|
||||
// --- Character Data ---
|
||||
public static string Experience { get; } = "data\\global\\excel\\experience.txt";
|
||||
public static string CharStats { get; } = "data\\global\\excel\\charstats.txt";
|
||||
public const string Experience = @"data\global\excel\experience.txt";
|
||||
public const string CharStats = @"data\global\excel\charstats.txt";
|
||||
|
||||
public static string GeneratePathForItem(string spriteName)
|
||||
{
|
||||
return $"data\\global\\items\\{spriteName}.dc6";
|
||||
return $@"data\global\items\{spriteName}.dc6";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,25 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using OpenDiablo2.Common.Extensions;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenDiablo2.Core.UI
|
||||
{
|
||||
@ -11,14 +28,21 @@ namespace OpenDiablo2.Core.UI
|
||||
private readonly IRenderWindow renderWindow;
|
||||
private readonly ISprite sprite;
|
||||
|
||||
public Point Location { get; set; }
|
||||
private readonly IButton closeButton;
|
||||
|
||||
public CharacterPanel(IRenderWindow renderWindow)
|
||||
public event OnPanelClosedEvent OnPanelClosed;
|
||||
|
||||
public CharacterPanel(
|
||||
IRenderWindow renderWindow,
|
||||
Func<eButtonType, IButton> createButton)
|
||||
{
|
||||
this.renderWindow = renderWindow;
|
||||
|
||||
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, new Point(79,61));
|
||||
Location = new Point(0, 0);
|
||||
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Act1, FrameType.GetOffset());
|
||||
|
||||
closeButton = createButton(eButtonType.Close);
|
||||
closeButton.Location = sprite.Location + new Size(128, 388);
|
||||
closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);
|
||||
}
|
||||
|
||||
public eButtonType PanelType => eButtonType.MinipanelCharacter;
|
||||
@ -26,12 +50,14 @@ namespace OpenDiablo2.Core.UI
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
closeButton.Update();
|
||||
}
|
||||
|
||||
public void Render()
|
||||
{
|
||||
renderWindow.Draw(sprite, 2, 2, 0);
|
||||
|
||||
closeButton.Render();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -1,4 +1,20 @@
|
||||
using OpenDiablo2.Common;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using System;
|
||||
@ -32,7 +48,7 @@ namespace OpenDiablo2.Core.UI
|
||||
this.gameState = gameState;
|
||||
this.mouseInfoProvider = mouseInfoProvider;
|
||||
minipanel = createMiniPanel();
|
||||
minipanel.PanelSelected += OpenPanel;
|
||||
minipanel.OnPanelToggled += TogglePanel;
|
||||
|
||||
leftPanelFrame = createPanelFrame(ePanelFrameType.Left);
|
||||
rightPanelFrame = createPanelFrame(ePanelFrameType.Right);
|
||||
@ -59,7 +75,7 @@ namespace OpenDiablo2.Core.UI
|
||||
public bool IsRightPanelVisible => RightPanel != null;
|
||||
public bool IsRunningEnabled => runButton.Toggled;
|
||||
|
||||
public void OpenPanel(IPanel panel)
|
||||
public void TogglePanel(IPanel panel)
|
||||
{
|
||||
switch (panel.FrameType)
|
||||
{
|
||||
@ -101,6 +117,14 @@ namespace OpenDiablo2.Core.UI
|
||||
ArePanelsBounded = true;
|
||||
}
|
||||
|
||||
public void ClosePanels()
|
||||
{
|
||||
LeftPanel = null;
|
||||
RightPanel = null;
|
||||
UpdateCameraOffset();
|
||||
ArePanelsBounded = false;
|
||||
}
|
||||
|
||||
public bool IsMouseOver()
|
||||
{
|
||||
return mouseInfoProvider.MouseY >= 550
|
||||
@ -122,9 +146,6 @@ namespace OpenDiablo2.Core.UI
|
||||
RightPanel.Render();
|
||||
rightPanelFrame.Render();
|
||||
}
|
||||
|
||||
if (!IsLeftPanelVisible || !IsRightPanelVisible)
|
||||
minipanel.Render();
|
||||
|
||||
// Render the background bottom bar
|
||||
renderWindow.Draw(panelSprite, 0, new Point(0, 600));
|
||||
@ -141,6 +162,9 @@ namespace OpenDiablo2.Core.UI
|
||||
// Render the mana bar
|
||||
renderWindow.Draw(healthManaSprite, 1, new Point(692, 588));
|
||||
renderWindow.Draw(gameGlobeOverlapSprite, 1, new Point(693, 591));
|
||||
|
||||
if (!IsLeftPanelVisible || !IsRightPanelVisible)
|
||||
minipanel.Render();
|
||||
|
||||
runButton.Render();
|
||||
menuButton.Render();
|
||||
|
@ -1,91 +1,112 @@
|
||||
using System;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using OpenDiablo2.Common.Extensions;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
|
||||
namespace OpenDiablo2.Core.UI
|
||||
{
|
||||
/**
|
||||
* TODO: Check positioning, it's probably not exact
|
||||
* TODO: Add logic so it can be used as an element in inventory grid
|
||||
**/
|
||||
public sealed class InventoryPanel : IInventoryPanel
|
||||
{
|
||||
private readonly IRenderWindow renderWindow;
|
||||
private readonly ISprite sprite;
|
||||
private Point location;
|
||||
|
||||
public Point Location {
|
||||
get => location;
|
||||
set {
|
||||
#pragma warning disable S4275 // Getters and setters should access the expected fields
|
||||
previouslyContainedItem = location;
|
||||
#pragma warning restore S4275 // Getters and setters should access the expected fields
|
||||
location = value;
|
||||
}
|
||||
}
|
||||
|
||||
public eButtonType PanelType => eButtonType.MinipanelInventory;
|
||||
public ePanelFrameType FrameType => ePanelFrameType.Right;
|
||||
|
||||
// Test vars
|
||||
public IItemContainer helmContainer, armorContainer, weaponLeftContainer, weaponRightContainer, beltContainer, gloveContainer, bootsContainer;
|
||||
private Point previouslyContainedItem;
|
||||
private readonly IItemContainer ringtLeftContainer;
|
||||
private readonly IItemContainer ringtRightContainer;
|
||||
private readonly IItemContainer amuletContainer;
|
||||
|
||||
public InventoryPanel(IRenderWindow renderWindow, IItemManager itemManager, Func<eItemContainerType, IItemContainer> createItemContainer)
|
||||
private readonly IButton closeButton, goldButton;
|
||||
|
||||
public event OnPanelClosedEvent OnPanelClosed;
|
||||
|
||||
public InventoryPanel(IRenderWindow renderWindow,
|
||||
IItemManager itemManager,
|
||||
Func<eItemContainerType, IItemContainer> createItemContainer,
|
||||
Func<eButtonType, IButton> createButton)
|
||||
{
|
||||
this.renderWindow = renderWindow;
|
||||
|
||||
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, new Point(402,61));
|
||||
Location = new Point(400, 0);
|
||||
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, FrameType.GetOffset());
|
||||
|
||||
this.helmContainer = createItemContainer(eItemContainerType.Helm);
|
||||
this.helmContainer.Location = new Point(Location.X + 138, Location.Y + 68);
|
||||
this.helmContainer.SetContainedItem(itemManager.getItem("cap"));
|
||||
closeButton = createButton(eButtonType.Close);
|
||||
closeButton.Location = sprite.Location + new Size(18, 384);
|
||||
closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);
|
||||
|
||||
this.amuletContainer = createItemContainer(eItemContainerType.Amulet);
|
||||
this.amuletContainer.Location = new Point(Location.X + 211, Location.Y + 92);
|
||||
this.amuletContainer.SetContainedItem(itemManager.getItem("vip"));
|
||||
goldButton = createButton(eButtonType.GoldCoin);
|
||||
goldButton.Location = sprite.Location + new Size(84, 391);
|
||||
goldButton.OnActivate = OpenGoldDrop;
|
||||
|
||||
this.armorContainer = createItemContainer(eItemContainerType.Armor);
|
||||
this.armorContainer.Location = new Point(Location.X + 138, Location.Y + 138);
|
||||
this.armorContainer.SetContainedItem(itemManager.getItem("hla"));
|
||||
|
||||
this.weaponLeftContainer = createItemContainer(eItemContainerType.Weapon);
|
||||
this.weaponLeftContainer.Location = new Point(Location.X + 22, Location.Y + 108);
|
||||
this.weaponLeftContainer.SetContainedItem(itemManager.getItem("ame"));
|
||||
|
||||
this.weaponRightContainer = createItemContainer(eItemContainerType.Weapon);
|
||||
this.weaponRightContainer.Location = new Point(Location.X + 255, Location.Y + 108);
|
||||
this.weaponRightContainer.SetContainedItem(itemManager.getItem("paf"));
|
||||
|
||||
this.beltContainer = createItemContainer(eItemContainerType.Belt);
|
||||
this.beltContainer.Location = new Point(Location.X + 138, Location.Y + 238);
|
||||
this.beltContainer.SetContainedItem(itemManager.getItem("vbl"));
|
||||
|
||||
this.ringtLeftContainer = createItemContainer(eItemContainerType.Ring);
|
||||
this.ringtLeftContainer.Location = new Point(Location.X + 97, Location.Y + 238);
|
||||
this.ringtLeftContainer.SetContainedItem(itemManager.getItem("rin"));
|
||||
|
||||
this.ringtRightContainer = createItemContainer(eItemContainerType.Ring);
|
||||
this.ringtRightContainer.Location = new Point(Location.X + 211, Location.Y + 238);
|
||||
this.ringtRightContainer.SetContainedItem(itemManager.getItem("rin"));
|
||||
|
||||
this.gloveContainer = createItemContainer(eItemContainerType.Glove);
|
||||
this.gloveContainer.Location = new Point(Location.X + 22, Location.Y + 238);
|
||||
this.gloveContainer.SetContainedItem(itemManager.getItem("tgl"));
|
||||
|
||||
this.bootsContainer = createItemContainer(eItemContainerType.Boots);
|
||||
this.bootsContainer.Location = new Point(Location.X + 255, Location.Y + 238);
|
||||
this.bootsContainer.SetContainedItem(itemManager.getItem("lbt"));
|
||||
helmContainer = createItemContainer(eItemContainerType.Helm);
|
||||
helmContainer.Location = sprite.Location + new Size(135, 5);
|
||||
helmContainer.SetContainedItem(itemManager.getItem("cap"));
|
||||
|
||||
amuletContainer = createItemContainer(eItemContainerType.Amulet);
|
||||
amuletContainer.Location = sprite.Location + new Size(209, 34);
|
||||
amuletContainer.SetContainedItem(itemManager.getItem("vip"));
|
||||
|
||||
armorContainer = createItemContainer(eItemContainerType.Armor);
|
||||
armorContainer.Location = sprite.Location + new Size(135, 75);
|
||||
armorContainer.SetContainedItem(itemManager.getItem("hla"));
|
||||
|
||||
weaponLeftContainer = createItemContainer(eItemContainerType.Weapon);
|
||||
weaponLeftContainer.Location = sprite.Location + new Size(20, 47);
|
||||
weaponLeftContainer.SetContainedItem(itemManager.getItem("ame"));
|
||||
|
||||
weaponRightContainer = createItemContainer(eItemContainerType.Weapon);
|
||||
weaponRightContainer.Location = sprite.Location + new Size(253, 47);
|
||||
weaponRightContainer.SetContainedItem(itemManager.getItem("paf"));
|
||||
|
||||
beltContainer = createItemContainer(eItemContainerType.Belt);
|
||||
beltContainer.Location = sprite.Location + new Size(136, 178);
|
||||
beltContainer.SetContainedItem(itemManager.getItem("vbl"));
|
||||
|
||||
ringtLeftContainer = createItemContainer(eItemContainerType.Ring);
|
||||
ringtLeftContainer.Location = sprite.Location + new Size(95, 179);
|
||||
ringtLeftContainer.SetContainedItem(itemManager.getItem("rin"));
|
||||
|
||||
ringtRightContainer = createItemContainer(eItemContainerType.Ring);
|
||||
ringtRightContainer.Location = sprite.Location + new Size(209, 179);
|
||||
ringtRightContainer.SetContainedItem(itemManager.getItem("rin"));
|
||||
|
||||
gloveContainer = createItemContainer(eItemContainerType.Glove);
|
||||
gloveContainer.Location = sprite.Location + new Size(20, 179);
|
||||
gloveContainer.SetContainedItem(itemManager.getItem("tgl"));
|
||||
|
||||
bootsContainer = createItemContainer(eItemContainerType.Boots);
|
||||
bootsContainer.Location = sprite.Location + new Size(251, 178);
|
||||
bootsContainer.SetContainedItem(itemManager.getItem("lbt"));
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
closeButton.Update();
|
||||
goldButton.Update();
|
||||
|
||||
helmContainer.Update();
|
||||
amuletContainer.Update();
|
||||
armorContainer.Update();
|
||||
@ -102,6 +123,9 @@ namespace OpenDiablo2.Core.UI
|
||||
{
|
||||
renderWindow.Draw(sprite, 2, 2, 1);
|
||||
|
||||
closeButton.Render();
|
||||
goldButton.Render();
|
||||
|
||||
helmContainer.Render();
|
||||
amuletContainer.Render();
|
||||
armorContainer.Render();
|
||||
@ -118,5 +142,10 @@ namespace OpenDiablo2.Core.UI
|
||||
{
|
||||
sprite.Dispose();
|
||||
}
|
||||
|
||||
private void OpenGoldDrop()
|
||||
{
|
||||
// todo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace OpenDiablo2.Core.UI
|
||||
|
||||
private bool isPanelVisible;
|
||||
|
||||
public event PanelSelectedEvent PanelSelected;
|
||||
public event OnPanelToggledEvent OnPanelToggled;
|
||||
|
||||
public MiniPanel(IRenderWindow renderWindow,
|
||||
IGameState gameState,
|
||||
@ -40,12 +40,13 @@ namespace OpenDiablo2.Core.UI
|
||||
buttons = panelButtons.Select((x, i) =>
|
||||
{
|
||||
var newBtn = createButton(x);
|
||||
newBtn.OnActivate = () =>
|
||||
var panel = panels.SingleOrDefault(o => o.PanelType == x);
|
||||
|
||||
if (panel != null)
|
||||
{
|
||||
var panel = panels.SingleOrDefault(o => o.PanelType == x);
|
||||
if (panel == null) return;
|
||||
PanelSelected?.Invoke(panel);
|
||||
};
|
||||
newBtn.OnActivate = () => OnPanelToggled?.Invoke(panel);
|
||||
panel.OnPanelClosed += Panel_OnPanelClosed;
|
||||
}
|
||||
return newBtn;
|
||||
}).ToList().AsReadOnly();
|
||||
|
||||
@ -100,5 +101,10 @@ namespace OpenDiablo2.Core.UI
|
||||
for (int i = 0; i < buttons.Count; i++)
|
||||
buttons[i].Location = new Point(3 + 21 * i + sprite.Location.X, 3 + sprite.Location.Y - sprite.LocalFrameSize.Height);
|
||||
}
|
||||
|
||||
private void Panel_OnPanelClosed(IPanel panel)
|
||||
{
|
||||
OnPanelToggled?.Invoke(panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,23 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenDiablo2.Common;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using OpenDiablo2.Common.Attributes;
|
||||
using OpenDiablo2.Common.Enums;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace OpenDiablo2.Scenes
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user