PanelAbstractClient.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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;
  16. using CommonLang.Vector;
  17. using CommonAI.Zone;
  18. using CommonAI.Zone.ZoneEditor;
  19. using CommonLang.Log;
  20. using GameEditorPlugin.Win32.BattleClient;
  21. using System.IO;
  22. using CommonLang.IO;
  23. using CommonLang.ByteOrder;
  24. using CommonLang.Property;
  25. using CommonAI.ZoneServer;
  26. using CommonFroms.Utils;
  27. using CommonFroms;
  28. using CommonFroms.G2D;
  29. using CommonAI.ZoneClient.Agent;
  30. namespace GameEditorPlugin.Win32.Runtime
  31. {
  32. public partial class PanelAbstractClient : UserControl
  33. {
  34. // -----------------------------------------------------------------------------------------------------------------
  35. protected readonly Logger log = LoggerFactory.GetLogger("Client");
  36. public IAbstractBattleFactory BattleFactory { get; private set; }
  37. public EditorTemplates DataRoot { get { return BattleFactory.DataRoot; } }
  38. public AbstractBattle BattleClient { get { return battle; } }
  39. public DisplayLayerWorld DisplayWorld { get { return display; } }
  40. public DisplayGameUnit DisplayActor { get { return displayActor; } }
  41. private AbstractBattle battle;
  42. private DisplayLayerWorld display;
  43. private DisplayGameUnit displayActor;
  44. private long mLastUpdateTime;
  45. public float TurboX { get; set; }
  46. public bool IsFreeView { get { return btn_FreeView.Checked || displayActor == null || !displayActor.Data.IsActive; } }
  47. public bool IsActorGuard
  48. {
  49. get
  50. {
  51. if (BattleClient.Actor != null)
  52. {
  53. return BattleClient.Actor.IsGuard;
  54. }
  55. return false;
  56. }
  57. set
  58. {
  59. btn_Guard.Checked = value;
  60. if (BattleClient.Actor != null)
  61. {
  62. BattleClient.Actor.SendUnitGuard(btn_Guard.Checked);
  63. }
  64. }
  65. }
  66. public int RenderFPS
  67. {
  68. get
  69. {
  70. return this.timer1.Interval / 1000;
  71. }
  72. set
  73. {
  74. this.timer1.Interval = Math.Max(10, 1000 / value);
  75. }
  76. }
  77. public PanelAbstractClient()
  78. {
  79. InitializeComponent();
  80. this.TurboX = 1;
  81. this.Disposed += PanelAbstractClient_Disposed;
  82. }
  83. protected override void DestroyHandle()
  84. {
  85. base.DestroyHandle();
  86. event_OnPanelLoaded = null;
  87. event_OnPanelClosed = null;
  88. event_OnTimerBeginUpdate = null;
  89. event_OnTimerUpdate = null;
  90. event_OnNetworkViewClicked = null;
  91. event_DisplayActor_OnRender = null;
  92. event_DisplayLayer_OnRenderHUD = null;
  93. event_DisplayLayer_OnRenderLayer = null;
  94. }
  95. private void PanelAbstractClient_Disposed(object sender, EventArgs e)
  96. {
  97. if (display != null)
  98. {
  99. this.display.UnbindMessageFilter();
  100. if (displayActor != null)
  101. {
  102. displayActor.OnRender -= actor_render;
  103. }
  104. if (event_OnPanelClosed != null)
  105. event_OnPanelClosed.Invoke();
  106. display.Dispose();
  107. }
  108. }
  109. public void Start(IAbstractBattleFactory factory)
  110. {
  111. this.BattleFactory = factory;
  112. if (DataRoot != null)
  113. {
  114. this.RenderFPS = (DataRoot.Templates.CFG.SYSTEM_FPS);
  115. this.battle = BattleFactory.GenBattle();
  116. this.display = BattleFactory.GenDisplay(pictureBox1);
  117. this.display.OnRenderHUD += display_OnRenderHUD;
  118. this.display.OnRenderLayer += display_OnRenderLayer;
  119. this.display.InitClient(battle);
  120. this.battle.Layer.LayerInit += Layer_LayerInit;
  121. this.battle.Layer.ActorAdded += Layer_ActorAdded;
  122. this.battle.Layer.MessageReceived += Layer_MessageReceived;
  123. this.timer1.Enabled = true;
  124. this.pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
  125. this.pictureBox1.KeyDown += new KeyEventHandler(pictureBox1_KeyDown);
  126. this.display.GenShowItems(this.toolStripDropDownButton2);
  127. foreach (SyncMode mode in Enum.GetValues(typeof(SyncMode)))
  128. {
  129. ToolStripButton item = new ToolStripButton(mode.ToString());
  130. item.Tag = mode;
  131. item.Click += item_SyncMode_Click;
  132. item.CheckOnClick = true;
  133. drop_SyncMode.DropDownItems.Add(item);
  134. if (battle.Layer.ActorSyncMode == mode)
  135. {
  136. item.Checked = true;
  137. }
  138. }
  139. this.display.BindMessageFilter(pictureBox1);
  140. if (event_OnPanelLoaded != null)
  141. event_OnPanelLoaded.Invoke();
  142. }
  143. }
  144. //-------------------------------------------------------------------------------------------------------------------
  145. protected virtual void Layer_LayerInit(ZoneLayer layer)
  146. {
  147. float scale = Math.Max(
  148. ((float)pictureBox1.Width) / battle.Layer.Terrain.TotalWidth,
  149. ((float)pictureBox1.Height) / battle.Layer.Terrain.TotalHeight);
  150. this.display.setCameraScale(scale, scale);
  151. }
  152. protected virtual void Layer_ActorAdded(ZoneLayer layer, ZoneActor actor)
  153. {
  154. actor.SendUnitGuard(btn_Guard.Checked);
  155. actor.IsSkillAutoFocusTarget = btn_autoFocus.Checked;
  156. }
  157. protected virtual void Layer_MessageReceived(ZoneLayer layer, IMessage e)
  158. {
  159. if (e is TestMessageBox)
  160. {
  161. TestMessageBox over = e as TestMessageBox;
  162. MessageBox.Show(over.msg, e.GetType().Name);
  163. }
  164. else if (e is ServerExceptionB2C)
  165. {
  166. ServerExceptionB2C over = e as ServerExceptionB2C;
  167. MessageBox.Show(over.Message + "\n" + over.StackTrace, e.GetType().Name);
  168. }
  169. }
  170. //-------------------------------------------------------------------------------------------------------------------
  171. #region Events
  172. private OnPanelLoadedHandler event_OnPanelLoaded;
  173. private OnPanelClosedHandler event_OnPanelClosed;
  174. private OnTimerBeginUpdateHandler event_OnTimerBeginUpdate;
  175. private OnTimerUpdateHandler event_OnTimerUpdate;
  176. private OnNetworkViewClickedHandler event_OnNetworkViewClicked;
  177. private OnExitClickedHandler event_OnExitClicked;
  178. private DisplayActor_OnRenderHandler event_DisplayActor_OnRender;
  179. private DisplayLayer_OnRenderHUDHandler event_DisplayLayer_OnRenderHUD;
  180. private DisplayLayer_OnRenderLayerHandler event_DisplayLayer_OnRenderLayer;
  181. public event OnPanelLoadedHandler OnPanelLoaded { add { event_OnPanelLoaded += value; } remove { event_OnPanelLoaded -= value; } }
  182. public event OnPanelClosedHandler OnPanelClosed { add { event_OnPanelClosed += value; } remove { event_OnPanelClosed -= value; } }
  183. public event OnTimerBeginUpdateHandler OnTimerBeginUpdate { add { event_OnTimerBeginUpdate += value; } remove { event_OnTimerBeginUpdate -= value; } }
  184. public event OnTimerUpdateHandler OnTimerUpdate { add { event_OnTimerUpdate += value; } remove { event_OnTimerUpdate -= value; } }
  185. public event OnNetworkViewClickedHandler OnNetworkViewClicked { add { event_OnNetworkViewClicked += value; } remove { event_OnNetworkViewClicked -= value; } }
  186. public event OnExitClickedHandler OnExitClicked { add { event_OnExitClicked += value; } remove { event_OnExitClicked -= value; } }
  187. public event DisplayActor_OnRenderHandler DisplayActor_OnRender { add { event_DisplayActor_OnRender += value; } remove { event_DisplayActor_OnRender -= value; } }
  188. public event DisplayLayer_OnRenderHUDHandler DisplayLayer_OnRenderHUD { add { event_DisplayLayer_OnRenderHUD += value; } remove { event_DisplayLayer_OnRenderHUD -= value; } }
  189. public event DisplayLayer_OnRenderLayerHandler DisplayLayer_OnRenderLayer { add { event_DisplayLayer_OnRenderLayer += value; } remove { event_DisplayLayer_OnRenderLayer -= value; } }
  190. public delegate void OnPanelLoadedHandler();
  191. public delegate void OnPanelClosedHandler();
  192. public delegate void OnTimerBeginUpdateHandler(int intervalMS);
  193. public delegate void OnTimerUpdateHandler(int intervalMS);
  194. public delegate void OnNetworkViewClickedHandler();
  195. public delegate void DisplayActor_OnRenderHandler(Graphics g, DisplayGameUnit unit);
  196. public delegate void DisplayLayer_OnRenderHUDHandler(Graphics g);
  197. public delegate void DisplayLayer_OnRenderLayerHandler(Graphics g);
  198. public delegate void OnExitClickedHandler();
  199. #endregion
  200. //-------------------------------------------------------------------------------------------------------------------
  201. #region _主更新_
  202. public virtual void syncUI()
  203. {
  204. // sync ui
  205. foreach (ToolStripButton btn in drop_SyncMode.DropDownItems)
  206. {
  207. btn.Checked = ((SyncMode)btn.Tag == battle.Layer.ActorSyncMode);
  208. }
  209. if (btn_Guard.Checked != IsActorGuard)
  210. {
  211. btn_Guard.Checked = IsActorGuard;
  212. }
  213. // chk_ShowTerrain.Checked = this.display.ShowTerrain;
  214. // chk_ShowGrid.Checked = this.display.ShowGrid;
  215. // chkShowAttackRangeToolStripMenuItem.Checked = this.display.ShowAttackRange;
  216. // chkShowDamageRange.Checked = this.display.ShowDamageRange;
  217. // chkShowGuardRangeToolStripMenuItem.Checked = this.display.ShowGuardRange;
  218. // chkShowHP.Checked = this.display.ShowHP;
  219. // chkShowName.Checked = this.display.ShowName;
  220. // chkShowZ.Checked = this.display.ShowZ;
  221. // chkShowLog.Checked = this.display.ShowLog;
  222. }
  223. public virtual void updateBattle(int intervalMS)
  224. {
  225. syncUI();
  226. if (event_OnTimerBeginUpdate != null)
  227. event_OnTimerBeginUpdate(intervalMS);
  228. int totalMS = (int)(intervalMS * TurboX);
  229. while (totalMS > 0)
  230. {
  231. int tick = Math.Min(totalMS, intervalMS);
  232. this.display.update(tick);
  233. totalMS -= intervalMS;
  234. }
  235. this.display.update_flush();
  236. if (event_OnTimerUpdate != null)
  237. {
  238. event_OnTimerUpdate(intervalMS);
  239. }
  240. if (displayActor == null && display.DisplayActor != null)
  241. {
  242. displayActor = display.DisplayActor;
  243. displayActor.OnRender += actor_render;
  244. }
  245. this.pictureBox1.Refresh();
  246. btnTurbo.Text = "加速x" + TurboX;
  247. }
  248. protected virtual void timer1_Tick(object sender, EventArgs e)
  249. {
  250. try
  251. {
  252. long curTime = CommonLang.CUtils.CurrentTimeMS;
  253. if (mLastUpdateTime == 0)
  254. {
  255. mLastUpdateTime = curTime;
  256. }
  257. int intervalMS = (int)(curTime - mLastUpdateTime);
  258. this.mLastUpdateTime = curTime;
  259. updateBattle(intervalMS);
  260. }
  261. catch (Exception err)
  262. {
  263. MessageBox.Show(err.Message + "\n" + err.StackTrace);
  264. }
  265. }
  266. private void actor_render(Graphics g, DisplayGameUnit unit)
  267. {
  268. if (event_DisplayActor_OnRender != null)
  269. {
  270. event_DisplayActor_OnRender.Invoke(g, unit);
  271. }
  272. }
  273. private void display_OnRenderHUD(Graphics g, DisplayLayerWorld world)
  274. {
  275. if (event_DisplayLayer_OnRenderHUD != null)
  276. {
  277. event_DisplayLayer_OnRenderHUD.Invoke(g);
  278. }
  279. }
  280. private void display_OnRenderLayer(Graphics g, DisplayLayerWorld world)
  281. {
  282. if (event_DisplayLayer_OnRenderLayer != null)
  283. {
  284. event_DisplayLayer_OnRenderLayer.Invoke(g);
  285. }
  286. }
  287. protected virtual void item_SyncMode_Click(object sender, EventArgs e)
  288. {
  289. ToolStripButton item = sender as ToolStripButton;
  290. if (item != null)
  291. {
  292. battle.Layer.ActorSyncMode = (SyncMode)item.Tag;
  293. }
  294. }
  295. #endregion
  296. //--------------------------------------------------------------------------------------------
  297. #region _绘制_
  298. private float mouseX, mouseY;
  299. private Vector2 pic_lastMouesDown;
  300. private Vector2 pic_lastCameraPos;
  301. protected virtual void pictureBox1_KeyDown(object sender, KeyEventArgs e)
  302. {
  303. try
  304. {
  305. if (e.Shift)
  306. {
  307. display.ActorUseItem(e);
  308. }
  309. else
  310. {
  311. if (display.SelectedObject != null)
  312. {
  313. display.ActorLaunchSkill(e, display.SelectedObject.ZoneObjectData);
  314. }
  315. else
  316. {
  317. display.ActorLaunchSkill(e, mouseX, mouseY);
  318. }
  319. }
  320. }
  321. catch (Exception err)
  322. {
  323. Console.WriteLine(err.Message);
  324. }
  325. }
  326. protected virtual void pictureBox1_MouseDown(object sender, MouseEventArgs e)
  327. {
  328. pictureBox1.Focus();
  329. try
  330. {
  331. if (battle != null)
  332. {
  333. pic_lastMouesDown = new Vector2(e.Location.X, e.Location.Y);
  334. pic_lastCameraPos = new Vector2(display.CameraX, display.CameraY);
  335. float wx = mouseX = display.screenToWorldX(e.X);
  336. float wy = mouseY = display.screenToWorldY(e.Y);
  337. if (e.Button == MouseButtons.Left)
  338. {
  339. if (Keyboard.IsShiftDown)
  340. {
  341. BattleClient.Actor.SendUnitLaunchNormalAttack(wx, wy);
  342. }
  343. else
  344. {
  345. DisplayLayerObject selected = display.PickObject(wx, wy);
  346. ZoneItem item = pictureBox1_CheckPickItem();
  347. if (item != null)
  348. {
  349. BattleClient.Actor.SendUnitPickObject(item.ObjectID);
  350. }
  351. else if (selected is DisplayGameUnit)
  352. {
  353. DisplayGameUnit su = selected as DisplayGameUnit;
  354. if (su.Data.Force != BattleClient.Actor.Force)
  355. {
  356. BattleClient.Actor.SendUnitFocuseTarget(selected.ObjectID);
  357. }
  358. else
  359. {
  360. BattleClient.Actor.SendUnitPickObject(selected.ObjectID);
  361. }
  362. }
  363. else if (selected is DisplayGameItem)
  364. {
  365. BattleClient.Actor.SendUnitPickObject(selected.ObjectID);
  366. }
  367. else if (selected is DisplayGameSpell)
  368. {
  369. }
  370. }
  371. }
  372. else if (e.Button == MouseButtons.Right)
  373. {
  374. if (IsFreeView)
  375. {
  376. }
  377. else
  378. {
  379. if (Keyboard.GetKeyState(Keys.A))
  380. {
  381. if (BattleClient.Actor.IsGuard)
  382. {
  383. BattleClient.Actor.SendUnitAttackMoveTo(wx, wy, true);
  384. }
  385. else
  386. {
  387. BattleClient.Actor.AddAgent(new ActorMoveAgent(wx, wy, 0.1f));
  388. }
  389. }
  390. else if (BattleClient.Actor.IsGuard)
  391. {
  392. BattleClient.Actor.SendUnitAttackMoveTo(wx, wy, false);
  393. }
  394. else
  395. {
  396. BattleClient.Actor.SendUnitAxis(
  397. mouseX - BattleClient.Actor.X,
  398. mouseY - BattleClient.Actor.Y);
  399. }
  400. }
  401. }
  402. }
  403. }
  404. catch (Exception err)
  405. {
  406. Console.WriteLine(err.Message);
  407. }
  408. }
  409. protected virtual void pictureBox1_MouseMove(object sender, MouseEventArgs e)
  410. {
  411. try
  412. {
  413. if (battle != null)
  414. {
  415. float wx = mouseX = display.screenToWorldX(e.X);
  416. float wy = mouseY = display.screenToWorldY(e.Y);
  417. if (IsFreeView)
  418. {
  419. }
  420. else
  421. {
  422. if (Keyboard.IsShiftDown)
  423. {
  424. BattleClient.Actor.SendUnitFaceTo(wx, wy);
  425. }
  426. }
  427. if (e.Button == MouseButtons.Left)
  428. {
  429. }
  430. else if (e.Button == MouseButtons.Right)
  431. {
  432. if (IsFreeView)
  433. {
  434. if (pic_lastMouesDown != null)
  435. {
  436. float x = pic_lastCameraPos.X + display.screenToWorldSizeX(pic_lastMouesDown.X - e.X);
  437. float y = pic_lastCameraPos.Y + display.screenToWorldSizeY(pic_lastMouesDown.Y - e.Y);
  438. display.setCamera(x, y);
  439. }
  440. }
  441. else
  442. {
  443. if (BattleClient.Actor.IsGuard)
  444. {
  445. BattleClient.Actor.SendUnitMove(wx, wy);
  446. }
  447. else
  448. {
  449. BattleClient.Actor.SendUnitAxis((float)Math.Atan2(
  450. mouseY - BattleClient.Actor.Y,
  451. mouseX - BattleClient.Actor.X));
  452. }
  453. }
  454. }
  455. this.pictureBox1_CheckPickItem();
  456. }
  457. }
  458. catch (Exception err)
  459. {
  460. Console.WriteLine(err.Message);
  461. }
  462. }
  463. protected virtual void pictureBox1_MouseUp(object sender, MouseEventArgs e)
  464. {
  465. pic_lastMouesDown = null;
  466. pic_lastCameraPos = null;
  467. if (battle != null)
  468. {
  469. float wx = mouseX = display.screenToWorldX(e.X);
  470. float wy = mouseY = display.screenToWorldY(e.Y);
  471. if (battle.Actor != null)
  472. {
  473. battle.Actor.SendUnitStopMove();
  474. }
  475. }
  476. }
  477. protected virtual void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
  478. {
  479. try
  480. {
  481. int d = CMath.getDirect(e.Delta);
  482. if (d > 0)
  483. {
  484. float newD = display.getCameraScale() * 1.1f;
  485. display.setCameraScale(newD, newD);
  486. }
  487. else if (d < 0)
  488. {
  489. float newD = display.getCameraScale() / 1.1f;
  490. display.setCameraScale(newD, newD);
  491. }
  492. }
  493. catch (Exception err)
  494. {
  495. Console.WriteLine(err.Message);
  496. }
  497. pictureBox1.Refresh();
  498. }
  499. protected virtual void pictureBox1_Paint(object sender, PaintEventArgs e)
  500. {
  501. if (battle != null && battle.Layer != null)
  502. {
  503. try
  504. {
  505. this.display.setWindow(new RectangleF(0, 0, pictureBox1.Width, pictureBox1.Height));
  506. if (!IsFreeView && battle.Actor != null)
  507. {
  508. this.display.setCamera(battle.Actor.X, battle.Actor.Y);
  509. }
  510. this.display.render(e.Graphics);
  511. this.pictureBox1_CheckPickItem();
  512. }
  513. catch (Exception err)
  514. {
  515. log.Error(err.Message, err);
  516. }
  517. }
  518. }
  519. protected virtual ZoneItem pictureBox1_CheckPickItem()
  520. {
  521. if (BattleClient.Actor != null)
  522. {
  523. pictureBox1.Cursor = Cursors.Default;
  524. ZoneItem item = BattleClient.Layer.GetNearPickableItem(BattleClient.Actor);
  525. if (item != null)
  526. {
  527. if (CMath.includeRoundPoint(item.X, item.Y, item.Info.BodySize, mouseX, mouseY))
  528. {
  529. pictureBox1.Cursor = Cursors.Hand;
  530. return item;
  531. }
  532. }
  533. }
  534. return null;
  535. }
  536. #endregion
  537. //--------------------------------------------------------------------------------------------
  538. #region _控制角色_
  539. private void btn_Guard_Click(object sender, EventArgs e)
  540. {
  541. if (battle.Layer != null)
  542. {
  543. if (battle.Actor != null)
  544. {
  545. battle.Actor.SendUnitGuard(btn_Guard.Checked);
  546. }
  547. }
  548. }
  549. private void btn_autoFocus_Click(object sender, EventArgs e)
  550. {
  551. if (battle.Layer != null)
  552. {
  553. if (battle.Actor != null)
  554. {
  555. battle.Actor.IsSkillAutoFocusTarget = btn_autoFocus.Checked;
  556. }
  557. }
  558. }
  559. private void btn_CleanBuffs_Click(object sender, EventArgs e)
  560. {
  561. if (battle.Actor != null)
  562. {
  563. foreach (ZoneUnit.BuffState bs in battle.Actor.GetBuffStatus())
  564. {
  565. battle.Actor.SendCancelBuff(bs.Data.ID);
  566. }
  567. }
  568. }
  569. private void pickUnitToolStripMenuItem_Click(object sender, EventArgs e)
  570. {
  571. if (DisplayWorld.SelectedObject != null && DisplayWorld.SelectedObject is DisplayGameUnit)
  572. {
  573. DisplayGameUnit su = DisplayWorld.SelectedObject as DisplayGameUnit;
  574. BattleClient.Actor.SendUnitPickObject(su.ObjectID);
  575. }
  576. }
  577. //--------------------------------------------------------------------------------------------
  578. private void btn_FreeView_Click(object sender, EventArgs e)
  579. {
  580. }
  581. private void btn_Exit_Click(object sender, EventArgs e)
  582. {
  583. if (event_OnExitClicked != null)
  584. event_OnExitClicked.Invoke();
  585. }
  586. private void btn_NewView_Click(object sender, EventArgs e)
  587. {
  588. if (event_OnNetworkViewClicked != null)
  589. event_OnNetworkViewClicked.Invoke();
  590. }
  591. #endregion
  592. //--------------------------------------------------------------------------------------------
  593. #region _加速_
  594. private void btn_1X_Click(object sender, EventArgs e)
  595. {
  596. TurboX = 1;
  597. }
  598. private void btn_2X_Click(object sender, EventArgs e)
  599. {
  600. TurboX = 2;
  601. }
  602. private void btn_3X_Click(object sender, EventArgs e)
  603. {
  604. TurboX = 3;
  605. }
  606. private void btn_4X_Click(object sender, EventArgs e)
  607. {
  608. TurboX = 4;
  609. }
  610. private void btn_5X_Click(object sender, EventArgs e)
  611. {
  612. TurboX = 5;
  613. }
  614. private void btn_10X_Click(object sender, EventArgs e)
  615. {
  616. TurboX = 10;
  617. }
  618. private void btn_0_5X_Click(object sender, EventArgs e)
  619. {
  620. TurboX = 0.5f;
  621. }
  622. private void btn_0_1X_Click(object sender, EventArgs e)
  623. {
  624. TurboX = 0.1f;
  625. }
  626. private void btn_TurboX_ToolStripMenuItem_Click(object sender, EventArgs e)
  627. {
  628. string turbo = G2DTextDialog.Show(TurboX.ToString(), "设置加速倍率");
  629. float turbox = 1;
  630. if (turbo != null && float.TryParse(turbo, out turbox))
  631. {
  632. this.TurboX = turbox;
  633. }
  634. }
  635. #endregion
  636. //--------------------------------------------------------------------------------------------
  637. }
  638. }