Values.Fields.Properties.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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. //-----------------------------------------------------------------------------------------
  12. #region __配置扩展__
  13. [DescAttribute("配置扩展字段(string)", "扩展字段 - 配置模板")]
  14. public class ExtConfigFieldStringValue : StringValue, IFieldMemberValue
  15. {
  16. [ObjectMemberNameAttribute(typeof(string))]
  17. [DescAttribute("字段名")]
  18. public string FieldName = "";
  19. public Type OwnerType { get { return TemplateManager.Factory.ExtConfigType; } }
  20. public override string ToString()
  21. {
  22. return string.Format("({0}).{1}", "配置扩展", FieldName);
  23. }
  24. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  25. {
  26. return GameFields.GetValue<string>(api.ZoneAPI.Templates.ExtConfig, OwnerType, FieldName);
  27. }
  28. }
  29. [DescAttribute("配置扩展字段(int)", "扩展字段 - 配置模板")]
  30. public class ExtConfigFieldIntegerValue : IntegerValue, IFieldMemberValue
  31. {
  32. [ObjectMemberNameAttribute(typeof(int))]
  33. [DescAttribute("字段名")]
  34. public string FieldName = "";
  35. public Type OwnerType { get { return TemplateManager.Factory.ExtConfigType; } }
  36. public override string ToString()
  37. {
  38. return string.Format("({0}).{1}", "配置扩展", FieldName);
  39. }
  40. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  41. {
  42. return GameFields.GetValue<int>(api.ZoneAPI.Templates.ExtConfig, OwnerType, FieldName);
  43. }
  44. }
  45. [DescAttribute("配置扩展字段(float)", "扩展字段 - 配置模板")]
  46. public class ExtConfigFieldRealValue : RealValue, IFieldMemberValue
  47. {
  48. [ObjectMemberNameAttribute(typeof(float))]
  49. [DescAttribute("字段名")]
  50. public string FieldName = "";
  51. public Type OwnerType { get { return TemplateManager.Factory.ExtConfigType; } }
  52. public override string ToString()
  53. {
  54. return string.Format("({0}).{1}", "配置扩展", FieldName);
  55. }
  56. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  57. {
  58. return GameFields.GetValue<float>(api.ZoneAPI.Templates.ExtConfig, OwnerType, FieldName);
  59. }
  60. }
  61. [DescAttribute("配置扩展字段(bool)", "扩展字段 - 配置模板")]
  62. public class ExtConfigFieldBoolValue : BooleanValue, IFieldMemberValue
  63. {
  64. [ObjectMemberNameAttribute(typeof(bool))]
  65. [DescAttribute("字段名")]
  66. public string FieldName = "";
  67. public Type OwnerType { get { return TemplateManager.Factory.ExtConfigType; } }
  68. public override string ToString()
  69. {
  70. return string.Format("({0}).{1}", "配置扩展", FieldName);
  71. }
  72. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  73. {
  74. return GameFields.GetValue<bool>(api.ZoneAPI.Templates.ExtConfig, OwnerType, FieldName);
  75. }
  76. }
  77. #endregion
  78. //-----------------------------------------------------------------------------------------
  79. #region __场景扩展__
  80. [DescAttribute("场景扩展字段(string)", "扩展字段 - 场景模板")]
  81. public class ZonePropertiesFieldStringValue : StringValue, IFieldMemberValue
  82. {
  83. [ObjectMemberNameAttribute(typeof(string))]
  84. [DescAttribute("字段名")]
  85. public string FieldName = "";
  86. public Type OwnerType { get { return TemplateManager.Factory.ScenePropertiesType; } }
  87. public override string ToString()
  88. {
  89. return string.Format("({0}).{1}", "场景扩展", FieldName);
  90. }
  91. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  92. {
  93. return GameFields.GetValue<string>((api.ZoneAPI as EditorScene).Data.Properties, OwnerType, FieldName);
  94. }
  95. }
  96. [DescAttribute("场景扩展字段(int)", "扩展字段 - 场景模板")]
  97. public class ZonePropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  98. {
  99. [ObjectMemberNameAttribute(typeof(int))]
  100. [DescAttribute("字段名")]
  101. public string FieldName = "";
  102. public Type OwnerType { get { return TemplateManager.Factory.ScenePropertiesType; } }
  103. public override string ToString()
  104. {
  105. return string.Format("({0}).{1}", "场景扩展", FieldName);
  106. }
  107. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  108. {
  109. return GameFields.GetValue<int>((api.ZoneAPI as EditorScene).Data.Properties, OwnerType, FieldName);
  110. }
  111. }
  112. [DescAttribute("场景扩展字段(float)", "扩展字段 - 场景模板")]
  113. public class ZonePropertiesFieldRealValue : RealValue, IFieldMemberValue
  114. {
  115. [ObjectMemberNameAttribute(typeof(float))]
  116. [DescAttribute("字段名")]
  117. public string FieldName = "";
  118. public Type OwnerType { get { return TemplateManager.Factory.ScenePropertiesType; } }
  119. public override string ToString()
  120. {
  121. return string.Format("({0}).{1}", "场景扩展", FieldName);
  122. }
  123. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  124. {
  125. return GameFields.GetValue<float>((api.ZoneAPI as EditorScene).Data.Properties, OwnerType, FieldName);
  126. }
  127. }
  128. [DescAttribute("场景扩展字段(bool)", "扩展字段 - 场景模板")]
  129. public class ZonePropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  130. {
  131. [ObjectMemberNameAttribute(typeof(bool))]
  132. [DescAttribute("字段名")]
  133. public string FieldName = "";
  134. public Type OwnerType { get { return TemplateManager.Factory.ScenePropertiesType; } }
  135. public override string ToString()
  136. {
  137. return string.Format("({0}).{1}", "场景扩展", FieldName);
  138. }
  139. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  140. {
  141. return GameFields.GetValue<bool>((api.ZoneAPI as EditorScene).Data.Properties, OwnerType, FieldName);
  142. }
  143. }
  144. #endregion
  145. //-----------------------------------------------------------------------------------------
  146. #region __单位扩展__
  147. [DescAttribute("单位扩展字段(string)", "扩展字段 - 单位模板")]
  148. public class UnitPropertiesFieldStringValue : StringValue, IFieldMemberValue
  149. {
  150. [ObjectMemberNameAttribute(typeof(string))]
  151. [DescAttribute("字段名")]
  152. public string FieldName = "";
  153. [DescAttribute("单位")]
  154. public UnitValue Unit = new UnitValue.Trigging();
  155. public Type OwnerType { get { return TemplateManager.Factory.UnitPropertiesType; } }
  156. public override string ToString()
  157. {
  158. return string.Format("({0}).扩展.{1}", Unit, FieldName);
  159. }
  160. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  161. {
  162. InstanceUnit o = Unit.GetValue(api, args);
  163. if (o != null)
  164. {
  165. return GameFields.GetValue<string>(o.Info.Properties, OwnerType, FieldName);
  166. }
  167. return null;
  168. }
  169. }
  170. [DescAttribute("单位扩展字段(int)", "扩展字段 - 单位模板")]
  171. public class UnitPropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  172. {
  173. [ObjectMemberNameAttribute(typeof(int))]
  174. [DescAttribute("字段名")]
  175. public string FieldName = "";
  176. [DescAttribute("单位")]
  177. public UnitValue Unit = new UnitValue.Trigging();
  178. public Type OwnerType { get { return TemplateManager.Factory.UnitPropertiesType; } }
  179. public override string ToString()
  180. {
  181. return string.Format("({0}).扩展.{1}", Unit, FieldName);
  182. }
  183. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  184. {
  185. InstanceUnit o = Unit.GetValue(api, args);
  186. if (o != null)
  187. {
  188. return GameFields.GetValue<int>(o.Info.Properties, OwnerType, FieldName);
  189. }
  190. return 0;
  191. }
  192. }
  193. [DescAttribute("单位扩展字段(float)", "扩展字段 - 单位模板")]
  194. public class UnitPropertiesFieldRealValue : RealValue, IFieldMemberValue
  195. {
  196. [ObjectMemberNameAttribute(typeof(float))]
  197. [DescAttribute("字段名")]
  198. public string FieldName = "";
  199. [DescAttribute("单位")]
  200. public UnitValue Unit = new UnitValue.Trigging();
  201. public Type OwnerType { get { return TemplateManager.Factory.UnitPropertiesType; } }
  202. public override string ToString()
  203. {
  204. return string.Format("({0}).扩展.{1}", Unit, FieldName);
  205. }
  206. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  207. {
  208. InstanceUnit o = Unit.GetValue(api, args);
  209. if (o != null)
  210. {
  211. return GameFields.GetValue<float>(o.Info.Properties, OwnerType, FieldName);
  212. }
  213. return 0;
  214. }
  215. }
  216. [DescAttribute("单位扩展字段(bool)", "扩展字段 - 单位模板")]
  217. public class UnitPropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  218. {
  219. [ObjectMemberNameAttribute(typeof(bool))]
  220. [DescAttribute("字段名")]
  221. public string FieldName = "";
  222. [DescAttribute("单位")]
  223. public UnitValue Unit = new UnitValue.Trigging();
  224. public Type OwnerType { get { return TemplateManager.Factory.UnitPropertiesType; } }
  225. public override string ToString()
  226. {
  227. return string.Format("({0}).扩展.{1}", Unit, FieldName);
  228. }
  229. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  230. {
  231. InstanceUnit o = Unit.GetValue(api, args);
  232. if (o != null)
  233. {
  234. return GameFields.GetValue<bool>(o.Info.Properties, OwnerType, FieldName);
  235. }
  236. return false;
  237. }
  238. }
  239. #endregion
  240. //-----------------------------------------------------------------------------------------
  241. #region __物品扩展__
  242. [DescAttribute("物品扩展字段(string)", "扩展字段 - 物品模板")]
  243. public class ItemPropertiesFieldStringValue : StringValue, IFieldMemberValue
  244. {
  245. [ObjectMemberNameAttribute(typeof(string))]
  246. [DescAttribute("字段名")]
  247. public string FieldName = "";
  248. [DescAttribute("物品")]
  249. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  250. public Type OwnerType { get { return TemplateManager.Factory.ItemPropertiesType; } }
  251. public override string ToString()
  252. {
  253. return string.Format("({0}).扩展.{1}", Item, FieldName);
  254. }
  255. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  256. {
  257. ItemTemplate o = Item.GetValue(api, args);
  258. if (o != null)
  259. {
  260. return GameFields.GetValue<string>(o.Properties, OwnerType, FieldName);
  261. }
  262. return null;
  263. }
  264. }
  265. [DescAttribute("物品扩展字段(int)", "扩展字段 - 物品模板")]
  266. public class ItemPropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  267. {
  268. [ObjectMemberNameAttribute(typeof(int))]
  269. [DescAttribute("字段名")]
  270. public string FieldName = "";
  271. [DescAttribute("物品")]
  272. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  273. public Type OwnerType { get { return TemplateManager.Factory.ItemPropertiesType; } }
  274. public override string ToString()
  275. {
  276. return string.Format("({0}).扩展.{1}", Item, FieldName);
  277. }
  278. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  279. {
  280. ItemTemplate o = Item.GetValue(api, args);
  281. if (o != null)
  282. {
  283. return GameFields.GetValue<int>(o.Properties, OwnerType, FieldName);
  284. }
  285. return 0;
  286. }
  287. }
  288. [DescAttribute("物品扩展字段(float)", "扩展字段 - 物品模板")]
  289. public class ItemPropertiesFieldRealValue : RealValue, IFieldMemberValue
  290. {
  291. [ObjectMemberNameAttribute(typeof(float))]
  292. [DescAttribute("字段名")]
  293. public string FieldName = "";
  294. [DescAttribute("物品")]
  295. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  296. public Type OwnerType { get { return TemplateManager.Factory.ItemPropertiesType; } }
  297. public override string ToString()
  298. {
  299. return string.Format("({0}).扩展.{1}", Item, FieldName);
  300. }
  301. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  302. {
  303. ItemTemplate o = Item.GetValue(api, args);
  304. if (o != null)
  305. {
  306. return GameFields.GetValue<float>(o.Properties, OwnerType, FieldName);
  307. }
  308. return 0;
  309. }
  310. }
  311. [DescAttribute("物品扩展字段(bool)", "扩展字段 - 物品模板")]
  312. public class ItemPropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  313. {
  314. [ObjectMemberNameAttribute(typeof(bool))]
  315. [DescAttribute("字段名")]
  316. public string FieldName = "";
  317. [DescAttribute("物品")]
  318. public ItemTemplateValue Item = new ItemTemplateValue.Template();
  319. public Type OwnerType { get { return TemplateManager.Factory.ItemPropertiesType; } }
  320. public override string ToString()
  321. {
  322. return string.Format("({0}).扩展.{1}", Item, FieldName);
  323. }
  324. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  325. {
  326. ItemTemplate o = Item.GetValue(api, args);
  327. if (o != null)
  328. {
  329. return GameFields.GetValue<bool>(o.Properties, OwnerType, FieldName);
  330. }
  331. return false;
  332. }
  333. }
  334. #endregion
  335. //-----------------------------------------------------------------------------------------
  336. #region __技能扩展__
  337. [DescAttribute("技能扩展字段(string)", "扩展字段 - 技能模板")]
  338. public class SkillPropertiesFieldStringValue : StringValue, IFieldMemberValue
  339. {
  340. [ObjectMemberNameAttribute(typeof(string))]
  341. [DescAttribute("字段名")]
  342. public string FieldName = "";
  343. [DescAttribute("技能")]
  344. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  345. public Type OwnerType { get { return TemplateManager.Factory.SkillPropertiesType; } }
  346. public override string ToString()
  347. {
  348. return string.Format("({0}).扩展.{1}", Skill, FieldName);
  349. }
  350. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  351. {
  352. SkillTemplate o = Skill.GetValue(api, args);
  353. if (o != null)
  354. {
  355. return GameFields.GetValue<string>(o.Properties, OwnerType, FieldName);
  356. }
  357. return null;
  358. }
  359. }
  360. [DescAttribute("技能扩展字段(int)", "扩展字段 - 技能模板")]
  361. public class SkillPropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  362. {
  363. [ObjectMemberNameAttribute(typeof(int))]
  364. [DescAttribute("字段名")]
  365. public string FieldName = "";
  366. [DescAttribute("技能")]
  367. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  368. public Type OwnerType { get { return TemplateManager.Factory.SkillPropertiesType; } }
  369. public override string ToString()
  370. {
  371. return string.Format("({0}).扩展.{1}", Skill, FieldName);
  372. }
  373. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  374. {
  375. SkillTemplate o = Skill.GetValue(api, args);
  376. if (o != null)
  377. {
  378. return GameFields.GetValue<int>(o.Properties, OwnerType, FieldName);
  379. }
  380. return 0;
  381. }
  382. }
  383. [DescAttribute("技能扩展字段(float)", "扩展字段 - 技能模板")]
  384. public class SkillPropertiesFieldRealValue : RealValue, IFieldMemberValue
  385. {
  386. [ObjectMemberNameAttribute(typeof(float))]
  387. [DescAttribute("字段名")]
  388. public string FieldName = "";
  389. [DescAttribute("技能")]
  390. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  391. public Type OwnerType { get { return TemplateManager.Factory.SkillPropertiesType; } }
  392. public override string ToString()
  393. {
  394. return string.Format("({0}).扩展.{1}", Skill, FieldName);
  395. }
  396. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  397. {
  398. SkillTemplate o = Skill.GetValue(api, args);
  399. if (o != null)
  400. {
  401. return GameFields.GetValue<float>(o.Properties, OwnerType, FieldName);
  402. }
  403. return 0;
  404. }
  405. }
  406. [DescAttribute("技能扩展字段(bool)", "扩展字段 - 技能模板")]
  407. public class SkillPropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  408. {
  409. [ObjectMemberNameAttribute(typeof(bool))]
  410. [DescAttribute("字段名")]
  411. public string FieldName = "";
  412. [DescAttribute("技能")]
  413. public SkillTemplateValue Skill = new SkillTemplateValue.Template();
  414. public Type OwnerType { get { return TemplateManager.Factory.SkillPropertiesType; } }
  415. public override string ToString()
  416. {
  417. return string.Format("({0}).扩展.{1}", Skill, FieldName);
  418. }
  419. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  420. {
  421. SkillTemplate o = Skill.GetValue(api, args);
  422. if (o != null)
  423. {
  424. return GameFields.GetValue<bool>(o.Properties, OwnerType, FieldName);
  425. }
  426. return false;
  427. }
  428. }
  429. #endregion
  430. //-----------------------------------------------------------------------------------------
  431. #region __法术扩展__
  432. [DescAttribute("法术扩展字段(string)", "扩展字段 - 法术模板")]
  433. public class SpellPropertiesFieldStringValue : StringValue, IFieldMemberValue
  434. {
  435. [ObjectMemberNameAttribute(typeof(string))]
  436. [DescAttribute("字段名")]
  437. public string FieldName = "";
  438. [DescAttribute("法术")]
  439. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  440. public Type OwnerType { get { return TemplateManager.Factory.SpellPropertiesType; } }
  441. public override string ToString()
  442. {
  443. return string.Format("({0}).扩展.{1}", Spell, FieldName);
  444. }
  445. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  446. {
  447. SpellTemplate o = Spell.GetValue(api, args);
  448. if (o != null)
  449. {
  450. return GameFields.GetValue<string>(o.Properties, OwnerType, FieldName);
  451. }
  452. return null;
  453. }
  454. }
  455. [DescAttribute("法术扩展字段(int)", "扩展字段 - 法术模板")]
  456. public class SpellPropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  457. {
  458. [ObjectMemberNameAttribute(typeof(int))]
  459. [DescAttribute("字段名")]
  460. public string FieldName = "";
  461. [DescAttribute("法术")]
  462. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  463. public Type OwnerType { get { return TemplateManager.Factory.SpellPropertiesType; } }
  464. public override string ToString()
  465. {
  466. return string.Format("({0}).扩展.{1}", Spell, FieldName);
  467. }
  468. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  469. {
  470. SpellTemplate o = Spell.GetValue(api, args);
  471. if (o != null)
  472. {
  473. return GameFields.GetValue<int>(o.Properties, OwnerType, FieldName);
  474. }
  475. return 0;
  476. }
  477. }
  478. [DescAttribute("法术扩展字段(float)", "扩展字段 - 法术模板")]
  479. public class SpellPropertiesFieldRealValue : RealValue, IFieldMemberValue
  480. {
  481. [ObjectMemberNameAttribute(typeof(float))]
  482. [DescAttribute("字段名")]
  483. public string FieldName = "";
  484. [DescAttribute("法术")]
  485. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  486. public Type OwnerType { get { return TemplateManager.Factory.SpellPropertiesType; } }
  487. public override string ToString()
  488. {
  489. return string.Format("({0}).扩展.{1}", Spell, FieldName);
  490. }
  491. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  492. {
  493. SpellTemplate o = Spell.GetValue(api, args);
  494. if (o != null)
  495. {
  496. return GameFields.GetValue<float>(o.Properties, OwnerType, FieldName);
  497. }
  498. return 0;
  499. }
  500. }
  501. [DescAttribute("法术扩展字段(bool)", "扩展字段 - 法术模板")]
  502. public class SpellPropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  503. {
  504. [ObjectMemberNameAttribute(typeof(bool))]
  505. [DescAttribute("字段名")]
  506. public string FieldName = "";
  507. [DescAttribute("法术")]
  508. public SpellTemplateValue Spell = new SpellTemplateValue.Template();
  509. public Type OwnerType { get { return TemplateManager.Factory.SpellPropertiesType; } }
  510. public override string ToString()
  511. {
  512. return string.Format("({0}).扩展.{1}", Spell, FieldName);
  513. }
  514. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  515. {
  516. SpellTemplate o = Spell.GetValue(api, args);
  517. if (o != null)
  518. {
  519. return GameFields.GetValue<bool>(o.Properties, OwnerType, FieldName);
  520. }
  521. return false;
  522. }
  523. }
  524. #endregion
  525. //-----------------------------------------------------------------------------------------
  526. #region __BUFF扩展__
  527. [DescAttribute("BUFF扩展字段(string)", "扩展字段 - BUFF模板")]
  528. public class BuffPropertiesFieldStringValue : StringValue, IFieldMemberValue
  529. {
  530. [ObjectMemberNameAttribute(typeof(string))]
  531. [DescAttribute("字段名")]
  532. public string FieldName = "";
  533. [DescAttribute("BUFF")]
  534. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  535. public Type OwnerType { get { return TemplateManager.Factory.BuffPropertiesType; } }
  536. public override string ToString()
  537. {
  538. return string.Format("({0}).扩展.{1}", Buff, FieldName);
  539. }
  540. public override string GetValue(IEditorValueAdapter api, EventArguments args)
  541. {
  542. BuffTemplate o = Buff.GetValue(api, args);
  543. if (o != null)
  544. {
  545. return GameFields.GetValue<string>(o.Properties, OwnerType, FieldName);
  546. }
  547. return null;
  548. }
  549. }
  550. [DescAttribute("BUFF扩展字段(int)", "扩展字段 - BUFF模板")]
  551. public class BuffPropertiesFieldIntegerValue : IntegerValue, IFieldMemberValue
  552. {
  553. [ObjectMemberNameAttribute(typeof(int))]
  554. [DescAttribute("字段名")]
  555. public string FieldName = "";
  556. [DescAttribute("BUFF")]
  557. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  558. public Type OwnerType { get { return TemplateManager.Factory.BuffPropertiesType; } }
  559. public override string ToString()
  560. {
  561. return string.Format("({0}).扩展.{1}", Buff, FieldName);
  562. }
  563. public override int GetValue(IEditorValueAdapter api, EventArguments args)
  564. {
  565. BuffTemplate o = Buff.GetValue(api, args);
  566. if (o != null)
  567. {
  568. return GameFields.GetValue<int>(o.Properties, OwnerType, FieldName);
  569. }
  570. return 0;
  571. }
  572. }
  573. [DescAttribute("BUFF扩展字段(float)", "扩展字段 - BUFF模板")]
  574. public class BuffPropertiesFieldRealValue : RealValue, IFieldMemberValue
  575. {
  576. [ObjectMemberNameAttribute(typeof(float))]
  577. [DescAttribute("字段名")]
  578. public string FieldName = "";
  579. [DescAttribute("BUFF")]
  580. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  581. public Type OwnerType { get { return TemplateManager.Factory.BuffPropertiesType; } }
  582. public override string ToString()
  583. {
  584. return string.Format("({0}).扩展.{1}", Buff, FieldName);
  585. }
  586. public override float GetValue(IEditorValueAdapter api, EventArguments args)
  587. {
  588. BuffTemplate o = Buff.GetValue(api, args);
  589. if (o != null)
  590. {
  591. return GameFields.GetValue<float>(o.Properties, OwnerType, FieldName);
  592. }
  593. return 0;
  594. }
  595. }
  596. [DescAttribute("BUFF扩展字段(bool)", "扩展字段 - BUFF模板")]
  597. public class BuffPropertiesFieldBoolValue : BooleanValue, IFieldMemberValue
  598. {
  599. [ObjectMemberNameAttribute(typeof(bool))]
  600. [DescAttribute("字段名")]
  601. public string FieldName = "";
  602. [DescAttribute("BUFF")]
  603. public BuffTemplateValue Buff = new BuffTemplateValue.Template();
  604. public Type OwnerType { get { return TemplateManager.Factory.BuffPropertiesType; } }
  605. public override string ToString()
  606. {
  607. return string.Format("({0}).扩展.{1}", Buff, FieldName);
  608. }
  609. public override bool GetValue(IEditorValueAdapter api, EventArguments args)
  610. {
  611. BuffTemplate o = Buff.GetValue(api, args);
  612. if (o != null)
  613. {
  614. return GameFields.GetValue<bool>(o.Properties, OwnerType, FieldName);
  615. }
  616. return false;
  617. }
  618. }
  619. #endregion
  620. //-----------------------------------------------------------------------------------------
  621. }