Пример #1
0
        private void EGMI_ACK_MOVE_IMMUNE(int id, MemoryStream stream)
        {
            Debug.Log("EGMI_ACK_MOVE_IMMUNE " + Time.time);
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData);

            if (xData.SyncUnit.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < xData.SyncUnit.Count; ++i)
            {
                NFMsg.PosSyncUnit posSync = xData.SyncUnit[i];
                NFGUID            xMover  = mHelpModule.PBToNF(posSync.Mover);
                if (xMover.IsNull())
                {
                    return;
                }

                GameObject xGameObject = mSceneModule.GetObject(xMover);
                if (!xGameObject)
                {
                    return;
                }

                NFHeroSync xHeroSync = xGameObject.GetComponent <NFHeroSync>();
                if (!xHeroSync)
                {
                    return;
                }


                //TODO
                //GC----------

                /*
                 * UnityEngine.Vector3 v = new UnityEngine.Vector3();
                 * v.x = vector.X;
                 * v.y = vector.Y;
                 * v.z = vector.Z;
                 */
                //xHeroSync.AddSyncData(v);

                //float fSpeed = mKernelModule.QueryPropertyInt(xMover, NFrame.NPC.MOVE_SPEED) / 100.0f;
                //fSpeed *= 1.5f;
                //mSceneModule.MoveImmuneBySpeed(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true);
            }
        }
Пример #2
0
        //////////////////////////////////
        ///
        private void EGMI_ACK_MOVE(int id, MemoryStream stream)
        {
            Debug.Log("Move " + Time.time);

            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData);

            if (xData.SyncUnit.Count <= 0)
            {
                return;
            }

            NFMsg.PosSyncUnit syncUnit = xData.SyncUnit[0];

            NFGUID xMover = mHelpModule.PBToNF(syncUnit.Mover);

            if (xMover.IsNull())
            {
                Debug.LogError("xMover " + Time.time);
                return;
            }

            if (xMover == mLoginModule.mRoleID)
            {
                return;
            }

            GameObject xGameObject = mSceneModule.GetObject(xMover);

            if (!xGameObject)
            {
                Debug.LogError("xGameObject " + Time.time);
                return;
            }

            NFHeroMotor xHeroMotor = xGameObject.GetComponent <NFHeroMotor>();

            if (!xHeroMotor)
            {
                Debug.LogError("xHeroSync " + Time.time);
                return;
            }

            UnityEngine.Vector3 v = new UnityEngine.Vector3();
            v.x = syncUnit.Pos.X;
            v.y = syncUnit.Pos.Y;
            v.z = syncUnit.Pos.Z;
            xHeroMotor.MoveTo(v);
        }
Пример #3
0
        //////////////////////////////////
        ///
        private void EGMI_ACK_MOVE(int id, MemoryStream stream)
        {
            Debug.Log("Move " + Time.time);

            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData);

            if (xData.SyncUnit.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < xData.SyncUnit.Count; ++i)
            {
                NFMsg.PosSyncUnit posSync = xData.SyncUnit[i];
                float             fSpeed  = mKernelModule.QueryPropertyInt(mHelpModule.PBToNF(posSync.Mover), NFrame.NPC.MOVE_SPEED) / 100.0f;
            }

            //mSceneModule.MoveTo(mHelpModule.PBToNF(xData.Mover), new UnityEngine.Vector3(xData.TargetPos[0].X, xData.TargetPos[0].Y, xData.TargetPos[0].Z), fSpeed, true);
        }
Пример #4
0
        private void EGMI_ACK_POS_SYNC(int id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData);

            for (int i = 0; i < xData.SyncUnit.Count; ++i)
            {
                NFMsg.PosSyncUnit posSync = xData.SyncUnit[i];

                NFGUID xMover = mHelpModule.PBToNF(posSync.Mover);
                if (xMover.IsNull())
                {
                    Debug.LogError("xMover " + Time.time);
                    return;
                }

                if (xMover == mLoginModule.mRoleID)
                {
                    return;
                }

                GameObject xGameObject = mSceneModule.GetObject(xMover);
                if (!xGameObject)
                {
                    Debug.LogError("xGameObject " + Time.time);
                    return;
                }

                NFHeroSync xHeroSync = xGameObject.GetComponent <NFHeroSync>();
                if (!xHeroSync)
                {
                    Debug.LogError("xHeroSync " + Time.time);
                    return;
                }
                xHeroSync.AddSyncData(xData);
            }
        }
Пример #5
0
        //////////////////////////////////
        ///
        private void EGMI_ACK_MOVE(int id, MemoryStream stream)
        {
            Debug.Log("Move " + Time.time);

            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData);

            if (xData.SyncUnit.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < xData.SyncUnit.Count; ++i)
            {
                NFMsg.PosSyncUnit syncUnit = xData.SyncUnit[i];

                NFGUID xMover = mHelpModule.PBToNF(syncUnit.Mover);

                if (xMover.IsNull())
                {
                    Debug.LogError("xMover " + Time.time);
                    return;
                }

                if (xMover == mLoginModule.mRoleID && syncUnit.Type == PosSyncUnit.Types.EMoveType.EmtWalk)
                {
                    //平常自己行走不需要同步
                    return;
                }

                GameObject xGameObject = mSceneModule.GetObject(xMover);
                if (!xGameObject)
                {
                    Debug.LogError("xGameObject " + Time.time);
                    return;
                }

                NFHeroMotor xHeroMotor = xGameObject.GetComponent <NFHeroMotor>();
                if (!xHeroMotor)
                {
                    Debug.LogError("xHeroSync " + Time.time);
                    return;
                }

                NFHeroSync xHeroSync = xGameObject.GetComponent <NFHeroSync>();
                if (!xHeroSync)
                {
                    Debug.LogError("xHeroSync " + Time.time);
                    return;
                }
                UnityEngine.Vector3 v = new UnityEngine.Vector3();
                v.x = syncUnit.Pos.X;
                v.y = syncUnit.Pos.Y;
                v.z = syncUnit.Pos.Z;

                if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EmtWalk)
                {
                    xHeroSync.AddSyncData(xData.Sequence, syncUnit);
                }
                else if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EetSpeedy)
                {
                    xHeroMotor.MoveToImmune(v, 0.1f);
                }
                else if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EetTeleport)
                {
                    xHeroMotor.MoveToImmune(v, 0.001f);
                }
            }
        }