コード例 #1
0
        public void ProcessActiveObjectMessage(uint type, byte[] data)
        {
            switch (type)
            {
            case (uint)ActiveObjectMessage.GENERIC_CMD_SET_PROPERTIES:
            {
                proto_server.s2c_object_properties pack = ProtoBuf.Serializer.Deserialize <proto_server.s2c_object_properties>(new MemoryStream(data));
                if (!_ActiveObjectMap.ContainsKey(pack.aid))
                {
                    LogHelper.ERROR("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_SET_PROPERTIES aid={0} not exist!", pack.aid);
                    return;
                }
                _ObjectMessageHandler.ProcessProperty(_ActiveObjectMap[pack.aid], pack);
                //LogHelper.DEBUG("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_SET_PROPERTIES aid={0} size={1}", pack.aid, data.Length);
            }
            break;

            case (uint)ActiveObjectMessage.GENERIC_CMD_UPDATE_MOVEMENT:
            {
                proto_server.s2c_object_movemont pack = ProtoBuf.Serializer.Deserialize <proto_server.s2c_object_movemont>(new MemoryStream(data));
                if (!_ActiveObjectMap.ContainsKey(pack.aid))
                {
                    LogHelper.ERROR("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_MOVEMENT aid={0} not exist!", pack.aid);
                    return;
                }
                _ObjectMessageHandler.ProcessMovemont(_ActiveObjectMap[pack.aid], pack);
                //LogHelper.DEBUG("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_MOVEMENT aid={0} size={1}", pack.aid, data.Length);
            }
            break;

            case (uint)ActiveObjectMessage.GENERIC_CMD_UPDATE_YAW_PITCH:
            {
                proto_server.s2c_object_yaw_and_picth pack = ProtoBuf.Serializer.Deserialize <proto_server.s2c_object_yaw_and_picth>(new MemoryStream(data));
                if (!_ActiveObjectMap.ContainsKey(pack.aid))
                {
                    LogHelper.ERROR("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_YAW_PITCH aid={0} not exist!", pack.aid);
                    return;
                }
                _ObjectMessageHandler.ProcessYawPitch(_ActiveObjectMap[pack.aid], pack);
                //LogHelper.DEBUG("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_YAW_PITCH aid={0} size={1}", pack.aid, data.Length);
            }
            break;

            case (uint)ActiveObjectMessage.GENERIC_CMD_UPDATE_CONTROL:
            {
                proto_server.s2c_object_control_bits pack = ProtoBuf.Serializer.Deserialize <proto_server.s2c_object_control_bits>(new MemoryStream(data));
                if (!_ActiveObjectMap.ContainsKey(pack.aid))
                {
                    LogHelper.ERROR("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_CONTROL aid={0} not exist!", pack.aid);
                    return;
                }
                _ObjectMessageHandler.ProcesssControlBits(_ActiveObjectMap[pack.aid], pack);
                //LogHelper.DEBUG("ActiveObjectManager", "ProcessActiveObjectMessage GENERIC_CMD_UPDATE_CONTROL aid={0} size={1}", pack.aid, data.Length);
            }
            break;

            default:
                break;
            }
        }
コード例 #2
0
        public void ProcesssControlBits(ActiveObject obj, proto_server.s2c_object_control_bits control)
        {
            Debug.Log("ProcesssControlBits......");
            if (obj is Player && (obj as Player)._Component != null)
            {
                uint flagJump = control.flags & (1 << 4);
                Debug.Log(flagJump);

                if (flagJump > 0)
                {
                    (obj as Player)._Component.NeedJump(true);
                }
                else
                {
                    (obj as Player)._Component.NeedJump(false);
                }
            }
        }