예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #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();
                }
            }
        }
예제 #12
0
 public Message_Query(MainMessageKind topType, KnownSubkinds subtype)
     : base(topType, subtype)
 {
 }
예제 #13
0
        protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc)
        {
            string msgtxt = GetContestantName(smc.BotId) + " says .... " + smc.Message;

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

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