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

Lots of minor code cleanup.

This commit is contained in:
Tim Sarbin 2018-12-08 09:32:09 -05:00
parent ebfcf5cf26
commit bd6c5a7e0f
40 changed files with 420 additions and 338 deletions

View File

@ -8,7 +8,7 @@ namespace OpenDiablo2.Common.Models
/// </summary>
internal class BitStream
{
private Stream _baseStream;
private readonly Stream _baseStream;
private int _current;
private int _bitCount;

View File

@ -1,17 +1,16 @@
using OpenDiablo2.Common.Enums;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Models
{
public sealed class MPQ : IDisposable
{
private const string HEADER_SIGNATURE = "MPQ\x1A";
private const string USERDATA_SIGNATURE = "MPQ\x1B";
//private const string USERDATA_SIGNATURE = "MPQ\x1B";
private const string LISTFILE_NAME = "(listfile)";
private const int MPQ_HASH_FILE_KEY = 3;
private const int MPQ_HASH_TABLE_OFFSET = 0;
@ -34,7 +33,9 @@ namespace OpenDiablo2.Common.Models
}
[Flags]
#pragma warning disable IDE1006 // Naming Styles
internal enum eBlockRecordFlags : UInt32
#pragma warning restore IDE1006 // Naming Styles
{
IsFile = 0x80000000, // Block is a file, and follows the file data format; otherwise, block is free space or unused. If the block is not a file, all other flags should be cleared, and FileSize should be 0.
SingleUnit = 0x01000000, // File is stored as a single unit, rather than split into sectors.
@ -72,8 +73,8 @@ namespace OpenDiablo2.Common.Models
internal static UInt32[] cryptTable = new UInt32[0x500];
internal HeaderRecord Header;
private List<BlockRecord> blockTable = new List<BlockRecord>();
private List<HashRecord> hashTable = new List<HashRecord>();
private readonly List<BlockRecord> blockTable = new List<BlockRecord>();
private readonly List<HashRecord> hashTable = new List<HashRecord>();
internal Stream fileStream;
public UInt16 LanguageId = 0;
@ -85,7 +86,7 @@ namespace OpenDiablo2.Common.Models
private List<string> GetFilePaths()
{
using (var stream = OpenFile("(listfile)"))
using (var stream = OpenFile(LISTFILE_NAME))
{
if (stream == null)
{
@ -346,13 +347,10 @@ namespace OpenDiablo2.Common.Models
public MPQStream OpenFile(string filename)
{
HashRecord hash;
BlockRecord block;
if (!GetHashRecord(filename, out hash))
if (!GetHashRecord(filename, out HashRecord hash))
throw new FileNotFoundException("File not found: " + filename);
block = blockTable[(int)hash.FileBlockIndex];
BlockRecord block = blockTable[(int)hash.FileBlockIndex];
block.FileName = filename.ToLower();
block.EncryptionSeed = CalculateEncryptionSeed(block);
return new MPQStream(this, block);

View File

@ -55,10 +55,12 @@ namespace OpenDiablo2.Common.Models
var layers = new List<COFLayer>();
for (var layerIdx = 0; layerIdx < numLayers; layerIdx++)
{
var layer = new COFLayer();
layer.COF = result;
layer.CompositType = (eCompositType)br.ReadByte();
layer.Shadow = br.ReadByte();
var layer = new COFLayer
{
COF = result,
CompositType = (eCompositType)br.ReadByte(),
Shadow = br.ReadByte()
};
br.ReadByte(); // Unknown
layer.IsTransparent = br.ReadByte() != 0;
layer.DrawEffect = (eDrawEffect)br.ReadByte();

View File

@ -45,7 +45,7 @@ namespace OpenDiablo2.Common.Models
public Int32 X2 { get; private set; }
public Int32 NumberOfTiles { get; private set; }
public MPQDT1Tile[] Tiles { get; private set; }
private Int32 tileHeaderOffset;
private readonly Int32 tileHeaderOffset;
public MPQDT1(Stream stream)
{

View File

@ -297,8 +297,10 @@ namespace OpenDiablo2.Common.Models
LinkedNode child1 = current.Prev;
if (child1 == null) break;
LinkedNode parent = new LinkedNode(0, child0.Weight + child1.Weight);
parent.Child0 = child0;
LinkedNode parent = new LinkedNode(0, child0.Weight + child1.Weight)
{
Child0 = child0
};
child0.Parent = parent;
child1.Parent = parent;
@ -313,11 +315,15 @@ namespace OpenDiablo2.Common.Models
LinkedNode parent = tail;
LinkedNode result = tail.Prev; // This will be the new tail after the tree is updated
LinkedNode temp = new LinkedNode(parent.DecompressedValue, parent.Weight);
temp.Parent = parent;
LinkedNode temp = new LinkedNode(parent.DecompressedValue, parent.Weight)
{
Parent = parent
};
LinkedNode newnode = new LinkedNode(decomp, 0);
newnode.Parent = parent;
LinkedNode newnode = new LinkedNode(decomp, 0)
{
Parent = parent
};
parent.Child0 = newnode;

View File

@ -18,7 +18,7 @@ namespace OpenDiablo2.Common.Models
private long position;
private byte[] _currentData;
private int _currentBlockIndex = -1;
private int blockSize;
private readonly int blockSize;
internal MPQStream(MPQ mpq, BlockRecord blockRecord)
{

View File

@ -10,7 +10,7 @@ namespace OpenDiablo2.Common.Models.Mobs
{
public class LevelExperienceConfig : ILevelExperienceConfig
{
private List<long> ExperiencePerLevel = new List<long>();
private readonly List<long> ExperiencePerLevel = new List<long>();
public LevelExperienceConfig(List<long> expperlevel)
{
@ -42,8 +42,7 @@ namespace OpenDiablo2.Common.Models.Mobs
// i starts at 1 because we want to skip the first column
// the first column is just the row titles
string heroname = data[i][0]; // first row is the hero name
eHero herotype = default(eHero);
if(!Enum.TryParse<eHero>(heroname, out herotype))
if (!Enum.TryParse<eHero>(heroname, out eHero herotype))
{
continue; // skip this hero if we can't parse the name into a valid hero type
}
@ -56,8 +55,7 @@ namespace OpenDiablo2.Common.Models.Mobs
List<long> expperlevel = new List<long>();
for (int o = 2; o < data.Length && (o-2 < maxlevel || maxlevel == -1); o++)
{
long exp = 0;
if(!long.TryParse(data[o][i], out exp))
if (!long.TryParse(data[o][i], out long exp))
{
throw new Exception("Could not parse experience number '" + data[o][i] + "'.");
}

View File

@ -9,8 +9,8 @@ namespace OpenDiablo2.Common.Models.Mobs
{
public Guid UID { get; protected set; } = Guid.NewGuid();
public eHero HeroType { get; protected set; }
private IHeroTypeConfig HeroTypeConfig;
private ILevelExperienceConfig ExperienceConfig;
private readonly IHeroTypeConfig HeroTypeConfig;
private readonly ILevelExperienceConfig ExperienceConfig;
public int ClientHash { get; protected set; }
public byte MovementDirection { get; set; } = 0;
public eMovementType MovementType { get; set; } = eMovementType.Stopped; // TODO: This needs to mess with MobMode somehow

View File

@ -41,12 +41,12 @@ namespace OpenDiablo2.Common.Models
/// </summary>
public class PKLibDecompress
{
private BitStream _bitstream;
private CompressionType _compressionType;
private int _dictSizeBits; // Dictionary size in bits
private readonly BitStream _bitstream;
private readonly CompressionType _compressionType;
private readonly int _dictSizeBits; // Dictionary size in bits
private static byte[] sPosition1;
private static byte[] sPosition2;
private static readonly byte[] sPosition1;
private static readonly byte[] sPosition2;
private static readonly byte[] sLenBits =
{

View File

@ -33,11 +33,13 @@ namespace OpenDiablo2.Common.Models
public static PlayerInfo FromBytes(byte[] data, int offset = 0)
{
var result = new PlayerInfo();
result.Hero = (eHero)data[offset];
result.WeaponClass= (eWeaponClass)data[offset + 1];
result.ArmorType = (eArmorType)data[offset + 2];
result.MobMode = (eMobMode)data[offset + 3];
var result = new PlayerInfo
{
Hero = (eHero)data[offset],
WeaponClass = (eWeaponClass)data[offset + 1],
ArmorType = (eArmorType)data[offset + 2],
MobMode = (eMobMode)data[offset + 3]
};
var nameLength = BitConverter.ToInt32(data, offset + 4);
result.Name = Encoding.UTF8.GetString(data, offset + 8, nameLength);
result.LocationDetails = PlayerLocationDetails.FromBytes(data, offset + 8 + nameLength);

View File

@ -14,7 +14,6 @@ namespace OpenDiablo2.Core
{
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly GlobalConfiguration globalConfig;
private readonly IMPQProvider mpqProvider;
private readonly Func<IRenderWindow> getRenderWindow;
private readonly Func<eSceneType, IScene> getScene;
@ -27,11 +26,10 @@ namespace OpenDiablo2.Core
private readonly MPQ[] MPQs;
private Dictionary<string, SoundEntry> soundTable = new Dictionary<string, SoundEntry>();
private readonly Dictionary<string, SoundEntry> soundTable = new Dictionary<string, SoundEntry>();
public Dictionary<string, Palette> PaletteTable { get; private set; } = new Dictionary<string, Palette>();
public GameEngine(
GlobalConfiguration globalConfig,
IMPQProvider mpqProvider,
Func<IRenderWindow> getRenderWindow,
Func<eSceneType, IScene> getScene,
@ -39,7 +37,6 @@ namespace OpenDiablo2.Core
Func<IGameState> getGameState
)
{
this.globalConfig = globalConfig;
this.mpqProvider = mpqProvider;
this.getRenderWindow = getRenderWindow;
this.getScene = getScene;

View File

@ -24,7 +24,7 @@ namespace OpenDiablo2.Core.GameState_
private float animationTime = 0f;
private List<MapInfo> mapInfo;
private List<MapCellInfo> mapDataLookup = new List<MapCellInfo>();
private readonly List<MapCellInfo> mapDataLookup = new List<MapCellInfo>();
private ISessionManager sessionManager;
public int Act { get; private set; }

View File

@ -15,7 +15,7 @@ namespace OpenDiablo2.Core.GameState_
IEnumerable<PlayerState> IMobManager.Players => Players;
IEnumerable<EnemyState> IMobManager.Enemies => Enemies;
private HashSet<int> IdsUsed = new HashSet<int>();
private readonly HashSet<int> IdsUsed = new HashSet<int>();
#region Player Controls
public void AddPlayer(PlayerState player)

View File

@ -11,7 +11,7 @@ namespace OpenDiablo2.Core
{
public sealed class ItemManager : IItemManager
{
private IEngineDataManager engineDataManager;
private readonly IEngineDataManager engineDataManager;
public ItemManager(IEngineDataManager engineDataManager)
{

View File

@ -11,18 +11,13 @@ namespace OpenDiablo2.Core
{
public sealed class MPQProvider : IMPQProvider
{
private readonly GlobalConfiguration globalConfiguration;
private readonly MPQ[] mpqs;
private Dictionary<string, int> mpqLookup = new Dictionary<string, int>();
private readonly Dictionary<string, int> mpqLookup = new Dictionary<string, int>();
public MPQProvider(GlobalConfiguration globalConfiguration)
{
this.globalConfiguration = globalConfiguration;
// TODO: Make this less dumb. We need to an external file to configure mpq load order.
var mpqsToLoad = new string[]
{
};
this.mpqs = Directory
.EnumerateFiles(globalConfiguration.BaseDataPath, "*.mpq")
.Where(x => !Path.GetFileName(x).StartsWith("patch"))

View File

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Interfaces.Drawing;
@ -14,10 +13,8 @@ namespace OpenDiablo2.Core.Map_Engine
{
private readonly IGameState gameState;
private readonly IRenderWindow renderWindow;
private readonly IResourceManager resourceManager;
private readonly ISessionManager sessionManager;
private List<ICharacterRenderer> characterRenderers = new List<ICharacterRenderer>();
private readonly List<ICharacterRenderer> characterRenderers = new List<ICharacterRenderer>();
public int FocusedPlayerId { get; set; } = 0;
@ -31,33 +28,24 @@ namespace OpenDiablo2.Core.Map_Engine
return;
cameraLocation = value;
cOffX = (int)((cameraLocation.X - cameraLocation.Y) * (cellSizeX / 2));
cOffY = (int)((cameraLocation.X + cameraLocation.Y) * (cellSizeY / 2));
//cOffX = (int)((cameraLocation.X - cameraLocation.Y) * (cellSizeX / 2));
//cOffY = (int)((cameraLocation.X + cameraLocation.Y) * (cellSizeY / 2));
}
}
private ISprite loadingSprite;
private int cOffX, cOffY;
private const int
cellSizeX = 160,
cellSizeY = 80,
renderCellsX = (800 / cellSizeX),
renderCellsY = (600 / cellSizeY);
cellSizeY = 80;
public MapEngine(
IGameState gameState,
IRenderWindow renderWindow,
IResourceManager resourceManager,
ISessionManager sessionManager
)
{
this.gameState = gameState;
this.renderWindow = renderWindow;
this.resourceManager = resourceManager;
this.sessionManager = sessionManager;
loadingSprite = renderWindow.LoadSprite(ResourcePaths.LoadingScreen, Palettes.Loading, new Point(300, 400));
sessionManager.OnPlayerInfo += OnPlayerInfo;
sessionManager.OnLocatePlayers += OnLocatePlayers;
}

View File

@ -15,11 +15,11 @@ namespace OpenDiablo2.Core
private readonly IMPQProvider mpqProvider;
private readonly IEngineDataManager engineDataManager;
private Dictionary<string, ImageSet> ImageSets = new Dictionary<string, ImageSet>();
private Dictionary<string, MPQFont> MPQFonts = new Dictionary<string, MPQFont>();
private Dictionary<string, Palette> Palettes = new Dictionary<string, Palette>();
private Dictionary<string, MPQDT1> DTs = new Dictionary<string, MPQDT1>();
private Dictionary<string, MPQCOF> PlayerCOFs = new Dictionary<string, MPQCOF>();
private readonly Dictionary<string, ImageSet> ImageSets = new Dictionary<string, ImageSet>();
private readonly Dictionary<string, MPQFont> MPQFonts = new Dictionary<string, MPQFont>();
private readonly Dictionary<string, Palette> Palettes = new Dictionary<string, Palette>();
private readonly Dictionary<string, MPQDT1> DTs = new Dictionary<string, MPQDT1>();
private readonly Dictionary<string, MPQCOF> PlayerCOFs = new Dictionary<string, MPQCOF>();
public Dictionary<string, List<AnimationData>> Animations { get; private set; } = new Dictionary<string, List<AnimationData>>();

View File

@ -23,7 +23,7 @@ namespace OpenDiablo2.Core
{
private readonly IMPQProvider mpqProvider;
private Dictionary<string, string> lookupTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> lookupTable = new Dictionary<string, string>();
public TextDictionary(IMPQProvider mpqProvider)
{

View File

@ -32,10 +32,11 @@ namespace OpenDiablo2.Core.UI
}
}
private int buttonWidth, buttonHeight;
private ISprite sprite;
private IFont font;
private ILabel label;
private readonly int buttonWidth;
private readonly int buttonHeight;
private readonly ISprite sprite;
private readonly IFont font;
private readonly ILabel label;
private bool pressed = false;
private bool active = false; // When true, button is actively being focus pressed
private bool activeLock = false; // When true, we have locked the mouse from everything else

View File

@ -9,7 +9,7 @@ namespace OpenDiablo2.Core.UI
public sealed class CharacterPanel : ICharacterPanel
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private readonly ISprite sprite;
public Point Location { get; set; }

View File

@ -13,7 +13,7 @@ namespace OpenDiablo2.Core.UI
public sealed class InventoryPanel : IInventoryPanel
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private readonly ISprite sprite;
private Point location;
public Point Location {
@ -30,9 +30,9 @@ namespace OpenDiablo2.Core.UI
// Test vars
public IItemContainer helmContainer, armorContainer, weaponLeftContainer, weaponRightContainer, beltContainer, gloveContainer, bootsContainer;
private Point previouslyContainedItem;
private IItemContainer ringtLeftContainer;
private IItemContainer ringtRightContainer;
private IItemContainer amuletContainer;
private readonly IItemContainer ringtLeftContainer;
private readonly IItemContainer ringtRightContainer;
private readonly IItemContainer amuletContainer;
public InventoryPanel(IRenderWindow renderWindow, IItemManager itemManager, Func<eItemContainerType, IItemContainer> createItemContainer)
{

View File

@ -1,115 +1,114 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Core.UI
{
// TODO: Self-align when side panels are open
public sealed class ItemContainer : IItemContainer
{
private readonly IRenderWindow renderWindow;
private readonly IGameState gameState;
private ISprite sprite;
private ItemContainerLayout itemContainerLayout;
private IMouseInfoProvider mouseInfoProvider;
public Item ContainedItem { get; internal set; }
private Dictionary<eItemContainerType, ISprite> sprites = new Dictionary<eItemContainerType, ISprite>();
private Point location = new Point();
public Point Location
{
get => location;
set
{
if (location == value)
return;
location = value;
placeholderSprite.Location = new Point(value.X, value.Y + placeholderSprite.LocalFrameSize.Height);
}
}
private ISprite placeholderSprite;
public Size Size { get; internal set; }
public ItemContainer(IRenderWindow renderWindow, IGameState gameState, ItemContainerLayout itemContainerLayout, IMouseInfoProvider mouseInfoProvider)
{
this.renderWindow = renderWindow;
this.gameState = gameState;
this.itemContainerLayout = itemContainerLayout;
this.mouseInfoProvider = mouseInfoProvider;
placeholderSprite = renderWindow.LoadSprite(itemContainerLayout.ResourceName, itemContainerLayout.PaletteName);
placeholderSprite.Location = new Point(location.X, location.Y + placeholderSprite.LocalFrameSize.Height);
this.Size = placeholderSprite.FrameSize; // For all but generic size is equal to the placeholder size. Source: me.
}
public void SetContainedItem(Item containedItem)
{
ContainedItem = containedItem;
if (ContainedItem != null)
{
sprite = renderWindow.LoadSprite(ResourcePaths.GeneratePathForItem(this.ContainedItem.InvFile), Palettes.Units);
sprite.Location = new Point(location.X, location.Y + sprite.LocalFrameSize.Height);
}
}
public void Update()
{
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Core.UI
{
// TODO: Self-align when side panels are open
public sealed class ItemContainer : IItemContainer
{
private readonly IRenderWindow renderWindow;
private readonly IGameState gameState;
private ISprite sprite;
private readonly ItemContainerLayout itemContainerLayout;
private readonly IMouseInfoProvider mouseInfoProvider;
public Item ContainedItem { get; internal set; }
private readonly Dictionary<eItemContainerType, ISprite> sprites = new Dictionary<eItemContainerType, ISprite>();
private Point location = new Point();
public Point Location
{
get => location;
set
{
if (location == value)
return;
location = value;
placeholderSprite.Location = new Point(value.X, value.Y + placeholderSprite.LocalFrameSize.Height);
}
}
private readonly ISprite placeholderSprite;
public Size Size { get; internal set; }
public ItemContainer(IRenderWindow renderWindow, IGameState gameState, ItemContainerLayout itemContainerLayout, IMouseInfoProvider mouseInfoProvider)
{
this.renderWindow = renderWindow;
this.gameState = gameState;
this.itemContainerLayout = itemContainerLayout;
this.mouseInfoProvider = mouseInfoProvider;
placeholderSprite = renderWindow.LoadSprite(itemContainerLayout.ResourceName, itemContainerLayout.PaletteName);
placeholderSprite.Location = new Point(location.X, location.Y + placeholderSprite.LocalFrameSize.Height);
this.Size = placeholderSprite.FrameSize; // For all but generic size is equal to the placeholder size. Source: me.
}
public void SetContainedItem(Item containedItem)
{
ContainedItem = containedItem;
if (ContainedItem != null)
{
sprite = renderWindow.LoadSprite(ResourcePaths.GeneratePathForItem(this.ContainedItem.InvFile), Palettes.Units);
sprite.Location = new Point(location.X, location.Y + sprite.LocalFrameSize.Height);
}
}
public void Update()
{
var hovered = (mouseInfoProvider.MouseX >= location.X && mouseInfoProvider.MouseX < (location.X + this.Size.Width))
&& (mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + this.Size.Height));
if (hovered && mouseInfoProvider.LeftMousePressed)
{
// If there is an item contained, remove from container and send to mouse
if (this.ContainedItem != null)
{
if (this.gameState.SelectedItem != null)
{
var switchItem = this.gameState.SelectedItem;
this.gameState.SelectItem(this.ContainedItem);
this.SetContainedItem(switchItem);
} else
{
this.gameState.SelectItem(this.ContainedItem);
this.SetContainedItem(null);
}
}
else if (this.gameState.SelectedItem != null)
{
this.SetContainedItem(this.gameState.SelectedItem);
this.gameState.SelectItem(null);
}
}
}
public void Render()
{
if (this.ContainedItem == null)
{
renderWindow.Draw(placeholderSprite, this.itemContainerLayout.BaseFrame);
}
else
{
renderWindow.Draw(sprite);
}
}
public void Dispose()
{
sprite.Dispose();
}
}
}
&& (mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + this.Size.Height));
if (hovered && mouseInfoProvider.LeftMousePressed)
{
// If there is an item contained, remove from container and send to mouse
if (this.ContainedItem != null)
{
if (this.gameState.SelectedItem != null)
{
var switchItem = this.gameState.SelectedItem;
this.gameState.SelectItem(this.ContainedItem);
this.SetContainedItem(switchItem);
} else
{
this.gameState.SelectItem(this.ContainedItem);
this.SetContainedItem(null);
}
}
else if (this.gameState.SelectedItem != null)
{
this.SetContainedItem(this.gameState.SelectedItem);
this.gameState.SelectItem(null);
}
}
}
public void Render()
{
if (this.ContainedItem == null)
{
renderWindow.Draw(placeholderSprite, this.itemContainerLayout.BaseFrame);
}
else
{
renderWindow.Draw(sprite);
}
}
public void Dispose()
{
sprite.Dispose();
}
}
}

View File

@ -9,8 +9,8 @@ namespace OpenDiablo2.Core.UI
public sealed class PanelFrame : IPanelFrame
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private ePanelFrameType panelFrameType;
private readonly ISprite sprite;
private readonly ePanelFrameType panelFrameType;
public Point Location { get; set; }

View File

@ -12,9 +12,9 @@ namespace OpenDiablo2.Core.UI
public sealed class TextBox : ITextBox
{
private readonly IRenderWindow renderWindow;
private ISprite sprite;
private IFont font;
private ILabel label, linebar;
private readonly ISprite sprite;
private readonly IFont font;
private readonly ILabel label, linebar;
private float frameTime = 0f;
private Point location = new Point();

View File

@ -3665,9 +3665,9 @@ namespace SDL2
public UInt32 timestamp;
public UInt32 display;
public SDL_DisplayEventID displayEvent; // event, lolC#
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int32 data1;
}
#pragma warning restore 0169
@ -3682,9 +3682,9 @@ namespace SDL2
public UInt32 timestamp;
public UInt32 windowID;
public SDL_WindowEventID windowEvent; // event, lolC#
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int32 data1;
public Int32 data2;
}
@ -3701,8 +3701,8 @@ namespace SDL2
public UInt32 windowID;
public byte state;
public byte repeat; /* non-zero if this is a repeat */
private byte padding2;
private byte padding3;
private readonly byte padding2;
private readonly byte padding3;
public SDL_Keysym keysym;
}
#pragma warning restore 0169
@ -3738,9 +3738,9 @@ namespace SDL2
public UInt32 windowID;
public UInt32 which;
public byte state; /* bitmask of buttons */
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int32 x;
public Int32 y;
public Int32 xrel;
@ -3761,7 +3761,7 @@ namespace SDL2
public byte button; /* button id */
public byte state; /* SDL_PRESSED or SDL_RELEASED */
public byte clicks; /* 1 for single-click, 2 for double-click, etc. */
private byte padding1;
private readonly byte padding1;
public Int32 x;
public Int32 y;
}
@ -3790,9 +3790,9 @@ namespace SDL2
public UInt32 timestamp;
public Int32 which; /* SDL_JoystickID */
public byte axis;
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int16 axisValue; /* value, lolC# */
public UInt16 padding4;
}
@ -3808,9 +3808,9 @@ namespace SDL2
public UInt32 timestamp;
public Int32 which; /* SDL_JoystickID */
public byte ball;
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int16 xrel;
public Int16 yrel;
}
@ -3827,8 +3827,8 @@ namespace SDL2
public Int32 which; /* SDL_JoystickID */
public byte hat; /* index of the hat */
public byte hatValue; /* value, lolC# */
private byte padding1;
private byte padding2;
private readonly byte padding1;
private readonly byte padding2;
}
#pragma warning restore 0169
@ -3843,8 +3843,8 @@ namespace SDL2
public Int32 which; /* SDL_JoystickID */
public byte button;
public byte state; /* SDL_PRESSED or SDL_RELEASED */
private byte padding1;
private byte padding2;
private readonly byte padding1;
private readonly byte padding2;
}
#pragma warning restore 0169
@ -3867,11 +3867,11 @@ namespace SDL2
public UInt32 timestamp;
public Int32 which; /* SDL_JoystickID */
public byte axis;
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
public Int16 axisValue; /* value, lolC# */
private UInt16 padding4;
private readonly UInt16 padding4;
}
#pragma warning restore 0169
@ -3886,8 +3886,8 @@ namespace SDL2
public Int32 which; /* SDL_JoystickID */
public byte button;
public byte state;
private byte padding1;
private byte padding2;
private readonly byte padding1;
private readonly byte padding2;
}
#pragma warning restore 0169
@ -3912,9 +3912,9 @@ namespace SDL2
public UInt32 timestamp;
public UInt32 which;
public byte iscapture;
private byte padding1;
private byte padding2;
private byte padding3;
private readonly byte padding1;
private readonly byte padding2;
private readonly byte padding3;
}
#pragma warning restore 0169
@ -5626,9 +5626,11 @@ namespace SDL2
gamecontroller,
axis
);
SDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind();
result.bindType = (SDL_GameControllerBindType) dumb.bindType;
result.value.hat.hat = dumb.unionVal0;
SDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind
{
bindType = (SDL_GameControllerBindType)dumb.bindType
};
result.value.hat.hat = dumb.unionVal0;
result.value.hat.hat_mask = dumb.unionVal1;
return result;
}
@ -5679,9 +5681,11 @@ namespace SDL2
gamecontroller,
button
);
SDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind();
result.bindType = (SDL_GameControllerBindType) dumb.bindType;
result.value.hat.hat = dumb.unionVal0;
SDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind
{
bindType = (SDL_GameControllerBindType)dumb.bindType
};
result.value.hat.hat = dumb.unionVal0;
result.value.hat.hat_mask = dumb.unionVal1;
return result;
}

View File

@ -1,6 +1,21 @@
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.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenDiablo2.Common;
using OpenDiablo2.Common.Enums;
@ -34,9 +49,9 @@ namespace OpenDiablo2.SDL2_
public eArmorType ArmorType { get; set; }
public eMobMode MobMode { get; set; }
private IntPtr renderer;
private readonly IntPtr renderer;
private List<DirectionCacheItem> directionCache = new List<DirectionCacheItem>();
private readonly List<DirectionCacheItem> directionCache = new List<DirectionCacheItem>();
DirectionCacheItem currentDirectionCache;
private float seconds;
@ -172,10 +187,8 @@ namespace OpenDiablo2.SDL2_
for (var frameIndex = 0; frameIndex < cache.FramesToAnimate; frameIndex++)
{
var texture = SDL.SDL_CreateTexture(renderer, SDL.SDL_PIXELFORMAT_ARGB8888, (int)SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING, frameW, frameH);
IntPtr pixels;
int pitch;
SDL.SDL_LockTexture(texture, IntPtr.Zero, out pixels, out pitch);
SDL.SDL_LockTexture(texture, IntPtr.Zero, out IntPtr pixels, out int pitch);
UInt32* data = (UInt32*)pixels;
foreach (var layer in layerData)

View File

@ -1,4 +1,20 @@
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 System.Drawing;
using SDL2;
namespace OpenDiablo2.SDL2_

View File

@ -1,11 +1,23 @@
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Models;
/* 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.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.SDL2_
{

View File

@ -1,13 +1,26 @@
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using SDL2;
/* 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.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using SDL2;
namespace OpenDiablo2.SDL2_
{

View File

@ -1,7 +1,22 @@
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.Interfaces;
using SDL2;
namespace OpenDiablo2.SDL2_
{

View File

@ -1,12 +1,23 @@
using OpenDiablo2.Common.Interfaces;
using SDL2;
/* 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.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using OpenDiablo2.Common.Interfaces;
using SDL2;
namespace OpenDiablo2.SDL2_
{

View File

@ -1,4 +1,20 @@
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 System.Linq;
using System.Runtime.InteropServices;
@ -13,8 +29,8 @@ namespace OpenDiablo2.SDL2_
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private IntPtr window, renderer;
private bool fullscreen;
private readonly IntPtr window, renderer;
private readonly bool fullscreen;
public bool IsRunning { get; private set; }
@ -97,8 +113,7 @@ namespace OpenDiablo2.SDL2_
public unsafe bool KeyIsPressed(int scancode)
{
int numKeys;
byte* keys = (byte*)SDL.SDL_GetKeyboardState(out numKeys);
byte* keys = (byte*)SDL.SDL_GetKeyboardState(out int numKeys);
return keys[scancode] > 0;
}

View File

@ -1,8 +1,22 @@
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 System.Linq;
using System.Runtime.InteropServices;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Models;
using SDL2;
@ -108,13 +122,10 @@ namespace OpenDiablo2.SDL2_
private unsafe void LoadFrame(int index)
{
var frame = source.Frames[index];
IntPtr pixels;
int pitch;
var fullRect = new SDL.SDL_Rect { x = 0, y = 0, w = FrameSize.Width, h = FrameSize.Height };
SDL.SDL_SetTextureBlendMode(texture, blend ? SDL.SDL_BlendMode.SDL_BLENDMODE_ADD : SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND);
SDL.SDL_LockTexture(texture, IntPtr.Zero, out pixels, out pitch);
SDL.SDL_LockTexture(texture, IntPtr.Zero, out IntPtr pixels, out int pitch);
try
{
UInt32* data = (UInt32*)pixels;

View File

@ -1,4 +1,20 @@
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 OpenDiablo2.Common.Interfaces;
namespace OpenDiablo2.SDL2_

View File

@ -10,11 +10,7 @@ namespace OpenDiablo2.Scenes
[Scene(eSceneType.SelectCharacter)]
public sealed class CharacterSelection : IScene
{
static readonly log4net.ILog log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly IRenderWindow renderWindow;
private readonly ISprite backgroundSprite;
private readonly IButton createNewCharacterButton, deleteCharacterButton, exitButton, okButton;

View File

@ -13,7 +13,6 @@ namespace OpenDiablo2.Scenes
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;
private readonly IMouseInfoProvider mouseInfoProvider;
private readonly IGameState gameState;
@ -22,11 +21,11 @@ namespace OpenDiablo2.Scenes
//private ISprite[] testSprite;
private ISprite panelSprite, healthManaSprite, gameGlobeOverlapSprite;
private readonly ISprite panelSprite, healthManaSprite, gameGlobeOverlapSprite;
private readonly IMiniPanel minipanel;
private IButton runButton, menuButton;
private readonly IButton runButton, menuButton;
private eMovementType lastMovementType = eMovementType.Stopped;
private byte lastDirection = 255;
@ -34,7 +33,6 @@ namespace OpenDiablo2.Scenes
public Game(
IRenderWindow renderWindow,
IResourceManager resourceManager,
IMapEngine mapEngine,
IGameState gameState,
IMouseInfoProvider mouseInfoProvider,
@ -46,7 +44,6 @@ namespace OpenDiablo2.Scenes
)
{
this.renderWindow = renderWindow;
this.resourceManager = resourceManager;
this.mapEngine = mapEngine;
this.gameState = gameState;
this.mouseInfoProvider = mouseInfoProvider;
@ -69,10 +66,7 @@ namespace OpenDiablo2.Scenes
menuButton.Location = new Point(393, 561);
menuButton.OnToggle = minipanel.OnMenuToggle;
/*var item = itemManager.getItem("hdm");
var cursorsprite = renderWindow.LoadSprite(ResourcePaths.GeneratePathForItem(item.InvFile), Palettes.Units);
renderWindow.MouseCursor = renderWindow.LoadCursor(cursorsprite, 0, new Point(cursorsprite.FrameSize.Width/2, cursorsprite.FrameSize.Height / 2));*/
//var item = itemManager.getItem("hdm");
}
private void OnRunToggle(bool isToggled)

View File

@ -11,27 +11,17 @@ namespace OpenDiablo2.Scenes
[Scene(eSceneType.MainMenu)]
public class MainMenu : IScene
{
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly IRenderWindow renderWindow;
private readonly IPaletteProvider paletteProvider;
private readonly IMPQProvider mpqProvider;
private readonly IMouseInfoProvider mouseInfoProvider;
//private readonly IMusicProvider musicProvider;
private readonly ISceneManager sceneManager;
private float logoFrame;
private ISprite backgroundSprite, diabloLogoLeft, diabloLogoRight, diabloLogoLeftBlack, diabloLogoRightBlack;
private IFont labelFont;
private ILabel versionLabel, urlLabel;
private IButton btnSinglePlayer, btnExit, btnWebsite;
private readonly ISprite backgroundSprite, diabloLogoLeft, diabloLogoRight, diabloLogoLeftBlack, diabloLogoRightBlack;
private readonly IFont labelFont;
private readonly ILabel versionLabel, urlLabel;
private readonly IButton btnSinglePlayer, btnExit, btnWebsite;
public MainMenu(
IRenderWindow renderWindow,
IPaletteProvider paletteProvider,
IMPQProvider mpqProvider,
IMouseInfoProvider mouseInfoProvider,
//IMusicProvider musicProvider,
ISceneManager sceneManager,
IResourceManager resourceManager,
Func<eButtonType, IButton> createButton,
@ -39,10 +29,6 @@ namespace OpenDiablo2.Scenes
)
{
this.renderWindow = renderWindow;
this.paletteProvider = paletteProvider;
this.mpqProvider = mpqProvider;
this.mouseInfoProvider = mouseInfoProvider;
this.sceneManager = sceneManager;
backgroundSprite = renderWindow.LoadSprite(ResourcePaths.GameSelectScreen, Palettes.Sky);
diabloLogoLeft = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireLeft, Palettes.Units, new Point(400, 120));

View File

@ -31,11 +31,7 @@ namespace OpenDiablo2.Scenes
[Scene(eSceneType.SelectHeroClass)]
public sealed class SelectHeroClass : IScene
{
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly IRenderWindow renderWindow;
private readonly IPaletteProvider paletteProvider;
private readonly IMPQProvider mpqProvider;
private readonly IMouseInfoProvider mouseInfoProvider;
private readonly ISceneManager sceneManager;
private readonly ITextDictionary textDictionary;
@ -45,17 +41,17 @@ namespace OpenDiablo2.Scenes
private bool showEntryUi = false;
private eHero? selectedHero = null;
private float secondTimer;
private ISprite backgroundSprite, campfireSprite;
private IFont headingFont, heroDescFont, uiFont;
private ILabel headingLabel, heroClassLabel, heroDesc1Label, heroDesc2Label, heroDesc3Label, characterNameLabel;
private IButton exitButton, okButton;
private ITextBox characterNameTextBox;
private Dictionary<eHero, HeroRenderInfo> heroRenderInfo = new Dictionary<eHero, HeroRenderInfo>();
private readonly ISprite backgroundSprite, campfireSprite;
private readonly IFont headingFont;
private readonly IFont heroDescFont;
private readonly IFont uiFont;
private readonly ILabel headingLabel, heroClassLabel, heroDesc1Label, heroDesc2Label, heroDesc3Label, characterNameLabel;
private readonly IButton exitButton, okButton;
private readonly ITextBox characterNameTextBox;
private readonly Dictionary<eHero, HeroRenderInfo> heroRenderInfo = new Dictionary<eHero, HeroRenderInfo>();
public SelectHeroClass(
IRenderWindow renderWindow,
IPaletteProvider paletteProvider,
IMPQProvider mpqProvider,
IMouseInfoProvider mouseInfoProvider,
ISceneManager sceneManager,
Func<eButtonType, IButton> createButton,
@ -66,8 +62,6 @@ namespace OpenDiablo2.Scenes
)
{
this.renderWindow = renderWindow;
this.paletteProvider = paletteProvider;
this.mpqProvider = mpqProvider;
this.mouseInfoProvider = mouseInfoProvider;
this.sceneManager = sceneManager;
this.textDictionary = textDictionary;
@ -452,7 +446,7 @@ namespace OpenDiablo2.Scenes
}
private void setDescLabels(string descKey)
private void SetDescLabels(string descKey)
{
var heroDesc = textDictionary.Translate(descKey);
var parts = StringUtils.SplitIntoLinesWithMaxWidth(heroDesc, 37);
@ -470,15 +464,15 @@ namespace OpenDiablo2.Scenes
{
case eHero.Barbarian:
heroClassLabel.Text = textDictionary.Translate("strBarbarian");
setDescLabels("strBarbDesc");
SetDescLabels("strBarbDesc");
break;
case eHero.Necromancer:
heroClassLabel.Text = textDictionary.Translate("strNecromancer");
setDescLabels("strNecroDesc");
SetDescLabels("strNecroDesc");
break;
case eHero.Paladin:
heroClassLabel.Text = textDictionary.Translate("strPaladin");
setDescLabels("strPalDesc");
SetDescLabels("strPalDesc");
break;
case eHero.Assassin:
heroClassLabel.Text = textDictionary.Translate("strAssassin");
@ -488,11 +482,11 @@ namespace OpenDiablo2.Scenes
break;
case eHero.Sorceress:
heroClassLabel.Text = textDictionary.Translate("strSorceress");
setDescLabels("strSorcDesc");
SetDescLabels("strSorcDesc");
break;
case eHero.Amazon:
heroClassLabel.Text = textDictionary.Translate("strAmazon");
setDescLabels("strAmazonDesc");
SetDescLabels("strAmazonDesc");
break;
case eHero.Druid:
heroClassLabel.Text = textDictionary.Translate("strDruid");

View File

@ -38,7 +38,7 @@ namespace OpenDiablo2.ServiceBus
private readonly Func<IGameState> getGameState;
private RequestSocket requestSocket;
private AutoResetEvent resetEvent = new AutoResetEvent(false);
private readonly AutoResetEvent resetEvent = new AutoResetEvent(false);
private ISessionServer sessionServer;
private bool running = false;

View File

@ -36,7 +36,7 @@ namespace OpenDiablo2.ServiceBus
private readonly IGameServer gameServer;
private readonly Func<eMessageFrameType, IMessageFrame> getMessageFrame;
private AutoResetEvent resetEvent = new AutoResetEvent(false);
private readonly AutoResetEvent resetEvent = new AutoResetEvent(false);
public AutoResetEvent WaitServerStartEvent { get; set; } = new AutoResetEvent(false);
private bool running = false;
private ResponseSocket responseSocket;