| | |
| | | using System.Threading.Tasks; |
| | | using ZTImage.Configuration; |
| | | using RichCreator.Maps; |
| | | using RichCreator.Utility.Maps; |
| | | |
| | | namespace RichCreator |
| | | { |
| | |
| | | private WeGameJob wegameJob; |
| | | private JobBase dnfJob; |
| | | |
| | | private Int32 taskIndex; |
| | | private MapType mapType; |
| | | |
| | | Int32 runningStep = RunningStep.None; |
| | | |
| | | public JobMonitor(Int32 taskIndex) |
| | | public JobMonitor(MapType maptype) |
| | | { |
| | | this.config = ConfigHelper.GetInstance<RichCreatorConfig>(); |
| | | this.cancelTokenSource = new CancellationTokenSource(); |
| | | this.taskIndex = taskIndex; |
| | | this.mapType = maptype; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | throw new Exception("不能多次运行"); |
| | | } |
| | | canRun = false; |
| | | ThreadPool.QueueUserWorkItem(MonitorBusinessThread); |
| | | Thread thread = new Thread(MonitorBusinessThread); |
| | | thread.IsBackground = true; |
| | | thread.Start(); |
| | | |
| | | |
| | | |
| | | //ThreadPool.QueueUserWorkItem(MonitorBusinessThread); |
| | | } |
| | | |
| | | //停止 |
| | |
| | | for (; accountIndex < accountCount; accountIndex++) |
| | | { |
| | | RunningModel.UpdateAccountIndex(accountIndex+1); |
| | | |
| | | if (runningStep < RunningStep.SelectRole) |
| | | { |
| | | string username, password; |
| | |
| | | |
| | | //设为顶层 |
| | | WindowUtils.SetDnfToTop(); |
| | | this.dnfJob = GetDNFJob(); |
| | | this.dnfJob = new DNFJob(this.mapType, this.config); |
| | | jobResult = this.dnfJob.Do(this.cancelTokenSource.Token, runningStep); |
| | | if (jobResult != ZTResult.Success) |
| | | { |
| | |
| | | ProcessUtils.CloseWeGame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据当前选择的地图实例化DNF地图 |
| | | /// </summary> |
| | | /// <param name="config"></param> |
| | | /// <returns></returns> |
| | | private JobBase GetDNFJob() |
| | | { |
| | | switch (this.taskIndex) |
| | | { |
| | | case 0: |
| | | return new DNFJob<LindongMap>(this.config); |
| | | case 1: |
| | | return new DNFJob<SkillMap>(this.config); |
| | | case 2: |
| | | return new DNFJob<TestMap>(this.config); |
| | | } |
| | | throw new Exception("this task index is error"); |
| | | } |
| | | } |
| | | } |