public TaskInfo(ETaskType _type, string _name, string _deviceNo, string _obj) { Type = _type; Name = _name; DeviceNo = _deviceNo; Obj = _obj; }
public static void RunOnMainThread <T>(System.Action <T> action, T arg, ETaskType type = ETaskType.task, int id = 0) { if (sInitilized && action != null) { lock (sInstance.mLock) { TaskWithArg <T> task = sInstance.GetTaskWithArg <T>(id); task.Task = action; task.mArg = arg; if (type == ETaskType.task) { sInstance.mTasks.Enqueue(task); } else if (type == ETaskType.lateTask) { sInstance.mLateTasks.Enqueue(task); } } } #if UNITY_EDITOR else if (!sInitilized && Application.isPlaying) { RTLog.LogError(LogCat.Game, "MainThread not initialized."); } #endif }
// Start is called before the first frame update void Start() { StartCoroutine(ExecuteAfterTime(1f)); //init belief beliefList = new List <float>(); for (int i = 0; i < 3; i++) { beliefList.Add(UnityEngine.Random.Range(0f, 1f)); } IEnumerator ExecuteAfterTime(float time) { yield return(new WaitForSeconds(time)); animalCharacter = this.GetComponent <AnimalCharacter>(); //animalCharacter.navControl.TravelTo(appleTreeLocation); currentTaskIndex = 0; currentTask = taskList[currentTaskIndex]; // Code to execute after the delay canTakeAction = true; //init characterState = GetCharacterState(); } }
public List <TaskInfo> EnumTasks( [Parameter("Filter tasks to the a particular type", DefaultValue = ETaskType.All)] ETaskType taskTypeFilter, [Parameter("Filter tasks to the a particular status", DefaultValue = ETaskStatus.All)] ETaskStatus taskStatusFilter, [Parameter("User name to filter by (blank for all)", DefaultValue = null)] string taskUserName, [Parameter("Server name to filter by (blank for all servers in cluster)", DefaultValue = null)] string taskServerName, IOutput output) { var tasks = GetTasks(taskTypeFilter, taskStatusFilter, taskUserName, taskServerName, false); output.SetHeader("Task Id", 12, "User Id", "Server", "Task Type", "Task Status", 14, "% Complete", 10, "Description"); foreach (var task in tasks) { output.WriteRecord(task.TaskId, task.User, task.Server, task.TaskType, task.TaskStatus, task.PercentageComplete, task.Description); } output.End(); return(tasks); }
private void Switch(ETaskType type) { mMenus[type].value = true; mTaskListView.ResetPosition(); mCurTaskType = type; mCurTaskIndex = 0; ResetView(); }
public BaseTask GetTaskInfo(WFTaskEntity taskEntity) { ETaskType taskType = taskEntity.Type; var taskInfo = Tasks.Where(t => (t as BaseTask).TaskType == taskType).FirstOrDefault() as BaseTask; if (taskInfo == null) { throw new Exception($"类型{taskType}没有实现"); } return(taskInfo); }
private void BeginTask(string path, ETaskType taskType, Action <LoadTask> finishedHandler, string md5 = "") { string url = UrlCombine.GetRul(path, false, "", Application.platform); AddTask(url, taskType, (loadTask) => { if (finishedHandler != null) { finishedHandler(loadTask); } }); }
public static Task getTask(Int32 id , String title , String comments , float workHours , ETaskType type) { return(new Task { Id = id, Title = title, Comments = comments, WorkHours = workHours, Type = type }); }
private TaskLoader CreateLoadTaskLoader(string abFileName, ETaskType t) { TaskLoader loader = null; if (_loaderCache.ContainsKey(abFileName)) { loader = _loaderCache[abFileName]; } else { loader = new TaskLoader(abFileName, t); _loaderCache[abFileName] = loader; } return(loader); }
private void AddTask(string url, ETaskType taskType, Action <LoadTask> assetHandler, string md5 = "") { LoadTask task = null; if (_taskDictionary.TryGetValue(url, out task)) { CombineTask(url, assetHandler); } else { task = LoadTaskFactory.GetLoadTask(url, taskType, md5); _taskDictionary.Add(url, task); _todoTasks.Add(task); } }
static public LoadTask GetLoadTask(string url, ETaskType taskType, string md5 = "") { switch (taskType) { case ETaskType.loadRemoteAsset: return(new LoadRemoteTask(url, md5)); case ETaskType.loadLocalAssetBundle: return(new LoadAssetBundleFromDiskTask(url)); case ETaskType.loadMainManifest: return(new LoadManifestTask(url)); } return(null); }
/// <summary> /// 根据任务类型,获取指定任务列表 /// </summary> /// <param name="taskType"></param> /// <returns></returns> public static List <TaskEntity> GetTasksByType(ETaskType taskType) { string sql = "SELECT T.ID, T.TASK_TYPE, C.ITEM_DESC, T.BILL_ID, H.BILL_NO, " + "T.USER_CODE, T.QTY, T.CREATE_DATE, T.CREATOR, T.TASK_DESC, T.REMARK, T.CONFIRM_DATE " + "FROM TASKS T " + "LEFT JOIN WM_BASE_CODE C ON C.ITEM_VALUE = T.TASK_TYPE " + "LEFT JOIN WM_SO_HEADER H ON H.BILL_ID = T.BILL_ID"; if (taskType != ETaskType.无) { sql = string.Format("{0} WHERE T.TASK_TYPE = '{1}'", sql, (int)taskType); } IMapper map = DatabaseInstance.Instance(); return(map.Query <TaskEntity>(sql)); }
public override void Read(XmlElement element) { this.Id = element.GetInt32("Id"); this.Name = element.GetString("Name"); this.Desc = element.GetString("Desc"); this.Type = (ETaskType)element.GetInt32("Type"); this.Cycle = (ETaskCycleType)element.GetInt32("Cycle"); this.TargetType = (ETaskTargetType)element.GetInt32("TargetType"); this.TargetArgs = element.GetString("TargetArgs"); this.Script = element.GetString("Script"); this.Condition = element.GetInt32("Condition"); this.MinRquireLevel = element.GetInt32("MinRquireLevel"); this.MaxRquireLevel = element.GetInt32("MaxRquireLevel"); this.RewardMoneyNum = element.GetInt32("RewardMoneyNum"); this.RewardExpNum = element.GetInt32("RewardExpNum"); this.AwardID = element.GetInt32("AwardID"); this.Desc = element.GetString("Desc"); this.Icon = element.GetString("Icon"); }
protected override void OnAddButtonListener() { UIEventListener.Get(btnReturn).onClick = OnCloseClick; UIEventListener.Get(btnGoto).onClick = OnGotoClick; UIEventListener.Get(btnReceive).onClick = OnReceiveClick; foreach (KeyValuePair <ETaskType, UIToggle> pair in mMenus) { ETaskType type = pair.Key; GameObject btn = pair.Value.gameObject; UIEventListener.Get(btn).onClick = delegate(GameObject go) { GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK); if (type == mCurTaskType) { return; } Switch(type); }; } }
// Update is called once per frame void Update() { if (canTakeAction) { if (currentTaskIndex < taskList.Count && animalCharacter.currentActivityCoolDown < 0) { //Debug.Log("AOG Control:" + animalCharacter.navControl.IsDoneTraveling().ToString()); currentTask = taskList[currentTaskIndex]; if (currentTask == ETaskType.Walk) { GameObject targetObject = GameObject.Find(taskDesription[currentTaskIndex]); Vector3 targetLocation = new Vector3(targetObject.transform.position.x, this.transform.position.y, targetObject.transform.position.z); animalCharacter.navControl.TravelTo(targetLocation); if (Vector3.Distance(targetLocation, transform.position) < 2f || (animalCharacter.sceneTool != null && animalCharacter.sceneTool.gameObject.name == taskDesription[currentTaskIndex]) || animalCharacter.meetPickupObject != null && animalCharacter.meetPickupObject.gameObject.name == taskDesription[currentTaskIndex]) //done traveling { currentTaskIndex++; } } else if (currentTask == ETaskType.Interact) { animalCharacter.ActWithSceneTool(); animalCharacter.ActWithAnimalCharacter(); currentTaskIndex++; } else if (currentTask == ETaskType.PickupDrop) { animalCharacter.PickupDropObject(); currentTaskIndex++; } else if (currentTask == ETaskType.Use) { animalCharacter.UseObject(); currentTaskIndex++; } } } }
public static bool QueryTask(int id, ETaskType type = ETaskType.task) { if (sInitilized && id != 0) { lock (sInstance.mLock) { Queue <ITask> queue; if (type == ETaskType.task) { queue = sInstance.mTasks; } else if (type == ETaskType.lateTask) { queue = sInstance.mLateTasks; } else { queue = null; } if (queue != null) { foreach (var t in queue) { if (t.Identify == id) { return(true); } } } } } #if UNITY_EDITOR else if (!sInitilized && Application.isPlaying) { RTLog.LogError(LogCat.Game, "MainThread not initialized."); } #endif return(false); }
/// <summary> /// Returns a list containing details for tasks that match the selection /// criteria. /// </summary> protected List <TaskInfo> GetTasks(ETaskType taskType, ETaskStatus taskStatus, string user, string server, bool currentSessionOnly) { int userId = 0, totalTasks = 0; object oTaskIds = null, oTaskTypes = null, oTaskProgress = null, oTaskStatuses = null, oUsers = null, oServers = null, oScheduledStartTimes = null, oActualStartTimes = null, oLastUpdateTimes = null, oDescriptions = null, oLogFiles = null; int[] taskIds, progress; ETaskType[] taskTypes; ETaskStatus[] taskStatuses; double[] scheduledTimes, actualTimes, lastUpdateTimes; string[] users, servers, descriptions, logFiles; if (user != null) { HFM.Try("Retrieving user activity id for {0}", user, () => HsvSystemInfo.GetActivityUserID(user, out userId)); } HFM.Try("Retrieving details of tasks", () => HsvSystemInfo.EnumRunningTasks(taskType == ETaskType.All, (int)taskType, user == null, userId, server == null, server, !currentSessionOnly, taskStatus == ETaskStatus.All, (int)taskStatus, 0, 10000, // Retrieve the first 10,000 records out oTaskIds, out oTaskTypes, out oTaskProgress, out oTaskStatuses, out oUsers, out oServers, out oScheduledStartTimes, out oActualStartTimes, out oLastUpdateTimes, out oDescriptions, out oLogFiles, out totalTasks)); // Note: We can't use HFM.Object2Array for the primitive and ennum // types here, since the returned values are not object[]!? // May have something to do with the params being declared out, rather // than in/out? taskIds = (int[])oTaskIds; taskTypes = (ETaskType[])oTaskTypes; progress = (int[])oTaskProgress; taskStatuses = (ETaskStatus[])oTaskStatuses; users = HFM.Object2Array <string>(oUsers); servers = HFM.Object2Array <string>(oServers); scheduledTimes = (double[])oScheduledStartTimes; actualTimes = (double[])oActualStartTimes; lastUpdateTimes = (double[])oLastUpdateTimes; descriptions = HFM.Object2Array <string>(oDescriptions); logFiles = HFM.Object2Array <string>(oLogFiles); var tasks = new List <TaskInfo>(totalTasks); for (var i = 0; taskIds != null && i < taskIds.Length; ++i) { tasks.Add(new TaskInfo() { TaskId = taskIds[i], User = users[i], Server = servers[i], TaskType = taskTypes[i], TaskStatus = taskStatuses[i], PercentageComplete = progress[i], ScheduledStartTime = DateTime.FromOADate(scheduledTimes[i]), ActualStartTime = DateTime.FromOADate(actualTimes[i]), LastUpdate = DateTime.FromOADate(lastUpdateTimes[i]), Description = descriptions[i], LogFile = logFiles[i] }); } return(tasks); }
private void CreateTaskItemList(ETaskType type) { }
private void ShowTaskViewById(ETaskType type, int taskID) { }
/// <summary> /// 根据任务类型,获取指定任务列表 /// </summary> /// <param name="taskType"></param> /// <returns></returns> public List <TaskEntity> GetTasksByType(ETaskType taskType) { List <TaskEntity> list = new List <TaskEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("taskType=").Append(taskType); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetTasksByType); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetTasksByType bill = JsonConvert.DeserializeObject <JsonGetTasksByType>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetTasksByTypeResult jbr in bill.result) { TaskEntity asnEntity = new TaskEntity(); #region 0-10 asnEntity.BillID = Convert.ToInt32(jbr.billId); asnEntity.BillNO = jbr.billNo; asnEntity.TaskID = Convert.ToInt32(jbr.id); asnEntity.TaskName = jbr.itemDesc; asnEntity.Qty = Convert.ToInt32(jbr.qty); asnEntity.TaskDesc = jbr.taskDesc; asnEntity.TaskType = jbr.taskType; asnEntity.UserCode = jbr.userCode; try { if (!string.IsNullOrEmpty(jbr.confirmDate)) { asnEntity.ConfirmDate = Convert.ToDateTime(jbr.confirmDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } try { if (!string.IsNullOrEmpty(jbr.createDate)) { asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } #endregion list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }
public TaskAttribute(ETaskType taskType, string name) { this.taskType = taskType; this.name = name; }
public FrmChooseTask(ETaskType taskType) : this() { this._taskType = taskType; }
static void Main(string[] args) { Project[] BusinessProject = new Project[10]; void Menu() { Console.WriteLine("1- Criar Projeto"); Console.WriteLine("2- Listar Projeto"); Console.WriteLine("3- Atualizar Projeto"); Console.WriteLine("4- Deletar Projeto"); Console.WriteLine("0- Finalizar Programa!!!"); int opcao = Int16.Parse(Console.ReadLine()); int qtdProj; int qtdUser; int qtdTask; switch (opcao) { case 1: Console.WriteLine("How many Projects: "); qtdProj = Int16.Parse(Console.ReadLine()); for (int p = 0; p < qtdProj; p++) { CreateProject(p); Console.Clear(); //USUARIOS DO PROJETO Console.WriteLine("How many Users: "); qtdUser = Int16.Parse(Console.ReadLine()); CreateUser(p, qtdUser); Console.Clear(); // TAREFAS DO PROJETO Console.WriteLine("How many Tasks: "); qtdTask = Int16.Parse(Console.ReadLine()); CreateTask(p, qtdTask); Console.Clear(); } Menu(); break; case 2: ListProject(); Menu(); break; case 3: Console.Clear(); AlteraProj(); Menu(); break; case 4: Console.Clear(); int id; Console.WriteLine("Project ID"); id = int.Parse(Console.ReadLine()); DeleteProject(id); Menu(); break; case 5: break; default: Console.WriteLine("Não tem!!!"); break; } } void CreateProject(int p) { BusinessProject[p] = new Project(); Console.WriteLine("ID do projeto: "); BusinessProject[p].Id = Int32.Parse(Console.ReadLine()); Console.WriteLine("Nome do projeto: "); BusinessProject[p].Title = Console.ReadLine(); Console.WriteLine("Código do projeto: "); BusinessProject[p].Code = Console.ReadLine(); //Console.WriteLine("Data de inicio do projeto: "); //BusinessProject[p].StartDate = DateTime.Parse(Console.ReadLine()); //Console.WriteLine("Data estimada do projeto: "); //BusinessProject[p].EstimatedEndDate = DateTime.Parse(Console.ReadLine()); //Console.WriteLine("Data de conclusao do projeto: "); //BusinessProject[p].RealEndDate = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Responsável pelo projeto: "); BusinessProject[p].Responsible.Title = Console.ReadLine(); BusinessProject[p].Removed = 0; } void CreateUser(int p, int qtdUser) { for (int u = 0; u < qtdUser; u++) { Console.WriteLine("User ID: "); int id = Int32.Parse(Console.ReadLine()); Console.WriteLine("User Name: "); string name = Console.ReadLine(); Console.WriteLine("User Birth Date: "); DateTime birth = DateTime.Parse(Console.ReadLine()); Console.WriteLine("User Email: "); string email = Console.ReadLine(); BusinessProject[p].members.Add(new Person() { Id = id, Title = name, BirthDate = birth, Email = email }); Console.Clear(); } } void CreateTask(int p, int qtdTask) { for (int t = 0; t < qtdTask; t++) { var person = new Person(); var tasks = new List <Tasks>(); Console.WriteLine("Name of the responsible: "); string personName = Console.ReadLine(); var resp = "yes"; while (resp == "yes") { Console.WriteLine("ID of the Task: "); int id = Int32.Parse(Console.ReadLine()); Console.WriteLine("Name of the Task"); string taskName = Console.ReadLine(); Console.WriteLine("Scheduled Time: "); decimal workHour = decimal.Parse(Console.ReadLine()); Console.WriteLine("Task type: "); Console.WriteLine("1- Code Task"); Console.WriteLine("2- Test Case Task"); Console.WriteLine("3- Correction Task"); int type = Int16.Parse(Console.ReadLine()); ETaskType opcao = (ETaskType)type; Console.Clear(); var task = new Tasks { Id = id, Title = taskName, WorkHours = workHour, TaskType = opcao }; tasks.Add(task); person.Title = personName; Console.WriteLine("Do you want to create more tasks, mr: " + personName + " (yes / no)"); resp = Console.ReadLine(); resp = resp.ToLower(); } BusinessProject[p].Tasks.Add(person, tasks); } } bool ListProject() { int countRemoved = 0; int p; for (p = 0; p < BusinessProject.Length && BusinessProject[p] != null; p++) { if (BusinessProject[p].Removed == 0) { Console.WriteLine("\n----------Project " + (p + 1) + " ----------"); Console.WriteLine("\nId of the Project................: " + BusinessProject[p].Id); Console.WriteLine("Name of the Project................: " + BusinessProject[p].Title); foreach (var user in BusinessProject[p].members) { Console.WriteLine("Id of the User of the Project......: " + user.Id); Console.WriteLine("Name of the User of the Project....: " + user.Title); } foreach (KeyValuePair <Person, List <Tasks> > pair in BusinessProject[p].Tasks) { Console.WriteLine("\nTask Responsible...................: " + pair.Key.Title); foreach (var task in pair.Value) { Console.WriteLine("Task Name..........................: " + task.Title); } } } else if (BusinessProject[p].Removed == 1) { countRemoved++; } } if (countRemoved == p) { Console.WriteLine("\nThere isn't projects registered\n"); return(false); } return(true); } bool DeleteProject(int id) { for (int p = 0; p < BusinessProject.Length && BusinessProject[p] != null; p++) { if (id == BusinessProject[p].Id) { BusinessProject[p].Removed = 1; Console.WriteLine("Projeto Removido com sucesso!"); return(true); } } Console.WriteLine("\nProjeto nao encontrado!\n"); return(false); } bool AlteraProj() { int id; Console.WriteLine("Id do projeto que deseja alterar: "); id = Int32.Parse(Console.ReadLine()); for (int p = 0; p < BusinessProject.Length && BusinessProject[p] != null; p++) { if (BusinessProject[p].Id == id) { Console.WriteLine("Campos para alterar: \n1- Nome\n2- Código"); int op = int.Parse(Console.ReadLine()); if (op == 1) { Console.WriteLine("Digite o novo nome: "); BusinessProject[p].Title = Console.ReadLine(); Console.WriteLine("Nome do projeto alterado com sucesso! "); } else if (op == 2) { Console.WriteLine("Digite o novo codigo: "); BusinessProject[p].Code = Console.ReadLine(); Console.WriteLine("Código do projeto alterado com sucesso! "); } else { Console.WriteLine("Opcao nao encontrada"); return(false); } return(true); } } Console.WriteLine("Projeto com este Id não encontrado"); return(false); } Menu(); }
public TaskLoader(string p, ETaskType t) { path = p; taskType = t; }
private bool IsNeedCallback(ETaskType taskType) { return(taskType == ETaskType.WorkAsyncSendHttp || taskType == ETaskType.WorkAsyncSendMQ); }
public void Explore(int state_action_code, ETaskType taskType, string TaskDescription) { if (state_action_code == 0) //Scene { } }
public FrmChooseTask(ETaskType taskType, string warnMsg) : this(taskType) { this._warnMsg = warnMsg; }
public override void Read(XmlElement os) { this.Id = os.GetInt32("Id"); this.Name = os.GetString("Name"); this.Type = (ETaskType)os.GetInt32("Type"); this.CanbeCancle = os.GetBool("CanbeCancle"); this.CanbeSearch = os.GetBool("CanbeSearch"); this.IsAutoPathFind = os.GetBool("IsAutoPathFind"); this.IsFinishedTaskCount = os.GetBool("IsFinishedTaskCount"); this.IsAutoFinish = os.GetBool("IsAutoFinish"); this.PreTaskID = os.GetInt32("PreTaskID"); foreach (var current in GetChilds(os)) { switch (current.Name) { case "SubTasks": foreach (var child in GetChilds(current)) { string type = child.GetString("Type"); switch (type) { case "SubTask": this.SubTasks.Add(ReadObj <SubTalk>(child)); break; case "SubCollectItem": this.SubTasks.Add(ReadObj <SubCollectItem>(child)); break; case "SubConvoy": this.SubTasks.Add(ReadObj <SubConvoy>(child)); break; case "SubGather": this.SubTasks.Add(ReadObj <SubGather>(child)); break; case "SubInterActive": this.SubTasks.Add(ReadObj <SubInterActive>(child)); break; case "SubKillMonster": this.SubTasks.Add(ReadObj <SubKillMonster>(child)); break; case "SubTriggerCutscene": this.SubTasks.Add(ReadObj <SubTriggerCutscene>(child)); break; case "SubTriggerPlot": this.SubTasks.Add(ReadObj <SubTriggerPlot>(child)); break; case "SubUseItem": this.SubTasks.Add(ReadObj <SubUseItem>(child)); break; case "SubUseSkill": this.SubTasks.Add(ReadObj <SubUseSkill>(child)); break; } } break; } } }