コード例 #1
0
        public MainMenu()
        {
            //Increase the size so we can fit the character model into the menu
            var screenSize = GUCView.GetScreenSize();
            int width      = 900;
            int height     = 600;

            int posX = (screenSize.X - width) / 2;
            int posY = (screenSize.Y - height) / 2;


            Back.SetPos(posX, posY);
            Back.SetSize(width, height);

            AddButton("Welt betreten", "Die Spielwelt mit dem gewählten Character betreten.", 50, () => JoinGameSelected?.Invoke(this));
            AddButton("Charakter wählen", "Wähle deinen Spielcharakter.", 100, () => CharacterSelectionSelected?.Invoke(this));
            AddButton("Charakter erstellen", "Erstelle einen Spielcharakter", 150, () => CharacterCreationSelected?.Invoke(this));
            AddButton("Logout", "Zurück zum Login Menü", 200, () => BackToLoginSelected?.Invoke(this));
            AddButton("Spiel verlassen", "Das Spiel schließen.", 250, () => ExitGameSelected?.Invoke(this));


            _Character = AddCharacter("", 400, 0, 533, 400);
            _Character.SetVisual("HUMANS.MDS");
            _Character.SetAdditionalVisuals(HumBodyMeshs.HUM_BODY_BABE0.ToString(), (int)HumBodyTexs.G1Hero, HumHeadMeshs.HUM_HEAD_BABE.ToString(), (int)HumHeadTexs.FaceBabe_B_RedLocks);
            _Character.Enabled = false;
            _Character.Hide();

            _CharacterNameText = Back.CreateText("PlayerName", 650, 475);
            _CharacterNameText.Hide();
        }
コード例 #2
0
        protected static void DoVictoryStuff(bool win, string winText = "SIEG!", string lossText = "NIEDERLAGE!")
        {
            if (VictoryVis == null)
            {
                const int boxWidth  = 260;
                const int boxHeight = 45;
                const int boxOffset = 100;
                var       ssize     = GUCView.GetScreenSize();
                var       vis       = new GUCVisual((ssize.X - boxWidth) / 2, boxOffset, boxWidth, boxHeight);
                vis.Font = GUCView.Fonts.Menu;
                vis.SetBackTexture("menu_choice_back.tga");
                var txt = vis.CreateTextCenterX("", 7);
                txt.Show();
                VictoryVis = vis;
            }

            if (win)
            {
                VictoryVis.Texts[0].Text = winText;
                SoundHandler.PlaySound(VictoryWin);
            }
            else
            {
                VictoryVis.Texts[0].Text = lossText;
                SoundHandler.PlaySound(VictoryLoss);
            }
            VictoryVis.Show();
        }
コード例 #3
0
        public CharacterSelectionMenu()
        {
            Back.CreateTextCenterX("Charakterauswahl", 10);

            _CharacterButtons = new MainMenuButton[5];
            for (int i = 0; i < _CharacterButtons.Length; i++)
            {
                _CharacterButtons[i]         = AddButton("...", "", _DistanceBetweenButtons * (i + 1), OnActivate);
                _CharacterButtons[i].Enabled = false;
            }

            //Increase the size so we can fit the character model into the menu
            var screenSize = GUCView.GetScreenSize();
            int width      = 900;
            int height     = 600;

            int posX = (screenSize.X - width) / 2;
            int posY = (screenSize.Y - height) / 2;


            Back.SetPos(posX, posY);
            Back.SetSize(width, height);


            _CharacterDisplay = AddCharacter("", 400, 0, 533, 400);
            _CharacterDisplay.SetVisual("HUMANS.MDS");
            _CharacterDisplay.SetAdditionalVisuals(HumBodyMeshs.HUM_BODY_BABE0.ToString(), (int)HumBodyTexs.G1Hero, HumHeadMeshs.HUM_HEAD_BABE.ToString(), (int)HumHeadTexs.FaceBabe_B_RedLocks);
            _CharacterDisplay.Enabled = false;
            _CharacterDisplay.Hide();

            _CharacterNameText = Back.CreateText("PlayerName", 650, 475);
            _CharacterNameText.Hide();

            CursorChanged += OnCursorChanged;
        }
コード例 #4
0
        public ChatMenu(Chat chat)
        {
            _Chat = chat ?? throw new ArgumentNullException(nameof(chat));
            _Chat.ChatMessageReceived += (sender, args) => ReceiveServerMessage(args.Mode, args.Message);


            screenSize = GUCView.GetScreenSize();
            chatHeigth = screenSize.Y / 5;
            chatWidth  = screenSize.X - 350;

            chatBackground = new GUCVisual(0, 0, chatWidth, chatHeigth + 5);
            chatBackground.SetBackTexture("Dlg_Conversation.tga");

            const int space = 20;
            int       lines = chatHeigth / space;

            for (int i = 0; i < lines; i++)
            {
                chatBackground.CreateText("" + i, 20, 5 + i * space);
                chatBackground.Texts[i].Text = "";
            }

            textBox = new GUCTextBox(70, chatHeigth + 5, chatWidth - 90, false);
            prefix  = new GUCVisual(15, chatHeigth + 5, chatWidth, 20);
            prefix.CreateText("", 0, 0);

            chatInactivityTimer = new GUCTimer();
            chatInactivityTimer.SetCallback(() => { if (!textBox.Enabled)
                                                    {
                                                        chatBackground.Hide();
                                                    }
                                                    chatInactivityTimer.Stop(); });
            chatInactivityTimer.SetInterval(6 * TimeSpan.TicksPerSecond);
        }
コード例 #5
0
        static GameClient()
        {
            Client = ScriptManager.Interface.CreateClient();

            // Init RakNet objects
            clientInterface = RakPeerInterface.GetInstance();
            clientInterface.SetOccasionalPing(true);

            socketDescriptor      = new SocketDescriptor();
            socketDescriptor.port = 0;

            if (clientInterface.Startup(1, socketDescriptor, 1) != StartupResult.RAKNET_STARTED)
            {
                Logger.LogError("RakNet failed to start!");
            }

            // Init debug info on screen
            var screenSize = GUCView.GetScreenSize();

            abortInfo = new GUCVisual((screenSize.Y - 300) / 2, 150, 300, 40);
            abortInfo.SetBackTexture("Menu_Choice_Back.tga");
            GUCVisualText visText = abortInfo.CreateText("Verbindung unterbrochen!");

            visText.SetColor(ColorRGBA.Red);

            devInfo = new GUCVisual();
            for (int pos = 0; pos < 0x2000; pos += devInfo.zView.FontY() + 5)
            {
                var t = devInfo.CreateText("", 0x2000, pos, true);
                t.Format = GUCVisualText.TextFormat.Right;
            }
            devInfo.Show();
        }
コード例 #6
0
        public ChatMenu()
        {
            screenSize = GUCView.GetScreenSize();
            chatHeigth = screenSize.Y / 5;
            chatWidth  = screenSize.X - 350;

            chatBackground = new GUCVisual(0, 0, chatWidth, chatHeigth + 5);
            chatBackground.SetBackTexture("Dlg_Conversation.tga");

            const int space = 20;
            int       lines = chatHeigth / space;

            for (int i = 0; i < lines; i++)
            {
                chatBackground.CreateText("" + i, 20, 5 + i * space);
                chatBackground.Texts[i].Text = "";
            }

            textBox = new GUCTextBox(70, chatHeigth + 5, chatWidth - 90, false);
            prefix  = new GUCVisual(15, chatHeigth + 5, chatWidth, 20);
            prefix.CreateText("", 0, 0);

            chatInactivityTimer = new GUCTimer();
            chatInactivityTimer.SetCallback(() => { if (!textBox.Enabled)
                                                    {
                                                        chatBackground.Hide();
                                                    }
                                                    chatInactivityTimer.Stop(); });
            chatInactivityTimer.SetInterval(6 * TimeSpan.TicksPerSecond);
        }
コード例 #7
0
        protected MenuWithViewBlocker()
        {
            var screenSize = GUCView.GetScreenSize();

            _BackgroundTexture = new GUCVisual(0, 0, screenSize.X, screenSize.Y);
            _BackgroundTexture.SetBackTexture("StartScreen.tga");
            _BackgroundTexture.Font = GUCVisual.Fonts.Menu;
        }
コード例 #8
0
        static MissionScreen()
        {
            countdown = new GUCVisual();
            countdown.CreateTextCenterX("", 200).Font = GUCView.Fonts.Menu;

            const int missionHeight = 300;
            const int missionWidth  = 300;

            mission = new GUCVisual(20, GUCView.GetScreenSize().Y - missionHeight - 50, missionWidth, missionHeight);
            mission.CreateText("", 25, 25).Font = GUCView.Fonts.Book;
            mission.SetBackTexture("Letters.tga");
        }
コード例 #9
0
        public PlayerInventory()
        {
            // Create the player inventory relative to the screen size
            int x, y, cols, rows;
            var screenSize = GUCView.GetScreenSize();

            cols = 5;
            x    = screenSize.X - (GUCInventory.SlotSize * cols + screenSize.X / 25);
            y    = screenSize.Y / 7 + 15;
            rows = (screenSize.Y - GUCInventory.DescriptionBoxHeight - y) / GUCInventory.SlotSize;

            inv = new GUCInventory(x, y, cols, rows);
        }
コード例 #10
0
        static TOInfoScreen()
        {
            vis      = new GUCVisual();
            vis.Font = GUCView.Fonts.Menu;

            const int yOffset = 60;
            var       text    = vis.CreateText("Team Objective", GUCView.GetScreenSize().X, yOffset);

            text.Format = GUCVisualText.TextFormat.Right;

            //toName = vis.CreateText("TO_NAME", GUCView.GetScreenSize().Width, yOffset + GUCView.FontsizeMenu);
            //toName.Format = GUCVisualText.TextFormat.Right;

            toTime        = vis.CreateText("TIME LEFT", GUCView.GetScreenSize().X, yOffset + 1 * GUCView.FontsizeMenu);
            toTime.Format = GUCVisualText.TextFormat.Right;
        }
コード例 #11
0
        public GUCMainMenu()
        {
            var screenSize = GUCView.GetScreenSize();

            pos  = new int[] { (screenSize.X - 640) / 2, (screenSize.Y - 480) / 2 };
            Back = new GUCVisual(pos[0], pos[1], 640, 480);
            Back.SetBackTexture("Menu_Ingame.tga");
            Back.Font = GUCVisual.Fonts.Menu;

            helpVis            = GUCVisualText.Create("", 0, pos[1] + 455);
            helpText.CenteredX = true;

            scrollHelper = new KeyHoldHelper()
            {
                { () => MoveCursor(true), VirtualKeys.Up },
                { () => MoveCursor(false), VirtualKeys.Down },
                { () => MoveCursor(false), VirtualKeys.Tab },
            };
        }
コード例 #12
0
        void UpdateBoardPositions()
        {
            var screenSize = GUCView.GetScreenSize();

            for (int i = 0; i < boardCount; i++)
            {
                ScoreBoard board;
                if (i >= boards.Count)
                {
                    board = new ScoreBoard();
                    boards.Add(board);
                }
                else
                {
                    board = boards[i];
                }
                board.SetPos((screenSize.X - ScoreBoard.Width * boardCount) / 2 + i * ScoreBoard.Width, ScoreBoard.YDistance);
            }
        }
コード例 #13
0
        static PlayerList()
        {
            var screen = GUCView.GetScreenSize();

            int x = (screen.X - Width) / 2;
            int y = (screen.Y - Height) / 2;

            vis      = new GUCVisual(x, y - GUCView.FontsizeMenu, Width, Height + GUCView.FontsizeMenu);
            vis.Font = GUCView.Fonts.Menu;
            vis.CreateTextCenterX("Spielerliste", 0);

            listVis = new GUCVisual(x, y, Width, Height);
            vis.AddChild(listVis);

            listVis.SetBackTexture(BackTex);
            for (int offset = 20; offset < Height - GUCView.FontsizeDefault - 5; offset += GUCView.FontsizeDefault + 1)
            {
                listVis.CreateText("", 17, offset);
            }
        }
コード例 #14
0
        public DropItemMenu()
        {
            const int backWidth  = 120;
            const int backHeight = 64;

            back = new GUCVisual((GUCView.GetScreenSize().X - backWidth) / 2, (GUCView.GetScreenSize().Y - backHeight) / 2, backWidth, backHeight);
            back.SetBackTexture("Inv_Back.tga");

            const int borderWidth  = 80;
            const int borderHeight = 24;

            border = (GUCVisual)back.AddChild(new GUCVisual((GUCView.GetScreenSize().X - borderWidth) / 2, (GUCView.GetScreenSize().Y - borderHeight) / 2, borderWidth, borderHeight));
            border.SetBackTexture("Inv_Titel.tga");

            const int tbWidth = borderWidth - 20;

            tb             = (GUCTextBox)border.AddChild(new GUCTextBox((GUCView.GetScreenSize().X - tbWidth) / 2, (GUCView.GetScreenSize().Y - GUCView.FontsizeDefault) / 2, tbWidth, true));
            tb.OnlyNumbers = true;

            player = ScriptClient.Client.Character;
        }
コード例 #15
0
        static bool ShowConnectionAttempts()
        {
            if (GameClient.IsDisconnected)
            {
                return(true);
            }

            if (!GameClient.IsConnected)
            {
                if (!GameClient.IsConnecting)
                {
                    GameClient.Connect();
                }

                if (connectionVis == null)
                {
                    connectionVis = new GUCVisual();
                    connectionVis.SetBackTexture("MENU_CHOICE_BACK.TGA");
                    var text = connectionVis.CreateText("");
                }
                var screenSize = GUCView.GetScreenSize();
                connectionVis.SetPosX(screenSize.X / 2 - 200);
                connectionVis.SetPosY(200);
                connectionVis.SetHeight(40);
                connectionVis.SetWidth(400);
                connectionVis.Texts[0].Text = string.Format("Connecting to '{0}:{1}' ... ({2})", Program.ServerIP, Program.ServerPort, GameClient.ConnectionAttempts);
                connectionVis.Show();
                return(true);
            }

            if (connectionVis != null)
            {
                connectionVis.Hide();
            }
            return(!GameClient.IsConnected);
        }
コード例 #16
0
        protected override void OnCreate()
        {
            base.OnCreate();
            var screenSize = GUCView.GetScreenSize();

            Back.SetPos((screenSize.X - 900) / 2, (screenSize.Y - 480) / 2);
            Back.SetSize(900, 480);

            Back.CreateTextCenterX("Login", 100);

            _TbName = AddTextBox("Accountname:", "Name deines Accounts eingeben.", 200, 200, OnActivate);


            _TbPw = AddTextBox("Passwort:", "Passwort deines Accounts eingeben.", 250, 200, OnActivate, true);

            _TbPw2 = AddTextBox("Passwort wdh.:", "Passwort deines Accounts wiederholen.", 300, 200, OnActivate, true);

            AddButton("erstellen", "Die Erstellung des Accounts ausführen", 350, OnActivate);

            AddButton("Zurück", "Die Erstellung des Accounts abbrechen", 400, () => ChancelSelected?.Invoke(this));

            _LbErrorText = Back.CreateTextCenterX("", 400);
            _LbErrorText.SetColor(ColorRGBA.Red);
        }
コード例 #17
0
 static RespawnNote()
 {
     textVis      = new GUCVisual().CreateTextCenterX("Warte auf Respawn...", GUCView.GetScreenSize().Y - 100);
     textVis.Font = GUCView.Fonts.Menu;
 }