DRAircraft.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. // 此文件由工具自动生成,请勿直接修改。
  8. // 生成时间:2021-06-16 21:54:35.517
  9. //------------------------------------------------------------
  10. using GameFramework;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.IO;
  14. using System.Text;
  15. using UnityEngine;
  16. using UnityGameFramework.Runtime;
  17. namespace MetaClient
  18. {
  19. /// <summary>
  20. /// 战机表。
  21. /// </summary>
  22. public class DRAircraft : DataRowBase
  23. {
  24. private int m_Id = 0;
  25. /// <summary>
  26. /// 获取战机编号。
  27. /// </summary>
  28. public override int Id
  29. {
  30. get
  31. {
  32. return m_Id;
  33. }
  34. }
  35. /// <summary>
  36. /// 获取推进器编号。
  37. /// </summary>
  38. public int ThrusterId
  39. {
  40. get;
  41. private set;
  42. }
  43. /// <summary>
  44. /// 获取武器编号0。
  45. /// </summary>
  46. public int WeaponId0
  47. {
  48. get;
  49. private set;
  50. }
  51. /// <summary>
  52. /// 获取武器编号1。
  53. /// </summary>
  54. public int WeaponId1
  55. {
  56. get;
  57. private set;
  58. }
  59. /// <summary>
  60. /// 获取武器编号2。
  61. /// </summary>
  62. public int WeaponId2
  63. {
  64. get;
  65. private set;
  66. }
  67. /// <summary>
  68. /// 获取装甲编号0。
  69. /// </summary>
  70. public int ArmorId0
  71. {
  72. get;
  73. private set;
  74. }
  75. /// <summary>
  76. /// 获取装甲编号1。
  77. /// </summary>
  78. public int ArmorId1
  79. {
  80. get;
  81. private set;
  82. }
  83. /// <summary>
  84. /// 获取装甲编号2。
  85. /// </summary>
  86. public int ArmorId2
  87. {
  88. get;
  89. private set;
  90. }
  91. /// <summary>
  92. /// 获取死亡特效编号。
  93. /// </summary>
  94. public int DeadEffectId
  95. {
  96. get;
  97. private set;
  98. }
  99. /// <summary>
  100. /// 获取死亡声音编号。
  101. /// </summary>
  102. public int DeadSoundId
  103. {
  104. get;
  105. private set;
  106. }
  107. public override bool ParseDataRow(string dataRowString, object userData)
  108. {
  109. string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
  110. for (int i = 0; i < columnStrings.Length; i++)
  111. {
  112. columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
  113. }
  114. int index = 0;
  115. index++;
  116. m_Id = int.Parse(columnStrings[index++]);
  117. index++;
  118. ThrusterId = int.Parse(columnStrings[index++]);
  119. WeaponId0 = int.Parse(columnStrings[index++]);
  120. WeaponId1 = int.Parse(columnStrings[index++]);
  121. WeaponId2 = int.Parse(columnStrings[index++]);
  122. ArmorId0 = int.Parse(columnStrings[index++]);
  123. ArmorId1 = int.Parse(columnStrings[index++]);
  124. ArmorId2 = int.Parse(columnStrings[index++]);
  125. DeadEffectId = int.Parse(columnStrings[index++]);
  126. DeadSoundId = int.Parse(columnStrings[index++]);
  127. GeneratePropertyArray();
  128. return true;
  129. }
  130. public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
  131. {
  132. using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
  133. {
  134. using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
  135. {
  136. m_Id = binaryReader.Read7BitEncodedInt32();
  137. ThrusterId = binaryReader.Read7BitEncodedInt32();
  138. WeaponId0 = binaryReader.Read7BitEncodedInt32();
  139. WeaponId1 = binaryReader.Read7BitEncodedInt32();
  140. WeaponId2 = binaryReader.Read7BitEncodedInt32();
  141. ArmorId0 = binaryReader.Read7BitEncodedInt32();
  142. ArmorId1 = binaryReader.Read7BitEncodedInt32();
  143. ArmorId2 = binaryReader.Read7BitEncodedInt32();
  144. DeadEffectId = binaryReader.Read7BitEncodedInt32();
  145. DeadSoundId = binaryReader.Read7BitEncodedInt32();
  146. }
  147. }
  148. GeneratePropertyArray();
  149. return true;
  150. }
  151. private KeyValuePair<int, int>[] m_WeaponId = null;
  152. public int WeaponIdCount
  153. {
  154. get
  155. {
  156. return m_WeaponId.Length;
  157. }
  158. }
  159. public int GetWeaponId(int id)
  160. {
  161. foreach (KeyValuePair<int, int> i in m_WeaponId)
  162. {
  163. if (i.Key == id)
  164. {
  165. return i.Value;
  166. }
  167. }
  168. throw new GameFrameworkException(Utility.Text.Format("GetWeaponId with invalid id '{0}'.", id));
  169. }
  170. public int GetWeaponIdAt(int index)
  171. {
  172. if (index < 0 || index >= m_WeaponId.Length)
  173. {
  174. throw new GameFrameworkException(Utility.Text.Format("GetWeaponIdAt with invalid index '{0}'.", index));
  175. }
  176. return m_WeaponId[index].Value;
  177. }
  178. private KeyValuePair<int, int>[] m_ArmorId = null;
  179. public int ArmorIdCount
  180. {
  181. get
  182. {
  183. return m_ArmorId.Length;
  184. }
  185. }
  186. public int GetArmorId(int id)
  187. {
  188. foreach (KeyValuePair<int, int> i in m_ArmorId)
  189. {
  190. if (i.Key == id)
  191. {
  192. return i.Value;
  193. }
  194. }
  195. throw new GameFrameworkException(Utility.Text.Format("GetArmorId with invalid id '{0}'.", id));
  196. }
  197. public int GetArmorIdAt(int index)
  198. {
  199. if (index < 0 || index >= m_ArmorId.Length)
  200. {
  201. throw new GameFrameworkException(Utility.Text.Format("GetArmorIdAt with invalid index '{0}'.", index));
  202. }
  203. return m_ArmorId[index].Value;
  204. }
  205. private void GeneratePropertyArray()
  206. {
  207. m_WeaponId = new KeyValuePair<int, int>[]
  208. {
  209. new KeyValuePair<int, int>(0, WeaponId0),
  210. new KeyValuePair<int, int>(1, WeaponId1),
  211. new KeyValuePair<int, int>(2, WeaponId2),
  212. };
  213. m_ArmorId = new KeyValuePair<int, int>[]
  214. {
  215. new KeyValuePair<int, int>(0, ArmorId0),
  216. new KeyValuePair<int, int>(1, ArmorId1),
  217. new KeyValuePair<int, int>(2, ArmorId2),
  218. };
  219. }
  220. }
  221. }