using CommonAI.Zone; using CommonAI.Zone.ZoneEditor; using CommonAIClient.Client; using CommonLang; using CommonLang.Protocol; using GameEditorPlugin.Win32.BattleClient; using GameEditorPlugin.Win32.Runtime; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using ZeusServerNode.Node; using ZeusServerNode.Node.Interface; namespace ZeusServerTest { public class FormTestClient : FormAbstractClient { // ----------------------------------------------------------------------------------------------------------------- private ZoneNode mNode; private NodeTestBattleClient mBattle; private float mClientSyncInRange; private float mClientSyncOutRange; public FormTestClient(NodeTestBattleClient client) { this.Text = client.PlayerUUID; this.mNode = client.Node; this.mBattle = client; this.mClientSyncInRange = Math.Min( ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_IN_RANGE, ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_OUT_RANGE); this.mClientSyncOutRange = Math.Max( ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_IN_RANGE, ZoneNodeManager.NodeConfig.CLIENT_SYNC_OBJECT_OUT_RANGE); } //-------------------------------------------------------------------------------------------- public override EditorTemplates DataRoot { get { return ZoneNodeManager.Templates; } } public override AbstractBattle GenBattle() { return mBattle; } public override DisplayLayerWorld GenDisplay(PictureBox control) { return new DisplayLayerWorld(); } protected override void OnLoaded() { this.BattlePanel.DisplayWorld.SpaceDIV = mNode.Zone.SpaceDIV; this.BattlePanel.DisplayWorld.ShowGrid = true; this.BattlePanel.DisplayWorld.ShowHP = true; this.BattlePanel.DisplayWorld.ShowLog = true; this.BattlePanel.DisplayWorld.ShowZ = true; this.BattlePanel.DisplayWorld.Layer.ActorSyncMode = CommonAI.ZoneClient.SyncMode.MoveByClient_PreSkillByClient; mBattle.Layer.ActorAdded += Layer_ActorAdded; mBattle.Layer.MessageReceived += Layer_MessageReceived; mBattle.Start(); } protected override void OnClose() { mBattle.Stop(); } //-------------------------------------------------------------------------------------------- private void Layer_ActorAdded(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor) { } private void Layer_MessageReceived(CommonAI.ZoneClient.ZoneLayer layer, IMessage msg) { } protected override void DisplayActor_OnRender(Graphics g, DisplayGameUnit unit) { Pen pen = new Pen(Color.FromArgb(128, 255, 255, 255)); pen.Width = 1f / BattlePanel.DisplayWorld.getCameraScale(); g.DrawArc(pen, -mClientSyncInRange, -mClientSyncInRange, mClientSyncInRange * 2, mClientSyncInRange * 2, 0, 360); g.DrawArc(pen, -mClientSyncOutRange, -mClientSyncOutRange, mClientSyncOutRange * 2, mClientSyncOutRange * 2, 0, 360); } } }