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

            });
            TaskManager.PushBack (task, delegate {
                //jetPower = _nomal;
                refreshJet();
            });
            return task;
        }
Example #27
0
		public static void Run(Task task){
			if(TaskManager.GetInstance() != null){
				TaskManager.GetInstance().runner.addTask(task);
			}
		}
Example #28
0
File: Ctrl.cs Project: 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;
 }