Example #1
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();
        }
Example #2
0
        public static void AddText(string text, GUCView.Fonts font, ColorRGBA color, long duration = TextDuration)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }

            if (vis.Texts.Count == 0)
            {
                vis.CreateTextCenterX("", 0);
            }

            int vFontSize = GUCView.PixelToVirtualY(GUCView.GetFontSize(font));

            // push up active texts
            for (int i = endTimes.Count - 1; i >= 0; i--)
            {
                if (i == vis.Texts.Count - 1)
                {
                    vis.CreateTextCenterX("", 0);
                }

                var newText = vis.Texts[i + 1];
                var curText = vis.Texts[i];

                newText.Font = curText.Font;
                newText.SetColor(curText.GetColor());
                newText.Text = curText.Text;
                newText.SetPosY(curText.VPos.Y - vFontSize, true);
            }

            // add new text
            var visText = vis.Texts[0];

            visText.Font = font;
            visText.SetColor(color);
            visText.Text = text;
            visText.SetPosY(0xB00 - vFontSize, true);

            endTimes.Insert(0, GameTime.Ticks + duration);

            if (endTimes.Count == 1)
            {
                vis.Show();
                GUCScripts.OnUpdate += Update;
            }
        }
Example #3
0
        protected override void OnCreate()
        {
            Back.CreateTextCenterX("Kurzhilfe", 100);

            AddButton("Chatbefehle", "Eine Liste aller nutzbaren Chatbefehle.", 180, HelpChatMenu.Menu.Open);
            AddButton("RP-Guide", "Eine kurze Einführung ins Rollenspiel.", 220, HelpRPMenu.Menu.Open);

            const int offsetY = 280;
            const int dist    = 24;

            keyHelp = (GUCVisual)Back.AddChild(new GUCVisual());
            keyHelp.CreateTextCenterX("ENTER - Chat öffnen", pos[1] + offsetY + dist * 0);
            keyHelp.CreateTextCenterX("F2 - Wechsel zw. OOC-/RP-Chat", pos[1] + offsetY + dist * 1);
            keyHelp.CreateTextCenterX("T - Handelsanfrage", pos[1] + offsetY + dist * 2);
            keyHelp.CreateTextCenterX("X - Animationsmenü", pos[1] + offsetY + dist * 3);

            AddButton("Zurück", "Zurück zum Hauptmenü.", 400, MainMenu.Menu.Open);
            //OnEscape = MainMenu.Menu.Open;
        }
Example #4
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");
        }
Example #5
0
        private TDMScoreBoard() : base(ScriptMessages.TDMScoreBoard)
        {
            OnOpen += UpdateScenario;


            countdown = new GUCVisual();
            var textVis = countdown.CreateTextCenterX("", 200);

            textVis.Font = GUCView.Fonts.Menu_Hi;

            OnOpen  += StartCountdown;
            OnClose += StopCountdown;
        }
Example #6
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";
        }
Example #7
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);
            }
        }
Example #8
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);
        }