EventsPlayerQuest.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using CommonAI.Zone.EventTrigger;
  2. using CommonAI.Zone.Instance;
  3. using CommonAI.Zone.ZoneEditor;
  4. using CommonAI.Zone.ZoneEditor.EventTrigger;
  5. using CommonLang.Property;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using XmdsCommonServer.Plugin.Scene;
  11. namespace XmdsCommonServer.Plugin.Editor
  12. {
  13. /*
  14. [DescAttribute("某个玩家任务状态Flag发生变化", "Xmds扩展 - 任务")]
  15. public class QuestFlagChanged : AbstractTrigger
  16. {
  17. public override void Listen(EventTriggerAdapter api, EventArguments args)
  18. {
  19. XmdsServerScene scene = (api.ZoneAPI as XmdsServerScene);
  20. XmdsServerScene.OnPlayerQuestFlagChangedHandlerR2B handler = new XmdsServerScene.OnPlayerQuestFlagChangedHandlerR2B((zone, player, flagName, flagValue)=>
  21. {
  22. //api.TriggingUnit = player;
  23. api.SetAttribute("TriggingFlagName", flagName);
  24. api.TestAndDoAction();
  25. });
  26. scene.OnPlayerQuestFlagChanged_R2B += handler;
  27. api.OnDisposed += (a) =>
  28. {
  29. scene.OnPlayerQuestFlagChanged_R2B -= handler;
  30. };
  31. }
  32. public override string ToString()
  33. {
  34. return string.Format("某个玩家任务状态Flag发生变化");
  35. }
  36. }
  37. [DescAttribute("设置玩家任务Flag", "Xmds扩展 - 任务")]
  38. public class SetPlayerQuestFlagAction : AbstractAction
  39. {
  40. [DescAttribute("玩家单位")]
  41. public UnitValue PlayerUnit = new UnitValue.Trigging();
  42. [DescAttribute("Flag唯一ID")]
  43. public StringValue FlagName = new StringValue.VALUE("FlagName");
  44. [DescAttribute("Flag值")]
  45. public StringValue FlagValue = new StringValue.VALUE("FlagValue");
  46. public override void DoAction(EventTriggerAdapter api, EventArguments args)
  47. {
  48. XmdsServerScene scene = (api.ZoneAPI as XmdsServerScene);
  49. InstancePlayer player = PlayerUnit.GetValue(api, args) as InstancePlayer;
  50. if (player != null)
  51. {
  52. scene.BS_SetPlayerQuestFlag(player, FlagName.GetValue(api, args), FlagValue.GetValue(api, args));
  53. }
  54. }
  55. public override string ToString()
  56. {
  57. return string.Format("设置玩家({0})任务Flag:{1}={2}", PlayerUnit, FlagName, FlagValue);
  58. }
  59. }
  60. [DescAttribute("清理玩家任务Flag", "Xmds扩展 - 任务")]
  61. public class ClearPlayerQuestFlagAction : AbstractAction
  62. {
  63. [DescAttribute("玩家单位")]
  64. public UnitValue PlayerUnit = new UnitValue.Trigging();
  65. [DescAttribute("Flag唯一ID")]
  66. public StringValue FlagName = new StringValue.VALUE("FlagName");
  67. public override void DoAction(EventTriggerAdapter api, EventArguments args)
  68. {
  69. XmdsServerScene scene = (api.ZoneAPI as XmdsServerScene);
  70. InstancePlayer player = PlayerUnit.GetValue(api, args) as InstancePlayer;
  71. if (player != null)
  72. {
  73. scene.BS_ClearPlayerQuestFlag(player, FlagName.GetValue(api, args));
  74. }
  75. }
  76. public override string ToString()
  77. {
  78. return string.Format("清理玩家({0})任务Flag:{1}", PlayerUnit, FlagName);
  79. }
  80. }
  81. [DescAttribute("获得玩家任务Flag值", "Xmds扩展 - 任务")]
  82. public class PlayerQuestFlagValue : StringValue
  83. {
  84. [DescAttribute("玩家单位")]
  85. public UnitValue PlayerUnit = new UnitValue.Trigging();
  86. [DescAttribute("Flag唯一ID")]
  87. public StringValue FlagName = new StringValue.VALUE("FlagName");
  88. public override string GetValue((IEditorValueAdapter api, EventArguments args)
  89. {
  90. string flagName = FlagName.GetValue(api, args);
  91. InstancePlayer player = PlayerUnit.GetValue(api, args) as InstancePlayer;
  92. if (player != null && flagName != null)
  93. {
  94. return (player.Virtual as XmdsVirtual_Player).GetQuestFlag(flagName);
  95. }
  96. return null;
  97. }
  98. public override string ToString()
  99. {
  100. return string.Format("获得玩家({0})任务Flag:{1}", PlayerUnit, FlagName);
  101. }
  102. }
  103. [DescAttribute("玩家是否拥有任务Flag", "Xmds扩展 - 任务")]
  104. public class PlayerContainsQuestFlag : BooleanValue
  105. {
  106. [DescAttribute("玩家单位")]
  107. public UnitValue PlayerUnit = new UnitValue.Trigging();
  108. [DescAttribute("Flag唯一ID")]
  109. public StringValue FlagName = new StringValue.VALUE("FlagName");
  110. public override bool GetValue((IEditorValueAdapter api, EventArguments args)
  111. {
  112. string flagName = FlagName.GetValue(api, args);
  113. InstancePlayer player = PlayerUnit.GetValue(api, args) as InstancePlayer;
  114. if (player != null && flagName != null)
  115. {
  116. return !string.IsNullOrEmpty((player.Virtual as XmdsVirtual_Player).GetQuestFlag(flagName));
  117. }
  118. return false;
  119. }
  120. public override string ToString()
  121. {
  122. return string.Format("玩家({0})是否拥有任务Flag:{1}", PlayerUnit, FlagName);
  123. }
  124. }
  125. [DescAttribute("触发中的FlagName", "Xmds扩展 - 任务")]
  126. public class TriggingFlagName : StringValue
  127. {
  128. public override string ToString()
  129. {
  130. return string.Format("触发中的FlagName");
  131. }
  132. public override string GetValue((IEditorValueAdapter api, EventArguments args)
  133. {
  134. return api.GetAttribute("TriggingFlagName") as string;
  135. }
  136. }
  137. */
  138. }