public void UpdateBackTex() { if (this.isSelected) { back.SetBackTexture((item != null && item.IsEquipped) ? TextureSlotEquipHL : TextureSlotHL); } else { back.SetBackTexture((item != null && item.IsEquipped) ? TextureSlotEquip : TextureSlot); } }
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); }
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); }
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(); }
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 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 MenuWithViewBlocker() { var screenSize = GUCView.GetScreenSize(); _BackgroundTexture = new GUCVisual(0, 0, screenSize.X, screenSize.Y); _BackgroundTexture.SetBackTexture("StartScreen.tga"); _BackgroundTexture.Font = GUCVisual.Fonts.Menu; }
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"); }
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"; }
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 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 }, }; }
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); }
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); }