コード例 #1
0
ファイル: DesktopProcess.cs プロジェクト: MrPPGit/MrPP.com
        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);
        }
コード例 #2
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);
        }