Beispiel #1
0
        private void LogXmlGEMovement(MainMessageKind mainMessageKind, KnownSubkinds gameMessageSubKind, int objId, Point point)
        {
            var el = GetEventElement(mainMessageKind.ToString(), gameMessageSubKind.ToString());

            el.Add(new XElement("pt-x", point.X),
                   new XElement("pt-y", point.Y),
                   new XElement("id-bot1", objId));
            eventsParentElement.Add(el);
        }
Beispiel #2
0
        private void LogXmlCombatEvent(MainMessageKind mainMessageKind, KnownSubkinds gameMessageSubKind, UICombatContext context)
        {
            var el = GetEventElement(mainMessageKind.ToString(), gameMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(context.GetType());
                sr.WriteObject(w, context);
            }
            eventsParentElement.Add(el);
        }
Beispiel #3
0
        private void LogSystemMessage(MainMessageKind mainMessageKind, KnownSubkinds gameMessageSubKind, SystemMessageContext ctxt4)
        {
            var el = GetEventElement(mainMessageKind.ToString(), gameMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(ctxt4.GetType());
                sr.WriteObject(w, ctxt4);
            }
            eventsParentElement.Add(el);
        }
Beispiel #4
0
        private void LogBotEnterWorld(MainMessageKind mainMessageKind, KnownSubkinds uIMessageSubKind, BotEnterWorldContext ctxtBew)
        {
            var el = GetEventElement(mainMessageKind.ToString(), uIMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(ctxtBew.GetType());
                sr.WriteObject(w, ctxtBew);
            }
            eventsParentElement.Add(el);
        }
Beispiel #5
0
        private void LogXmlNavigationEvent(MainMessageKind mainMessageKind, KnownSubkinds uIMessageSubKind, NavigationInfoContext nic)
        {
            var el = GetEventElement(mainMessageKind.ToString(), uIMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(nic.GetType());
                sr.WriteObject(w, nic);
            }
            eventsParentElement.Add(el);
        }
Beispiel #6
0
        private void LogXmlBotStatusEvent2(MainMessageKind mainMessageKind, KnownSubkinds uIMessageSubKind, BotStatusRequestContext ctxt)
        {
            var el = GetEventElement(mainMessageKind.ToString(), uIMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(ctxt.GetType());
                sr.WriteObject(w, ctxt);
            }

            eventsParentElement.Add(el);
        }
Beispiel #7
0
        protected override void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc)
        {
            string msgtxt;

            if (bdc.Reason == BotEndReason.Depleted)
            {
                msgtxt = GetContestantName(bdc.BotId) + " Is Depleted......";
            }
            else
            {
                msgtxt = GetContestantName(bdc.BotId) + " DIES! ";
            }
            Console.WriteLine(msgtxt);
        }
Beispiel #8
0
        protected override void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nic)
        {
            string msgtxt;

            if (subKind == KnownSubkinds.ChangeDirection)
            {
                msgtxt = string.Format(GetContestantName(nic.BotId) + " changes to direction " + nic.NewHeading.ToString());
            }
            else
            {
                msgtxt = string.Format(GetContestantName(nic.BotId) + " changes speed " + nic.SpeedDelta.ToString());
            }
            Console.WriteLine(msgtxt);
        }
Beispiel #9
0
        protected override void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc)
        {
            string msgtxt;

            if (bdc.Reason == BotEndReason.Depleted)
            {
                msgtxt = GetContestantName(bdc.BotId) + " Is Depleted......";
                LogXmlBotCombatEvent("UI", subKind.ToString(), bdc.BotId);
            }
            else
            {
                msgtxt = GetContestantName(bdc.BotId) + " DIES! ";
                LogBotDeathEvent(messageKind, subKind, bdc);
            }
        }
Beispiel #10
0
        protected override void ActualWeaponFire_UI(MainMessageKind messageKind, KnownSubkinds subKind, UICombatContext ctxt)
        {
            string nm       = GetContestantName(ctxt.AggressorId);
            string vnm      = GetContestantName(ctxt.VictimId);
            int    weaponId = ctxt.WeaponTypeId;
            string endText  = " but MISSES!  ";

            if (ctxt.DidHit)
            {
                endText = " and hits for " + ctxt.Damage.ToString() + "  ";
            }
            string msgtxt = nm + " shoots at " + vnm + " W[" + weaponId.ToString() + "]" + endText;

            Console.WriteLine(msgtxt);
        }
Beispiel #11
0
        private void LogStructureMessage(MainMessageKind mainMessageKind, KnownSubkinds gameMessageSubKind, GameStructureNotificationContext ctxt2)
        {
            var el = GetEventElement(mainMessageKind.ToString(), gameMessageSubKind.ToString());

            using (var w = el.CreateWriter()) {
                var sr = new DataContractSerializer(ctxt2.GetType());
                sr.WriteObject(w, ctxt2);
            }

            eventsParentElement.Add(el);
            ActiveTurn = ctxt2.Turn;
            ActiveTick = ctxt2.Tick;
            if (gameMessageSubKind == KnownSubkinds.TurnStart)
            {
                if ((ctxt2.Turn > 0) && (ctxt2.Turn % TURNS_BEFORE_WRITE == 0))
                {
                    CloseDownAndRecreateXDocument();
                }
            }
        }
Beispiel #12
0
 public Message_Query(MainMessageKind topType, KnownSubkinds subtype)
     : base(topType, subtype)
 {
 }
Beispiel #13
0
        protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc)
        {
            string msgtxt = GetContestantName(smc.BotId) + " says .... " + smc.Message;

            Console.WriteLine(msgtxt);
        }
Beispiel #14
0
 protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc)
 {
     // do nothing
 }
Beispiel #15
0
 protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc)
 {
     UIMessageCount++;
 }
Beispiel #16
0
 public MockBDMessage(MainMessageKind kind, KnownSubkinds subKind)
     : base(kind, KnownSubkinds.MockMessage)
 {
 }
Beispiel #17
0
 protected abstract void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc);
Beispiel #18
0
 protected abstract void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd);
Beispiel #19
0
 public Message_GameCombat(MainMessageKind kind, KnownSubkinds subKind)
     : base(kind, subKind)
 {
 }
Beispiel #20
0
 protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc)
 {
     LogBotMessage(messageKind, subKind, smc);
 }
Beispiel #21
0
        protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc)
        {
            string msgtxt = "End Game : " + egrc.EndGameDataDump;

            Console.WriteLine(msgtxt);
        }
Beispiel #22
0
 protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc)
 {
     UIMessageCount++;
 }
Beispiel #23
0
 protected abstract void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc);
Beispiel #24
0
 protected override void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd)
 {
     UIMessageCount++;
 }
Beispiel #25
0
 protected abstract void ActualWeaponFire_UI(MainMessageKind messageKind, KnownSubkinds subKind, UICombatContext ctxt);
Beispiel #26
0
 protected override void ActualWeaponFire_UI(MainMessageKind messageKind, KnownSubkinds subKind, UICombatContext ctxt)
 {
     UIMessageCount++;
 }
Beispiel #27
0
 protected abstract void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc);
Beispiel #28
0
 protected override void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc)
 {
     UIMessageCount++;
 }
Beispiel #29
0
 public Message_Ui(MainMessageKind kind, KnownSubkinds subKind)
     : base(kind, subKind)
 {
 }
Beispiel #30
0
 protected override void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd)
 {
     LogXmlNavigationEvent(messageKind, subKind, nicspd);
 }