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); }
protected override void OnCreate() { Back.CreateTextCenterX("TEAM DEATHMATCH", 20); Back.CreateTextCenterX("Team auswählen", 100); const int offset = 150; const int distance = 40; const int backButtonOffset = 400; int y, i = 0; while ((y = offset + i * distance) < 340 - distance) { int index = i; AddButton("TEAM", "", y, () => SelectTeam(index)); i++; } AddButton("Zuschauen", "Team Deathmatch zuschauen.", 340, Spectate); AddButton("Zurück", "Zurück ins Hauptmenü.", backButtonOffset, Menus.MainMenu.Menu.Open); OnEscape = Menus.MainMenu.Menu.Open; arrow = new GUCVisual(0, 0, 20, 20); arrow.SetBackTexture("R.tga"); }
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(); }
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); }
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(); }
protected MenuWithViewBlocker() { var screenSize = GUCView.GetScreenSize(); _BackgroundTexture = new GUCVisual(0, 0, screenSize.X, screenSize.Y); _BackgroundTexture.SetBackTexture("StartScreen.tga"); _BackgroundTexture.Font = GUCVisual.Fonts.Menu; }
public MainMenuButton(string text, string help, int x, int y, Action action, Fonts font = Fonts.Menu) { HelpText = help; vis = GUCVisualText.Create(text, x, y); visText = vis.Texts[0]; visText.Format = GUCVisualText.TextFormat.Center; vis.Font = font; OnActivate = action; }
public Slot(int x, int y) { back = new GUCVisual(x, y, SlotSize, SlotSize); back.SetBackTexture(TextureSlot); vis = new GUCVobVisual(x, y, SlotSize, SlotSize); amount = vis.CreateText("", SlotSize - 5, SlotSize - 5 - FontsizeDefault); amount.Format = GUCVisualText.TextFormat.Right; }
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"); }
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; }
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"; }
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; }
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; }
public MainMenuTextBox(string title, string help, int x, int y, int width, int titleX, int titleY, Action action) { HelpText = help; OnActivate = action; //title text titleVis = GUCVisualText.Create(title, titleX, titleY); titleVis.Font = Fonts.Menu; //background visual vis = new GUCVisual(x, y, width, height); vis.SetBackTexture(BackTexture); //text box tb = new GUCTextBox(x + 15, y + 5, width - 30, true); tb.AllowSpaces = false; Update = tb.Update; }
public MainMenuCharacter(string help, int x, int y, int w, int h) { HelpText = help; thisVob = oCNpc.Create(); vis = new GUCVobVisual(x, y, w, h) { Lighting = true, }; UpdateOrientation(); leftArrow = new GUCVisual(x + 150, y + h / 2 - 40, 15, 20); leftArrow.SetBackTexture("L.TGA"); rightArrow = new GUCVisual(x + w - 170, y + h / 2 - 40, 15, 20); rightArrow.SetBackTexture("R.TGA"); vis.CreateText("Zoom +/-", 120, 10); }
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 }, }; }
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; }
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); } }
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; }
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); }
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); }
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); }