public override void Hide() { vis.Hide(); leftArrow.Hide(); rightArrow.Hide(); _ZoomText.Hide(); }
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); }
void SelectSlot() { slots[cursor.X, cursor.Y].IsSelected = true; ItemInst selItem = GetSelectedItem(); if (selItem == null) { descrBack.Hide(); descrVis.Hide(); } else { List <GUCVisualText> texts = descrBack.Texts; var def = selItem.Definition; //set description name texts[0].Text = def.Name; if (def.Damage != 0) { texts[3].Text = "Schaden"; texts[4].Text = def.Damage.ToString(); } else { texts[3].Text = texts[4].Text = ""; } if (def.Range != 0) { texts[5].Text = "Reichweite"; texts[6].Text = def.Range.ToString(); } else { texts[5].Text = texts[6].Text = ""; } if (def.Protection != 0) { texts[7].Text = "Schutz vor Waffen"; texts[8].Text = def.Protection.ToString(); } else { texts[7].Text = texts[8].Text = ""; } //visual vob descrVis.SetVisual(selItem.ModelDef.Visual); //show description def.PositionInVobVisual(descrVis); descrBack.Show(); descrVis.Show(); } }
public override void Close() { textBox.Enabled = false; textBox.Hide(); prefix.Hide(); StartInactivityTimer(); base.Close(); }
public override void Close() { back.Hide(); border.Hide(); tb.Hide(); tb.Enabled = false; base.Close(); }
public void ToggleBackground() { if (chatBackground.Shown) { chatBackground.Hide(); } else { chatBackground.Show(); } }
public static void Hide() { if (!shown) { return; } shown = false; GUCScripts.OnUpdate -= Update; countdown.Hide(); mission.Hide(); }
public override void Hide() { Enabled = false; foreach (Slot slot in slots) { slot.Hide(); } rightBack.Hide(); rightVis.Hide(); leftBack.Hide(); leftVis.Hide(); }
public static void TogglePlayerList() { if (vis.Shown) { vis.Hide(); PlayerInfo.OnPlayerListChange -= UpdateList; } else { vis.Show(); UpdateList(); PlayerInfo.OnPlayerListChange += UpdateList; } }
public override void Close() { base.Close(); Back.Hide(); helpVis.Hide(); for (int i = 0; i < Items.Count; i++) { Items[i].Hide(); } CurrentItem?.Deselect(); isOpen = false; }
protected virtual void End() { try { VictoryVis?.Hide(); MissionScreen.Hide(); ScoreBoard?.Close(); ActiveMode = null; NPCClass.Hero = null; } catch (Exception e) { Log.Logger.LogWarning((VictoryVis != null) + " " + (ScoreBoard != null) + " " + e.ToString()); } }
static void Update(long now) { if (TeamMode.ActiveTODef == null) { vis.Hide(); return; } if (!vis.Shown) { vis.Show(); } long timeLeft = TeamMode.PhaseEndTime - now; if (timeLeft < 0) { timeLeft = 0; } long mins = timeLeft / TimeSpan.TicksPerMinute; long secs = timeLeft % TimeSpan.TicksPerMinute / TimeSpan.TicksPerSecond; string phase; switch (TeamMode.Phase) { case TOPhases.Battle: phase = "Kampf läuft."; break; case TOPhases.Warmup: phase = "Startet in"; break; case TOPhases.Finish: phase = "Ende"; break; default: phase = TeamMode.Phase.ToString(); break; } toTime.Text = string.Format("{0} {1}:{2:00}", phase, mins, secs); }
public void UpdateSelectedTeam() { if (GameMode.IsActive && GameMode.ActiveMode is TDMMode) { int index = (int)PlayerInfo.HeroInfo.TeamID; if (index >= 0) { if (Cast.Try(items[index], out MainMenuButton button)) { arrow.SetPosY(button.VPos.Y + GUCView.PixelToVirtualY(5), true); arrow.SetPosX(button.VPos.X - GUCView.PixelToVirtualX(25), true); arrow.Show(); return; } } } arrow.Hide(); }
public void UpdateSelectedTeam() { if (TeamMode.ActiveTODef != null) { var team = TeamMode.TeamDef; int index = TeamMode.ActiveTODef.Teams.IndexOf(team); if (team != null && index >= 0) { if (Cast.Try(items[index], out MainMenuButton button)) { arrow.SetPosY(button.VPos.Y + GUCView.PixelToVirtualY(5), true); arrow.SetPosX(button.VPos.X - GUCView.PixelToVirtualX(25), true); arrow.Show(); return; } } } arrow.Hide(); }
static void Update(long now) { for (int i = endTimes.Count - 1; i >= 0; i--) { long endTime = endTimes[i]; if (endTime <= now) { vis.Texts[i].Text = ""; endTimes.RemoveAt(i); } else { } } if (endTimes.Count == 0) { vis.Hide(); GUCScripts.OnUpdate -= Update; } }
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); }
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 override void Hide() { vis.Hide(); }
void StopCountdown() { GUCScripts.OnUpdate -= UpdateCountdown; countdown.Hide(); }
public override void Hide() { vis.Hide(); back.Hide(); shown = false; }
public override void Hide() { titleVis.Hide(); }
public override void Close() { _BackgroundTexture?.Hide(); base.Close(); }