public override object createFromStream(MemoryStream stream)
        {
            UInt32 size = stream.readUint32();

            if (4 != size)
            {
                Dbg.ERROR_MSG(string.Format("KBEDATATYPE_VECTOR4::createFromStream: size({0}) is error!", size));
            }

            return(new Vector4(stream.readFloat(), stream.readFloat(), stream.readFloat(), stream.readFloat()));
        }
        public CITY_TYPE_PRICE_INFO createFromStreamEx(MemoryStream stream)
        {
            CITY_TYPE_PRICE_INFO datas = new CITY_TYPE_PRICE_INFO();

            datas.GoodsType = stream.readUint32();
            datas.TypePrice = stream.readFloat();
            return(datas);
        }
Exemple #3
0
 static int readFloat(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         KBEngine.MemoryStream obj = (KBEngine.MemoryStream)ToLua.CheckObject <KBEngine.MemoryStream>(L, 1);
         float o = obj.readFloat();
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #4
0
        public D_TEAM_INFOS createFromStreamEx(MemoryStream stream)
        {
            D_TEAM_INFOS datas = new D_TEAM_INFOS();

            datas.id          = stream.readInt32();
            datas.team_id     = stream.readInt32();
            datas.position_x  = stream.readFloat();
            datas.position_y  = stream.readFloat();
            datas.position_z  = stream.readFloat();
            datas.direction_x = stream.readFloat();
            datas.direction_y = stream.readFloat();
            datas.direction_z = stream.readFloat();
            return(datas);
        }
Exemple #5
0
        public D_ROAD_INFOS createFromStreamEx(MemoryStream stream)
        {
            D_ROAD_INFOS datas = new D_ROAD_INFOS();

            datas.id            = stream.readInt32();
            datas.group         = stream.readInt32();
            datas.position_x    = stream.readFloat();
            datas.position_y    = stream.readFloat();
            datas.position_z    = stream.readFloat();
            datas.eulerAngles_x = stream.readFloat();
            datas.eulerAngles_y = stream.readFloat();
            datas.eulerAngles_z = stream.readFloat();
            datas.born          = stream.readInt32();
            return(datas);
        }
        /*
            服务端强制设置了玩家的坐标
            例如:在服务端使用avatar.position=(0,0,0), 或者玩家位置与速度异常时会强制拉回到一个位置
        */
        public void Client_onSetEntityPosAndDir(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                Dbg.ERROR_MSG("KBEngine::Client_onSetEntityPosAndDir: entity(" + eid + ") not found!");
                return;
            }

            entity.position.x = stream.readFloat();
            entity.position.y = stream.readFloat();
            entity.position.z = stream.readFloat();

            entity.direction.x = stream.readFloat();
            entity.direction.y = stream.readFloat();
            entity.direction.z = stream.readFloat();

            Vector3 position = (Vector3)entity.getDefinedPropterty("position");
            Vector3 direction = (Vector3)entity.getDefinedPropterty("direction");
            Vector3 old_position = new Vector3(position.x, position.y, position.z);
            Vector3 old_direction = new Vector3(direction.x, direction.y, direction.z);

            position.x = entity.position.x;
            position.y = entity.position.y;
            position.z = entity.position.z;

            direction.x = entity.direction.x;
            direction.y = entity.direction.y;
            direction.z = entity.direction.z;

            entity.setDefinedPropterty("position", position);
            entity.setDefinedPropterty("direction", direction);

            _entityLastLocalPos = entity.position;
            _entityLastLocalDir = entity.direction;

            entity.set_direction(old_direction);
            entity.set_position(old_position);
        }
Exemple #7
0
        public void Client_onSetEntityPosAndDir(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                Dbg.ERROR_MSG("KBEngine::Client_onSetEntityPosAndDir: entity(" + eid + ") not found!");
                return;
            }

            entity.position.x = stream.readFloat();
            entity.position.y = stream.readFloat();
            entity.position.z = stream.readFloat();

            entity.direction.z = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);
            entity.direction.y = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);
            entity.direction.x = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);

            Vector3 position = (Vector3)entity.getDefinedPropterty("position");
            Vector3 direction = (Vector3)entity.getDefinedPropterty("direction");

            position.x = entity.position.x;
            position.y = entity.position.y;
            position.z = entity.position.z;

            direction.x = entity.direction.x;
            direction.y = entity.direction.y;
            direction.z = entity.direction.z;

            Event.fire("set_direction", new object[]{entity});
            Event.fire("set_position", new object[]{entity});
        }
Exemple #8
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = 0;

                {
                    if (sm.usePropertyDescrAlias)
                    {
                        _t_utype       = stream.readUint8();
                        _t_child_utype = stream.readUint8();
                    }
                    else
                    {
                        _t_utype       = stream.readUint16();
                        _t_child_utype = stream.readUint16();
                    }
                }

                Property prop = null;

                if (_t_utype == 0)
                {
                    prop = pdatas[_t_child_utype];
                }
                else
                {
                    Property pComponentPropertyDescription = pdatas[_t_utype];
                    switch (pComponentPropertyDescription.properUtype)
                    {
                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 40001:
                    Vector3 oldval_direction = direction;
                    direction = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }

                    break;

                case 5:
                    Byte oldval_level = level;
                    level = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onLevelChanged(oldval_level);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onLevelChanged(oldval_level);
                        }
                    }

                    break;

                case 4:
                    Int32 oldval_mass = mass;
                    mass = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMassChanged(oldval_mass);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMassChanged(oldval_mass);
                        }
                    }

                    break;

                case 9:
                    Byte oldval_modelID = modelID;
                    modelID = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }

                    break;

                case 7:
                    float oldval_modelScale = modelScale;
                    modelScale = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelScaleChanged(oldval_modelScale);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelScaleChanged(oldval_modelScale);
                        }
                    }

                    break;

                case 6:
                    float oldval_moveSpeed = moveSpeed;
                    moveSpeed = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMoveSpeedChanged(oldval_moveSpeed);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMoveSpeedChanged(oldval_moveSpeed);
                        }
                    }

                    break;

                case 2:
                    string oldval_name = name;
                    name = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onNameChanged(oldval_name);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onNameChanged(oldval_name);
                        }
                    }

                    break;

                case 40000:
                    Vector3 oldval_position = position;
                    position = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                case 8:
                    SByte oldval_state = state;
                    state = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onStateChanged(oldval_state);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onStateChanged(oldval_state);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
		public override object createFromStream(MemoryStream stream)
		{
			UInt32 size = stream.readUint32();
			if(4 != size)
			{
				Dbg.ERROR_MSG(string.Format("KBEDATATYPE_VECTOR4::createFromStream: size({0}) is error!", size));
			}
			
			return new Vector4(stream.readFloat(), stream.readFloat(), stream.readFloat(), stream.readFloat());
		}
		public override object createFromStream(MemoryStream stream)
		{
			return stream.readFloat();
		}
Exemple #11
0
 /*
     服务端更新玩家的基础位置, 客户端以这个基础位置加上便宜值计算出玩家周围实体的坐标
 */
 public void Client_onUpdateBasePos(MemoryStream stream)
 {
     _entityServerPos.X = stream.readFloat();
     _entityServerPos.Y = stream.readFloat();
     _entityServerPos.Z = stream.readFloat();
 }
Exemple #12
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = 0;

                {
                    if (sm.usePropertyDescrAlias)
                    {
                        _t_utype       = stream.readUint8();
                        _t_child_utype = stream.readUint8();
                    }
                    else
                    {
                        _t_utype       = stream.readUint16();
                        _t_child_utype = stream.readUint16();
                    }
                }

                Property prop = null;

                if (_t_utype == 0)
                {
                    prop = pdatas[_t_child_utype];
                }
                else
                {
                    Property pComponentPropertyDescription = pdatas[_t_utype];
                    switch (pComponentPropertyDescription.properUtype)
                    {
                    case 15:
                        componentFrameSync.onUpdatePropertys(_t_child_utype, stream, -1);
                        break;

                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 15:
                    componentFrameSync.createFromStream(stream);
                    break;

                case 40001:
                    Vector3 oldval_direction = direction;
                    direction = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }

                    break;

                case 11:
                    SByte oldval_gameStateC = gameStateC;
                    gameStateC = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onGameStateCChanged(oldval_gameStateC);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onGameStateCChanged(oldval_gameStateC);
                        }
                    }

                    break;

                case 13:
                    Byte oldval_modelID = modelID;
                    modelID = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }

                    break;

                case 8:
                    float oldval_moveSpeed = moveSpeed;
                    moveSpeed = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMoveSpeedChanged(oldval_moveSpeed);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMoveSpeedChanged(oldval_moveSpeed);
                        }
                    }

                    break;

                case 3:
                    string oldval_name = name;
                    name = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onNameChanged(oldval_name);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onNameChanged(oldval_name);
                        }
                    }

                    break;

                case 40000:
                    Vector3 oldval_position = position;
                    position = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }

                    break;

                case 4:
                    Byte oldval_roleType = roleType;
                    roleType = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoleTypeChanged(oldval_roleType);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoleTypeChanged(oldval_roleType);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                case 9:
                    SByte oldval_state = state;
                    state = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onStateChanged(oldval_state);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onStateChanged(oldval_state);
                        }
                    }

                    break;

                case 6:
                    Byte oldval_teamID = teamID;
                    teamID = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onTeamIDChanged(oldval_teamID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onTeamIDChanged(oldval_teamID);
                        }
                    }

                    break;

                case 5:
                    Int32 oldval_weaponID = weaponID;
                    weaponID = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onWeaponIDChanged(oldval_weaponID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onWeaponIDChanged(oldval_weaponID);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
Exemple #13
0
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];

            UInt16 methodUtype            = 0;
            UInt16 componentPropertyUType = 0;

            if (sm.useMethodDescrAlias)
            {
                componentPropertyUType = stream.readUint8();
                methodUtype            = stream.readUint8();
            }
            else
            {
                componentPropertyUType = stream.readUint16();
                methodUtype            = stream.readUint16();
            }

            Method method = null;

            if (componentPropertyUType == 0)
            {
                method = sm.idmethods[methodUtype];
            }
            else
            {
                Property pComponentPropertyDescription = sm.idpropertys[componentPropertyUType];
                switch (pComponentPropertyDescription.properUtype)
                {
                case 15:
                    componentFrameSync.onRemoteMethodCall(methodUtype, stream);
                    break;

                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 14:
                onEnding();
                break;

            case 10:
                Int32 onPlayerQuitMatch_arg1 = stream.readInt32();
                onPlayerQuitMatch(onPlayerQuitMatch_arg1);
                break;

            case 12:
                onReadyForBattle();
                break;

            case 9:
                MATCHING_INFOS_LIST onResPlayersInfo_arg1 = ((DATATYPE_MATCHING_INFOS_LIST)method.args[0]).createFromStreamEx(stream);
                onResPlayersInfo(onResPlayersInfo_arg1);
                break;

            case 13:
                onReturnHalls();
                break;

            case 15:
                Byte  onStatisticalResult_arg1 = stream.readUint8();
                float onStatisticalResult_arg2 = stream.readFloat();
                onStatisticalResult(onStatisticalResult_arg1, onStatisticalResult_arg2);
                break;

            case 11:
                onTeamMateChange();
                break;

            default:
                break;
            }
            ;
        }
Exemple #14
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Account"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = 0;

                {
                    if (sm.usePropertyDescrAlias)
                    {
                        _t_utype       = stream.readUint8();
                        _t_child_utype = stream.readUint8();
                    }
                    else
                    {
                        _t_utype       = stream.readUint16();
                        _t_child_utype = stream.readUint16();
                    }
                }

                Property prop = null;

                if (_t_utype == 0)
                {
                    prop = pdatas[_t_child_utype];
                }
                else
                {
                    Property pComponentPropertyDescription = pdatas[_t_utype];
                    switch (pComponentPropertyDescription.properUtype)
                    {
                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 40001:
                    Vector3 oldval_direction = direction;
                    direction = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }

                    break;

                case 2:
                    Int32 oldval_modelType = modelType;
                    modelType = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelTypeChanged(oldval_modelType);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelTypeChanged(oldval_modelType);
                        }
                    }

                    break;

                case 6:
                    Int64 oldval_playerExp = playerExp;
                    playerExp = stream.readInt64();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerExpChanged(oldval_playerExp);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerExpChanged(oldval_playerExp);
                        }
                    }

                    break;

                case 5:
                    UInt16 oldval_playerID = playerID;
                    playerID = stream.readUint16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerIDChanged(oldval_playerID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerIDChanged(oldval_playerID);
                        }
                    }

                    break;

                case 11:
                    Int32 oldval_playerLayer = playerLayer;
                    playerLayer = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerLayerChanged(oldval_playerLayer);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerLayerChanged(oldval_playerLayer);
                        }
                    }

                    break;

                case 9:
                    Int32 oldval_playerMass = playerMass;
                    playerMass = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerMassChanged(oldval_playerMass);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerMassChanged(oldval_playerMass);
                        }
                    }

                    break;

                case 4:
                    string oldval_playerName = playerName;
                    playerName = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerNameChanged(oldval_playerName);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerNameChanged(oldval_playerName);
                        }
                    }

                    break;

                case 3:
                    string oldval_playerNameBase = playerNameBase;
                    playerNameBase = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerNameBaseChanged(oldval_playerNameBase);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerNameBaseChanged(oldval_playerNameBase);
                        }
                    }

                    break;

                case 8:
                    float oldval_playerScale = playerScale;
                    playerScale = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerScaleChanged(oldval_playerScale);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerScaleChanged(oldval_playerScale);
                        }
                    }

                    break;

                case 10:
                    float oldval_playerSpeed = playerSpeed;
                    playerSpeed = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerSpeedChanged(oldval_playerSpeed);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerSpeedChanged(oldval_playerSpeed);
                        }
                    }

                    break;

                case 7:
                    Int32 oldval_playerState = playerState;
                    playerState = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerStateChanged(oldval_playerState);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerStateChanged(oldval_playerState);
                        }
                    }

                    break;

                case 40000:
                    Vector3 oldval_position = position;
                    position = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
 public void Client_onUpdateBasePosXZ(MemoryStream stream)
 {
     _entityServerPos.x = stream.readFloat();
     _entityServerPos.z = stream.readFloat();
 }
Exemple #16
0
        public override void onUpdatePropertys(Property prop, MemoryStream stream)
        {
            switch (prop.properUtype)
            {
            case 21:
                UInt16 oldval_anYeYiYangGold = anYeYiYangGold;
                anYeYiYangGold = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onAnYeYiYangGoldChanged(oldval_anYeYiYangGold);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onAnYeYiYangGoldChanged(oldval_anYeYiYangGold);
                    }
                }

                break;

            case 18:
                string oldval_animState = animState;
                animState = stream.readUnicode();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onAnimStateChanged(oldval_animState);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onAnimStateChanged(oldval_animState);
                    }
                }

                break;

            case 40001:
                Vector3 oldval_direction = direction;
                direction = stream.readVector3();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }

                break;

            case 13:
                UInt16 oldval_goldNum = goldNum;
                goldNum = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onGoldNumChanged(oldval_goldNum);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onGoldNumChanged(oldval_goldNum);
                    }
                }

                break;

            case 20:
                UInt16 oldval_jiaSuGold = jiaSuGold;
                jiaSuGold = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onJiaSuGoldChanged(oldval_jiaSuGold);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onJiaSuGoldChanged(oldval_jiaSuGold);
                    }
                }

                break;

            case 19:
                UInt16 oldval_keepJiaSuTime = keepJiaSuTime;
                keepJiaSuTime = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onKeepJiaSuTimeChanged(oldval_keepJiaSuTime);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onKeepJiaSuTimeChanged(oldval_keepJiaSuTime);
                    }
                }

                break;

            case 14:
                float oldval_moveSpeed = moveSpeed;
                moveSpeed = stream.readFloat();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onMoveSpeedChanged(oldval_moveSpeed);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onMoveSpeedChanged(oldval_moveSpeed);
                    }
                }

                break;

            case 16:
                string oldval_name = name;
                name = stream.readUnicode();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onNameChanged(oldval_name);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onNameChanged(oldval_name);
                    }
                }

                break;

            case 23:
                UInt16 oldval_nanShangJiaNanGold = nanShangJiaNanGold;
                nanShangJiaNanGold = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onNanShangJiaNanGoldChanged(oldval_nanShangJiaNanGold);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onNanShangJiaNanGoldChanged(oldval_nanShangJiaNanGold);
                    }
                }

                break;

            case 40000:
                Vector3 oldval_position = position;
                position = stream.readVector3();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onPositionChanged(oldval_position);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onPositionChanged(oldval_position);
                    }
                }

                break;

            case 40002:
                stream.readUint32();
                break;

            case 12:
                Byte oldval_track = track;
                track = stream.readUint8();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onTrackChanged(oldval_track);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onTrackChanged(oldval_track);
                    }
                }

                break;

            case 22:
                UInt16 oldval_xiaCiYiDingGold = xiaCiYiDingGold;
                xiaCiYiDingGold = stream.readUint16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onXiaCiYiDingGoldChanged(oldval_xiaCiYiDingGold);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onXiaCiYiDingGoldChanged(oldval_xiaCiYiDingGold);
                    }
                }

                break;

            default:
                break;
            }
            ;
        }
 public override object createFromStream(MemoryStream stream)
 {
     return(stream.readFloat());
 }
        public void Client_onUpdateBaseDir(MemoryStream stream)
        {
            float yaw, pitch, roll;
            yaw = stream.readFloat() * 360 / ((float)System.Math.PI * 2);
            pitch = stream.readFloat() * 360 / ((float)System.Math.PI * 2);
            roll = stream.readFloat() * 360 / ((float)System.Math.PI * 2);

            var entity = player();
            if (entity != null && entity.isControlled)
            {
                entity.direction.Set(roll, pitch, yaw);
                Event.fireOut("set_direction", new object[]{entity});
                entity.onUpdateVolatileData();
            }
        }
Exemple #19
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Smash"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = 0;

                {
                    if (sm.usePropertyDescrAlias)
                    {
                        _t_utype       = stream.readUint8();
                        _t_child_utype = stream.readUint8();
                    }
                    else
                    {
                        _t_utype       = stream.readUint16();
                        _t_child_utype = stream.readUint16();
                    }
                }

                Property prop = null;

                if (_t_utype == 0)
                {
                    prop = pdatas[_t_child_utype];
                }
                else
                {
                    Property pComponentPropertyDescription = pdatas[_t_utype];
                    switch (pComponentPropertyDescription.properUtype)
                    {
                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 40001:
                    Vector3 oldval_direction = direction;
                    direction = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }

                    break;

                case 17:
                    Byte oldval_modelID = modelID;
                    modelID = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelIDChanged(oldval_modelID);
                        }
                    }

                    break;

                case 16:
                    float oldval_modelScale = modelScale;
                    modelScale = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onModelScaleChanged(oldval_modelScale);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onModelScaleChanged(oldval_modelScale);
                        }
                    }

                    break;

                case 40000:
                    Vector3 oldval_position = position;
                    position = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
Exemple #20
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = 0;

                {
                    if (sm.usePropertyDescrAlias)
                    {
                        _t_utype       = stream.readUint8();
                        _t_child_utype = stream.readUint8();
                    }
                    else
                    {
                        _t_utype       = stream.readUint16();
                        _t_child_utype = stream.readUint16();
                    }
                }

                Property prop = null;

                if (_t_utype == 0)
                {
                    prop = pdatas[_t_child_utype];
                }
                else
                {
                    Property pComponentPropertyDescription = pdatas[_t_utype];
                    switch (pComponentPropertyDescription.properUtype)
                    {
                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 2:
                    UInt32 oldval_GatherEnergy = GatherEnergy;
                    GatherEnergy = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onGatherEnergyChanged(oldval_GatherEnergy);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onGatherEnergyChanged(oldval_GatherEnergy);
                        }
                    }

                    break;

                case 3:
                    Byte oldval_IsRun = IsRun;
                    IsRun = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onIsRunChanged(oldval_IsRun);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onIsRunChanged(oldval_IsRun);
                        }
                    }

                    break;

                case 1:
                    float oldval_MoveSpeed = MoveSpeed;
                    MoveSpeed = stream.readFloat();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMoveSpeedChanged(oldval_MoveSpeed);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMoveSpeedChanged(oldval_MoveSpeed);
                        }
                    }

                    break;

                case 40001:
                    Vector3 oldval_direction = direction;
                    direction = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDirectionChanged(oldval_direction);
                        }
                    }

                    break;

                case 40000:
                    Vector3 oldval_position = position;
                    position = stream.readVector3();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPositionChanged(oldval_position);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }