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(); }
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; }
protected override void OnCreate() { tdmName = Back.CreateTextCenterX("", 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", "TeamObjective zuschauen.", 340, Spectate); AddButton("Zurück", "Zurück ins Hauptmenü.", backButtonOffset, MainMenu.Menu.Open); OnEscape = MainMenu.Menu.Open; arrow = new GUCVisual(0, 0, 20, 20); arrow.SetBackTexture("R.tga"); }
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(); }
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; }
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; }
protected override void OnCreate() { title = Back.CreateTextCenterX("", 50); const int offset = 100; const int distance = 50; const int backButtonOffset = 350; int y, i = 0; while ((y = offset + i * distance) < backButtonOffset - distance) { int index = i; AddButton("CLASS", "", y, () => SelectClass(index)); i++; } AddButton("Zurück", "Zurück ins Teammenü.", backButtonOffset, TOTeamsMenu.Menu.Open); OnEscape = TOTeamsMenu.Menu.Open; }
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() { title = Back.CreateTextCenterX("", 50); const int offset = 100; const int distance = 50; const int backButtonOffset = 350; int y, i = 0; while ((y = offset + i * distance) < backButtonOffset - distance) { int index = i; AddButton("CLASS", "", y, () => SelectClass(index)); i++; } AddButton("Zuschauen", "Dem Spielmodus zuschauen.", 300, Spectate); AddButton("Zurück", "Zurück ins Hauptmenü.", backButtonOffset, Menus.MainMenu.Menu.Open); OnEscape = Menus.MainMenu.Menu.Open; }
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"); _ZoomText = vis.CreateText("Zoom +/-", 120, 10); _ZoomText.Hide(); }
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); }
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); }
public ErrorScreen() { _Text = Back.CreateTextCenterX("...", 50); _Text.SetColor(ColorRGBA.Red); Back.CreateTextCenterX("mit Esc schließen.", 150); }
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); }
internal static void Update() { int counter = 0; ServerMessages msgType; Packet packet; // Receive packets while ((packet = clientInterface.Receive()) != null) { try { receivedBytes += packet.length; packetReader.Load(packet.data, (int)packet.length); msgType = (ServerMessages)packetReader.ReadByte(); ReadMessage(msgType, packetReader); counter++; if (counter >= 1000) { counter = 0; Logger.Log("1000 Pakete hintereinander"); } } catch (Exception e) { if (packet.length >= 1) { Logger.LogError("{0}: {1}: {2}\n{3}", (ServerMessages)packet.data[0], e.Source, e.Message, e.StackTrace); } else { Logger.LogError("{0}: {1}\n{2}", e.Source, e.Message, e.StackTrace); } } finally { clientInterface.DeallocatePacket(packet); } } #region Debug Info // update only every second if (infoTimer.IsReady) { int ping = clientInterface.GetLastPing(clientInterface.GetSystemAddressFromIndex(0)); if (isDisconnected) { abortInfo.Texts[0].Text = "Verbindung geschlossen!"; abortInfo.Show(); } else if (isConnected) { if (ping > 300 || ping < 0) { abortInfo.Show(); } else { abortInfo.Hide(); } } // update ping text on screen int devIndex = 0; GUCVisualText pingText = devInfo.Texts[devIndex++]; pingText.Text = string.Format("Ping: {0}ms", ping); ColorRGBA color; if (ping <= 120) { color = new ColorRGBA((byte)(40 + 180 * ping / 120), 220, 40); } else if (ping <= 220) { color = new ColorRGBA(220, (byte)(220 - 180 * (ping - 100) / 120), 40); } else { color = new ColorRGBA(220, 40, 40); } pingText.SetColor(color); long fps = Hooks.hGame.LastElapsedTicks > 0 ? TimeSpan.TicksPerSecond / Hooks.hGame.LastElapsedTicks : 999; GUCVisualText fpsText = devInfo.Texts[devIndex++]; fpsText.Text = "FPS: " + fps; if (fps < 10) { color = new ColorRGBA(220, 40, 40); } else if (fps < 40) { color = new ColorRGBA(220, (byte)(40 + 180 * (fps - 10) / 30), 40); } else if (fps < 90) { color = new ColorRGBA((byte)(220 - 180 * (fps - 40) / 50), 220, 40); } else { color = new ColorRGBA(40, 220, 40); } fpsText.SetColor(color); devInfo.Texts[devIndex++].Text = "Spike: " + Hooks.hGame.SpikeLongest / TimeSpan.TicksPerMillisecond + "ms"; // update kB/s text on screen int kbs = (int)(receivedBytes); devInfo.Texts[devIndex++].Text = ("Net received: " + kbs + "B/s"); kbs = (int)(sentBytes); devInfo.Texts[devIndex++].Text = ("Net Sent: " + kbs + "B/s"); receivedBytes = 0; sentBytes = 0; if (World.Current != null) { devIndex = 8; devInfo.Texts[devIndex++].Text = World.Current.VobCount + " Vobs"; devInfo.Texts[devIndex++].Text = Client.guidedIDs.Count + " guided"; devInfo.Texts[devIndex++].Text = "Weather: " + World.Current.WeatherCtrl.CurrentWeight + " " + World.Current.Clock.Time.ToString(false); devInfo.Texts[devIndex++].Text = "Barrier: " + World.Current.BarrierCtrl.CurrentWeight + " " + World.Current.BarrierCtrl.EndWeight; devInfo.Texts[devIndex++].Text = "VobSounds: " + SoundHandler.VobSoundCount; devInfo.Texts[devIndex++].Text = "PosSounds: " + SoundHandler.PosSoundCount; //if (NPC.Hero != null) // devInfo.Texts[devIndex++].Text = NPC.Hero.Movement.ToString(); } } #endregion }
public WaitScreen() { _Text = Back.CreateTextCenterX("...", 50); }
static RespawnNote() { textVis = new GUCVisual().CreateTextCenterX("Warte auf Respawn...", GUCView.GetScreenSize().Y - 100); textVis.Font = GUCView.Fonts.Menu; }