Ejemplo n.º 1
0
        private StateBase whoIsGod()
        {
            State state = TaskState.Create(delegate {
                if (_hasAnchor)
                {
                    Root.Instance.view.board.state = InfoBoard.State.Hide;
                }
                else
                {
                    Root.Instance.view.board.state = InfoBoard.State.Scan;
                }

                Task task = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    return(Root.Instance.model.hasGod);
                });
                return(task);
            }, this.fsm_, "running");

            state.addAction(Ctrl.AnchorEvent, delegate
            {
                WhoIsGod wid = Altar.LocalComponent <WhoIsGod>();
                wid.IAmGod();
            });
            state.onStart += delegate
            {
                _stateName = "whoIsGod";

                Debug.Log("state:" + _stateName);
            };


            return(state);
        }
Ejemplo n.º 2
0
        private StateBase whoIsGod()
        {
            State state = TaskState.Create(delegate {
                Task task = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    return(Root.Instance.model.hasGod);
                });
                return(task);
            }, this.fsm_, "running");

            return(state);
        }
Ejemplo n.º 3
0
        private StateBase wait()
        {
            State state = TaskState.Create(delegate {
                stateName = "wait";
                Task task = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    return(Model.Instance.hasGod);
                });

                return(task);
            }, this.fsm_, "running");

            return(state);
        }
Ejemplo n.º 4
0
        private StateBase alone()
        {
            State state = TaskState.Create(delegate {
                WhoIsGod wid = null;
                Task task    = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    wid = Altar.LocalComponent <WhoIsGod>();
                    return(wid != null);
                });
                TaskManager.PushBack(task, delegate
                {
                    wid.IAmGod();
                });
                return(task);
            }, this.fsm_, "running");

            return(state);
        }
Ejemplo n.º 5
0
        private StateBase server()
        {
            State state = TaskState.Create(delegate {
                Task task = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    return(Model.Instance.hasGod);
                });
                TaskManager.PushFront(task, delegate
                {
                    //refreshHero();
                    //创建服务器
                    NetworkSystem.Instance.host();

                    //显示识别图
                    HudManager.Instance.marking();
                    //Desktop.Instance.hud.showImageTarget();
                });
                TaskManager.PushBack(task, delegate
                {
                    //Desktop.Instance.hud.closeImageTarget();
                    //NetworkSystem.Instance.s
                });
                return(task);
            }, this.fsm_, "running");



            state.addAction("select", delegate(FSMEvent evt)
            {
                Database.Instance.godIndex = (int)(evt.obj);
            });
            state.addAction("start", delegate
            {
                WhoIsGod wid = Altar.LocalComponent <WhoIsGod>();
                wid.sheIsGod((uint)(Database.Instance.godIndex));
                //设置控制者,并切换状态。
            });

            //state.addAction("");

            return(state);
        }
Ejemplo n.º 6
0
        private StateBase server()
        {
            State state = TaskState.Create(delegate {
                Task task = new Task();
                TaskManager.AddAndIsOver(task, delegate
                {
                    return(Model.Instance.hasGod);
                });
                TaskManager.PushFront(task, delegate
                {
                    //创建服务器
                    NetworkSystem.Instance.host();
                    Debug.Log("server");
                    //显示识别图
                    HudManager.Instance.marking();
                });
                TaskManager.PushBack(task, delegate
                {
                    Yggdrasil.Instance.transform.position = Camera.main.transform.position;
                    Yggdrasil.Instance.transform.rotation = Camera.main.transform.rotation;
                });
                return(task);
            }, this.fsm_, "running");



            state.addAction("select", delegate(FSMEvent evt)
            {
                Database.Instance.godIndex = (int)(evt.obj);
            });
            state.addAction("start", delegate
            {
                WhoIsGod wid = Altar.LocalComponent <WhoIsGod>();
                wid.sheIsGod((uint)(Database.Instance.godIndex));
            });

            //state.addAction("");

            return(state);
        }
Ejemplo n.º 7
0
        public Task getTask <T>(RequestHelper requestOptions, Action <T> ret)
        {
            Task task   = new Task();
            bool isOver = false;

            TaskManager.PushFront(task, delegate
            {
                RestClient.Get <T>(requestOptions).Then(res => {
                    this.LogMessage("Posts", JsonUtility.ToJson(res));
                    ret(res);
                    isOver = true;
                }).Catch(delegate(Exception err) {
                    this.LogMessage("Error", err.Message);
                    isOver = true;
                }
                         );
            });
            TaskManager.AddAndIsOver(task, delegate
            {
                return(isOver);
            });
            return(task);
        }