Esempio n. 1
0
        private void SetupMainPanel()
        {
            uint panelId;

            if (SystemVars.ControlPanelMode == ControlPanelMode.CP_DEATHSCREEN)
                panelId = SwordRes.SR_DEATHPANEL;
            else
            {
                if (SystemVars.RealLanguage.TwoLetterISOLanguageName == "en-US")
                    panelId = SwordRes.SR_PANEL_AMERICAN;
                else if (SystemVars.Language <= Language.BS1_SPANISH)
                    panelId = (uint)(SwordRes.SR_PANEL_ENGLISH + SystemVars.Language);
                else
                    panelId = SwordRes.SR_PANEL_ENGLISH;
            }

            ControlButton panel = new ControlButton(0, 0, panelId, 0, 0, _resMan, _screenBuf, _system);
            panel.Draw();

            if (SystemVars.ControlPanelMode != ControlPanelMode.CP_NORMAL)
                CreateButtons(_deathButtons, 3);
            else
            {
                CreateButtons(_panelButtons, 7);
                _buttons[5].SetSelected(SystemVars.ShowText);
            }

            if (SystemVars.ControlPanelMode == ControlPanelMode.CP_THEEND) // end of game
                RenderText(_lStrings[(int)LangStrings.STR_THE_END], 480, 188 + 40, TextModes.TEXT_RIGHT_ALIGN);

            if (SystemVars.ControlPanelMode == ControlPanelMode.CP_NORMAL)
            { // normal panel
                RenderText(_lStrings[(int)LangStrings.STR_SAVE], 180, 188 + 40, TextModes.TEXT_LEFT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_DONE], 460, 332 + 40, TextModes.TEXT_RIGHT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_RESTORE], 180, 224 + 40, TextModes.TEXT_LEFT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_RESTART], 180, 260 + 40, TextModes.TEXT_LEFT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_QUIT], 180, 296 + 40, TextModes.TEXT_LEFT_ALIGN);

                RenderText(_lStrings[(int)LangStrings.STR_VOLUME], 460, 188 + 40, TextModes.TEXT_RIGHT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_TEXT], 460, 224 + 40, TextModes.TEXT_RIGHT_ALIGN);
            }
            else
            {
                RenderText(_lStrings[(int)LangStrings.STR_RESTORE], 285, 224 + 40, TextModes.TEXT_LEFT_ALIGN);
                if (SystemVars.ControlPanelMode == ControlPanelMode.CP_NEWGAME) // just started game
                    RenderText(_lStrings[(int)LangStrings.STR_START], 285, 260 + 40, TextModes.TEXT_LEFT_ALIGN);
                else
                    RenderText(_lStrings[(int)LangStrings.STR_RESTART], 285, 260 + 40, TextModes.TEXT_LEFT_ALIGN);
                RenderText(_lStrings[(int)LangStrings.STR_QUIT], 285, 296 + 40, TextModes.TEXT_LEFT_ALIGN);
            }
        }
Esempio n. 2
0
        private void SetupSaveRestorePanel(bool saving)
        {
            ReadSavegameDescriptions();

            FrameHeader savePanel = new FrameHeader(_resMan.FetchFrame(_resMan.OpenFetchRes(SwordRes.SR_WINDOW), 0));
            short panelX = (short)((640 - _resMan.ReadUInt16(savePanel.width)) / 2);
            short panelY = (short)((480 - _resMan.ReadUInt16(savePanel.height)) / 2);
            ControlButton panel = new ControlButton((ushort)panelX, (ushort)panelY, SwordRes.SR_WINDOW, 0, 0, _resMan, _screenBuf, _system);
            panel.Draw();
            _resMan.ResClose(SwordRes.SR_WINDOW);
            CreateButtons(_saveButtons, 14);
            RenderText(_lStrings[(int)LangStrings.STR_CANCEL], _saveButtons[13].x - 10, _saveButtons[13].y, TextModes.TEXT_RIGHT_ALIGN);
            if (saving)
            {
                RenderText(_lStrings[(int)LangStrings.STR_SAVE], _saveButtons[12].x + 30, _saveButtons[13].y, TextModes.TEXT_LEFT_ALIGN);
            }
            else
            {
                RenderText(_lStrings[(int)LangStrings.STR_RESTORE], _saveButtons[12].x + 30, _saveButtons[13].y, TextModes.TEXT_LEFT_ALIGN);
            }
            ReadSavegameDescriptions();
            _selectedSavegame = 255;
            ShowSavegameNames();
        }
Esempio n. 3
0
        private void SetupVolumePanel()
        {
            ControlButton panel = new ControlButton(0, 0, SwordRes.SR_VOLUME, 0, 0, _resMan, _screenBuf, _system);
            panel.Draw();

            RenderText(_lStrings[(int)LangStrings.STR_MUSIC], 149, 39 + 40, TextModes.TEXT_LEFT_ALIGN);
            RenderText(_lStrings[(int)LangStrings.STR_SPEECH], 320, 39 + 40, TextModes.TEXT_CENTER);
            RenderText(_lStrings[(int)LangStrings.STR_FX], 438, 39 + 40, TextModes.TEXT_LEFT_ALIGN);

            CreateButtons(_volumeButtons, 4);
            RenderText(_lStrings[(int)LangStrings.STR_DONE], _volumeButtons[0].x - 10, _volumeButtons[0].y, TextModes.TEXT_RIGHT_ALIGN);

            byte volL, volR;
            _music.GiveVolume(out volL, out volR);
            RenderVolumeBar(1, volL, volR);
            _sound.GiveSpeechVol(out volL, out volR);
            RenderVolumeBar(2, volL, volR);
            _sound.GiveSfxVol(out volL, out volR);
            RenderVolumeBar(3, volL, volR);
        }
Esempio n. 4
0
 private void CreateButtons(ButtonInfo[] buttons, byte num)
 {
     for (var cnt = 0; cnt < num; cnt++)
     {
         _buttons[cnt] = new ControlButton(buttons[cnt].x, buttons[cnt].y, buttons[cnt].resId, (ButtonIds)buttons[cnt].id, buttons[cnt].flag, _resMan, _screenBuf, _system);
         _buttons[cnt].Draw();
     }
     _numButtons = num;
 }
Esempio n. 5
0
        private bool GetConfirm(string title)
        {
            var panel = new ControlButton(0, 0, SwordRes.SR_CONFIRM, 0, 0, _resMan, _screenBuf, _system);
            panel.Draw();

            RenderText(title, 320, 160, TextModes.TEXT_CENTER);
            ControlButton[] buttons = new ControlButton[2];
            buttons[0] = new ControlButton(260, 192 + 40, SwordRes.SR_BUTTON, 0, 0, _resMan, _screenBuf, _system);
            RenderText(_lStrings[(int)LangStrings.STR_OK], 640 - 260, 192 + 40, TextModes.TEXT_RIGHT_ALIGN);
            buttons[1] = new ControlButton(260, 256 + 40, SwordRes.SR_BUTTON, 0, 0, _resMan, _screenBuf, _system);
            RenderText(_lStrings[(int)LangStrings.STR_CANCEL], 640 - 260, 256 + 40, TextModes.TEXT_RIGHT_ALIGN);
            byte retVal = 0;
            byte clickVal = 0;
            do
            {
                buttons[0].Draw();
                buttons[1].Draw();
                Delay(1000 / 12);
                if (_keyPressed.IsKeyDown(KeyCode.Escape))
                    retVal = 2;
                else if (_keyPressed.IsKeyDown(KeyCode.Return) /*|| _keyPressed.IsKeyDown(KeyCode.Enter)*/)
                    retVal = 1;
                if ((_mouseState & Mouse.BS1L_BUTTON_DOWN) != 0)
                {
                    if (buttons[0].WasClicked((ushort)_mouseCoord.X, (ushort)_mouseCoord.Y))
                        clickVal = 1;
                    else if (buttons[1].WasClicked((ushort)_mouseCoord.X, (ushort)_mouseCoord.Y))
                        clickVal = 2;
                    else
                        clickVal = 0;
                    if (clickVal != 0)
                        buttons[clickVal - 1].SetSelected(1);
                }
                if ((_mouseState & Mouse.BS1L_BUTTON_UP) != 0 && (clickVal != 0))
                {
                    if (buttons[clickVal - 1].WasClicked((ushort)_mouseCoord.X, (ushort)_mouseCoord.Y))
                        retVal = clickVal;
                    else
                        buttons[clickVal - 1].SetSelected(0);
                    clickVal = 0;
                }
            } while (retVal == 0);
            return retVal == 1;
        }