FormTestClient.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.ZoneEditor;
  3. using CommonAIClient.Client;
  4. using CommonLang;
  5. using CommonLang.Protocol;
  6. using GameEditorPlugin.Win32.BattleClient;
  7. using GameEditorPlugin.Win32.Runtime;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. namespace ZeusServerTestClient
  15. {
  16. public class FormTestClient : FormAbstractClient
  17. {
  18. private NodeTestBattleClient mBattle;
  19. private float mClientSyncInRange;
  20. private float mClientSyncOutRange;
  21. public FormTestClient()
  22. {
  23. }
  24. //--------------------------------------------------------------------------------------------
  25. public override EditorTemplates DataRoot
  26. {
  27. get { return mBattle.DataRoot; }
  28. }
  29. public override AbstractBattle GenBattle()
  30. {
  31. return mBattle;
  32. }
  33. public override DisplayLayerWorld GenDisplay(PictureBox control)
  34. {
  35. return new DisplayLayerWorld();
  36. }
  37. protected override void OnLoaded()
  38. {
  39. this.BattlePanel.DisplayWorld.SpaceDIV = mNode.Zone.SpaceDIV;
  40. this.BattlePanel.DisplayWorld.ShowGrid = true;
  41. this.BattlePanel.DisplayWorld.ShowHP = true;
  42. this.BattlePanel.DisplayWorld.ShowLog = true;
  43. this.BattlePanel.DisplayWorld.ShowZ = true;
  44. this.BattlePanel.DisplayWorld.Layer.ActorSyncMode = CommonAI.ZoneClient.SyncMode.MoveByClient_PreSkillByClient;
  45. mBattle.Layer.ActorAdded += Layer_ActorAdded;
  46. mBattle.Layer.MessageReceived += Layer_MessageReceived;
  47. mBattle.Start();
  48. }
  49. protected override void OnClose()
  50. {
  51. mBattle.Stop();
  52. }
  53. //--------------------------------------------------------------------------------------------
  54. private void Layer_ActorAdded(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  55. {
  56. }
  57. private void Layer_MessageReceived(CommonAI.ZoneClient.ZoneLayer layer, IMessage msg)
  58. {
  59. }
  60. protected override void DisplayActor_OnRender(Graphics g, DisplayGameUnit unit)
  61. {
  62. Pen pen = new Pen(Color.FromArgb(128, 255, 255, 255));
  63. pen.Width = 1f / BattlePanel.DisplayWorld.getCameraScale();
  64. g.DrawArc(pen,
  65. -mClientSyncInRange,
  66. -mClientSyncInRange,
  67. mClientSyncInRange * 2,
  68. mClientSyncInRange * 2,
  69. 0, 360);
  70. g.DrawArc(pen,
  71. -mClientSyncOutRange,
  72. -mClientSyncOutRange,
  73. mClientSyncOutRange * 2,
  74. mClientSyncOutRange * 2,
  75. 0, 360);
  76. }
  77. }
  78. }