Values.Fields.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CommonLang.Property;
  6. using CommonAI.Zone.Instance;
  7. using CommonAI.Zone.Attributes;
  8. using CommonAI.Zone.EventTrigger;
  9. namespace CommonAI.Zone.ZoneEditor.EventTrigger
  10. {
  11. public static class GameFields
  12. {
  13. private static Type[] s32_types = new Type[] { typeof(int), typeof(sbyte), typeof(short), typeof(byte), typeof(ushort), typeof(uint), };
  14. private static Type[] f32_types = new Type[] { typeof(float), typeof(double), };
  15. private static FieldManager s_Manager;
  16. public static FieldManager Manager { get { return s_Manager; } }
  17. internal static void InitFiledManager()
  18. {
  19. if (s_Manager == null)
  20. {
  21. s_Manager = new FieldManager();
  22. AddObjectType(typeof(Config));
  23. AddObjectType(typeof(InstanceUnit));
  24. AddObjectType(typeof(UnitInfo));
  25. AddObjectType(typeof(InstanceItem));
  26. AddObjectType(typeof(ItemTemplate));
  27. AddObjectType(typeof(SkillTemplate));
  28. AddObjectType(typeof(SpellTemplate));
  29. AddObjectType(typeof(BuffTemplate));
  30. AddObjectType(typeof(EditorScene));
  31. AddObjectType(TemplateManager.Factory.ExtConfigType);
  32. AddObjectType(TemplateManager.Factory.UnitPropertiesType);
  33. AddObjectType(TemplateManager.Factory.SkillPropertiesType);
  34. AddObjectType(TemplateManager.Factory.SpellPropertiesType);
  35. AddObjectType(TemplateManager.Factory.ItemPropertiesType);
  36. AddObjectType(TemplateManager.Factory.BuffPropertiesType);
  37. AddObjectType(TemplateManager.Factory.ScenePropertiesType);
  38. }
  39. }
  40. public static void AddObjectType(Type objType)
  41. {
  42. s_Manager.AddFieldsMap(new FieldsMap(objType, typeof(int), s32_types));
  43. s_Manager.AddFieldsMap(new FieldsMap(objType, typeof(float), f32_types));
  44. s_Manager.AddFieldsMap(new FieldsMap(objType, typeof(string)));
  45. s_Manager.AddFieldsMap(new FieldsMap(objType, typeof(bool)));
  46. }
  47. public static T GetValue<T>(object owner, Type baseType, string fieldname)
  48. {
  49. FieldsMap fm = s_Manager.GetFields(baseType, typeof(T));
  50. if (fm != null)
  51. {
  52. return fm.GetValue<T>(owner, fieldname);
  53. }
  54. return default(T);
  55. }
  56. }
  57. public interface IFieldMemberValue
  58. {
  59. Type OwnerType { get; }
  60. }
  61. //-----------------------------------------------------------------------------------------
  62. #region __Config__
  63. [DescAttribute("配置字段(string)", "字段 - 配置")]
  64. public class ConfigFieldStringValue : StringValue
  65. {
  66. [ObjectMemberNameAttribute(typeof(Config), typeof(string))]
  67. [DescAttribute("字段名")]
  68. public string FieldName = "";
  69. public override string ToString()
  70. {
  71. return string.Format("({0}).{1}", "配置", FieldName);
  72. }
  73. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  74. {
  75. return GameFields.GetValue<string>(api.ZoneAPI.Templates.CFG, typeof(Config), FieldName);
  76. }
  77. }
  78. [DescAttribute("配置字段(int)", "字段 - 配置")]
  79. public class ConfigFieldIntegerValue : IntegerValue
  80. {
  81. [ObjectMemberNameAttribute(typeof(Config), typeof(int))]
  82. [DescAttribute("字段名")]
  83. public string FieldName = "";
  84. public override string ToString()
  85. {
  86. return string.Format("({0}).{1}", "配置", FieldName);
  87. }
  88. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  89. {
  90. return GameFields.GetValue<int>(api.ZoneAPI.Templates.CFG, typeof(Config), FieldName);
  91. }
  92. }
  93. [DescAttribute("配置字段(float)", "字段 - 配置")]
  94. public class ConfigFieldRealValue : RealValue
  95. {
  96. [ObjectMemberNameAttribute(typeof(Config), typeof(float))]
  97. [DescAttribute("字段名")]
  98. public string FieldName = "";
  99. public override string ToString()
  100. {
  101. return string.Format("({0}).{1}", "配置", FieldName);
  102. }
  103. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  104. {
  105. return GameFields.GetValue<float>(api.ZoneAPI.Templates.CFG, typeof(Config), FieldName);
  106. }
  107. }
  108. [DescAttribute("配置字段(bool)", "字段 - 配置")]
  109. public class ConfigFieldBoolValue : BooleanValue
  110. {
  111. [ObjectMemberNameAttribute(typeof(Config), typeof(bool))]
  112. [DescAttribute("字段名")]
  113. public string FieldName = "";
  114. public override string ToString()
  115. {
  116. return string.Format("({0}).{1}", "配置", FieldName);
  117. }
  118. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  119. {
  120. return GameFields.GetValue<bool>(api.ZoneAPI.Templates.CFG, typeof(Config), FieldName);
  121. }
  122. }
  123. #endregion
  124. //-----------------------------------------------------------------------------------------
  125. #region __场景实体__
  126. [DescAttribute("场景字段(string)", "字段 - 场景")]
  127. public class ZoneFieldStringValue : StringValue
  128. {
  129. [ObjectMemberNameAttribute(typeof(EditorScene), typeof(string))]
  130. [DescAttribute("字段名")]
  131. public string FieldName = "";
  132. public override string ToString()
  133. {
  134. return string.Format("({0}).{1}", "场景", FieldName);
  135. }
  136. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  137. {
  138. return GameFields.GetValue<string>(api.ZoneAPI, typeof(EditorScene), FieldName);
  139. }
  140. }
  141. [DescAttribute("场景字段(int)", "字段 - 场景")]
  142. public class ZoneFieldIntegerValue : IntegerValue
  143. {
  144. [ObjectMemberNameAttribute(typeof(EditorScene), typeof(int))]
  145. [DescAttribute("字段名")]
  146. public string FieldName = "";
  147. public override string ToString()
  148. {
  149. return string.Format("({0}).{1}", "场景", FieldName);
  150. }
  151. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  152. {
  153. return GameFields.GetValue<int>(api.ZoneAPI, typeof(EditorScene), FieldName);
  154. }
  155. }
  156. [DescAttribute("场景字段(float)", "字段 - 场景")]
  157. public class ZoneFieldRealValue : RealValue
  158. {
  159. [ObjectMemberNameAttribute(typeof(EditorScene), typeof(float))]
  160. [DescAttribute("字段名")]
  161. public string FieldName = "";
  162. public override string ToString()
  163. {
  164. return string.Format("({0}).{1}", "场景", FieldName);
  165. }
  166. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  167. {
  168. return GameFields.GetValue<float>(api.ZoneAPI, typeof(EditorScene), FieldName);
  169. }
  170. }
  171. [DescAttribute("场景字段(bool)", "字段 - 场景")]
  172. public class ZoneFieldBoolValue : BooleanValue
  173. {
  174. [ObjectMemberNameAttribute(typeof(EditorScene), typeof(bool))]
  175. [DescAttribute("字段名")]
  176. public string FieldName = "";
  177. public override string ToString()
  178. {
  179. return string.Format("({0}).{1}", "场景", FieldName);
  180. }
  181. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  182. {
  183. return GameFields.GetValue<bool>(api.ZoneAPI, typeof(EditorScene), FieldName);
  184. }
  185. }
  186. #endregion
  187. //-----------------------------------------------------------------------------------------
  188. #region __单位实体__
  189. [DescAttribute("单位字段(string)", "字段 - 单位")]
  190. public class UnitFieldStringValue : StringValue
  191. {
  192. [ObjectMemberNameAttribute(typeof(InstanceUnit), typeof(string))]
  193. [DescAttribute("字段名")]
  194. public string FieldName = "";
  195. [DescAttribute("单位")]
  196. public UnitValue Unit = new UnitValue.Trigging();
  197. public override string ToString()
  198. {
  199. return string.Format("({0}).{1}", Unit, FieldName);
  200. }
  201. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  202. {
  203. InstanceUnit o = Unit.GetValue(api, args);
  204. if (o != null)
  205. {
  206. return GameFields.GetValue<string>(o, typeof(InstanceUnit), FieldName);
  207. }
  208. return null;
  209. }
  210. }
  211. [DescAttribute("单位字段(int)", "字段 - 单位")]
  212. public class UnitFieldIntegerValue : IntegerValue
  213. {
  214. [ObjectMemberNameAttribute(typeof(InstanceUnit), typeof(int))]
  215. [DescAttribute("字段名")]
  216. public string FieldName = "";
  217. [DescAttribute("单位")]
  218. public UnitValue Unit = new UnitValue.Trigging();
  219. public override string ToString()
  220. {
  221. return string.Format("({0}).{1}", Unit, FieldName);
  222. }
  223. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  224. {
  225. InstanceUnit o = Unit.GetValue(api, args);
  226. if (o != null)
  227. {
  228. return GameFields.GetValue<int>(o, typeof(InstanceUnit), FieldName);
  229. }
  230. return 0;
  231. }
  232. }
  233. [DescAttribute("单位字段(float)", "字段 - 单位")]
  234. public class UnitFieldRealValue : RealValue
  235. {
  236. [ObjectMemberNameAttribute(typeof(InstanceUnit), typeof(float))]
  237. [DescAttribute("字段名")]
  238. public string FieldName = "";
  239. [DescAttribute("单位")]
  240. public UnitValue Unit = new UnitValue.Trigging();
  241. public override string ToString()
  242. {
  243. return string.Format("({0}).{1}", Unit, FieldName);
  244. }
  245. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  246. {
  247. InstanceUnit o = Unit.GetValue(api, args);
  248. if (o != null)
  249. {
  250. return GameFields.GetValue<float>(o, typeof(InstanceUnit), FieldName);
  251. }
  252. return 0;
  253. }
  254. }
  255. [DescAttribute("单位字段(bool)", "字段 - 单位")]
  256. public class UnitFieldBoolValue : BooleanValue
  257. {
  258. [ObjectMemberNameAttribute(typeof(InstanceUnit), typeof(bool))]
  259. [DescAttribute("字段名")]
  260. public string FieldName = "";
  261. [DescAttribute("单位")]
  262. public UnitValue Unit = new UnitValue.Trigging();
  263. public override string ToString()
  264. {
  265. return string.Format("({0}).{1}", Unit, FieldName);
  266. }
  267. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  268. {
  269. InstanceUnit o = Unit.GetValue(api, args);
  270. if (o != null)
  271. {
  272. return GameFields.GetValue<bool>(o, typeof(InstanceUnit), FieldName);
  273. }
  274. return false;
  275. }
  276. }
  277. #endregion
  278. //-----------------------------------------------------------------------------------------
  279. #region __单位模板__
  280. [DescAttribute("单位模板字段(string)", "字段 - 单位模板")]
  281. public class UnitTemplateFieldStringValue : StringValue
  282. {
  283. [ObjectMemberNameAttribute(typeof(UnitInfo), typeof(string))]
  284. [DescAttribute("字段名")]
  285. public string FieldName = "";
  286. [DescAttribute("单位")]
  287. public UnitValue Unit = new UnitValue.Trigging();
  288. public override string ToString()
  289. {
  290. return string.Format("({0}).模板.{1}", Unit, FieldName);
  291. }
  292. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  293. {
  294. InstanceUnit o = Unit.GetValue(api, args);
  295. if (o != null)
  296. {
  297. return GameFields.GetValue<string>(o.Info, typeof(UnitInfo), FieldName);
  298. }
  299. return null;
  300. }
  301. }
  302. [DescAttribute("单位模板字段(int)", "字段 - 单位模板")]
  303. public class UnitTemplateFieldIntegerValue : IntegerValue
  304. {
  305. [ObjectMemberNameAttribute(typeof(UnitInfo), typeof(int))]
  306. [DescAttribute("字段名")]
  307. public string FieldName = "";
  308. [DescAttribute("单位")]
  309. public UnitValue Unit = new UnitValue.Trigging();
  310. public override string ToString()
  311. {
  312. return string.Format("({0}).模板.{1}", Unit, FieldName);
  313. }
  314. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  315. {
  316. InstanceUnit o = Unit.GetValue(api, args);
  317. if (o != null)
  318. {
  319. return GameFields.GetValue<int>(o.Info, typeof(UnitInfo), FieldName);
  320. }
  321. return 0;
  322. }
  323. }
  324. [DescAttribute("单位模板字段(float)", "字段 - 单位模板")]
  325. public class UnitTemplateFieldRealValue : RealValue
  326. {
  327. [ObjectMemberNameAttribute(typeof(UnitInfo), typeof(float))]
  328. [DescAttribute("字段名")]
  329. public string FieldName = "";
  330. [DescAttribute("单位")]
  331. public UnitValue Unit = new UnitValue.Trigging();
  332. public override string ToString()
  333. {
  334. return string.Format("({0}).模板.{1}", Unit, FieldName);
  335. }
  336. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  337. {
  338. InstanceUnit o = Unit.GetValue(api, args);
  339. if (o != null)
  340. {
  341. return GameFields.GetValue<float>(o.Info, typeof(UnitInfo), FieldName);
  342. }
  343. return 0;
  344. }
  345. }
  346. [DescAttribute("单位模板字段(bool)", "字段 - 单位模板")]
  347. public class UnitTemplateFieldBoolValue : BooleanValue
  348. {
  349. [ObjectMemberNameAttribute(typeof(UnitInfo), typeof(bool))]
  350. [DescAttribute("字段名")]
  351. public string FieldName = "";
  352. [DescAttribute("单位")]
  353. public UnitValue Unit = new UnitValue.Trigging();
  354. public override string ToString()
  355. {
  356. return string.Format("({0}).模板.{1}", Unit, FieldName);
  357. }
  358. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  359. {
  360. InstanceUnit o = Unit.GetValue(api, args);
  361. if (o != null)
  362. {
  363. return GameFields.GetValue<bool>(o.Info, typeof(UnitInfo), FieldName);
  364. }
  365. return false;
  366. }
  367. }
  368. #endregion
  369. //-----------------------------------------------------------------------------------------
  370. #region __物品实体__
  371. [DescAttribute("物品字段(string)", "字段 - 物品")]
  372. public class ItemFieldStringValue : StringValue
  373. {
  374. [ObjectMemberNameAttribute(typeof(InstanceItem), typeof(string))]
  375. [DescAttribute("字段名")]
  376. public string FieldName = "";
  377. [DescAttribute("物品")]
  378. public ItemValue Item = new ItemValue.NA();
  379. public override string ToString()
  380. {
  381. return string.Format("({0}).{1}", Item, FieldName);
  382. }
  383. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  384. {
  385. InstanceItem o = Item.GetValue(api, args);
  386. if (o != null)
  387. {
  388. return GameFields.GetValue<string>(o, typeof(InstanceItem), FieldName);
  389. }
  390. return null;
  391. }
  392. }
  393. [DescAttribute("物品字段(int)", "字段 - 物品")]
  394. public class ItemFieldIntegerValue : IntegerValue
  395. {
  396. [ObjectMemberNameAttribute(typeof(InstanceItem), typeof(int))]
  397. [DescAttribute("字段名")]
  398. public string FieldName = "";
  399. [DescAttribute("物品")]
  400. public ItemValue Item = new ItemValue.NA();
  401. public override string ToString()
  402. {
  403. return string.Format("({0}).{1}", Item, FieldName);
  404. }
  405. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  406. {
  407. InstanceItem o = Item.GetValue(api, args);
  408. if (o != null)
  409. {
  410. return GameFields.GetValue<int>(o, typeof(InstanceItem), FieldName);
  411. }
  412. return 0;
  413. }
  414. }
  415. [DescAttribute("物品字段(float)", "字段 - 物品")]
  416. public class ItemFieldRealValue : RealValue
  417. {
  418. [ObjectMemberNameAttribute(typeof(InstanceItem), typeof(float))]
  419. [DescAttribute("字段名")]
  420. public string FieldName = "";
  421. [DescAttribute("物品")]
  422. public ItemValue Item = new ItemValue.NA();
  423. public override string ToString()
  424. {
  425. return string.Format("({0}).{1}", Item, FieldName);
  426. }
  427. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  428. {
  429. InstanceItem o = Item.GetValue(api, args);
  430. if (o != null)
  431. {
  432. return GameFields.GetValue<float>(o, typeof(InstanceItem), FieldName);
  433. }
  434. return 0;
  435. }
  436. }
  437. [DescAttribute("物品字段(bool)", "字段 - 物品")]
  438. public class ItemFieldBoolValue : BooleanValue
  439. {
  440. [ObjectMemberNameAttribute(typeof(InstanceItem), typeof(bool))]
  441. [DescAttribute("字段名")]
  442. public string FieldName = "";
  443. [DescAttribute("物品")]
  444. public ItemValue Item = new ItemValue.NA();
  445. public override string ToString()
  446. {
  447. return string.Format("({0}).{1}", Item, FieldName);
  448. }
  449. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  450. {
  451. InstanceItem o = Item.GetValue(api, args);
  452. if (o != null)
  453. {
  454. return GameFields.GetValue<bool>(o, typeof(InstanceItem), FieldName);
  455. }
  456. return false;
  457. }
  458. }
  459. #endregion
  460. //-----------------------------------------------------------------------------------------
  461. #region __物品模板__
  462. [DescAttribute("物品模板字段(string)", "字段 - 物品模板")]
  463. public class ItemTemplateFieldStringValue : StringValue
  464. {
  465. [ObjectMemberNameAttribute(typeof(ItemTemplate), typeof(string))]
  466. [DescAttribute("字段名")]
  467. public string FieldName = "";
  468. [DescAttribute("物品")]
  469. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  470. public override string ToString()
  471. {
  472. return string.Format("({0}).{1}", Item, FieldName);
  473. }
  474. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  475. {
  476. ItemTemplate o = Item.GetValue(api, args);
  477. if (o != null)
  478. {
  479. return GameFields.GetValue<string>(o, typeof(ItemTemplate), FieldName);
  480. }
  481. return null;
  482. }
  483. }
  484. [DescAttribute("物品模板字段(int)", "字段 - 物品模板")]
  485. public class ItemTemplateFieldIntegerValue : IntegerValue
  486. {
  487. [ObjectMemberNameAttribute(typeof(ItemTemplate), typeof(int))]
  488. [DescAttribute("字段名")]
  489. public string FieldName = "";
  490. [DescAttribute("物品")]
  491. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  492. public override string ToString()
  493. {
  494. return string.Format("({0}).{1}", Item, FieldName);
  495. }
  496. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  497. {
  498. ItemTemplate o = Item.GetValue(api, args);
  499. if (o != null)
  500. {
  501. return GameFields.GetValue<int>(o, typeof(ItemTemplate), FieldName);
  502. }
  503. return 0;
  504. }
  505. }
  506. [DescAttribute("物品模板字段(float)", "字段 - 物品模板")]
  507. public class ItemTemplateFieldRealValue : RealValue
  508. {
  509. [ObjectMemberNameAttribute(typeof(ItemTemplate), typeof(float))]
  510. [DescAttribute("字段名")]
  511. public string FieldName = "";
  512. [DescAttribute("物品")]
  513. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  514. public override string ToString()
  515. {
  516. return string.Format("({0}).{1}", Item, FieldName);
  517. }
  518. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  519. {
  520. ItemTemplate o = Item.GetValue(api, args);
  521. if (o != null)
  522. {
  523. return GameFields.GetValue<float>(o, typeof(ItemTemplate), FieldName);
  524. }
  525. return 0;
  526. }
  527. }
  528. [DescAttribute("物品模板字段(bool)", "字段 - 物品模板")]
  529. public class ItemTemplateFieldBoolValue : BooleanValue
  530. {
  531. [ObjectMemberNameAttribute(typeof(ItemTemplate), typeof(bool))]
  532. [DescAttribute("字段名")]
  533. public string FieldName = "";
  534. [DescAttribute("物品")]
  535. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  536. public override string ToString()
  537. {
  538. return string.Format("({0}).{1}", Item, FieldName);
  539. }
  540. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  541. {
  542. ItemTemplate o = Item.GetValue(api, args);
  543. if (o != null)
  544. {
  545. return GameFields.GetValue<bool>(o, typeof(ItemTemplate), FieldName);
  546. }
  547. return false;
  548. }
  549. }
  550. #endregion
  551. //-----------------------------------------------------------------------------------------
  552. #region __技能模板__
  553. [DescAttribute("技能模板字段(string)", "字段 - 技能模板")]
  554. public class SkillTemplateFieldStringValue : StringValue
  555. {
  556. [ObjectMemberNameAttribute(typeof(SkillTemplate), typeof(string))]
  557. [DescAttribute("字段名")]
  558. public string FieldName = "";
  559. [DescAttribute("技能")]
  560. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  561. public override string ToString()
  562. {
  563. return string.Format("({0}).{1}", Skill, FieldName);
  564. }
  565. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  566. {
  567. SkillTemplate o = Skill.GetValue(api, args);
  568. if (o != null)
  569. {
  570. return GameFields.GetValue<string>(o, typeof(SkillTemplate), FieldName);
  571. }
  572. return null;
  573. }
  574. }
  575. [DescAttribute("技能模板字段(int)", "字段 - 技能模板")]
  576. public class SkillTemplateFieldIntegerValue : IntegerValue
  577. {
  578. [ObjectMemberNameAttribute(typeof(SkillTemplate), typeof(int))]
  579. [DescAttribute("字段名")]
  580. public string FieldName = "";
  581. [DescAttribute("技能")]
  582. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  583. public override string ToString()
  584. {
  585. return string.Format("({0}).{1}", Skill, FieldName);
  586. }
  587. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  588. {
  589. SkillTemplate o = Skill.GetValue(api, args);
  590. if (o != null)
  591. {
  592. return GameFields.GetValue<int>(o, typeof(SkillTemplate), FieldName);
  593. }
  594. return 0;
  595. }
  596. }
  597. [DescAttribute("技能模板字段(float)", "字段 - 技能模板")]
  598. public class SkillTemplateFieldRealValue : RealValue
  599. {
  600. [ObjectMemberNameAttribute(typeof(SkillTemplate), typeof(float))]
  601. [DescAttribute("字段名")]
  602. public string FieldName = "";
  603. [DescAttribute("技能")]
  604. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  605. public override string ToString()
  606. {
  607. return string.Format("({0}).{1}", Skill, FieldName);
  608. }
  609. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  610. {
  611. SkillTemplate o = Skill.GetValue(api, args);
  612. if (o != null)
  613. {
  614. return GameFields.GetValue<float>(o, typeof(SkillTemplate), FieldName);
  615. }
  616. return 0;
  617. }
  618. }
  619. [DescAttribute("技能模板字段(bool)", "字段 - 技能模板")]
  620. public class SkillTemplateFieldBoolValue : BooleanValue
  621. {
  622. [ObjectMemberNameAttribute(typeof(SkillTemplate), typeof(bool))]
  623. [DescAttribute("字段名")]
  624. public string FieldName = "";
  625. [DescAttribute("技能")]
  626. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  627. public override string ToString()
  628. {
  629. return string.Format("({0}).{1}", Skill, FieldName);
  630. }
  631. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  632. {
  633. SkillTemplate o = Skill.GetValue(api, args);
  634. if (o != null)
  635. {
  636. return GameFields.GetValue<bool>(o, typeof(SkillTemplate), FieldName);
  637. }
  638. return false;
  639. }
  640. }
  641. #endregion
  642. //-----------------------------------------------------------------------------------------
  643. #region __法术模板__
  644. [DescAttribute("法术模板字段(string)", "字段 - 法术模板")]
  645. public class SpellTemplateFieldStringValue : StringValue
  646. {
  647. [ObjectMemberNameAttribute(typeof(SpellTemplate), typeof(string))]
  648. [DescAttribute("字段名")]
  649. public string FieldName = "";
  650. [DescAttribute("法术")]
  651. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  652. public override string ToString()
  653. {
  654. return string.Format("({0}).{1}", Spell, FieldName);
  655. }
  656. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  657. {
  658. SpellTemplate o = Spell.GetValue(api, args);
  659. if (o != null)
  660. {
  661. return GameFields.GetValue<string>(o, typeof(SpellTemplate), FieldName);
  662. }
  663. return null;
  664. }
  665. }
  666. [DescAttribute("法术模板字段(int)", "字段 - 法术模板")]
  667. public class SpellTemplateFieldIntegerValue : IntegerValue
  668. {
  669. [ObjectMemberNameAttribute(typeof(SpellTemplate), typeof(int))]
  670. [DescAttribute("字段名")]
  671. public string FieldName = "";
  672. [DescAttribute("法术")]
  673. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  674. public override string ToString()
  675. {
  676. return string.Format("({0}).{1}", Spell, FieldName);
  677. }
  678. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  679. {
  680. SpellTemplate o = Spell.GetValue(api, args);
  681. if (o != null)
  682. {
  683. return GameFields.GetValue<int>(o, typeof(SpellTemplate), FieldName);
  684. }
  685. return 0;
  686. }
  687. }
  688. [DescAttribute("法术模板字段(float)", "字段 - 法术模板")]
  689. public class SpellTemplateFieldRealValue : RealValue
  690. {
  691. [ObjectMemberNameAttribute(typeof(SpellTemplate), typeof(float))]
  692. [DescAttribute("字段名")]
  693. public string FieldName = "";
  694. [DescAttribute("法术")]
  695. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  696. public override string ToString()
  697. {
  698. return string.Format("({0}).{1}", Spell, FieldName);
  699. }
  700. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  701. {
  702. SpellTemplate o = Spell.GetValue(api, args);
  703. if (o != null)
  704. {
  705. return GameFields.GetValue<float>(o, typeof(SpellTemplate), FieldName);
  706. }
  707. return 0;
  708. }
  709. }
  710. [DescAttribute("法术模板字段(bool)", "字段 - 法术模板")]
  711. public class SpellTemplateFieldBoolValue : BooleanValue
  712. {
  713. [ObjectMemberNameAttribute(typeof(SpellTemplate), typeof(bool))]
  714. [DescAttribute("字段名")]
  715. public string FieldName = "";
  716. [DescAttribute("法术")]
  717. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  718. public override string ToString()
  719. {
  720. return string.Format("({0}).{1}", Spell, FieldName);
  721. }
  722. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  723. {
  724. SpellTemplate o = Spell.GetValue(api, args);
  725. if (o != null)
  726. {
  727. return GameFields.GetValue<bool>(o, typeof(SpellTemplate), FieldName);
  728. }
  729. return false;
  730. }
  731. }
  732. #endregion
  733. //-----------------------------------------------------------------------------------------
  734. #region __BUFF模板__
  735. [DescAttribute("BUFF模板字段(string)", "字段 - BUFF模板")]
  736. public class BuffTemplateFieldStringValue : StringValue
  737. {
  738. [ObjectMemberNameAttribute(typeof(BuffTemplate), typeof(string))]
  739. [DescAttribute("字段名")]
  740. public string FieldName = "";
  741. [DescAttribute("BUFF")]
  742. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  743. public override string ToString()
  744. {
  745. return string.Format("({0}).{1}", Buff, FieldName);
  746. }
  747. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  748. {
  749. BuffTemplate o = Buff.GetValue(api, args);
  750. if (o != null)
  751. {
  752. return GameFields.GetValue<string>(o, typeof(BuffTemplate), FieldName);
  753. }
  754. return null;
  755. }
  756. }
  757. [DescAttribute("BUFF模板字段(int)", "字段 - BUFF模板")]
  758. public class BuffTemplateFieldIntegerValue : IntegerValue
  759. {
  760. [ObjectMemberNameAttribute(typeof(BuffTemplate), typeof(int))]
  761. [DescAttribute("字段名")]
  762. public string FieldName = "";
  763. [DescAttribute("BUFF")]
  764. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  765. public override string ToString()
  766. {
  767. return string.Format("({0}).{1}", Buff, FieldName);
  768. }
  769. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  770. {
  771. BuffTemplate o = Buff.GetValue(api, args);
  772. if (o != null)
  773. {
  774. return GameFields.GetValue<int>(o, typeof(BuffTemplate), FieldName);
  775. }
  776. return 0;
  777. }
  778. }
  779. [DescAttribute("BUFF模板字段(float)", "字段 - BUFF模板")]
  780. public class BuffTemplateFieldRealValue : RealValue
  781. {
  782. [ObjectMemberNameAttribute(typeof(BuffTemplate), typeof(float))]
  783. [DescAttribute("字段名")]
  784. public string FieldName = "";
  785. [DescAttribute("BUFF")]
  786. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  787. public override string ToString()
  788. {
  789. return string.Format("({0}).{1}", Buff, FieldName);
  790. }
  791. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  792. {
  793. BuffTemplate o = Buff.GetValue(api, args);
  794. if (o != null)
  795. {
  796. return GameFields.GetValue<float>(o, typeof(BuffTemplate), FieldName);
  797. }
  798. return 0;
  799. }
  800. }
  801. [DescAttribute("BUFF模板字段(bool)", "字段 - BUFF模板")]
  802. public class BuffTemplateFieldBoolValue : BooleanValue
  803. {
  804. [ObjectMemberNameAttribute(typeof(BuffTemplate), typeof(bool))]
  805. [DescAttribute("字段名")]
  806. public string FieldName = "";
  807. [DescAttribute("BUFF")]
  808. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  809. public override string ToString()
  810. {
  811. return string.Format("({0}).{1}", Buff, FieldName);
  812. }
  813. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  814. {
  815. BuffTemplate o = Buff.GetValue(api, args);
  816. if (o != null)
  817. {
  818. return GameFields.GetValue<bool>(o, typeof(BuffTemplate), FieldName);
  819. }
  820. return false;
  821. }
  822. }
  823. #endregion
  824. //-----------------------------------------------------------------------------------------
  825. }