public static void AddUpdate(Task task, TaskUpdate func){ TaskUpdate update = task.update; task.update = delegate(float d){ update(d); func(d); }; }
public static void AddIsOver(Task task, TaskIsOver func) { TaskIsOver oIsOver = task.isOver; task.isOver = delegate(){ return (oIsOver() || func()); }; }
public void push(Task task){ TaskManager.PushBack (task, delegate { index_++; runTask(); }); other_.Add(task); }
public static void PushFront(Task task, TaskInit func) { TaskInit oInit = task.init; task.init = delegate(){ func(); oInit(); }; }
public static void PushBack(Task task, TaskShutdown func) { TaskShutdown oShutdown = task.shutdown; task.shutdown = delegate (){ oShutdown(); func(); }; }
public Task closeTask() { Task task = new Task (); TaskManager.PushBack (task, delegate { this.transform.localScale = Vector3.zero; }); return task; }
public Task closePopTask() { Task task = new Task (); TaskManager.PushBack (task, delegate { _pop.close (); }); return task; }
public Task closeTask() { Task task = new Task (); TaskManager.PushFront (task, delegate { _head.close(); _pop.close(); }); return task; }
// Use this for initialization private Task talk2(Task task) { TaskManager.PushFront (task, delegate { _head.talk = true; }); TaskManager.PushBack (task, delegate { _head.talk = false; }); return task; }
public Task run(Task task) { TaskList tl = new TaskList (); tl.push (packTask(task)); tl.push (hide ()); TaskManager.PushFront (tl, delegate { _cg.alpha = 0f; this.gameObject.SetActive(true); }); return tl; }
public Task openTask() { if (_text == ' '||_fontColor == _bgColor) { Task task = new Task(); TaskManager.PushBack(task, delegate{open();}); return task; } TweenTask tt = new TweenTask (delegate { this.transform.localEulerAngles = new Vector3 (0, 179, 0); return TweenRotation.Begin( this.gameObject, 0.3f, Quaternion.Euler(new Vector3(0,0,0))); }); return tt; }
private Task packTask(Task task) { Task pack = new Task(); float allTime = 0.0f; bool isOver = false; bool isLoading = false; bool isLoaded = false; pack.init = delegate{ allTime = 0; isOver = false; isLoading = false; isLoaded = false; TaskManager.PushBack (task, delegate{ isOver = true; }); TaskManager.Run (task); }; pack.update = delegate(float d) { allTime += d; if(allTime>_wait && !isLoading){ isLoading = true; Task show = this.show (); TaskManager.PushBack (show, delegate{ //Debug.LogError("???"); isLoaded = true; }); TaskManager.Run (show); } }; pack.isOver = delegate { if (isOver) { if(!isLoading){//Debug.LogError("error"); return true; } if(isLoaded){//Debug.LogError("erro2r"); return true; } } return false; }; return pack; }
public Task create(WebPack pack, BytesHandler succeed, Handler error) { WWW www = pack.www() as WWW; Task task = new Task (); bool over = false; task.init = delegate { over = false; StartCoroutine(WebTaskFactory.GetInstance().linkIt(www, succeed, error, delegate{ over = true; })); }; task.isOver = delegate{ return over; }; return task; }
public TaskPack(CreateTask createTask){ this.init = delegate { isOver_ = false; task_ = createTask(); if(task_ == null){ isOver_ = true; }else{ TaskManager.PushBack(task_, delegate { isOver_ = true; }); TaskManager.Run(task_); } }; this.isOver = delegate { return isOver_; }; }
public void push(Task task) { if(this.isCompleted_){ Debug.LogError("list task is completed!"); } if(this.begin_ == null && this.end_ == null) { this.begin_ = task; this.end_ = task; }else{ Task end = this.end_; TaskShutdown oShutdown = end.shutdown; end.shutdown = delegate(){ oShutdown(); TaskManager.Run(task); }; other_.Add(this.end_); this.end_ = task; } }
private Task loadTask() { TaskList tl = new TaskList (); Task load = new Task (); this._view._play.show(); Fly fly = _view._play.createFly("hero"); _dirver.position = new Vector3(0, -100, 0); _dirver.fly = fly; fly.doHurt += doHurt; _dirver.reset(); load.init = delegate { TempSound.GetInstance ().comeIn (); // AkSoundEngine.PostEvent ("ComeIn", this.gameObject); }; load.update = delegate(float d) { _dirver.move(_dirver.position + new Vector3(0, d*120, 0)); }; load.isOver = delegate() { if(_dirver.position.y > -60){ return true; } return false; }; load.shutdown = delegate { _dirver.move(new Vector3(0, -60, 0)); }; tl.push (_logo.openTask()); tl.push (_dirver.fly.downTask ()); tl.push (load); tl.push (_dirver.fly.upTask ()); TaskManager.PushBack (tl, delegate { GameManager.GetInstance().road.walk(); _level.building (); }); return tl; }
private State clearState() { StateWithEventMap state = TaskState.Create(delegate() { Task task = new Task(); TaskManager.PushBack(task, delegate { _talk.close(); alive_ = false; Debug.LogWarning("position" + position_); Debug.LogWarning("quaternion_" + quaternion_); _talk._head.gameObject.transform.localPosition = position_; _talk._head.gameObject.transform.localRotation = quaternion_; }); return task; }, fsm_, "sleep"); return state; }
public Task task(VoxelProduct product) { Task task = new Task (); task.init = delegate { build(product); }; return task; }
public static void Run(Task task) { if(TaskManager.GetInstance() == null){ GameObject obj = new GameObject (); obj.name = "TaskManager"; instance_ = obj.AddComponent<TaskManager> (); } TaskManager.GetInstance().runner.addTask(task); }
/* protected virtual void OnDestroy(){ try{ for(int i=0; i< this.tasks_.Count; ++i){ Task task = this.tasks_[i] as Task; task.shutdown(); } tasks_ = new ArrayList(); }catch(System.Exception e){ Debug.LogWarning(e.Message); } }*/ public void addTask(Task task){ task.init(); this.tasks_.Add(task); }
public void push(Task task) { this.tasks_.Add (task); TaskManager.PushBack(task, delegate(){overCount_++;}); }
/*private Task removeFacesTask(){ Task task = new Task (); task.init = delegate { removeFaces(); }; return task; }*/ private Task updateVerticesAndTriangleOfProductTask(VoxelProduct product) { Task task = new Task (); task.init = delegate { updateVerticesAndTriangleOfProduct(product); }; return task; }
private Task removeFacesTask() { int can_collapse_index = 0; TaskCircle tc = new TaskCircle (); TaskManager.PushFront (tc, delegate { can_collapse_index = getCanCollapseVertexIndex(); }); Task task = new Task (); task.init = delegate() { for (int i = 0; i < 200; ++i) { collapse (vertices [can_collapse_index], vertices [can_collapse_index].collapse); can_collapse_index = getCanCollapseVertexIndex (); if (can_collapse_index == -1) { break; } } }; TaskManager.PushBack (task, delegate { if(can_collapse_index == -1){ tc.forceQuit(); } }); tc.push (task); return tc; }
private Task initVertices4Task() { Task task = new Task (); task.init = delegate { initVertices4(); }; return task; }
private Task initVertices1Task(VoxelDrawData data) { Task task = new Task (); task.init = delegate { initVertices1(data); }; return task; }
public Task upTask() { Task task = new Task (); TaskManager.PushBack (task, delegate { jetPower = false; }); TaskManager.PushBack (task, delegate { //jetPower = _nomal; refreshJet(); }); return task; }
public static void Run(Task task){ if(TaskManager.GetInstance() != null){ TaskManager.GetInstance().runner.addTask(task); } }
private State shareState() { StateWithEventMap state = TaskState.Create (delegate { Task tsk = new Task(); TaskManager.PushFront(tsk, delegate { string okCb = "GDGeekSendMessage(\"GDGeek\", \"message\", \"web_ok\");"; string cancelCb = "GDGeekSendMessage(\"GDGeek\", \"message\", \"web_cancel\");"; WebPlayer.Share("haha", "http://baidu.com", okCb, cancelCb); }); return tsk; }, fsm_, "close_share"); return state; }