1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-20 22:25:24 +00:00

Basic Character Panel and Inventory Panel drawing (#30)

* Initial minipanel work
* Character and Inventory panel implementation, frame included
* Separate panel frame from the actual inventory and character panels so they can be reused by other panels
This commit is contained in:
Diego M 2018-11-29 21:11:25 -03:00 committed by Tim Sarbin
parent baed1834b4
commit f3793e0a60
16 changed files with 457 additions and 199 deletions

View File

@ -0,0 +1,8 @@
namespace OpenDiablo2.Common.Enums
{
public enum ePanelFrameType
{
Left,
Right
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface ICharacterPanel : IDisposable
{
void Render();
void Update();
}
}

View File

@ -12,6 +12,12 @@ namespace OpenDiablo2.Common.Interfaces
string MapName { get; }
Palette CurrentPalette { get; }
bool ToggleShowInventoryPanel();
bool ShowInventoryPanel { get; set; }
bool ToggleShowCharacterPanel();
bool ShowCharacterPanel { get; set; }
void Initialize(string text, eHero value);
void Update(long ms);
IEnumerable<MapCellInfo> GetMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType);

View File

@ -0,0 +1,10 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IInventoryPanel : IDisposable
{
void Render();
void Update();
}
}

View File

@ -0,0 +1,11 @@
using OpenDiablo2.Common.Enums;
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IPanelFrame : IDisposable
{
void Render();
void Update();
}
}

View File

@ -1,116 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B743160E-A0BB-45DC-9998-967A85E50562}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenDiablo2.Common</RootNamespace>
<AssemblyName>OpenDiablo2.Common</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.12.0\lib\net20\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.84.0.0, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
<HintPath>..\packages\NetSword.Common.ICSharpCode.SharpZipLib.0.84.0\lib\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\SceneAttribute.cs" />
<Compile Include="AutofacModule.cs" />
<Compile Include="Enums\eButtonType.cs" />
<Compile Include="Enums\eHero.cs" />
<Compile Include="Enums\eLevelId.cs" />
<Compile Include="Enums\eLevelSubType.cs" />
<Compile Include="Enums\eMPQFormatVersion.cs" />
<Compile Include="Enums\eRenderCellType.cs" />
<Compile Include="Enums\eTextAlign.cs" />
<Compile Include="Enums\eWildBorder.cs" />
<Compile Include="Interfaces\IButton.cs" />
<Compile Include="Interfaces\IEngineDataManager.cs" />
<Compile Include="Interfaces\IFont.cs" />
<Compile Include="Interfaces\IGameEngine.cs" />
<Compile Include="Interfaces\IGameState.cs" />
<Compile Include="Interfaces\IKeyboardInfoProvider.cs" />
<Compile Include="Interfaces\ILabel.cs" />
<Compile Include="Interfaces\IMapEngine.cs" />
<Compile Include="Interfaces\IMiniPanel.cs" />
<Compile Include="Interfaces\IMouseCursor.cs" />
<Compile Include="Interfaces\IMPQProvider.cs" />
<Compile Include="Interfaces\IMusicProvider.cs" />
<Compile Include="Interfaces\IPaletteProvider.cs" />
<Compile Include="Interfaces\IRenderWindow.cs" />
<Compile Include="Interfaces\IResourceManager.cs" />
<Compile Include="Interfaces\IScene.cs" />
<Compile Include="Interfaces\ISceneManager.cs" />
<Compile Include="Interfaces\ISprite.cs" />
<Compile Include="Interfaces\IMouseInfoProvider.cs" />
<Compile Include="Interfaces\ITextBox.cs" />
<Compile Include="Interfaces\ITextDictionary.cs" />
<Compile Include="Interfaces\ITextLabel.cs" />
<Compile Include="Interfaces\ITexture.cs" />
<Compile Include="Models\BitStream.cs" />
<Compile Include="Models\ButtonLayout.cs" />
<Compile Include="Models\LevelDetail.cs" />
<Compile Include="Models\LevelPreset.cs" />
<Compile Include="Models\LevelType.cs" />
<Compile Include="Models\MapCellInfo.cs" />
<Compile Include="Models\MapInfo.cs" />
<Compile Include="Models\MPQDS1.cs" />
<Compile Include="Models\MPQDT1.cs" />
<Compile Include="Models\MPQFont.cs" />
<Compile Include="Models\GlobalConfiguration.cs" />
<Compile Include="Models\ImageSet.cs" />
<Compile Include="Models\MPQ.cs" />
<Compile Include="Models\MPQHuffman.cs" />
<Compile Include="Models\MPQStream.cs" />
<Compile Include="Models\MPQWavCompression.cs" />
<Compile Include="Models\Palette.cs" />
<Compile Include="Models\PKLibDecompress.cs" />
<Compile Include="Models\SoundEntry.cs" />
<Compile Include="Palettes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourcePaths.cs" />
<Compile Include="StringUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B743160E-A0BB-45DC-9998-967A85E50562}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenDiablo2.Common</RootNamespace>
<AssemblyName>OpenDiablo2.Common</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.12.0\lib\net20\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.84.0.0, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
<HintPath>..\packages\NetSword.Common.ICSharpCode.SharpZipLib.0.84.0\lib\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\SceneAttribute.cs" />
<Compile Include="AutofacModule.cs" />
<Compile Include="Enums\ePanelFrameType.cs" />
<Compile Include="Enums\eButtonType.cs" />
<Compile Include="Enums\eHero.cs" />
<Compile Include="Enums\eLevelId.cs" />
<Compile Include="Enums\eLevelSubType.cs" />
<Compile Include="Enums\eMPQFormatVersion.cs" />
<Compile Include="Enums\eRenderCellType.cs" />
<Compile Include="Enums\eTextAlign.cs" />
<Compile Include="Enums\eWildBorder.cs" />
<Compile Include="Interfaces\IButton.cs" />
<Compile Include="Interfaces\IPanelFrame.cs" />
<Compile Include="Interfaces\IInventoryPanel.cs" />
<Compile Include="Interfaces\IEngineDataManager.cs" />
<Compile Include="Interfaces\IFont.cs" />
<Compile Include="Interfaces\IGameEngine.cs" />
<Compile Include="Interfaces\IGameState.cs" />
<Compile Include="Interfaces\IKeyboardInfoProvider.cs" />
<Compile Include="Interfaces\ILabel.cs" />
<Compile Include="Interfaces\IMapEngine.cs" />
<Compile Include="Interfaces\IMiniPanel.cs" />
<Compile Include="Interfaces\ICharacterPanel.cs" />
<Compile Include="Interfaces\IMouseCursor.cs" />
<Compile Include="Interfaces\IMPQProvider.cs" />
<Compile Include="Interfaces\IMusicProvider.cs" />
<Compile Include="Interfaces\IPaletteProvider.cs" />
<Compile Include="Interfaces\IRenderWindow.cs" />
<Compile Include="Interfaces\IResourceManager.cs" />
<Compile Include="Interfaces\IScene.cs" />
<Compile Include="Interfaces\ISceneManager.cs" />
<Compile Include="Interfaces\ISprite.cs" />
<Compile Include="Interfaces\IMouseInfoProvider.cs" />
<Compile Include="Interfaces\ITextBox.cs" />
<Compile Include="Interfaces\ITextDictionary.cs" />
<Compile Include="Interfaces\ITextLabel.cs" />
<Compile Include="Interfaces\ITexture.cs" />
<Compile Include="Models\BitStream.cs" />
<Compile Include="Models\ButtonLayout.cs" />
<Compile Include="Models\LevelDetail.cs" />
<Compile Include="Models\LevelPreset.cs" />
<Compile Include="Models\LevelType.cs" />
<Compile Include="Models\MapCellInfo.cs" />
<Compile Include="Models\MapInfo.cs" />
<Compile Include="Models\MPQDS1.cs" />
<Compile Include="Models\MPQDT1.cs" />
<Compile Include="Models\MPQFont.cs" />
<Compile Include="Models\GlobalConfiguration.cs" />
<Compile Include="Models\ImageSet.cs" />
<Compile Include="Models\MPQ.cs" />
<Compile Include="Models\MPQHuffman.cs" />
<Compile Include="Models\MPQStream.cs" />
<Compile Include="Models\MPQWavCompression.cs" />
<Compile Include="Models\Palette.cs" />
<Compile Include="Models\PKLibDecompress.cs" />
<Compile Include="Models\SoundEntry.cs" />
<Compile Include="Palettes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourcePaths.cs" />
<Compile Include="StringUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -111,6 +111,9 @@ namespace OpenDiablo2.Common
public static string MinipanelSmall = "data\\global\\ui\\PANEL\\minipanel_s.dc6";
public static string MinipanelButton = "data\\global\\ui\\PANEL\\minipanelbtn.DC6";
public static string Frame = "data\\global\\ui\\PANEL\\800borderframe.dc6";
public static string InventoryCharacterPanel = "data\\global\\ui\\PANEL\\invchar.DC6";
public static string RunButton = "data\\global\\ui\\PANEL\\runbutton.dc6";
public static string MenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6";

View File

@ -20,6 +20,9 @@ namespace OpenDiablo2.Core
builder.RegisterType<GameState>().As<IGameState>().SingleInstance();
builder.RegisterType<MapEngine>().As<IMapEngine>().SingleInstance();
builder.RegisterType<MiniPanel>().As<IMiniPanel>().InstancePerDependency();
builder.RegisterType<PanelFrame>().As<IPanelFrame>().InstancePerDependency();
builder.RegisterType<CharacterPanel>().As<ICharacterPanel>().InstancePerDependency();
builder.RegisterType<InventoryPanel>().As<IInventoryPanel>().InstancePerDependency();
builder.RegisterType<MPQProvider>().As<IMPQProvider>().SingleInstance();
builder.RegisterType<ResourceManager>().As<IResourceManager>().SingleInstance();
builder.RegisterType<TextDictionary>().As<ITextDictionary>().SingleInstance();

View File

@ -34,6 +34,9 @@ namespace OpenDiablo2.Core.GameState_
public string MapName { get; private set; }
public Palette CurrentPalette => paletteProvider.PaletteTable[$"ACT{Act}"];
public bool ShowInventoryPanel { get; set; } = false;
public bool ShowCharacterPanel { get; set; } = false;
public int Seed { get; internal set; }
public GameState(
@ -223,6 +226,20 @@ namespace OpenDiablo2.Core.GameState_
}
public bool ToggleShowInventoryPanel()
{
ShowInventoryPanel = !ShowInventoryPanel;
return ShowInventoryPanel;
}
public bool ToggleShowCharacterPanel()
{
ShowCharacterPanel = !ShowCharacterPanel;
return ShowCharacterPanel;
}
private MapCellInfo GetMapCellInfo(
MapInfo map,

View File

@ -1,82 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8FC6BF7D-835A-47C1-A6B2-125495FA0900}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenDiablo2.Core</RootNamespace>
<AssemblyName>OpenDiablo2.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Xabe.FFmpeg, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xabe.FFmpeg.3.1.4\lib\netstandard2.0\Xabe.FFmpeg.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AutofacModule.cs" />
<Compile Include="EngineDataManager.cs" />
<Compile Include="GameEngine.cs" />
<Compile Include="GameState\GameState.cs" />
<Compile Include="Map Engine\MapEngine.cs" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8FC6BF7D-835A-47C1-A6B2-125495FA0900}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenDiablo2.Core</RootNamespace>
<AssemblyName>OpenDiablo2.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Xabe.FFmpeg, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xabe.FFmpeg.3.1.4\lib\netstandard2.0\Xabe.FFmpeg.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AutofacModule.cs" />
<Compile Include="EngineDataManager.cs" />
<Compile Include="GameEngine.cs" />
<Compile Include="GameState\GameState.cs" />
<Compile Include="Map Engine\MapEngine.cs" />
<Compile Include="Map Engine\MapGenerator.cs" />
<Compile Include="MPQProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceManager.cs" />
<Compile Include="TextDictionary.cs" />
<Compile Include="UI\Button.cs" />
<Compile Include="UI\TextBox.cs" />
<Compile Include="UI\MiniPanel.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenDiablo2.Common\OpenDiablo2.Common.csproj">
<Project>{b743160e-a0bb-45dc-9998-967a85e50562}</Project>
<Name>OpenDiablo2.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Compile Include="MPQProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceManager.cs" />
<Compile Include="TextDictionary.cs" />
<Compile Include="UI\Button.cs" />
<Compile Include="UI\PanelFrame.cs" />
<Compile Include="UI\InventoryPanel.cs" />
<Compile Include="UI\TextBox.cs" />
<Compile Include="UI\MiniPanel.cs" />
<Compile Include="UI\CharacterPanel.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenDiablo2.Common\OpenDiablo2.Common.csproj">
<Project>{b743160e-a0bb-45dc-9998-967a85e50562}</Project>
<Name>OpenDiablo2.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,44 @@
using System;
using System.Drawing;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
namespace OpenDiablo2.Core.UI
{
public sealed class CharacterPanel : ICharacterPanel
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private IPanelFrame panelFrame;
public Point Location { get; set; }
public CharacterPanel(IRenderWindow renderWindow, Func<ePanelFrameType, IPanelFrame> createPanelFrame)
{
this.renderWindow = renderWindow;
this.panelFrame = createPanelFrame(ePanelFrameType.Left);
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, new Point(79,61));
Location = new Point(0, 0);
}
public void Update()
{
}
public void Render()
{
panelFrame.Render();
renderWindow.Draw(sprite, 2, 2, 0);
}
public void Dispose()
{
sprite.Dispose();
}
}
}

View File

@ -0,0 +1,42 @@
using System;
using System.Drawing;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
namespace OpenDiablo2.Core.UI
{
public sealed class InventoryPanel : IInventoryPanel
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private IPanelFrame panelFrame;
public Point Location { get; set; }
public InventoryPanel(Func<ePanelFrameType, IPanelFrame> createPanelFrame, IRenderWindow renderWindow)
{
this.renderWindow = renderWindow;
this.panelFrame = createPanelFrame(ePanelFrameType.Right);
sprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, new Point(402,61));
Location = new Point(400, 0);
}
public void Update()
{
}
public void Render()
{
panelFrame.Render();
renderWindow.Draw(sprite, 2, 2, 1);
}
public void Dispose()
{
sprite.Dispose();
}
}
}

View File

@ -6,7 +6,7 @@ using OpenDiablo2.Common.Interfaces;
namespace OpenDiablo2.Core.UI
{
// TODO: Allow to set Minipanel.buttons.character.OnAction or similar for button delegates
// TODO: Self-align when side panels are open
public sealed class MiniPanel : IMiniPanel
{
private readonly IRenderWindow renderWindow;
@ -28,7 +28,7 @@ namespace OpenDiablo2.Core.UI
}
}
public MiniPanel(IRenderWindow renderWindow, Func<eButtonType, IButton> createButton)
public MiniPanel(IRenderWindow renderWindow, IGameState gameState, Func<eButtonType, IButton> createButton)
{
this.renderWindow = renderWindow;
@ -37,9 +37,11 @@ namespace OpenDiablo2.Core.UI
characterBtn = createButton(eButtonType.MinipanelCharacter);
characterBtn.Location = new Point(3 + Location.X, 3 + Location.Y);
characterBtn.OnActivate = () => gameState.ToggleShowCharacterPanel();
inventoryBtn = createButton(eButtonType.MinipanelInventory);
inventoryBtn.Location = new Point(24 + Location.X, 3 + Location.Y);
inventoryBtn.OnActivate = () => gameState.ToggleShowInventoryPanel();
skillBtn = createButton(eButtonType.MinipanelSkill);
skillBtn.Location = new Point(45 + Location.X, 3 + Location.Y);

View File

@ -0,0 +1,67 @@
using System;
using System.Drawing;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
namespace OpenDiablo2.Core.UI
{
public sealed class PanelFrame : IPanelFrame
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private ePanelFrameType panelFrameType;
public Point Location { get; set; }
public PanelFrame(IRenderWindow renderWindow, ePanelFrameType panelFrameType)
{
this.renderWindow = renderWindow;
this.panelFrameType = panelFrameType;
sprite = renderWindow.LoadSprite(ResourcePaths.Frame, Palettes.Units, new Point(0, 0));
Location = new Point(0, 0);
}
private void DrawPanel()
{
switch(this.panelFrameType)
{
case ePanelFrameType.Left:
renderWindow.Draw(sprite, 0, new Point(0, 256));
renderWindow.Draw(sprite, 1, new Point(256, 66));
renderWindow.Draw(sprite, 2, new Point(0, 256 + 231));
renderWindow.Draw(sprite, 3, new Point(0, 256 + 231 + 66));
renderWindow.Draw(sprite, 4, new Point(256, 256 + 231 + 66));
break;
case ePanelFrameType.Right:
renderWindow.Draw(sprite, 5, new Point(400 + 0, 66));
renderWindow.Draw(sprite, 6, new Point(400 + 145, 256));
renderWindow.Draw(sprite, 7, new Point(400 + 145 + 169, 256 + 231));
renderWindow.Draw(sprite, 8, new Point(400 + 145, 256 + 231 + 66));
renderWindow.Draw(sprite, 9, new Point(400 + 0, 256 + 231 + 66));
break;
}
}
public void Update()
{
}
public void Render()
{
DrawPanel();
}
public void Dispose()
{
sprite.Dispose();
}
}
}

View File

@ -23,6 +23,9 @@ namespace OpenDiablo2.Scenes
private ISprite panelSprite, healthManaSprite, gameGlobeOverlapSprite;
private IMiniPanel minipanel;
private ICharacterPanel characterpanel;
private IInventoryPanel inventorypanel;
private bool showMinipanel = false;
private IButton runButton, menuButton;
@ -33,7 +36,9 @@ namespace OpenDiablo2.Scenes
IGameState gameState,
IKeyboardInfoProvider keyboardInfoProvider,
Func<eButtonType, IButton> createButton,
Func<IMiniPanel> createMiniPanel
Func<IMiniPanel> createMiniPanel,
Func<ICharacterPanel> createCharacterPanel,
Func<IInventoryPanel> createInventoryPanel
)
{
this.renderWindow = renderWindow;
@ -51,6 +56,9 @@ namespace OpenDiablo2.Scenes
// Maybe? Not sure.
// miniPanel.OnMenuActivate();
characterpanel = createCharacterPanel();
inventorypanel = createInventoryPanel();
runButton = createButton(eButtonType.Run);
runButton.Location = new Point(256, 570);
runButton.OnToggle = OnRunToggle;
@ -86,6 +94,16 @@ namespace OpenDiablo2.Scenes
private void DrawPanel()
{
if(gameState.ShowInventoryPanel)
{
inventorypanel.Render();
}
if (gameState.ShowCharacterPanel)
{
characterpanel.Render();
}
// Render the background bottom bar
renderWindow.Draw(panelSprite, 0, new Point(0, 600));
renderWindow.Draw(panelSprite, 1, new Point(166, 600));
@ -106,6 +124,8 @@ namespace OpenDiablo2.Scenes
{
minipanel.Render();
}
runButton.Render();
menuButton.Render();
@ -117,7 +137,9 @@ namespace OpenDiablo2.Scenes
{
minipanel.Update();
}
characterpanel.Update();
runButton.Update();
menuButton.Update();

View File

@ -68,6 +68,12 @@ namespace OpenDiablo2
return (buttonType) => componentContext.Resolve<IButton>(new NamedParameter("buttonLayout", ButtonLayout.Values[buttonType]));
});
containerBuilder.Register<Func<ePanelFrameType, IPanelFrame>>(c =>
{
var componentContext = c.Resolve<IComponentContext>();
return (panelFrameType) => componentContext.Resolve<IPanelFrame>(new NamedParameter("panelFrameType", panelFrameType));
});
/* Uncomment the below if we support multiple textbox types
containerBuilder.Register<Func<TextBox>>(c =>
{