2018-11-28 22:25:08 -05:00
|
|
|
using System;
|
|
|
|
using System.Drawing;
|
|
|
|
using OpenDiablo2.Common;
|
|
|
|
using OpenDiablo2.Common.Attributes;
|
|
|
|
using OpenDiablo2.Common.Enums;
|
|
|
|
using OpenDiablo2.Common.Interfaces;
|
|
|
|
|
|
|
|
namespace OpenDiablo2.Scenes
|
|
|
|
{
|
2018-12-08 09:12:40 -05:00
|
|
|
[Scene(eSceneType.SelectCharacter)]
|
2018-11-28 22:25:08 -05:00
|
|
|
public sealed class CharacterSelection : IScene
|
|
|
|
{
|
|
|
|
private readonly IRenderWindow renderWindow;
|
|
|
|
private readonly ISprite backgroundSprite;
|
|
|
|
private readonly IButton createNewCharacterButton, deleteCharacterButton, exitButton, okButton;
|
|
|
|
|
|
|
|
public CharacterSelection(IRenderWindow renderWindow,
|
|
|
|
ISceneManager sceneManager, ITextDictionary textDictionary, Func<eButtonType, IButton> createButton)
|
|
|
|
{
|
|
|
|
this.renderWindow = renderWindow;
|
|
|
|
|
|
|
|
backgroundSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectionBackground, Palettes.Sky);
|
|
|
|
createNewCharacterButton = createButton(eButtonType.Tall);
|
|
|
|
// TODO: use strCreateNewCharacter -- need to get the text to split after 10 chars though.
|
2018-11-28 23:03:32 -05:00
|
|
|
createNewCharacterButton.Text = textDictionary.Translate("strCreateNewCharacter");// "Create New".ToUpper();
|
2018-11-28 22:25:08 -05:00
|
|
|
createNewCharacterButton.Location = new Point(33, 467);
|
2018-12-08 09:12:40 -05:00
|
|
|
createNewCharacterButton.OnActivate = () => sceneManager.ChangeScene(eSceneType.SelectHeroClass);
|
2018-11-28 22:25:08 -05:00
|
|
|
|
|
|
|
deleteCharacterButton = createButton(eButtonType.Tall);
|
|
|
|
deleteCharacterButton.Text = textDictionary.Translate("strDelete");
|
|
|
|
deleteCharacterButton.Location = new Point(433, 467);
|
|
|
|
|
|
|
|
exitButton = createButton(eButtonType.Medium);
|
|
|
|
exitButton.Text = textDictionary.Translate("strExit");
|
|
|
|
exitButton.Location = new Point(33, 540);
|
2018-12-08 09:12:40 -05:00
|
|
|
exitButton.OnActivate = () => sceneManager.ChangeScene(eSceneType.MainMenu);
|
2018-11-28 22:25:08 -05:00
|
|
|
|
|
|
|
okButton = createButton(eButtonType.Medium);
|
|
|
|
okButton.Text = textDictionary.Translate("strOk");
|
|
|
|
okButton.Location = new Point(630, 540);
|
|
|
|
okButton.Enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Update(long ms)
|
|
|
|
{
|
|
|
|
createNewCharacterButton.Update();
|
|
|
|
deleteCharacterButton.Update();
|
|
|
|
exitButton.Update();
|
|
|
|
okButton.Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Render()
|
|
|
|
{
|
|
|
|
renderWindow.Draw(backgroundSprite, 4, 3, 0);
|
|
|
|
|
|
|
|
createNewCharacterButton.Render();
|
|
|
|
deleteCharacterButton.Render();
|
|
|
|
exitButton.Render();
|
|
|
|
okButton.Render();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
backgroundSprite.Dispose();
|
|
|
|
createNewCharacterButton.Dispose();
|
|
|
|
deleteCharacterButton.Dispose();
|
|
|
|
exitButton.Dispose();
|
|
|
|
okButton.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|