FormTestClient.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. using ZeusServerNode.Node;
  15. using ZeusServerNode.Node.Interface;
  16. namespace ZeusServerTest
  17. {
  18. public class FormTestClient : FormAbstractClient
  19. {
  20. // -----------------------------------------------------------------------------------------------------------------
  21. private ZoneNode mNode;
  22. private NodeTestBattleClient mBattle;
  23. private float mClientSyncInRange;
  24. private float mClientSyncOutRange;
  25. public FormTestClient(NodeTestBattleClient client)
  26. {
  27. this.Text = client.PlayerUUID;
  28. this.mNode = client.Node;
  29. this.mBattle = client;
  30. this.mClientSyncInRange = Math.Min(
  31. ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_IN_RANGE,
  32. ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_OUT_RANGE);
  33. this.mClientSyncOutRange = Math.Max(
  34. ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_IN_RANGE,
  35. ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_OUT_RANGE);
  36. }
  37. //--------------------------------------------------------------------------------------------
  38. public override EditorTemplates DataRoot
  39. {
  40. get { return ZoneNodeManager.Templates; }
  41. }
  42. public override AbstractBattle GenBattle()
  43. {
  44. return mBattle;
  45. }
  46. public override DisplayLayerWorld GenDisplay(PictureBox control)
  47. {
  48. return new DisplayLayerWorld();
  49. }
  50. protected override void OnLoaded()
  51. {
  52. this.BattlePanel.DisplayWorld.SpaceDIV = mNode.Zone.SpaceDIV;
  53. this.BattlePanel.DisplayWorld.ShowGrid = true;
  54. this.BattlePanel.DisplayWorld.ShowHP = true;
  55. this.BattlePanel.DisplayWorld.ShowLog = true;
  56. this.BattlePanel.DisplayWorld.ShowZ = true;
  57. this.BattlePanel.DisplayWorld.Layer.ActorSyncMode = CommonAI.ZoneClient.SyncMode.MoveByClient_PreSkillByClient;
  58. mBattle.Layer.ActorAdded += Layer_ActorAdded;
  59. mBattle.Layer.MessageReceived += Layer_MessageReceived;
  60. mBattle.Start();
  61. }
  62. protected override void OnClose()
  63. {
  64. mBattle.Stop();
  65. }
  66. //--------------------------------------------------------------------------------------------
  67. private void Layer_ActorAdded(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  68. {
  69. }
  70. private void Layer_MessageReceived(CommonAI.ZoneClient.ZoneLayer layer, IMessage msg)
  71. {
  72. }
  73. protected override void DisplayActor_OnRender(Graphics g, DisplayGameUnit unit)
  74. {
  75. Pen pen = new Pen(Color.FromArgb(128, 255, 255, 255));
  76. pen.Width = 1f / BattlePanel.DisplayWorld.getCameraScale();
  77. g.DrawArc(pen,
  78. -mClientSyncInRange,
  79. -mClientSyncInRange,
  80. mClientSyncInRange * 2,
  81. mClientSyncInRange * 2,
  82. 0, 360);
  83. g.DrawArc(pen,
  84. -mClientSyncOutRange,
  85. -mClientSyncOutRange,
  86. mClientSyncOutRange * 2,
  87. mClientSyncOutRange * 2,
  88. 0, 360);
  89. }
  90. }
  91. }