public Credits( IRenderWindow renderWindow, ISceneManager sceneManager, IMPQProvider mpqProvider, Func <eButtonType, IButton> createButton ) { this.renderWindow = renderWindow; this.sceneManager = sceneManager; this.mpqProvider = mpqProvider; backgroundSprite = renderWindow.LoadSprite(ResourcePaths.CreditsBackground, Palettes.Sky); btnExit = createButton(eButtonType.Medium); btnExit.Text = "Exit".ToUpper(); btnExit.Location = new Point(20, 550); btnExit.OnActivate = OnActivateClicked; textFont = renderWindow.LoadFont(ResourcePaths.FontFormal10, Palettes.Static); creditsText = new Stack <string>(( File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs().First()), "credits.txt")) .Concat(mpqProvider.GetTextFile(ResourcePaths.CreditsText)) ).Reverse()); }
public MainMenu( IRenderWindow renderWindow, ISceneManager sceneManager, ITextDictionary textDictionary, IResourceManager resourceManager, ISoundProvider soundProvider, IMPQProvider mpqProvider, Func <eButtonType, IButton> createButton ) { this.renderWindow = renderWindow; this.sceneManager = sceneManager; backgroundSprite = renderWindow.LoadSprite(ResourcePaths.GameSelectScreen, Palettes.Sky); diabloLogoLeft = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireLeft, Palettes.Units, new Point(400, 120)); diabloLogoLeft.Blend = true; diabloLogoRight = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireRight, Palettes.Units, new Point(400, 120)); diabloLogoRight.Blend = true; diabloLogoLeftBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackLeft, Palettes.Units, new Point(400, 120)); diabloLogoRightBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackRight, Palettes.Units, new Point(400, 120)); btnSinglePlayer = createButton(eButtonType.Wide); btnSinglePlayer.Text = textDictionary.Translate("strStartMenu1"); btnSinglePlayer.Location = new Point(264, 290); btnSinglePlayer.OnActivate = OnSinglePlayerClicked; btnWebsite = createButton(eButtonType.Wide); btnWebsite.Text = "Visit Github".ToUpper(); btnWebsite.Location = new Point(264, 330); btnWebsite.OnActivate = OnVisitWebsiteClicked; btnExit = createButton(eButtonType.Wide); btnExit.Text = textDictionary.Translate("strexitentiregame"); btnExit.Location = new Point(264, 500); btnExit.OnActivate = OnExitClicked; btnCredits = createButton(eButtonType.Short); btnCredits.Text = textDictionary.Translate("strGameCredits"); /* TODO: We apparently need a 'half font' option... */ btnCredits.Location = new Point(264, 470); btnCredits.OnActivate = OnCreditsClicked; labelFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Static); versionLabel = renderWindow.CreateLabel(labelFont, new Point(50, 555), "v0.02 Pre-Alpha"); urlLabel = renderWindow.CreateLabel(labelFont, new Point(50, 569), "https://github.com/essial/OpenDiablo2/"); urlLabel.TextColor = Color.Magenta; soundProvider.LoadSong(mpqProvider.GetStream(ResourcePaths.BGMTitle)); soundProvider.PlaySong(); }
public MainMenu( IRenderWindow renderWindow, ISceneManager sceneManager, IResourceManager resourceManager, ISoundProvider soundProvider, IMPQProvider mpqProvider, Func <eButtonType, IButton> createButton, Func <eSceneType, IScene> getScene // Temporary until SDL load functions are sped up ) { this.renderWindow = renderWindow; this.sceneManager = sceneManager; backgroundSprite = renderWindow.LoadSprite(ResourcePaths.GameSelectScreen, Palettes.Sky); diabloLogoLeft = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireLeft, Palettes.Units, new Point(400, 120)); diabloLogoLeft.Blend = true; diabloLogoRight = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireRight, Palettes.Units, new Point(400, 120)); diabloLogoRight.Blend = true; diabloLogoLeftBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackLeft, Palettes.Units, new Point(400, 120)); diabloLogoRightBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackRight, Palettes.Units, new Point(400, 120)); btnSinglePlayer = createButton(eButtonType.Wide); btnSinglePlayer.Text = "Single Player".ToUpper(); btnSinglePlayer.Location = new Point(264, 290); btnSinglePlayer.OnActivate = OnSinglePlayerClicked; btnWebsite = createButton(eButtonType.Wide); btnWebsite.Text = "Visit Github".ToUpper(); btnWebsite.Location = new Point(264, 460); btnWebsite.OnActivate = OnVisitWebsiteClicked; btnExit = createButton(eButtonType.Wide); btnExit.Text = "Exit Diablo II".ToUpper(); btnExit.Location = new Point(264, 500); btnExit.OnActivate = OnExitClicked; labelFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Static); versionLabel = renderWindow.CreateLabel(labelFont, new Point(50, 555), "v0.01 Pre-Alpha"); urlLabel = renderWindow.CreateLabel(labelFont, new Point(50, 569), "https://github.com/essial/OpenDiablo2/"); urlLabel.TextColor = Color.Magenta; soundProvider.LoadSong(mpqProvider.GetStream(ResourcePaths.BGMTitle)); soundProvider.PlaySong(); }
public MainMenu( IRenderWindow renderWindow, IPaletteProvider paletteProvider, IMPQProvider mpqProvider, IMouseInfoProvider mouseInfoProvider, IMusicProvider musicProvider, ISceneManager sceneManager, IResourceManager resourceManager, Func <eButtonType, IButton> createButton, Func <string, IScene> getScene // Temporary until SDL load functions are sped up ) { 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)); diabloLogoLeft.Blend = true; diabloLogoRight = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoFireRight, Palettes.Units, new Point(400, 120)); diabloLogoRight.Blend = true; diabloLogoLeftBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackLeft, Palettes.Units, new Point(400, 120)); diabloLogoRightBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackRight, Palettes.Units, new Point(400, 120)); btnSinglePlayer = createButton(eButtonType.Wide); btnSinglePlayer.Text = "Single Player".ToUpper(); btnSinglePlayer.Location = new Point(264, 290); btnSinglePlayer.OnActivate = OnSinglePlayerClicked; btnWebsite = createButton(eButtonType.Wide); btnWebsite.Text = "Visit Github".ToUpper(); btnWebsite.Location = new Point(264, 460); btnWebsite.OnActivate = OnVisitWebsiteClicked; btnExit = createButton(eButtonType.Wide); btnExit.Text = "Exit Diablo II".ToUpper(); btnExit.Location = new Point(264, 500); btnExit.OnActivate = OnExitClicked; labelFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Static); versionLabel = renderWindow.CreateLabel(labelFont, new Point(50, 555), "v0.01 Pre-Alpha"); urlLabel = renderWindow.CreateLabel(labelFont, new Point(50, 569), "https://github.com/essial/OpenDiablo2/"); urlLabel.TextColor = Color.Magenta; var loadingSprite = renderWindow.LoadSprite(ResourcePaths.LoadingScreen, Palettes.Loading, new Point(300, 400)); // Pre-load all the scenes for now until we fix the sdl load problem var scenesToLoad = new string[] { "Select Hero Class" }; for (int i = 0; i < scenesToLoad.Count(); i++) { renderWindow.Clear(); renderWindow.Draw(loadingSprite, (int)((float)loadingSprite.TotalFrames * ((float)i / (float)scenesToLoad.Count()))); renderWindow.Sync(); getScene(scenesToLoad[i]); } /* * musicProvider.LoadSong(mpqProvider.GetStream("data\\global\\music\\introedit.wav")); * * musicProvider.PlaySong(); */ }
public SelectHeroClass( IRenderWindow renderWindow, IMouseInfoProvider mouseInfoProvider, ISceneManager sceneManager, ISoundProvider soundProvider, Func <eButtonType, IButton> createButton, Func <ITextBox> createTextBox, ITextDictionary textDictionary, IKeyboardInfoProvider keyboardInfoProvider, IMPQProvider mpqProvider, IGameState gameState ) { this.renderWindow = renderWindow; this.mouseInfoProvider = mouseInfoProvider; this.sceneManager = sceneManager; this.textDictionary = textDictionary; this.keyboardInfoProvider = keyboardInfoProvider; this.soundProvider = soundProvider; this.gameState = gameState; sfxDictionary = new Dictionary <string, byte[]>(); backgroundSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBackground, Palettes.Fechar); campfireSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectCampfire, Palettes.Fechar, new Point(380, 335)); campfireSprite.Blend = true; heroRenderInfo[eHero.Barbarian] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianUnselected, Palettes.Fechar, new Point(400, 330)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianUnselectedH, Palettes.Fechar, new Point(400, 330)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianForwardWalk, Palettes.Fechar, new Point(400, 330)), ForwardWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianForwardWalkOverlay, Palettes.Fechar, new Point(400, 330)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianSelected, Palettes.Fechar, new Point(400, 330)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectBarbarianBackWalk, Palettes.Fechar, new Point(400, 330)), SelectionBounds = new Rectangle(364, 201, 90, 170), ForwardWalkTimeMs = 2500, BackWalkTimeMs = 1000 }; heroRenderInfo[eHero.Sorceress] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressUnselected, Palettes.Fechar, new Point(626, 352)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressUnselectedH, Palettes.Fechar, new Point(626, 352)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressForwardWalk, Palettes.Fechar, new Point(626, 352)), ForwardWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressForwardWalkOverlay, Palettes.Fechar, new Point(626, 352)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressSelected, Palettes.Fechar, new Point(626, 352)), SelectedSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressSelectedOverlay, Palettes.Fechar, new Point(626, 352)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressBackWalk, Palettes.Fechar, new Point(626, 352)), BackWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecSorceressBackWalkOverlay, Palettes.Fechar, new Point(626, 352)), SelectionBounds = new Rectangle(580, 240, 65, 160), ForwardWalkTimeMs = 2300, BackWalkTimeMs = 1200 }; heroRenderInfo[eHero.Sorceress].SelectedSpriteOverlay.Blend = true; heroRenderInfo[eHero.Sorceress].ForwardWalkSpriteOverlay.Blend = true; heroRenderInfo[eHero.Sorceress].BackWalkSpriteOverlay.Blend = true; heroRenderInfo[eHero.Necromancer] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectNecromancerUnselected, Palettes.Fechar, new Point(300, 335)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectNecromancerUnselectedH, Palettes.Fechar, new Point(300, 335)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerForwardWalk, Palettes.Fechar, new Point(300, 335)), ForwardWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerForwardWalkOverlay, Palettes.Fechar, new Point(300, 335)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerSelected, Palettes.Fechar, new Point(300, 335)), SelectedSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerSelectedOverlay, Palettes.Fechar, new Point(300, 335)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerBackWalk, Palettes.Fechar, new Point(300, 335)), BackWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecNecromancerBackWalkOverlay, Palettes.Fechar, new Point(300, 335)), SelectionBounds = new Rectangle(265, 220, 55, 175), ForwardWalkTimeMs = 2000, BackWalkTimeMs = 1500, }; heroRenderInfo[eHero.Necromancer].ForwardWalkSpriteOverlay.Blend = true; heroRenderInfo[eHero.Necromancer].BackWalkSpriteOverlay.Blend = true; heroRenderInfo[eHero.Necromancer].SelectedSpriteOverlay.Blend = true; heroRenderInfo[eHero.Paladin] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectPaladinUnselected, Palettes.Fechar, new Point(521, 338)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectPaladinUnselectedH, Palettes.Fechar, new Point(521, 338)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecPaladinForwardWalk, Palettes.Fechar, new Point(521, 338)), ForwardWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecPaladinForwardWalkOverlay, Palettes.Fechar, new Point(521, 338)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecPaladinSelected, Palettes.Fechar, new Point(521, 338)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecPaladinBackWalk, Palettes.Fechar, new Point(521, 338)), SelectionBounds = new Rectangle(490, 210, 65, 180), ForwardWalkTimeMs = 3400, BackWalkTimeMs = 1300 }; heroRenderInfo[eHero.Amazon] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAmazonUnselected, Palettes.Fechar, new Point(100, 339)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAmazonUnselectedH, Palettes.Fechar, new Point(100, 339)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecAmazonForwardWalk, Palettes.Fechar, new Point(100, 339)), //ForwardWalkSpriteOverlay = renderWindow.LoadSprite(ResourcePaths.CharacterSelecAmazonForwardWalkOverlay, Palettes.Fechar, new Point(100, 339)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecAmazonSelected, Palettes.Fechar, new Point(100, 339)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelecAmazonBackWalk, Palettes.Fechar, new Point(100, 339)), SelectionBounds = new Rectangle(70, 220, 55, 200), ForwardWalkTimeMs = 2200, BackWalkTimeMs = 1500 }; heroRenderInfo[eHero.Assassin] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAssassinUnselected, Palettes.Fechar, new Point(231, 365)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAssassinUnselectedH, Palettes.Fechar, new Point(231, 365)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAssassinForwardWalk, Palettes.Fechar, new Point(231, 365)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAssassinSelected, Palettes.Fechar, new Point(231, 365)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectAssassinBackWalk, Palettes.Fechar, new Point(231, 365)), SelectionBounds = new Rectangle(175, 235, 50, 180), ForwardWalkTimeMs = 3800, BackWalkTimeMs = 1500 }; heroRenderInfo[eHero.Druid] = new HeroRenderInfo { Stance = eHeroStance.Idle, IdleSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectDruidUnselected, Palettes.Fechar, new Point(720, 370)), IdleSelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectDruidUnselectedH, Palettes.Fechar, new Point(720, 370)), ForwardWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectDruidForwardWalk, Palettes.Fechar, new Point(720, 370)), SelectedSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectDruidSelected, Palettes.Fechar, new Point(720, 370)), BackWalkSprite = renderWindow.LoadSprite(ResourcePaths.CharacterSelectDruidBackWalk, Palettes.Fechar, new Point(720, 370)), SelectionBounds = new Rectangle(680, 220, 70, 195), ForwardWalkTimeMs = 4800, BackWalkTimeMs = 1500 }; headingFont = renderWindow.LoadFont(ResourcePaths.Font30, Palettes.Units); heroDescFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Units); uiFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Units); headingLabel = renderWindow.CreateLabel(headingFont); headingLabel.Text = textDictionary.Translate("strSelectHeroClass"); headingLabel.Location = new Point(400 - (headingLabel.TextArea.Width / 2), 17); heroClassLabel = renderWindow.CreateLabel(headingFont); heroClassLabel.Text = ""; heroClassLabel.Location = new Point(400 - (heroClassLabel.TextArea.Width / 2), 65); heroDesc1Label = renderWindow.CreateLabel(heroDescFont); heroDesc2Label = renderWindow.CreateLabel(heroDescFont); heroDesc3Label = renderWindow.CreateLabel(heroDescFont); characterNameLabel = renderWindow.CreateLabel(uiFont); characterNameLabel.Text = textDictionary.Translate("strCharacterName"); characterNameLabel.Location = new Point(320, 475); characterNameLabel.TextColor = Color.FromArgb(216, 196, 128); exitButton = createButton(eButtonType.Medium); exitButton.Text = textDictionary.Translate("strExit"); exitButton.Location = new Point(33, 540); exitButton.OnActivate = OnExitClicked; okButton = createButton(eButtonType.Medium); okButton.Text = textDictionary.Translate("strOk"); okButton.Location = new Point(630, 540); okButton.OnActivate = OnOkclicked; okButton.Enabled = false; characterNameTextBox = createTextBox(); characterNameTextBox.Text = ""; characterNameTextBox.Location = new Point(320, 493); Parallel.ForEach(new[] { ResourcePaths.SFXAmazonSelect, ResourcePaths.SFXAssassinSelect, ResourcePaths.SFXBarbarianSelect, ResourcePaths.SFXDruidSelect, ResourcePaths.SFXNecromancerSelect, ResourcePaths.SFXPaladinSelect, ResourcePaths.SFXSorceressSelect, ResourcePaths.SFXAmazonDeselect, ResourcePaths.SFXAssassinDeselect, ResourcePaths.SFXBarbarianDeselect, ResourcePaths.SFXDruidDeselect, ResourcePaths.SFXNecromancerDeselect, ResourcePaths.SFXPaladinDeselect, ResourcePaths.SFXSorceressDeselect }, (path => sfxDictionary.Add(path, mpqProvider.GetBytes(path)))); }