示例#1
0
		public static void AddUpdate(Task task, TaskUpdate func){
			TaskUpdate update = task.update;
			task.update = delegate(float d){
				update(d);
				func(d);
			};
		}
示例#2
0
 public static void AddIsOver(Task task, TaskIsOver func)
 {
     TaskIsOver oIsOver = task.isOver;
     task.isOver = delegate(){
         return (oIsOver() || func());
     };
 }
示例#3
0
		public void push(Task task){
			TaskManager.PushBack (task, delegate {
				index_++;
				runTask();
			});
			other_.Add(task);
		}
示例#4
0
 public static void PushFront(Task task, TaskInit func)
 {
     TaskInit oInit = task.init;
     task.init = delegate(){
         func();
         oInit();
     };
 }
示例#5
0
 public static void PushBack(Task task, TaskShutdown func)
 {
     TaskShutdown oShutdown = task.shutdown;
     task.shutdown = delegate (){
         oShutdown();
         func();
     };
 }
示例#6
0
 public Task closeTask()
 {
     Task task = new Task ();
     TaskManager.PushBack (task, delegate {
         this.transform.localScale = Vector3.zero;
                 });
     return task;
 }
示例#7
0
 public Task closePopTask()
 {
     Task task = new Task ();
     TaskManager.PushBack (task, delegate {
         _pop.close ();
                 });
     return task;
 }
示例#8
0
 public Task closeTask()
 {
     Task task = new Task ();
     TaskManager.PushFront (task, delegate {
         _head.close();
         _pop.close();
                 });
     return task;
 }
示例#9
0
文件: Test.cs 项目: gdgeek/fly
        // 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;
        }
示例#11
0
文件: VoxelFont.cs 项目: gdgeek/fly
        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;
        }
示例#13
0
        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;
        }
示例#14
0
文件: TaskPack.cs 项目: CzDreamer/eat
	    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_;
	        };
	       
	    }
示例#15
0
 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;
     }
 }
示例#16
0
文件: FlyCtrl.cs 项目: gdgeek/fly
        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;
        }
示例#17
0
文件: BossFace.cs 项目: gdgeek/fly
        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;
        }
示例#18
0
 public Task task(VoxelProduct product)
 {
     Task task = new Task ();
     task.init = delegate {
         build(product);
     };
     return task;
 }
示例#19
0
 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);
 }
示例#20
0
		/*
		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);
		}
示例#21
0
 public void push(Task task)
 {
     this.tasks_.Add (task);
     TaskManager.PushBack(task, delegate(){overCount_++;});
 }
示例#22
0
 /*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;
 }
示例#23
0
        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;
        }
示例#24
0
 private Task initVertices4Task()
 {
     Task task = new Task ();
     task.init = delegate {
         initVertices4();
     };
     return task;
 }
示例#25
0
 private Task initVertices1Task(VoxelDrawData data)
 {
     Task task = new Task ();
     task.init = delegate {
         initVertices1(data);
     };
     return task;
 }
示例#26
0
文件: Fly.cs 项目: gdgeek/fly
        public Task upTask()
        {
            Task task = new Task ();
            TaskManager.PushBack (task, delegate {
                jetPower = false;

            });
            TaskManager.PushBack (task, delegate {
                //jetPower = _nomal;
                refreshJet();
            });
            return task;
        }
示例#27
0
		public static void Run(Task task){
			if(TaskManager.GetInstance() != null){
				TaskManager.GetInstance().runner.addTask(task);
			}
		}
示例#28
0
文件: Ctrl.cs 项目: gdgeek/fly
 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;
 }