Ejemplo n.º 1
0
        protected virtual void SetPhase(GamePhase phase)
        {
            this.Phase = phase;
            if (phase == GamePhase.WarmUp)
            {
                PhaseEndTime = GameTime.Ticks + Scenario.WarmUpDuration;
            }
            else if (phase == GamePhase.FadeOut)
            {
                PhaseEndTime = GameTime.Ticks + FadeOutDuration;
            }
            else
            {
                PhaseEndTime = GameTime.Ticks + Scenario.FightDuration;
            }

            if (Phase != GamePhase.WarmUp)
            {
                MissionScreen.Hide();
            }

            OnPhaseChange?.Invoke();

            Log.Logger.Log("Set phase " + phase);
        }
Ejemplo n.º 2
0
        static void SetPhase(HordePhase phase)
        {
            string screenMsg;

            switch (phase)
            {
            case HordePhase.WarmUp:
                screenMsg = "warmup";
                break;

            case HordePhase.Fight:
                screenMsg = "Fight!";
                break;

            case HordePhase.Stand:
                screenMsg = "Stand";
                break;

            case HordePhase.Victory:
                screenMsg = "Sieg!";
                HordeBoardScreen.Instance.Open();
                break;

            case HordePhase.Lost:
                screenMsg = "Niederlage!";
                HordeBoardScreen.Instance.Open();
                break;

            default: return;
            }

            Phase = phase;
            ScreenScrollText.AddText(screenMsg, GUI.GUCView.Fonts.Menu);
            OnPhaseChange?.Invoke(phase);
        }
Ejemplo n.º 3
0
        public static void ReadFinish(PacketReader stream)
        {
            if (!IsRunning)
            {
                return;
            }

            phase        = TOPhases.Finish;
            phaseEndTime = GameTime.Ticks + FinishDuration;
            OnPhaseChange?.Invoke();

            if (teamDef == null)
            {
                return;
            }

            TOMessage("Der Kampf ist vorüber!");

            int count = stream.ReadByte();
            List <TOTeamDef> winners = new List <TOTeamDef>(count);

            for (int i = 0; i < count; i++)
            {
                int index = stream.ReadByte();
                if (index < activeTODef.Teams.Count)
                {
                    winners.Add(activeTODef.Teams[index]);
                }
            }

            if (winners.Count == 0 || winners.Count == activeTODef.Teams.Count)
            {
                TOMessage("Unentschieden.");
            }
            else if (winners.Count == 1)
            {
                TOMessage(winners[0].Name + " hat gewonnen.");
            }
            else
            {
                string message = "";
                for (int i = 0; i < winners.Count; i++)
                {
                    message += winners[i].Name;
                    if (i < winners.Count - 2)
                    {
                        message += ", ";
                    }
                    else if (i == winners.Count - 2)
                    {
                        message += " und ";
                    }
                }
                TOMessage(message + " haben gewonnen.");
            }
        }
Ejemplo n.º 4
0
        public static void ReadEnd(PacketReader stream)
        {
            phase = TOPhases.None;
            OnPhaseChange?.Invoke();

            //TOMessage("Team Objective ist vorüber!");
            activeTODef = null;
            teamDef     = null;
            ArenaClient.Client.TOClass = null;
        }
Ejemplo n.º 5
0
        public static void ReadWarmup(PacketReader stream)
        {
            string name = stream.ReadString();

            if ((activeTODef = TODef.TryGet(name)) == null)
            {
                throw new Exception("TODef not found: " + name);
            }

            phase        = TOPhases.Warmup;
            phaseEndTime = GameTime.Ticks + WarmUpDuration;
            OnPhaseChange?.Invoke();

            TOMessage(string.Format("Team Objective '{0}' startet in wenigen Sekunden!", name));
        }
Ejemplo n.º 6
0
        public static void ReadStart(PacketReader stream)
        {
            if (!IsRunning)
            {
                return;
            }

            phase        = TOPhases.Battle;
            phaseEndTime = GameTime.Ticks + activeTODef.Duration * TimeSpan.TicksPerMinute;
            OnPhaseChange?.Invoke();

            if (teamDef == null)
            {
                return;
            }
            TOMessage("Der Kampf beginnt!");
        }
Ejemplo n.º 7
0
        public static void ReadGameInfo(PacketReader stream)
        {
            phase = (TOPhases)stream.ReadByte();
            if (phase != TOPhases.None)
            {
                string name = stream.ReadString();
                if ((activeTODef = TODef.TryGet(name)) == null)
                {
                    throw new Exception("TODef not found: " + name);
                }

                phaseEndTime = GameTime.Ticks + stream.ReadUInt() * TimeSpan.TicksPerMillisecond;
            }
            Menus.TOInfoScreen.Shown = true;

            OnPhaseChange?.Invoke();
        }
Ejemplo n.º 8
0
        static void SetPhase(HordePhase phase)
        {
            if (Phase == phase)
            {
                return;
            }

            Phase = phase;

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.HordePhase);
            stream.Write((byte)Phase);
            if (Phase == HordePhase.Stand)
            {
                stream.Write((byte)ActiveStandInst.Index);
            }

            ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered));

            OnPhaseChange?.Invoke(phase);
        }