PanelBattle.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using GameEditorPlugin.Win32.Runtime;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using XmdsBattleClientBot.Bot;
  7. using CommonAI.Zone.ZoneEditor;
  8. using CommonAIClient.Client;
  9. using GameEditorPlugin.Win32.BattleClient;
  10. using System.Windows.Forms;
  11. using CommonAI.ZoneClient;
  12. using CommonLang.Protocol;
  13. using CommonAI.Zone;
  14. namespace XmdsBattleClientWin32.Battle
  15. {
  16. public class PanelBattle : PanelAbstractClient
  17. {
  18. public readonly BotClient bot;
  19. private static CommonLang.Vector.Vector2 s_CameraScal;
  20. public PanelBattle(BotClient bot)
  21. {
  22. this.bot = bot;
  23. base.Start(new BotBattleFactory(bot));
  24. }
  25. protected override void timer1_Tick(object sender, EventArgs e)
  26. {
  27. if (base.DisplayWorld != null && s_CameraScal != null)
  28. {
  29. if (base.DisplayWorld.getCameraScaleX() != s_CameraScal.X || base.DisplayWorld.getCameraScaleY() != s_CameraScal.Y)
  30. {
  31. base.DisplayWorld.setCameraScale(s_CameraScal.X, s_CameraScal.Y);
  32. }
  33. }
  34. }
  35. protected override void Layer_ActorAdded(ZoneLayer layer, ZoneActor actor)
  36. {
  37. this.btn_Guard.Checked = bot.Client.BattleActor.IsGuard;
  38. }
  39. protected override void Layer_MessageReceived(ZoneLayer layer, IMessage e)
  40. {
  41. if (e is ServerExceptionB2C)
  42. {
  43. ServerExceptionB2C err = e as ServerExceptionB2C;
  44. //MessageBox.Show(over.Message + "\n" + over.StackTrace, e.GetType().Name);
  45. Console.WriteLine("ServerExceptionB2C : " + err.Message + "\r\n" + err.StackTrace);
  46. return;
  47. }
  48. base.Layer_MessageReceived(layer, e);
  49. }
  50. protected override void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
  51. {
  52. base.pictureBox1_MouseWheel(sender, e);
  53. if (base.DisplayWorld != null)
  54. {
  55. s_CameraScal = new CommonLang.Vector.Vector2(base.DisplayWorld.getCameraScaleX(), base.DisplayWorld.getCameraScaleY());
  56. }
  57. }
  58. public class BotBattleFactory : IAbstractBattleFactory
  59. {
  60. public readonly BotClient bot;
  61. public BotBattleFactory(BotClient bot) { this.bot = bot; }
  62. public EditorTemplates DataRoot { get { return bot.Client.BattleClient.DataRoot; } }
  63. public AbstractBattle GenBattle() { return bot.Client.BattleClient; }
  64. public DisplayLayerWorld GenDisplay(PictureBox control) { return new BotBattleDisplay(); }
  65. }
  66. public class BotBattleDisplay : DisplayLayerWorld
  67. {
  68. public BotBattleDisplay()
  69. {
  70. base.ShowHP = false;
  71. base.ShowLog = false;
  72. base.ShowName = false;
  73. base.ShowFlagName = false;
  74. base.ShowTerrain = false;
  75. base.ShowZ = false;
  76. }
  77. protected override void clientUpdate(int intervalMS)
  78. {
  79. }
  80. public override void Dispose()
  81. {
  82. }
  83. }
  84. }
  85. }