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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } }
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); }
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(); } } }
public Message_Query(MainMessageKind topType, KnownSubkinds subtype) : base(topType, subtype) { }
protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc) { string msgtxt = GetContestantName(smc.BotId) + " says .... " + smc.Message; Console.WriteLine(msgtxt); }
protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc) { // do nothing }
protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc) { UIMessageCount++; }
public MockBDMessage(MainMessageKind kind, KnownSubkinds subKind) : base(kind, KnownSubkinds.MockMessage) { }
protected abstract void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc);
protected abstract void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd);
public Message_GameCombat(MainMessageKind kind, KnownSubkinds subKind) : base(kind, subKind) { }
protected override void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc) { LogBotMessage(messageKind, subKind, smc); }
protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc) { string msgtxt = "End Game : " + egrc.EndGameDataDump; Console.WriteLine(msgtxt); }
protected override void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc) { UIMessageCount++; }
protected abstract void ActualEndGame_UI(MainMessageKind messageKind, KnownSubkinds subKind, EndGameRequestContext egrc);
protected override void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd) { UIMessageCount++; }
protected abstract void ActualWeaponFire_UI(MainMessageKind messageKind, KnownSubkinds subKind, UICombatContext ctxt);
protected override void ActualWeaponFire_UI(MainMessageKind messageKind, KnownSubkinds subKind, UICombatContext ctxt) { UIMessageCount++; }
protected abstract void ActualOnBotMessage_UI(MainMessageKind messageKind, KnownSubkinds subKind, SystemMessageContext smc);
protected override void ActualBotEndEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, BotEndContext bdc) { UIMessageCount++; }
public Message_Ui(MainMessageKind kind, KnownSubkinds subKind) : base(kind, subKind) { }
protected override void ActualNavitationEvent_UI(MainMessageKind messageKind, KnownSubkinds subKind, NavigationInfoContext nicspd) { LogXmlNavigationEvent(messageKind, subKind, nicspd); }