Ejemplo n.º 1
0
        public Game(
            IRenderWindow renderWindow,
            IResourceManager resourceManager,
            IMapEngine mapEngine,
            IGameState gameState,
            IKeyboardInfoProvider keyboardInfoProvider,
            Func <eButtonType, IButton> createButton,
            Func <IMiniPanel> createMiniPanel
            )
        {
            this.renderWindow         = renderWindow;
            this.resourceManager      = resourceManager;
            this.mapEngine            = mapEngine;
            this.gameState            = gameState;
            this.keyboardInfoProvider = keyboardInfoProvider;


            panelSprite            = renderWindow.LoadSprite(ResourcePaths.GamePanels, Palettes.Act1);
            healthManaSprite       = renderWindow.LoadSprite(ResourcePaths.HealthMana, Palettes.Act1);
            gameGlobeOverlapSprite = renderWindow.LoadSprite(ResourcePaths.GameGlobeOverlap, Palettes.Act1);

            minipanel = createMiniPanel();
            // Maybe? Not sure.
            // miniPanel.OnMenuActivate();

            runButton          = createButton(eButtonType.Run);
            runButton.Location = new Point(256, 570);
            runButton.OnToggle = OnRunToggle;

            menuButton          = createButton(eButtonType.Menu);
            menuButton.Location = new Point(393, 561);
            menuButton.OnToggle = OnMenuToggle;
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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.
            createNewCharacterButton.Text       = textDictionary.Translate("strCreateNewCharacter");// "Create New".ToUpper();
            createNewCharacterButton.Location   = new Point(33, 467);
            createNewCharacterButton.OnActivate = () => sceneManager.ChangeScene(eSceneType.SelectHeroClass);

            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);
            exitButton.OnActivate = () => sceneManager.ChangeScene(eSceneType.MainMenu);

            okButton          = createButton(eButtonType.Medium);
            okButton.Text     = textDictionary.Translate("strOk");
            okButton.Location = new Point(630, 540);
            okButton.Enabled  = false;
        }
Ejemplo n.º 5
0
        public MiniPanel(IRenderWindow renderWindow,
                         Func <IGameHUD> getGameHud,
                         IMouseInfoProvider mouseInfoProvider,
                         IEnumerable <IPanel> panels,
                         Func <eButtonType, IButton> createButton)
        {
            this.renderWindow      = renderWindow;
            this.mouseInfoProvider = mouseInfoProvider;
            this._getGameHud       = getGameHud;
            this.panels            = panels;

            sprite = renderWindow.LoadSprite(ResourcePaths.MinipanelSmall, Palettes.Units, true);

            buttons = panelButtons.Select((x, i) =>
            {
                var newBtn = createButton(x);
                var panel  = panels.SingleOrDefault(o => o.PanelType == x.GetPanelType());

                if (panel != null)
                {
                    newBtn.OnActivate    = () => OnPanelToggled?.Invoke(panel);
                    panel.OnPanelClosed += Panel_OnPanelClosed;
                }
                return(newBtn);
            }).ToList().AsReadOnly();
        }
Ejemplo n.º 6
0
        public PanelFrame(IRenderWindow renderWindow, ePanelFrameType panelFrameType)
        {
            this.renderWindow   = renderWindow;
            this.panelFrameType = panelFrameType;

            sprite = renderWindow.LoadSprite(ResourcePaths.Frame, Palettes.Units, new Point(0, 0), true);

            Location = new Point(0, 0);
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
        public CharacterPanel(
            IRenderWindow renderWindow,
            Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Act1, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(128, 388);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);
        }
Ejemplo n.º 9
0
        public GameHUD(
            IRenderWindow renderWindow,
            IGameState gameState,
            IMouseInfoProvider mouseInfoProvider,
            Func <IMiniPanel> createMiniPanel,
            Func <eButtonType, IButton> createButton,
            Func <ePanelFrameType, IPanelFrame> createPanelFrame)
        {
            this.renderWindow      = renderWindow;
            this.gameState         = gameState;
            this.mouseInfoProvider = mouseInfoProvider;
            minipanel = createMiniPanel();
            minipanel.OnPanelToggled += TogglePanel;

            leftPanelFrame  = createPanelFrame(ePanelFrameType.Left);
            rightPanelFrame = createPanelFrame(ePanelFrameType.Right);

            runButton          = createButton(eButtonType.Run);
            runButton.Location = new Point(256, 570);
            runButton.OnToggle = OnRunToggle;

            menuButton          = createButton(eButtonType.Menu);
            menuButton.Location = new Point(393, 561);
            menuButton.OnToggle = minipanel.OnMenuToggle;
            menuButton.Toggle();

            addStatButton            = createButton(eButtonType.Skill);
            addStatButton.Location   = new Point(207, 562);
            addStatButton.Enabled    = addNewAttribute;
            addStatButton.OnActivate = () => TogglePanel(ePanelType.Character);

            addSkillButton          = createButton(eButtonType.Skill);
            addSkillButton.Location = new Point(564, 562);
            addSkillButton.Enabled  = addNewSkill;

            panelSprite            = renderWindow.LoadSprite(ResourcePaths.GamePanels, Palettes.Act1, true);
            healthManaSprite       = renderWindow.LoadSprite(ResourcePaths.HealthMana, Palettes.Act1, true);
            gameGlobeOverlapSprite = renderWindow.LoadSprite(ResourcePaths.GameGlobeOverlap, Palettes.Act1, true);
        }
Ejemplo n.º 10
0
        public void SelectItem(ItemInstance item)
        {
            if (item == null)
            {
                renderWindow.MouseCursor = this.originalMouseCursor;
            }
            else
            {
                var cursorSprite = renderWindow.LoadSprite(ResourcePaths.GeneratePathForItem(item.Item.InvFile), Palettes.Units);
                renderWindow.MouseCursor = renderWindow.LoadCursor(cursorSprite, 0, new Point(cursorSprite.FrameSize.Width / 2, cursorSprite.FrameSize.Height / 2));
            }

            this.SelectedItem = item;
        }
Ejemplo n.º 11
0
        public SkillsPanel(
            IRenderWindow renderWindow,
            Func <eHero, int, IButton> createTreeButton,
            Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.GetHeroSkillPanel(hero), Palettes.Act1, FrameType.GetOffset(), true);

            treeButtons = Enumerable.Range(0, 3).Select(o =>
            {
                var btn        = createTreeButton(hero, o);
                btn.Location   = FrameType.GetOffset();
                btn.OnActivate = () => { ActivePanelIndex = o; };
                return(btn);
            }).ToArray();
        }
Ejemplo n.º 12
0
        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();
             */
        }
Ejemplo n.º 13
0
        public InventoryPanel(IRenderWindow renderWindow,
                              IItemManager itemManager,
                              Func <eItemContainerType, IItemContainer> createItemContainer,
                              Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(18, 384);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);

            secondaryLeftButton                  = createButton(eButtonType.SecondaryInvHand);
            secondaryLeftButton.Location         = panelSprite.Location + new Size(15, 22);
            secondaryLeftButton.OnActivate       = ToggleWeaponsSlot;
            secondaryLeftButton.ClickableRect    = new Size(0, 20);
            secondaryLeftButton.AllowFrameChange = false;

            secondaryRightButton                  = createButton(eButtonType.SecondaryInvHand);
            secondaryRightButton.Location         = panelSprite.Location + new Size(246, 22);
            secondaryRightButton.OnActivate       = ToggleWeaponsSlot;
            secondaryRightButton.ClickableRect    = new Size(0, 20);
            secondaryRightButton.AllowFrameChange = false;

            goldButton            = createButton(eButtonType.GoldCoin);
            goldButton.Location   = panelSprite.Location + new Size(84, 391);
            goldButton.OnActivate = OpenGoldDrop;

            helmContainer          = createItemContainer(eItemContainerType.Helm);
            helmContainer.Location = panelSprite.Location + new Size(135, 5);

            amuletContainer          = createItemContainer(eItemContainerType.Amulet);
            amuletContainer.Location = panelSprite.Location + new Size(209, 34);

            armorContainer          = createItemContainer(eItemContainerType.Armor);
            armorContainer.Location = panelSprite.Location + new Size(135, 75);

            leftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            leftHandContainer.Location = panelSprite.Location + new Size(20, 47);

            rightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            rightHandContainer.Location = panelSprite.Location + new Size(253, 47);

            secondaryLeftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryLeftHandContainer.Location = panelSprite.Location + new Size(24, 45);

            secondaryRightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryRightHandContainer.Location = panelSprite.Location + new Size(257, 45);

            beltContainer          = createItemContainer(eItemContainerType.Belt);
            beltContainer.Location = panelSprite.Location + new Size(136, 178);

            ringtLeftContainer          = createItemContainer(eItemContainerType.Ring);
            ringtLeftContainer.Location = panelSprite.Location + new Size(95, 179);

            ringtRightContainer          = createItemContainer(eItemContainerType.Ring);
            ringtRightContainer.Location = panelSprite.Location + new Size(209, 179);

            gloveContainer          = createItemContainer(eItemContainerType.Glove);
            gloveContainer.Location = panelSprite.Location + new Size(20, 179);

            bootsContainer          = createItemContainer(eItemContainerType.Boots);
            bootsContainer.Location = panelSprite.Location + new Size(251, 178);
        }
Ejemplo n.º 14
0
        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))));
        }
Ejemplo n.º 15
0
        public InventoryPanel(IRenderWindow renderWindow,
                              IItemManager itemManager,
                              IMapRenderer mapRenderer,
                              ISessionManager sessionManager,
                              Func <eItemContainerType, IItemContainer> createItemContainer,
                              IGameState gameState,
                              Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;
            this.mapRenderer  = mapRenderer;
            this.gameState    = gameState;

            sessionManager.OnFocusOnPlayer   += OnFocusOnPlayer;
            sessionManager.OnPlayerInfo      += OnPlayerInfo;
            sessionManager.OnChangeEquipment += OnChangeEquipment;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(18, 384);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);

            secondaryLeftButton            = createButton(eButtonType.SecondaryInvHand);
            secondaryLeftButton.Location   = panelSprite.Location + new Size(15, 22);
            secondaryLeftButton.OnActivate = ToggleWeaponsSlot;

            secondaryRightButton            = createButton(eButtonType.SecondaryInvHand);
            secondaryRightButton.Location   = panelSprite.Location + new Size(246, 22);
            secondaryRightButton.OnActivate = ToggleWeaponsSlot;

            goldButton            = createButton(eButtonType.GoldCoin);
            goldButton.Location   = panelSprite.Location + new Size(84, 391);
            goldButton.OnActivate = OpenGoldDrop;

            headContainer          = createItemContainer(eItemContainerType.Helm);
            headContainer.Location = panelSprite.Location + new Size(135, 5);
            headContainer.Slot     = "head";

            neckContainer          = createItemContainer(eItemContainerType.Amulet);
            neckContainer.Location = panelSprite.Location + new Size(209, 34);
            neckContainer.Slot     = "neck";

            torsoContainer          = createItemContainer(eItemContainerType.Armor);
            torsoContainer.Location = panelSprite.Location + new Size(135, 75);
            torsoContainer.Slot     = "tors";

            rightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            rightHandContainer.Location = panelSprite.Location + new Size(20, 47);
            rightHandContainer.Slot     = "rarm";

            leftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            leftHandContainer.Location = panelSprite.Location + new Size(253, 47);
            leftHandContainer.Slot     = "larm";

            secondaryLeftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryLeftHandContainer.Location = panelSprite.Location + new Size(24, 45);

            secondaryRightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryRightHandContainer.Location = panelSprite.Location + new Size(257, 45);

            beltContainer          = createItemContainer(eItemContainerType.Belt);
            beltContainer.Location = panelSprite.Location + new Size(136, 178);
            beltContainer.Slot     = "belt";

            ringLeftContainer          = createItemContainer(eItemContainerType.Ring);
            ringLeftContainer.Location = panelSprite.Location + new Size(95, 179);
            ringLeftContainer.Slot     = "rrin";

            ringRightContainer          = createItemContainer(eItemContainerType.Ring);
            ringRightContainer.Location = panelSprite.Location + new Size(209, 179);
            ringRightContainer.Slot     = "lrin";

            gloveContainer          = createItemContainer(eItemContainerType.Glove);
            gloveContainer.Location = panelSprite.Location + new Size(20, 179);
            gloveContainer.Slot     = "glov";

            bootsContainer          = createItemContainer(eItemContainerType.Boots);
            bootsContainer.Location = panelSprite.Location + new Size(251, 178);
            bootsContainer.Slot     = "feet";
        }