using GameEditorPlugin.Win32.Runtime; using System; using System.Collections.Generic; using System.Linq; using System.Text; using XmdsBattleClientBot.Bot; using CommonAI.Zone.ZoneEditor; using CommonAIClient.Client; using GameEditorPlugin.Win32.BattleClient; using System.Windows.Forms; using CommonAI.ZoneClient; using CommonLang.Protocol; using CommonAI.Zone; namespace XmdsBattleClientWin32.Battle { public class PanelBattle : PanelAbstractClient { public readonly BotClient bot; private static CommonLang.Vector.Vector2 s_CameraScal; public PanelBattle(BotClient bot) { this.bot = bot; base.Start(new BotBattleFactory(bot)); } protected override void timer1_Tick(object sender, EventArgs e) { if (base.DisplayWorld != null && s_CameraScal != null) { if (base.DisplayWorld.getCameraScaleX() != s_CameraScal.X || base.DisplayWorld.getCameraScaleY() != s_CameraScal.Y) { base.DisplayWorld.setCameraScale(s_CameraScal.X, s_CameraScal.Y); } } } protected override void Layer_ActorAdded(ZoneLayer layer, ZoneActor actor) { this.btn_Guard.Checked = bot.Client.BattleActor.IsGuard; } protected override void Layer_MessageReceived(ZoneLayer layer, IMessage e) { if (e is ServerExceptionB2C) { ServerExceptionB2C err = e as ServerExceptionB2C; //MessageBox.Show(over.Message + "\n" + over.StackTrace, e.GetType().Name); Console.WriteLine("ServerExceptionB2C : " + err.Message + "\r\n" + err.StackTrace); return; } base.Layer_MessageReceived(layer, e); } protected override void pictureBox1_MouseWheel(object sender, MouseEventArgs e) { base.pictureBox1_MouseWheel(sender, e); if (base.DisplayWorld != null) { s_CameraScal = new CommonLang.Vector.Vector2(base.DisplayWorld.getCameraScaleX(), base.DisplayWorld.getCameraScaleY()); } } public class BotBattleFactory : IAbstractBattleFactory { public readonly BotClient bot; public BotBattleFactory(BotClient bot) { this.bot = bot; } public EditorTemplates DataRoot { get { return bot.Client.BattleClient.DataRoot; } } public AbstractBattle GenBattle() { return bot.Client.BattleClient; } public DisplayLayerWorld GenDisplay(PictureBox control) { return new BotBattleDisplay(); } } public class BotBattleDisplay : DisplayLayerWorld { public BotBattleDisplay() { base.ShowHP = false; base.ShowLog = false; base.ShowName = false; base.ShowFlagName = false; base.ShowTerrain = false; base.ShowZ = false; } protected override void clientUpdate(int intervalMS) { } public override void Dispose() { } } } }