/// <summary> /// 清理背包,从第几页几格到几页几格 /// </summary> /// <param name="role"></param> /// <param name="beginPage">开始页数</param> /// <param name="beginItem">开始格数</param> /// <param name="stopPage">停止页数</param> /// <param name="sotpItem">停止格数</param> public static void BagCleanup(this IRole role, int beginPage, int beginItem, int stopPage, int sotpItem) { if (beginPage == stopPage) { role.BagCleanup(beginPage, beginItem, sotpItem); } if (beginPage < stopPage) { for (int i = beginPage; i <= stopPage; i++) { if (i == stopPage) { role.BagCleanup(i, 1, sotpItem); } if (i == beginPage) { role.BagCleanup(i, beginItem, 30); } if (i < stopPage && i != beginPage) { role.BagCleanup(i, 1, 30); } } } }
private TaskResult RunStep1(TaskContext context) { IRole role = context.Role; bool ret = role.HasBoard("拥有物品"); if (ret != true) { throw new TaskInterruptException("背包未打开!"); } //第一页坐标: 第一格坐标: role.BagCleanup(_beginPage, _beginItem, _stopPage, _stopItem); return(TaskResult.Finished); }