/// <summary>
 /// 从执行服务移除一个能力代码
 /// </summary>
 /// <param name="code">要移除的能力代码</param>
 /// <returns></returns>
 public static Code UnregisterCode(Code code)
 {
     lock (CodeList)
     {
         if (CodeList.Contains(code)) CodeList.Remove(code);
     }
     return code;
 }
 /// <summary>
 /// 注册一个能力代码到执行服务
 /// </summary>
 /// <param name="code">要注册的能力代码</param>
 /// <returns></returns>
 public static Code RegisterCode(Code code)
 {
     lock (CodeList)
     {
         if (!CodeList.Contains(code)) CodeList.Add(code);
     }
     return code;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 设置卡片的属性
 /// </summary>
 /// <param name="id">卡片ID</param>
 /// <param name="beforeUsingCheck">使用检查前能力代码</param>
 /// <param name="usingCheck">使用检查能力代码</param>
 /// <param name="afterUsingCheck">使用检查后能力代码</param>
 /// <param name="use">使用时能力代码</param>
 /// <returns></returns>
 public Card SetCard(int id, Code beforeUsingCheck, Code usingCheck, Code afterUsingCheck, Code use)
 {
     ID = id;
     CodeBeforeUsingCheck = beforeUsingCheck;
     CodeUsingCheck = usingCheck;
     CodeAfterUsingCheck = afterUsingCheck;
     CodeUse = use;
     return this;
 }
Exemplo n.º 4
0
 public static Servant SetServant(Servant servant, string name, Code[] codes)
 {
     return servant.SetServant(name, codes);
 }
Exemplo n.º 5
0
 public Servant SetServant(string name, Code[] codes)
 {
     Dispatcher.Run(() => Definition = new ServantDefinition(name));
     Codes = codes;
     return this;
 }
Exemplo n.º 6
0
 internal override ExecuteInformation Execute(Code previousCode, Code nextCode, ExecuteInformation parameter)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 /// <summary>
 /// 设置卡片的属性
 /// </summary>
 /// <param name="card">目标卡片</param>
 /// <param name="id">卡片ID</param>
 /// <param name="beforeUsingCheck">使用检查前能力代码</param>
 /// <param name="usingCheck">使用检查能力代码</param>
 /// <param name="afterUsingCheck">使用检查后能力代码</param>
 /// <param name="use">使用时能力代码</param>
 /// <returns></returns>
 public static Card SetCard(Card card, int id, Code beforeUsingCheck, Code usingCheck, Code afterUsingCheck, Code use)
 {
     return card.SetCard(id, beforeUsingCheck, usingCheck, afterUsingCheck, use);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 执行能力代码
 /// </summary>
 /// <param name="previousCode">执行链上的前一个能力代码</param>
 /// <param name="nextCode">执行链上的后一个能力代码</param>
 /// <param name="parameter">执行信息</param>
 /// <returns></returns>
 internal abstract ExecuteInformation Execute(Code previousCode, Code nextCode, ExecuteInformation parameter);
 /// <summary>
 /// 立即执行指定能力代码
 /// </summary>
 /// <param name="code">目标能力代码</param>
 /// <param name="parameter">执行信息</param>
 /// <returns></returns>
 public static ExecuteInformation Execute(Code code, ExecuteInformation parameter)
 {
     RegisterCode(code);
     return Execute(ExecuteTimePoint.Now, parameter.ExecuteParameter);
 }