public static IEnumerable <string> GetExistingMediaFiles(this BaseTask baseTask, string buildConfiguration) { var buildConfigAssetDir = baseTask.GetBuildConfigurationAssetDir(buildConfiguration); try { var files = Directory.EnumerateFiles(buildConfigAssetDir, "*.png", SearchOption.AllDirectories); if (baseTask.IsVerbose()) { if (files.Any()) { baseTask.LogVerbose("{0} png files found in resources folder {1}", files.Count(), buildConfigAssetDir); foreach (var file in files) { baseTask.LogDebug("Media file found {0}", file); } } else { baseTask.LogVerbose("No files found in resources folder {0}", buildConfigAssetDir); } } return(files); } catch (Exception ex) { baseTask.Log.LogErrorFromException(ex); } return(null); }
public static string GetBuildConfigurationAssetDir(this BaseTask baseTask, string buildConfiguration) { var tapAssetDir = baseTask.GetAssetDir(); baseTask.LogDebug($"{Consts.TapAssetsDir} located at {tapAssetDir}", tapAssetDir); baseTask.LogDebug("BuildConfiguration {0}", buildConfiguration); try { var mediaAssetDir = Path.Combine(tapAssetDir, buildConfiguration); if (!Directory.Exists(mediaAssetDir)) { baseTask.LogDebug("Created asset folder at '{0}'", mediaAssetDir); Directory.CreateDirectory(mediaAssetDir); } else { baseTask.LogDebug("Asset folder location '{0}'", mediaAssetDir); } var directoryInfo = new DirectoryInfo(mediaAssetDir); return(directoryInfo.FullName); } catch (Exception ex) { baseTask.Log.LogErrorFromException(ex); } return(null); }
public async void Put([FromBody] BaseTask task) { await repository.Update(task); manager.Remove(task.Id); manager.Add(task, tasksFactory.SendMessageAction); }
private BaseTask GetTaskFromRecord(TaskRecord taskRecord) { BaseTask task = null; if (taskRecord.Type == Metronome) { task = new MetronomeGoalTask(); task.Id = taskRecord.Id; task.Title = taskRecord.Title; } else if (taskRecord.Type == Duration) { task = new DurationGoalTask(); task.Id = taskRecord.Id; task.Title = taskRecord.Title; } else if (taskRecord.Type == Percent) { task = new PercentGoalTask(); task.Id = taskRecord.Id; task.Title = taskRecord.Title; } else if (taskRecord.Type == Aggregate) { // https://www.c-sharpcorner.com/UploadFile/c5c6e2/populate-a-treeview-dynamically/ // https://github.com/vectors36/dynamic_treeview_sqlite_winform task = new AggregateTask(); task.Id = taskRecord.Id; task.Title = taskRecord.Title; } return(task); }
private void CreateTaskList(List <int> taskIds) { this.mTopTaskItem = null; for (int i = taskIds.get_Count() - 1; i >= 0; i--) { BaseTask task = MainTaskManager.Instance.GetTask(taskIds.get_Item(i), true); if (task != null) { if (task.IsActive) { if (task.Task.taskType == Package.Task.TaskType.MainTask && MainTaskManager.Instance.GodWeaponTaskId > 0) { task.IsActive = false; } else { this.CheckCreateTask(task); } } else if (task.Task.taskType == Package.Task.TaskType.MainTask && MainTaskManager.Instance.GodWeaponTaskId == 0) { if (task.Task.status == Package.Task.TaskStatus.TaskNotOpen || (task.Task.status == Package.Task.TaskStatus.TaskFinished && !task.hasNextTask)) { this.CheckCreateTask(task); } } else if (task.Task.taskType == Package.Task.TaskType.ChangeCareer && !task.hasNextTask) { this.CheckCreateTask(task); } } } }
public override void OpenRecord(BaseTask task) { task.RecordIndex = RecordList.Count; SpatialRecord prevRecord = (RecordList.Count == 0) ? null : RecordList[RecordList.Count - 1] as SpatialRecord; RecordList.Add(new SpatialRecord(prevRecord, task as SpatialTask)); }
protected void OnDelayExecuteTask() { if (this.mDelayExecuteId > 0u) { if (GuideManager.Instance.guide_lock) { Debug.Log("任务延迟后操作被指引打断!!!"); return; } if (this.Task.status == Package.Task.TaskStatus.TaskReceived) { MainTaskManager.Instance.ExecuteTask(this.Task.taskId, false); } else if (this.Task.status == Package.Task.TaskStatus.TaskFinished) { BaseTask task = MainTaskManager.Instance.GetTask(MainTaskManager.Instance.CurTaskId, true); if (task != null && task.Task.taskType == this.Task.taskType) { MainTaskManager.Instance.ExecuteTask(0, false); } } MainTaskManager.Instance.DelayExecuteTaskId = 0; TimerHeap.DelTimer(this.mDelayExecuteId); this.mDelayExecuteId = 0u; } }
private static BaseTask CreateTask(TaskInfo taskInfo) { BaseTask task; switch (taskInfo.Action) { case ActionType.AddTemplate: task = new AddTemplateTask(); break; case ActionType.CompareValue: task = new CompareValueTask(); break; case ActionType.GetValueFromCache: task = new GetValueFromCacheTask(); break; case ActionType.ClearCacheValue: task = new ClearCacheValueTask(); break; default: task = new BaseTask(); break; } return(task); }
private void OnClickTask(BaseTask task) { if (MainTaskManager.Instance.ZeroTaskTimes <= 0) { return; } switch (task.Task.extParams.get_Item(4)) { case 1: UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(310032, false)); break; case 2: if (MainTaskManager.Instance.ZeroTaskTimes > this.mCommintTaskCount + this.mReceivedTaskCount) { MainTaskManager.Instance.SendTaskGroupAcceptReq(task.Task.extParams.get_Item(0)); } break; case 3: DialogBoxUIViewModel.Instance.ShowAsOKCancel(GameDataUtils.GetChineseContent(621270, false), GameDataUtils.GetChineseContent(310037, false), null, delegate { MainTaskManager.Instance.SendAbandonTaskReq(task.Task.extParams.get_Item(0)); }, "取 消", "确 定", "button_orange_1", "button_yellow_1", null, true, true); break; case 4: MainTaskManager.Instance.SendGetZeroCityPrizeReq(task.Task.extParams.get_Item(0)); break; } }
public void CurrentExecute(BaseTask task) { if (_receivers.ContainsKey(task.GetType())) { _receivers[task.GetType()].Handle(task); } }
/// <summary> /// Remove a reward from this quest /// </summary> /// <param name="Task">Task which should be removed</param> public void RemoveTask(BaseTask Task) { if (Tasks.Contains(Task)) { Tasks.Remove(Task); } }
internal void MakeTouchableAgain(BaseTask task) { var matchingTask = items.First(t => t.Task.ID == task.ID); var matchingIndex = items.IndexOf(matchingTask); items[matchingIndex].IsUntouchable = false; }
// 문자열내에 지정된 환경변수를 분석하여 문자열을 실행 가능한 상태로 완성시킨다. string ParseContext(BaseTask task, string text, string[] args, out string[] outText) { outText = null; string[] contexts = m_Config.ExtractText(text); if (contexts.Length == 0) { return(text); } string resultText = text; List <string> resultContexts = new List <string>(); foreach (var ctx in contexts) { string[] words = ctx.Split(':'); if (words.Length < 2) { throw new DevilException(DevilErrorCode.ErrorTaskNotExists, "invalid context:{0}", string.Join(' ', ctx)); } BaseParser parser; if (m_Parsers.TryGetValue(words[0], out parser) == false) { throw new DevilException(DevilErrorCode.ErrorTaskNotExists, "not found parser. key:{0}", words[0]); } resultText = parser.Run(task, resultText, words, args, out outText); } return(resultText); }
private View GenerateItemViewBasedOnType(BaseTask item, View convertView, ViewGroup parent) { var habit = item as Habit; var routine = item as Routine; var todo = item as Todo; if (convertView == null) // no view to re-use, create new { convertView = context.LayoutInflater.Inflate(Resource.Layout.TaskCell, null); } var view = GetGenericView(item, convertView); if (habit != null) { return(GenerateHabitCell(habit, view)); } else if (routine != null) { return(GenerateRoutineCell(routine, view)); } else if (todo != null) { return(GenerateTodoCell(todo, view)); } else { throw new InvalidCastException(); } }
public void AddTaskToQueue(BaseTask task) { if (task.unique) { if (currentTask != null && currentTask.name == task.name) { currentTask.priority = task.priority; return; } else if (HasTaskOfType(task.name)) { BaseTask existingTask = GetTaskOfType(task.name); if (existingTask.resumeable) { return; } else { awaitingTasks.Remove(existingTask); } } } task.owner = this; awaitingTasks.Add(task); task.OnAddedToQueue(); UpdateQueue(); }
public override void OpenRecord(BaseTask task) { task.RecordIndex = RecordList.Count; CollectRecord prevRecord = (RecordList.Count == 0) ? null : RecordList[RecordList.Count - 1] as CollectRecord; RecordList.Add(new CollectRecord(prevRecord, task as CollectTask)); }
public void Update() { if (currentTask != null && currentTask.GetType() == typeof(BaseTask)) { currentTask = null; //TODO; } if (currentTask == null) { if (awaitingTasks.Count == 0) { //Laze around } else { UpdateQueue(); StartTask(awaitingTasks[0]); } } else { UpdateQueue(); currentTask.OnUpdate(); if (currentTask.failed || currentTask.completed) { if (awaitingTasks.Count > 0) { StartTask(awaitingTasks[0]); } else { currentTask = null; } } } }
private void RefreshInfo(BaseTask cell) { this.mTxTaskName.set_text(GameDataUtils.GetChineseContent(cell.Data.dramaIntroduce, false)); this.mTxTaskDesc.set_text(GameDataUtils.GetChineseContent(cell.Data.introduction, false)); this.mBtnGetMultiple.get_gameObject().SetActive(false); string chineseContent = GameDataUtils.GetChineseContent(310010, false); if (cell.Task.status == Package.Task.TaskStatus.TaskCanAccept) { chineseContent = GameDataUtils.GetChineseContent(310011, false); this.SetGuideTips(cell, 4); } else if (cell.Task.status == Package.Task.TaskStatus.WaitingToClaimPrize && (MainTaskManager.Instance.IsTaskNpc(MainTaskManager.Instance.NpcId) || (cell.Data != null && cell.Data.quickComplete == 1))) { chineseContent = GameDataUtils.GetChineseContent(310012, false); this.SetGuideTips(cell, 5); if (cell.Data.doubleReward == 1) { this.mBtnGetMultiple.get_gameObject().SetActive(true); this.mTxGetMultiplePrice.set_text("x" + MainTaskManager.Instance.UseDiamondCount); this.mTxGetMultipleButton.set_text(GameDataUtils.GetChineseContent(505305, false)); } } this.mTxGetButton.set_text(chineseContent); }
private void RefreshDescUI(Package.Task data = null) { if (!base.get_gameObject().get_activeInHierarchy()) { return; } if (MainTaskManager.Instance.CurTaskId != TaskDescUI.OpenByTaskId) { return; } this.HideGuideTips(); BaseTask task = MainTaskManager.Instance.GetTask(TaskDescUI.OpenByTaskId, true); if (task != null) { if (data != null && (task.Data.quickReceive == 1 || task.Data.quickComplete == 1)) { this.Show(false); } else { this.RefreshReward(task); this.RefreshInfo(task); } } }
internal void AddTaskToQueue(BaseTask task) { lock (_tasks) { _tasks.Add(task); } }
public InputFileArgumentCollection(BaseTask baseTask, ITaskItem[] inputFileList, int maxArgLength) { this.task = baseTask; this.inputFiles = inputFileList; this.maxArgLength = maxArgLength; this.Reset(); }
private static int Run <T>(BaseTask <T> task, T opts) where T : BaseOptions { Console.WriteLine(task.TaskName); task.Options = opts; OrganizationServiceProxy serviceProxy = null; try { // Obtain the target organization's web address and client logon credentials // from the user by using a helper class. ServerConnection serverConnect = new ServerConnection(); ServerConnection.Configuration config = serverConnect.GetServerConfiguration(); // Establish an authenticated connection to the Organization web service. serviceProxy = new OrganizationServiceProxy(config.OrganizationUri, config.HomeRealmUri, config.Credentials, null); task.Service = serviceProxy; task.Run(); } catch (Exception e) { HandleException(e); return(1); } finally { // Always dispose the service object to close the service connection and free resources. if (serviceProxy != null) { serviceProxy.Dispose(); } } return(0); }
public static string GetAssetDir(this BaseTask baseTask) { baseTask.LogDebug("ProjectDir located at {0}", baseTask.ProjectDir); try { var tapAssetDir = Path.Combine(baseTask.ProjectDir, Consts.TapAssetsDir); if (!Directory.Exists(tapAssetDir)) { baseTask.LogDebug($"Created {Consts.TapAssetsDir} folder at {tapAssetDir}"); Directory.CreateDirectory(tapAssetDir); } else { baseTask.LogDebug($"{Consts.TapAssetsDir} folder location {tapAssetDir}"); } var directoryInfo = new DirectoryInfo(tapAssetDir); return(directoryInfo.FullName); } catch (Exception ex) { baseTask.Log.LogErrorFromException(ex); } return(null); }
protected override void OnStart(string[] args) { InitLog4Net(); #region 检查并创建 MSMQ 消息队列 //string wmsBarcodeScanQueue = ConfigurationManager.AppSettings["WmsBarcodeScanQueue"]; //if (!MessageQueue.Exists(wmsBarcodeScanQueue)) // MessageQueue.Create(wmsBarcodeScanQueue, true); string wmsRunQueue = ConfigurationManager.AppSettings["WmsRunQueue"]; if (!MessageQueue.Exists(wmsRunQueue)) { MessageQueue.Create(wmsRunQueue, true); } string wmsScanQueue = ConfigurationManager.AppSettings["WmsScanQueue"]; if (!MessageQueue.Exists(wmsScanQueue)) { MessageQueue.Create(wmsScanQueue, true); } #endregion BaseTask.Run(); }
public static string GetTaskTarget(BaseTask task, bool hasColor, string color = "") { string text = GameDataUtils.GetChineseContent(task.Data.targetContent, false); switch (task.Task.status) { case Package.Task.TaskStatus.TaskNotOpen: if (EntityWorld.Instance.EntSelf.Lv < task.Data.lv) { text += string.Format(MainTaskItem.GetStatus(hasColor, color, 0), task.Data.lv); } else { text += MainTaskItem.GetStatus(hasColor, color, 1); } return(text); case Package.Task.TaskStatus.TaskReceived: switch (task.Data.type) { case 2: case 21: case 22: text += MainTaskItem.GetProgress(task.Data.target, -1, task.Task.count, MainTaskItem.GetStatus(hasColor, color, 6)); goto IL_23A; case 4: case 18: case 19: case 25: case 26: case 27: case 28: case 31: case 32: text += MainTaskItem.GetProgress(task.Data.target, 2, task.Task.count, MainTaskItem.GetStatus(hasColor, color, 6)); goto IL_23A; case 5: case 33: text += MainTaskItem.GetProgress(task.Data.target, 1, task.Task.count, MainTaskItem.GetStatus(hasColor, color, 6)); goto IL_23A; case 6: text += MainTaskItem.GetProgress(task.Data.target, 0, task.Task.count, MainTaskItem.GetStatus(hasColor, color, 6)); goto IL_23A; case 29: case 30: text += MainTaskItem.GetProgress(task.Data.target, 3, task.Task.count, MainTaskItem.GetStatus(hasColor, color, 6)); goto IL_23A; } text += MainTaskItem.GetStatus(hasColor, color, (int)task.Task.status); IL_23A: return(text); } text += MainTaskItem.GetStatus(hasColor, color, (int)task.Task.status); return(text); }
public override void CloseRecord(BaseTask task) { CollectTask collect = task as CollectTask; long expStartTicks = ExperimentManager.ExpStartTicks; startTimeStamp = TicksToSecond(collect.startTick - expStartTicks); endTimeStamp = TicksToSecond(collect.closedTick - expStartTicks); }
public void AddMap_null() { var task = new BaseTask(); task.AddMap(null); Assert.That(task.Maps.Count, Is.EqualTo(0)); }
public void AddMap_success() { var task = new BaseTask(); task.AddMap(new MapItem()); Assert.That(task.Maps.Count, Is.EqualTo(1)); }
public override void Start(object startObject = null) { base.Start(); // Start at the start of the task list. m_TaskIndex = 0; m_CurrentTask = m_TaskList[m_TaskIndex]; m_CurrentTask.Start(startObject); }
public void Execute() { if (_tasks.Count > 0) { BaseTask task = _tasks.Dequeue(); _receivers[task.GetType()].Handle(task); } }
/// <summary> /// 初始化操作 /// </summary> /// <param name="task"></param> public TaskRuntimeOperator(BaseTask task) { Task = task; }