FormAbstractClient.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using CommonAIClient.Client;
  9. using RoomService.Net.BsServer;
  10. using RoomService.Net.BsClient;
  11. using GameEditorPlugin.Win32.Runtime;
  12. using CommonLang.Protocol;
  13. using CommonAI.ZoneClient;
  14. using CommonLang;
  15. using CommonAI.RTS; using CommonLang.Vector;
  16. using CommonAI.Zone;
  17. using CommonAI.Zone.ZoneEditor;
  18. using CommonLang.Log;
  19. using GameEditorPlugin.Win32.BattleClient;
  20. using System.IO;
  21. using CommonLang.IO;
  22. using CommonLang.ByteOrder;
  23. using CommonLang.Property;
  24. using CommonAI.ZoneServer;
  25. using CommonFroms.Utils;
  26. namespace GameEditorPlugin.Win32.Runtime
  27. {
  28. public partial class FormAbstractClient : Form
  29. {
  30. // -----------------------------------------------------------------------------------------------------------------
  31. public float TurboX { get; set; }
  32. public bool IsFreeView { get; set; }
  33. public FormAbstractClient()
  34. {
  35. InitializeComponent();
  36. }
  37. protected override void OnLoad(EventArgs e)
  38. {
  39. base.OnLoad(e);
  40. this.BattlePanel.OnPanelLoaded += this.OnLoaded;
  41. this.BattlePanel.OnPanelClosed += this.OnClose;
  42. this.BattlePanel.OnTimerBeginUpdate += this.OnBeginUpdate;
  43. this.BattlePanel.OnTimerUpdate += this.OnUpdate;
  44. this.BattlePanel.OnNetworkViewClicked += this.OnNetworkViewClicked;
  45. this.BattlePanel.DisplayActor_OnRender += this.DisplayActor_OnRender;
  46. this.BattlePanel.DisplayLayer_OnRenderHUD += DisplayLayer_OnRenderHUD;
  47. this.BattlePanel.DisplayLayer_OnRenderLayer += DisplayLayer_OnRenderLayer;
  48. this.BattlePanel.Start(new BattleFactory(this));
  49. }
  50. //-----------------------------------------------------------------------------------------------------------------
  51. public class BattleFactory : IAbstractBattleFactory
  52. {
  53. public readonly FormAbstractClient form;
  54. public BattleFactory(FormAbstractClient form)
  55. {
  56. this.form = form;
  57. }
  58. public EditorTemplates DataRoot
  59. {
  60. get { return form.DataRoot; }
  61. }
  62. public AbstractBattle GenBattle()
  63. {
  64. return form.GenBattle();
  65. }
  66. public DisplayLayerWorld GenDisplay(PictureBox control)
  67. {
  68. return form.GenDisplay(control);
  69. }
  70. }
  71. //-----------------------------------------------------------------------------------------------------------------
  72. public virtual EditorTemplates DataRoot { get; }
  73. public virtual AbstractBattle GenBattle() { return null; }
  74. public virtual DisplayLayerWorld GenDisplay(PictureBox control) { return null; }
  75. protected virtual void OnLoaded() { }
  76. protected virtual void OnClose() { }
  77. protected virtual void OnBeginUpdate(int intervalMS) { }
  78. protected virtual void OnUpdate(int intervalMS) { }
  79. protected virtual void OnNetworkViewClicked() { }
  80. protected virtual void DisplayActor_OnRender(Graphics g, DisplayGameUnit unit) { }
  81. protected virtual void DisplayLayer_OnRenderHUD(Graphics g) { }
  82. protected virtual void DisplayLayer_OnRenderLayer(Graphics g) { }
  83. private void BattlePanel_Load(object sender, EventArgs e)
  84. {
  85. }
  86. }
  87. }