Esempio n. 1
0
        private Task _popTask(string text, VoxelHead.Emotions emotion)
        {
            if (String.IsNullOrEmpty(text))
            {
                return(new Task());
            }


            Task task = null;

            if (isPop_)
            {
                Task next = _pop.next(text);
                task = next;
            }
            else
            {
                isPop_ = true;
                task   = _pop.openTask(text);
            }


            TaskManager.PushFront(task, delegate {
                _head.talk = true;
            });

            TaskManager.PushBack(task, delegate {
                _head.talk    = false;
                _head.emotion = emotion;
            });
            return(task);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public static Task Logger(Task task, string taskName)
 {
                 #if DEBUG
     if (_instance == null)
     {
         GameObject go = new GameObject();
         go.name   = "TaskLogger";
         _instance = go.AddComponent <TaskLog>();
     }
     long begin = 0;
     TaskManager.PushFront(task, delegate() {
         //time_t t = time(null)
         begin = DateTime.Now.Ticks;
     });
     TaskManager.PushBack(task, delegate() {
         long all = DateTime.Now.Ticks - begin;
         if (_instance.dict_.ContainsKey(taskName))
         {
             _instance.dict_[taskName] += all;
         }
         else
         {
             _instance.dict_[taskName] = all;
         }
         //Debug.Log(taskName + ":" + all);
     });
                 #endif
     return(task);
 }
Esempio n. 4
0
        private Task refreshTask()
        {
            TaskSet ts = new TaskSet();

            if (_target.Value != _now.Value)
            {
                IRedio now = getRedio(_now.Value);
                if (now != null)
                {
                    ts.push(now.close);
                }


                IRedio target = getRedio(_target.Value);

                if (target != null)
                {
                    ts.push(target.open);
                }
            }


            TaskManager.PushFront(ts, delegate
            {
                _now = _target;
            });
            return(ts);
        }
Esempio n. 5
0
        public Task _test()
        {
            TaskList tl = new TaskList();
            TaskWait tw = new TaskWait();

            tw.setAllTime(2.0f);
            tl.push(tw);


            Task open = this.openTask("B");

            TaskManager.PushFront(open, delegate {
                write("从这两组图中选出你认为最");
            });

            tl.push(open);
            tl.push(new TaskWait(3.0f));

            tl.push(next("八哥为什么关注了我司的!>"));

            tl.push(new TaskWait(3.0f));

            tl.push(next("我司的八哥为什么关注了!>"));


            tl.push(new TaskWait(3.0f));

            tl.push(closeTask());
            return(tl);
        }
Esempio n. 6
0
        public Task task(VoxelProduct product)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                build(product);
            });
            return(task);
        }
Esempio n. 7
0
        static public Task Task(VoxelRemoveFace rsv, VoxelProduct.Product main)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                rsv.build(main);
            });
            return(task);
        }
Esempio n. 8
0
        static public Task Task(VoxelRemoveSameVertices rsv, VoxelProduct product)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                rsv.build(product);
            });
            return(task);
        }
Esempio n. 9
0
        public static Task Data2Mesh(VoxelMeshData data, Data2MeshReturn ret)         //创建mesh
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate() {
                ret(VoxelBuilder.Data2Mesh(data));
            });
            return(task);
        }
Esempio n. 10
0
        static public Task Task(VoxelData2Point d2p, VoxelProduct product)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                Build.Run(d2p, product);
            });
            return(task);
        }
Esempio n. 11
0
        public static Task Mesh2Filter(Mesh mesh, Mesh2FilterReturn ret)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate() {
                ret(VoxelBuilder.Mesh2Filter(mesh));
            });
            return(task);
        }
Esempio n. 12
0
        public static Task FilterAddRenderer(MeshFilter filter, Material material, FilterAddRendererReturn ret)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate() {
                ret(VoxelBuilder.FilterAddRenderer(filter, material));
            });
            return(task);
        }
Esempio n. 13
0
        public static Task FilterAddCollider(MeshFilter filter, FilterAddColliderReturn ret)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate() {
                ret(VoxelBuilder.FilterAddCollider(filter));
            });
            return(task);
        }
Esempio n. 14
0
        static public Task Task(VoxelSplitSmall vss, VoxelProduct product)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                Build.Run(vss, product);
            });
            return(task);
        }
Esempio n. 15
0
        public Task closeTask()
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                _head.close();
                _pop.close();
            });
            return(task);
        }
Esempio n. 16
0
        static public Task Task(VoxelMeshBuild vmb, VoxelProduct.Product main, Dictionary <Vector3Int, VoxelHandler> all)
        {
            Task task = new Task();

            TaskManager.PushFront(task, delegate {
                vmb.build(main, all);
            });


            return(task);
        }
Esempio n. 17
0
        private Task run(string text)
        {
            Task task = setTextTask(text);

            TaskManager.PushFront(task, delegate {
                locked_ = true;
            });
            TaskManager.PushBack(task, delegate {
                locked_ = false;
            });
            return(task);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
 private void refresh()
 {
     if (_target != _now && !_running)
     {
         Task task = refreshTask();
         TaskManager.PushFront(task, delegate
         {
             _running = true;
         });
         TaskManager.PushBack(task, delegate
         {
             _running = false;
         });
         TaskManager.Run(task);
     }
 }
Esempio n. 20
0
        public Task closeTask()
        {
            TweenTask task = new TweenTask(delegate {
                Tween tween = TweenScale.Begin(_neck.gameObject, 0.3f, Vector3.zero);
                return(tween);
            });

            TaskManager.PushBack(task, delegate {
                close();
            });

            TaskManager.PushFront(task, delegate {
                _neck.gameObject.transform.localScale = Vector3.one;
            });
            return(task);
        }
Esempio n. 21
0
        public Task openTask(string text)
        {
            //TaskSet ts = new TaskSet ();
            TweenTask task = new TweenTask(delegate {
                this.gameObject.transform.localScale = Vector3.zero;
                Tween tween  = TweenScale.Begin(this.gameObject, 0.3f, Vector3.one);
                tween.method = Tween.Method.BounceIn;
                return(tween);
            });

            TaskManager.PushFront(task, delegate {
                this.write(text);
                this.open();
            });

            return(task);
        }
Esempio n. 22
0
        public Task openCharTask(string text)
        {
            TaskSet ts = new TaskSet();

            for (int i = 0; i < _fonts.Length; ++i)
            {
                TaskList tl = new TaskList();
                if (i < text.Length)
                {
                    tl.push(new TaskWait(0.1f * i));
                }
                tl.push(new TaskPack(_fonts[i].openTask));
                ts.push(tl);
            }
            TaskManager.PushFront(ts, delegate {
                this.write(text);
            });
            return(ts);
        }
Esempio n. 23
0
        private Task _task(VoxelProduct product)
        {
//			Debug.Log ("****************");

            TaskList tl = new TaskList();

            TaskManager.PushFront(tl, delegate {
                //Debug.Log("!!!!!!");
                this.product_ = product;
                product_.draw = new VoxelDrawData();
            });


            for (int i = 0; i < product.voxels.Count; i += 1000)
            {
                tl.push(buildTask(i, Mathf.Min(i + 1000, product.voxels.Count), product.voxels));
            }

            return(tl);
        }
Esempio n. 24
0
        public Task openTask()
        {
            if (this.isOpen())
            {
                return(new Task());
            }
            TweenTask task = new TweenTask(delegate {
                Tween tween = TweenScale.Begin(_neck.gameObject, 0.3f, Vector3.one);
                return(tween);
            });



            TaskManager.PushFront(task, delegate {
                refersh_ = true;
                _neck.gameObject.transform.localScale = Vector3.zero;
                open();
            });
            return(task);
        }
Esempio n. 25
0
        public WebLoaderTask(string url)
        {
            pack_ = new WebPack(url);
            pack_.addField("a", "b");
            bool isOver = false;


            this.init = delegate {
                Task web = WebTaskFactory.Instance.create(pack, succeed, error);
                TaskManager.PushFront(web, delegate {
                    isOver = false;
                });
                TaskManager.PushBack(web, delegate {
                    isOver = true;
                });
                this.isOver = delegate {
                    return(isOver);
                };


                TaskManager.Run(web);
            };
        }
Esempio n. 26
0
 public static Task Front(this Task task, GDGeek.TaskInit frontTask)
 {
     TaskManager.PushFront(task, frontTask);
     return(task);
 }