void NextMessage() { if (ActiveStand == null || messageIndex >= ActiveStand.Messages.Length) { messageTimer.Stop(); return; } Log.Logger.Log(ActiveStand.Messages[messageIndex]); ChatMenu.Menu.AddMessage(ChatMode.Private, ActiveStand.Messages[messageIndex++]); }
static void Deactivate() { if (!isActive) { return; } isActive = false; SetLockedTarget(null); timer.Stop(); }
protected virtual void Start(GameScenario scenario) { this.Scenario = scenario; var stream = ArenaClient.GetStream(ScriptMessages.ModeStart); stream.Write(scenario.Name); ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered)); Phase = GamePhase.None; phaseTimer.Stop(); }
public void Remove(ArenaClient client) { if (clients.TryGetValue(client, out GUCTimer timer)) { timer.Stop(); clients.Remove(client); if (clients.Count == 0) { packetTimer.Stop(); } } }
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); }
public override void Open() { if (shown) { return; } SendToggleMessage(true); OnOpen?.Invoke(); for (int i = 0; i < boardCount; i++) { boards[i].Show(); } openTime = GameTime.Ticks; closeTimer.Stop(); shown = true; }
void EndStand() { if (ActiveStand == null) { return; } standSpawnTimer.Stop(); Stands.Remove(ActiveStand); foreach (var v in ActiveStand.Barriers) { v.Despawn(); } foreach (var bar in ActiveStand.Stand.Barriers) { if (bar.AddAfterEvent) { CreateBarrier(bar); } } if (ActiveStand.Stand.KillSpawnsOnEnd) { foreach (var npc in AliveStandEnemies) { npc.OnDeath -= OnStandSpawnDeath; npc.SetHealth(0); } AliveStandEnemies.Clear(); } ActiveStand = null; if (Stands.Count == 0) { HordeFadeOut(true); } else { standTimer.SetInterval(TimeSpan.TicksPerSecond); standTimer.SetCallback(CheckStandDistance); SetPhase(GamePhase.Fight); } Log.Logger.Log("end stand"); }
void HordeFadeOut(bool playersWon) { if (Phase == GamePhase.FadeOut) { return; } standSpawnTimer.Stop(); standTimer.Stop(); if (playersWon) { var stream = ArenaClient.GetStream(ScriptMessages.HordeWin); players.ForEach(p => { p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); if (p.IsCharacter) { p.Character.LiftUnconsciousness(); } }); var agent = CreateAgent(); foreach (var npc in AmbientNPCs) { npc.BaseInst.SetNeedsClientGuide(true); agent.Add(npc); } } else { var stream = ArenaClient.GetStream(ScriptMessages.HordeLoss); players.ForEach(p => { p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); if (p.IsCharacter) { p.Character.SetHealth(0); } }); ClearAgents(); } base.FadeOut(); }
protected override void FadeOut() { int max = teams.Max(t => t.Score); int count = teams.Count(t => t.Score == max); var stream = ArenaClient.GetStream(ScriptMessages.TDMWin); stream.Write((byte)count); for (byte i = 0; i < teams.Count; i++) { if (teams[i].Score == max) { stream.Write(i); } } players.ForEach(p => p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable)); base.FadeOut(); respawnTimer.Stop(); NPCInst.sOnHit -= OnHit; }
public void LiftUnconsciousness() { if (!IsUnconscious) { return; } var cat = AniCatalog.Unconscious; ScriptAniJob job = _Uncon == Unconsciousness.Front ? cat.StandUpFront : cat.StandUpBack; if (job != null) { ModelInst.StartAniJob(job, DoLiftUncon); } else { DoLiftUncon(); } if (unconTimer != null && unconTimer.Started) { unconTimer.Stop(); } }
public void StopRainTimer() { rainTimer.Stop(); }
public void StopTimer() { _Timer.Stop(); HideBarrier(); }
public static void StartHorde(HordeDef def) { if (def == null) { return; } Log.Logger.Log("horde init"); ArenaClient.ForEach(c => { var client = (ArenaClient)c; client.HordeScore = 0; client.HordeDeaths = 0; client.HordeKills = 0; client.HordeClass = null; }); players.ForEach(c => c.Spectate()); players.Clear(); if (activeWorld != null) { activeWorld.BaseWorld.ForEachVob(v => v.Despawn()); } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.HordeStart); stream.Write(def.Name); ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered)); activeDef = def; activeWorld = WorldInst.List.Find(w => w.Path == def.WorldPath); spawnBarriers.Clear(); foreach (var bar in activeDef.SpawnBarriers) { if (!bar.AddAfterEvent) { spawnBarriers.Add(CreateBarrier(bar)); } } ActiveStands.Clear(); for (int i = 0; i < activeDef.Stands.Length; i++) { var stand = activeDef.Stands[i]; StandInst inst = new StandInst() { Index = i, Stand = stand, }; if (stand.Boss != null) { inst.Boss = SpawnEnemy(stand.Boss, stand.Position); inst.Boss.CanGetHit += BossProtection; } inst.Barriers = new List <VobInst>(stand.Barriers.Length); foreach (var bar in stand.Barriers) { if (!bar.AddAfterEvent) { inst.Barriers.Add(CreateBarrier(bar)); } } ActiveStands.Add(inst); } foreach (var hi in activeDef.Items) { ItemInst item = new ItemInst(ItemDef.Get(hi.ItemDef)); item.Spawn(activeWorld, hi.Position, hi.Angles); } standEnemyCount = 0; ActiveStandInst = null; gameTimer.SetInterval(30 * TimeSpan.TicksPerSecond); gameTimer.SetCallback(Start); gameTimer.Stop(); SetPhase(HordePhase.WarmUp); }