Ejemplo n.º 1
0
        public override void Exit()
        {
            base.Exit();

            ActorModelCullManager.GetInstance().Reset();

            foreach (var behaviour in Behaviours)
            {
                behaviour.Value.Exit();
            }

            Game.GetInstance().UnsubscribeNetNotify(NetMsg.MSG_NWAR_INIT_INFO, HandleServerData);
            Game.GetInstance().UnsubscribeNetNotify(NetMsg.MSG_NWAR_ALL_READY, HandleServerData);

            //ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_STATUS_TRANSFER_AUTO_ENDED, OnPlayerTransferAutoEnded);

            InstanceManager.GetInstance().InstanceInfo = null;
            InstanceManager.GetInstance().MapInfo      = null;

            Actor player = Game.GetInstance().GetLocalPlayer();

            if (player == null)
            {
                return;
            }

            player.gameObject.transform.parent = null;
            //player.enabled = true;
        }
Ejemplo n.º 2
0
        public override void Enter(params object[] param)
        {
            if (mInitChildState != null)
            {
                this.SetChild(mInitChildState);
            }
            else
            {
                GameDebug.LogError("LuaInstanceState's Child State is null.");
            }

            m_PlayerAttributes = new Dictionary <UnitID, ActorAttributeData>();

            Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_NWAR_INIT_INFO, HandleServerData);
            Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_NWAR_ALL_READY, HandleServerData);

            //ClientEventMgr.Instance.SubscribeClientEvent((int)ClientEvent.CE_STATUS_TRANSFER_AUTO_ENDED, OnPlayerTransferAutoEnded);

            // 重设Input的引用计数
            GameInput.Instance.ResetInputRef();
            UnityEngine.EventSystems.EventSystem eventSys = xc.ui.ugui.UIManager.Instance.MainCtrl.EventSystemCom;
            if (eventSys != null)
            {
                eventSys.enabled = GameInput.Instance.GetEnableInput();
            }

            // 等map load之后才能移动
            GameInput.Instance.EnableInput(false);

            uint instanceID = SceneHelp.Instance.CurSceneID;

            // 配置表信息
            var dbInstance = DBManager.GetInstance().GetDB <DBInstance>();
            var dbMap      = DBManager.GetInstance().GetDB <DBMap>();

            InstanceManager.GetInstance().InstanceInfo = dbInstance.GetInstanceInfo(instanceID);
            InstanceManager.GetInstance().MapInfo      = dbMap.GetMapInfo(SceneHelp.GetFirstMapIdByInstanceId(instanceID));

            foreach (var behaviour in Behaviours)
            {
                behaviour.Value.Enter(param);
            }

            ActorModelCullManager.GetInstance().Reset();

            InstanceManager.Instance.ResetInstanceData();

            base.Enter(param);
        }
Ejemplo n.º 3
0
        public override void Update()
        {
            base.Update();

            // 处理AOI的缓存信息
            if (Game.Instance.CameraControl != null)
            {
                ActorManager.Instance.UpdateUnitCache(false);
            }

            using (var iter = Behaviours.GetEnumerator())
            {
                while (iter.MoveNext())
                {
                    iter.Current.Value.Update();
                }
            }

            //foreach (var behaviour in Behaviours)
            //    behaviour.Value.Update();

            ActorModelCullManager.GetInstance().Update();
        }