Exemplo n.º 1
0
        public GUCInventory(int x, int y, int cols, int rows, string backTex = TextureBackgroundDefault)
        {
            // create the background
            back = new GUCVisual(x, y, cols * SlotSize, rows * SlotSize);
            back.SetBackTexture(backTex);

            // create the slots
            slots = new Slot[cols, rows];
            for (int i = 0; i < cols; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    slots[i, j] = new Slot(x + i * SlotSize, y + j * SlotSize);
                }
            }

            // create the description
            descrBack = new GUCVisual((GetScreenSize().X - DescriptionBoxWidth) / 2, GetScreenSize().Y - DescriptionBoxHeight - 30, DescriptionBoxWidth, DescriptionBoxHeight);
            descrBack.SetBackTexture(backTex);   // "Inv_Desc.tga");

            descrBack.CreateTextCenterX("", 10); // title

            const int descrTextDist = FontsizeDefault - 3;

            for (int i = 0; i < 6; i++) // six info rows
            {
                descrBack.CreateText("", 20, 60 + i * descrTextDist);
                GUCVisualText count = descrBack.CreateText("", DescriptionBoxWidth - 20, 60 + i * descrTextDist);
                count.Format = GUCVisualText.TextFormat.Right;
            }

            descrVis = new GUCVobVisual(GetScreenSize().X / 2 + 160, GetScreenSize().Y - 128 - 48, 128, 128);

            // create the right info box
            rightBack = new GUCVisual(x + (cols - 2) * SlotSize, y - 20 - 35, 2 * SlotSize, 35);
            rightBack.SetBackTexture(backTex);
            rightVis = new GUCVisual(x + (cols - 2) * SlotSize, y - 20 - 35, 2 * SlotSize, 35);
            rightVis.SetBackTexture(TextureTitle);
            rightText    = rightVis.CreateText("Gold: 0");
            RightInfoBox = "GOLD";

            // create the left info box
            leftBack = new GUCVisual(x, y - 20 - 35, 2 * SlotSize, 35);
            leftBack.SetBackTexture(backTex);
            leftVis = new GUCVisual(x, y - 20 - 35, 2 * SlotSize, 35);
            leftVis.SetBackTexture(TextureTitle);
            leftText    = leftVis.CreateText("Gewicht: 0");
            LeftInfoBox = "WEIGHT";
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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");
        }
Exemplo n.º 7
0
        public ScoreBoard()
        {
            var screen = GetScreenSize();
            int height = screen.Y - YDistance * 2;

            titleVis       = new GUCVisual(0, 0, Width, height - FontsizeMenu);
            titleText      = titleVis.CreateTextCenterX("", 0);
            titleText.Font = Fonts.Menu;

            vis = new GUCVisual(0, FontsizeMenu, Width, height);
            vis.SetBackTexture(BackTex);

            int x = xOffset; int y = yOffset;

            vis.CreateText("Name", x, y); x   += NameWidth;
            vis.CreateText("Punkte", x, y); x += ScoreWidth;
            vis.CreateText("Kills", x, y); x  += KillsWidth;
            vis.CreateText("Tode", x, y); x   += DeathsWidth;
            vis.CreateText("Ping", x, y);

            int bottom = y + height - GUCView.FontsizeDefault;

            y += 5;

            while (y < bottom)
            {
                GUCVisualText t;
                x  = xOffset;
                y += FontsizeDefault;

                vis.CreateText("", x, y); x += NameWidth;
                t = vis.CreateText("", x + ScoreWidth / 2, y); x += ScoreWidth; t.Format = GUCVisualText.TextFormat.Center;
                t = vis.CreateText("", x + KillsWidth / 2, y); x += KillsWidth; t.Format = GUCVisualText.TextFormat.Center;
                t = vis.CreateText("", x + DeathsWidth / 2, y); x += DeathsWidth; t.Format = GUCVisualText.TextFormat.Center;
                t = vis.CreateText("", x + PingWidth / 2, y); x += PingWidth; t.Format = GUCVisualText.TextFormat.Center;
            }

            titleVis.AddChild(vis);
        }
Exemplo n.º 8
0
        public MainMenuChoice(string title, string help, int x, int y, Dictionary <int, string> choices, bool sorted, Action OnActivate, Action OnChange)
        {
            HelpText        = help;
            this.sorted     = sorted;
            this.OnActivate = OnActivate;
            this.OnChange   = OnChange;

            titleVis = GUCVisualText.Create(title, x + (width - (int)StringPixelWidth(title)) / 2, y - 15);

            vis = new GUCVisual(x, y, width, height);
            vis.SetBackTexture("Menu_Choice_Back.tga");
            vis.CreateText("");

            sorted  = false;
            Choices = choices;
        }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        protected override void OnCreate()
        {
            Back.SetBackTexture("STATUS_BACK.TGA");

            stat = new GUCVisual(pos[0], pos[1], 640, 480); //for small fonts
            Back.AddChild(stat);

            // left side

            const int dist = GUCView.FontsizeDefault;

            GUCVisualText title = stat.CreateText("CHARAKTERPROFIL", 152, 59);

            title.Format = GUCVisualText.TextFormat.Center;
            const int cpyoffset = 84;
            const int cpx1 = 39; const int cpx2 = 180;

            guild = stat.CreateText("Gildenlos", cpx1, cpyoffset); stat.CreateText("Stufe", cpx2, cpyoffset); level = stat.CreateText("0", cpx2 + 55, cpyoffset);
            stat.CreateText("Erfahrung", cpx1, cpyoffset + dist); exp             = stat.CreateText("0", cpx2, cpyoffset + dist);
            stat.CreateText("Nächste Stufe", cpx1, cpyoffset + dist * 2); nextExp = stat.CreateText("500", cpx2, cpyoffset + dist * 2);
            stat.CreateText("Lernpunkte", cpx1, cpyoffset + dist * 3); LP         = stat.CreateText("0", cpx2, cpyoffset + dist * 3);
            stat.CreateText("Talentpunkte", cpx1, cpyoffset + dist * 4); TP       = stat.CreateText("0", cpx2, cpyoffset + dist * 4);

            title        = stat.CreateText("ATTRIBUTE", 152, 190);
            title.Format = GUCVisualText.TextFormat.Center;
            const int atyoffset = 215;

            stat.CreateText("Stärke", cpx1, atyoffset); str              = stat.CreateText("10/10", cpx2, atyoffset);
            stat.CreateText("Geschick", cpx1, atyoffset + dist); dex     = stat.CreateText("10/10", cpx2, atyoffset + dist);
            stat.CreateText("Weisheit", cpx1, atyoffset + dist * 2); wis = stat.CreateText("10/10", cpx2, atyoffset + dist * 2);
            const int trimdist = 4;

            stat.CreateText("Lebensenergie", cpx1, trimdist + atyoffset + dist * 3); hp = stat.CreateText("100/100", cpx2, trimdist + atyoffset + dist * 3);
            stat.CreateText("Mana", cpx1, trimdist + atyoffset + dist * 4); mp          = stat.CreateText("10/10", cpx2, trimdist + atyoffset + dist * 4);
            stat.CreateText("Ausdauer", cpx1, trimdist + atyoffset + dist * 5); ap      = stat.CreateText("100/100", cpx2, trimdist + atyoffset + dist * 5);

            title        = stat.CreateText("RÜSTUNGSSCHUTZ", 152, 347);
            title.Format = GUCVisualText.TextFormat.Center;
            const int rsyoffset = 371; const int rsx2 = 230;

            stat.CreateText("vor Waffen", cpx1, rsyoffset); protW                  = stat.CreateText("0", rsx2, rsyoffset);
            stat.CreateText("vor Geschossen", cpx1, rsyoffset + dist); protR       = stat.CreateText("0", rsx2, rsyoffset + dist);
            stat.CreateText("vor Drachenfeuer", cpx1, rsyoffset + dist * 2); protF = stat.CreateText("0", rsx2, rsyoffset + dist * 2);
            stat.CreateText("vor Magie", cpx1, rsyoffset + dist * 3); protM        = stat.CreateText("0", rsx2, rsyoffset + dist * 3);

            // right side

            const int dist2 = GUCView.FontsizeMenu;

            const int tx = 450; const int ty1 = 80;

            title        = stat.CreateText("TALENTE", tx, 59);
            title.Format = GUCVisualText.TextFormat.Center;
            AddButton("Kampf", "", tx, ty1, null);
            AddButton("Magie", "", tx, ty1 + dist2, null);
            AddButton("Diebeskunst", "", tx, ty1 + 2 * dist2, null);

            title        = stat.CreateText("FERTIGKEITEN", tx, 191);
            title.Format = GUCVisualText.TextFormat.Center;
            const int ty2 = 217;

            AddButton("Handwerker", "", tx, ty2, null);
            AddButton("Waffenschmied", "", tx, ty2 + dist2, null);
            AddButton("Schmied", "", tx, ty2 + 2 * dist2, null);
            AddButton("Jäger & Sammler", "", tx, ty2 + 3 * dist2, null);
            AddButton("Verpfleger", "", tx, ty2 + 4 * dist2, null);
            AddButton("Alchemist", "", tx, ty2 + 5 * dist2, null);
            AddButton("Gelehrter", "", tx, ty2 + 6 * dist2, null);
        }