示例#1
0
 static int readInt32(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         KBEngine.MemoryStream obj = (KBEngine.MemoryStream)ToLua.CheckObject <KBEngine.MemoryStream>(L, 1);
         int o = obj.readInt32();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#2
0
        public void Client_onUpdateData_ypr(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();

            SByte y = stream.readInt8();
            SByte p = stream.readInt8();
            SByte r = stream.readInt8();

            _updateVolatileData(eid, 0.0f, 0.0f, 0.0f, y, p, r);
        }
示例#3
0
        public Int32 getAoiEntityIDFromStream(MemoryStream stream)
        {
            Int32 id = 0;
            if(entityIDAliasIDList.Count > 255)
            {
                id = stream.readInt32();
            }
            else
            {
                byte aliasID = stream.readUint8();
                id = entityIDAliasIDList[aliasID];
            }

            return id;
        }
		public override object createFromStream(MemoryStream stream)
		{
			return stream.readInt32();
		}
示例#5
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 6:
                    CARDGROUP_INFO_LIST oldval_CardGroupList = CardGroupList;
                    CardGroupList = ((DATATYPE_CARDGROUP_INFO_LIST)EntityDef.id2datatypes[29]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onCardGroupListChanged(oldval_CardGroupList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onCardGroupListChanged(oldval_CardGroupList);
                        }
                    }

                    break;

                case 5:
                    CARD_LIST oldval_CardList = CardList;
                    CardList = ((DATATYPE_CARD_LIST)EntityDef.id2datatypes[24]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onCardListChanged(oldval_CardList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onCardListChanged(oldval_CardList);
                        }
                    }

                    break;

                case 3:
                    Int32 oldval_Gold = Gold;
                    Gold = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onGoldChanged(oldval_Gold);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onGoldChanged(oldval_Gold);
                        }
                    }

                    break;

                case 4:
                    Int32 oldval_Kabao = Kabao;
                    Kabao = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onKabaoChanged(oldval_Kabao);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onKabaoChanged(oldval_Kabao);
                        }
                    }

                    break;

                case 2:
                    Int16 oldval_Level = Level;
                    Level = stream.readInt16();

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

                    break;

                case 1:
                    string oldval_Name = Name;
                    Name = stream.readUnicode();

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

                    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;
                }
                ;
            }
        }
 /*
     服务端调用实体方法
 */
 public void Client_onRemoteMethodCall(MemoryStream stream)
 {
     Int32 eid = stream.readInt32();
     onRemoteMethodCall_(eid, stream);
 }
        /*
            通过流数据获得AOI实体的ID
        */
        public Int32 getAoiEntityIDFromStream(MemoryStream stream)
        {
            if (!_args.useAliasEntityID)
                return stream.readInt32();

            Int32 id = 0;
            if(_entityIDAliasIDList.Count > 255)
            {
                id = stream.readInt32();

                // 如果为0且客户端上一步是重登陆或者重连操作并且服务端entity在断线期间一直处于在线状态
                // 则可以忽略这个错误, 因为cellapp可能一直在向baseapp发送同步消息, 当客户端重连上时未等
                // 服务端初始化步骤开始则收到同步信息, 此时这里就会出错。
                if(_entityIDAliasIDList.Count == 0)
                    return 0;
            }
            else
            {
                byte aliasID = stream.readUint8();

                // 如果为0且客户端上一步是重登陆或者重连操作并且服务端entity在断线期间一直处于在线状态
                // 则可以忽略这个错误, 因为cellapp可能一直在向baseapp发送同步消息, 当客户端重连上时未等
                // 服务端初始化步骤开始则收到同步信息, 此时这里就会出错。
                if(_entityIDAliasIDList.Count == 0)
                    return 0;

                id = _entityIDAliasIDList[aliasID];
            }

            return id;
        }
示例#8
0
        public void Client_onUpdateData_r(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();

            SByte r = stream.readInt8();

            _updateVolatileData(eid, 0.0f, 0.0f, 0.0f, KBE_FLT_MAX, KBE_FLT_MAX, r);
        }
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];

            UInt16 methodUtype            = 0;
            UInt16 componentPropertyUType = 0;

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

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

            Method method = null;

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

                case 21:
                    component2.onRemoteMethodCall(methodUtype, stream);
                    break;

                case 22:
                    component3.onRemoteMethodCall(methodUtype, stream);
                    break;

                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 10101:
                Byte   dialog_addOption_arg1 = stream.readUint8();
                UInt32 dialog_addOption_arg2 = stream.readUint32();
                string dialog_addOption_arg3 = stream.readUnicode();
                Int32  dialog_addOption_arg4 = stream.readInt32();
                dialog_addOption(dialog_addOption_arg1, dialog_addOption_arg2, dialog_addOption_arg3, dialog_addOption_arg4);
                break;

            case 10104:
                dialog_close();
                break;

            case 10102:
                string dialog_setText_arg1 = stream.readUnicode();
                Byte   dialog_setText_arg2 = stream.readUint8();
                UInt32 dialog_setText_arg3 = stream.readUint32();
                string dialog_setText_arg4 = stream.readUnicode();
                dialog_setText(dialog_setText_arg1, dialog_setText_arg2, dialog_setText_arg3, dialog_setText_arg4);
                break;

            case 12:
                Int32 onAddSkill_arg1 = stream.readInt32();
                onAddSkill(onAddSkill_arg1);
                break;

            case 7:
                onJump();
                break;

            case 13:
                Int32 onRemoveSkill_arg1 = stream.readInt32();
                onRemoveSkill(onRemoveSkill_arg1);
                break;

            case 16:
                Int32 recvDamage_arg1 = stream.readInt32();
                Int32 recvDamage_arg2 = stream.readInt32();
                Int32 recvDamage_arg3 = stream.readInt32();
                Int32 recvDamage_arg4 = stream.readInt32();
                recvDamage(recvDamage_arg1, recvDamage_arg2, recvDamage_arg3, recvDamage_arg4);
                break;

            default:
                break;
            }
            ;
        }
示例#10
0
        public override void onUpdatePropertys(Property prop, MemoryStream stream)
        {
            switch (prop.properUtype)
            {
            case 2:
                Int16 oldval_dbid = dbid;
                dbid = stream.readInt16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onDbidChanged(oldval_dbid);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onDbidChanged(oldval_dbid);
                    }
                }

                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 15:
                Int32 oldval_gameResult = gameResult;
                gameResult = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onGameResultChanged(oldval_gameResult);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onGameResultChanged(oldval_gameResult);
                    }
                }

                break;

            case 11:
                List <Int32> oldval_handCards = handCards;
                handCards = ((DATATYPE_AnonymousArray_31)EntityDef.id2datatypes[31]).createFromStreamEx(stream);

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onHandCardsChanged(oldval_handCards);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onHandCardsChanged(oldval_handCards);
                    }
                }

                break;

            case 12:
                Int32 oldval_handCardsCount = handCardsCount;
                handCardsCount = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onHandCardsCountChanged(oldval_handCardsCount);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onHandCardsCountChanged(oldval_handCardsCount);
                    }
                }

                break;

            case 7:
                Int32 oldval_loseCount = loseCount;
                loseCount = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onLoseCountChanged(oldval_loseCount);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onLoseCountChanged(oldval_loseCount);
                    }
                }

                break;

            case 8:
                Int32 oldval_loseCountC = loseCountC;
                loseCountC = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onLoseCountCChanged(oldval_loseCountC);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onLoseCountCChanged(oldval_loseCountC);
                    }
                }

                break;

            case 14:
                Int32 oldval_message = message;
                message = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onMessageChanged(oldval_message);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onMessageChanged(oldval_message);
                    }
                }

                break;

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

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

                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 4:
                string oldval_nameC = nameC;
                nameC = stream.readUnicode();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onNameCChanged(oldval_nameC);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onNameCChanged(oldval_nameC);
                    }
                }

                break;

            case 13:
                List <Int32> oldval_playCards = playCards;
                playCards = ((DATATYPE_AnonymousArray_32)EntityDef.id2datatypes[32]).createFromStreamEx(stream);

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onPlayCardsChanged(oldval_playCards);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onPlayCardsChanged(oldval_playCards);
                    }
                }

                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 1:
                UInt64 oldval_roomKey = roomKey;
                roomKey = stream.readUint64();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onRoomKeyChanged(oldval_roomKey);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onRoomKeyChanged(oldval_roomKey);
                    }
                }

                break;

            case 10:
                Int16 oldval_seatIndex = seatIndex;
                seatIndex = stream.readInt16();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onSeatIndexChanged(oldval_seatIndex);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onSeatIndexChanged(oldval_seatIndex);
                    }
                }

                break;

            case 40002:
                stream.readUint32();
                break;

            case 5:
                Int32 oldval_winCount = winCount;
                winCount = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onWinCountChanged(oldval_winCount);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onWinCountChanged(oldval_winCount);
                    }
                }

                break;

            case 6:
                Int32 oldval_winCountC = winCountC;
                winCountC = stream.readInt32();

                if (prop.isBase())
                {
                    if (inited)
                    {
                        onWinCountCChanged(oldval_winCountC);
                    }
                }
                else
                {
                    if (inWorld)
                    {
                        onWinCountCChanged(oldval_winCountC);
                    }
                }

                break;

            default:
                break;
            }
            ;
        }
示例#11
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 20:
                    Byte oldval_Country = Country;
                    Country = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onCountryChanged(oldval_Country);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onCountryChanged(oldval_Country);
                        }
                    }

                    break;

                case 23:
                    Int32 oldval_Gold = Gold;
                    Gold = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onGoldChanged(oldval_Gold);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onGoldChanged(oldval_Gold);
                        }
                    }

                    break;

                case 22:
                    Int16 oldval_Level = Level;
                    Level = stream.readInt16();

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

                    break;

                case 18:
                    string oldval_PlayerName = PlayerName;
                    PlayerName = stream.readUnicode();

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

                    break;

                case 19:
                    Byte oldval_RoleType = RoleType;
                    RoleType = stream.readUint8();

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

                    break;

                case 21:
                    Byte oldval_Sex = Sex;
                    Sex = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onSexChanged(oldval_Sex);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onSexChanged(oldval_Sex);
                        }
                    }

                    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 41006:
                    UInt32 oldval_modelID = modelID;
                    modelID = stream.readUint32();

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

                    break;

                case 41007:
                    Byte oldval_modelScale = modelScale;
                    modelScale = stream.readUint8();

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

                    break;

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

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

                    break;

                case 24:
                    UInt16 oldval_own_val = own_val;
                    own_val = stream.readUint16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onOwn_valChanged(oldval_own_val);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onOwn_valChanged(oldval_own_val);
                        }
                    }

                    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 41001:
                    UInt32 oldval_spaceUType = spaceUType;
                    spaceUType = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onSpaceUTypeChanged(oldval_spaceUType);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onSpaceUTypeChanged(oldval_spaceUType);
                        }
                    }

                    break;

                case 41004:
                    UInt32 oldval_uid = uid;
                    uid = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }

                    break;

                case 41005:
                    UInt32 oldval_utype = utype;
                    utype = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["DroppedItem"];
            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 64:
                    UInt32 oldval_dialogID = dialogID;
                    dialogID = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onDialogIDChanged(oldval_dialogID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onDialogIDChanged(oldval_dialogID);
                        }
                    }

                    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 51007:
                    UInt32 oldval_entityNO = entityNO;
                    entityNO = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onEntityNOChanged(oldval_entityNO);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onEntityNOChanged(oldval_entityNO);
                        }
                    }

                    break;

                case 59:
                    UInt32 oldval_itemCount = itemCount;
                    itemCount = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onItemCountChanged(oldval_itemCount);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onItemCountChanged(oldval_itemCount);
                        }
                    }

                    break;

                case 58:
                    Int32 oldval_itemId = itemId;
                    itemId = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onItemIdChanged(oldval_itemId);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onItemIdChanged(oldval_itemId);
                        }
                    }

                    break;

                case 41006:
                    UInt32 oldval_modelID = modelID;
                    modelID = stream.readUint32();

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

                    break;

                case 41007:
                    Byte oldval_modelScale = modelScale;
                    modelScale = stream.readUint8();

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

                    break;

                case 41003:
                    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 41004:
                    UInt32 oldval_uid = uid;
                    uid = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }

                    break;

                case 41005:
                    UInt32 oldval_utype = utype;
                    utype = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }

                    break;

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

            UInt16 methodUtype            = 0;
            UInt16 componentPropertyUType = 0;

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

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

            Method method = null;

            if (componentPropertyUType == 0)
            {
                method = sm.idmethods[methodUtype];
            }
            else
            {
                Property pComponentPropertyDescription = sm.idpropertys[componentPropertyUType];
                switch (pComponentPropertyDescription.properUtype)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 40:
                Int32 onLoadingFinish_arg1 = stream.readInt32();
                onLoadingFinish(onLoadingFinish_arg1);
                break;

            case 42:
                Int32 onPropResult_arg1 = stream.readInt32();
                Int32 onPropResult_arg2 = stream.readInt32();
                Int32 onPropResult_arg3 = stream.readInt32();
                Byte  onPropResult_arg4 = stream.readUint8();
                onPropResult(onPropResult_arg1, onPropResult_arg2, onPropResult_arg3, onPropResult_arg4);
                break;

            case 43:
                Int32 onReachDestination_arg1 = stream.readInt32();
                Int32 onReachDestination_arg2 = stream.readInt32();
                onReachDestination(onReachDestination_arg1, onReachDestination_arg2);
                break;

            case 41:
                PROP_LIST onResetProps_arg1 = ((DATATYPE_PROP_LIST)method.args[0]).createFromStreamEx(stream);
                onResetProps(onResetProps_arg1);
                break;

            case 44:
                Int32 onTimerChanged_arg1 = stream.readInt32();
                onTimerChanged(onTimerChanged_arg1);
                break;

            default:
                break;
            }
            ;
        }
        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 13:
                    TING_PAI_LIST oldval_TingPaiList = TingPaiList;
                    TingPaiList = ((DATATYPE_TING_PAI_LIST)EntityDef.id2datatypes[34]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onTingPaiListChanged(oldval_TingPaiList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onTingPaiListChanged(oldval_TingPaiList);
                        }
                    }

                    break;

                case 15:
                    Int32 oldval__lastmailID = _lastmailID;
                    _lastmailID = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            on_lastmailIDChanged(oldval__lastmailID);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            on_lastmailIDChanged(oldval__lastmailID);
                        }
                    }

                    break;

                case 12:
                    PLAYER_ACTION_DIC oldval_actionData = actionData;
                    actionData = ((DATATYPE_PLAYER_ACTION_DIC)EntityDef.id2datatypes[32]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onActionDataChanged(oldval_actionData);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onActionDataChanged(oldval_actionData);
                        }
                    }

                    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 1:
                    FRIENDS_LIST oldval_friendsList = friendsList;
                    friendsList = ((DATATYPE_FRIENDS_LIST)EntityDef.id2datatypes[26]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onFriendsListChanged(oldval_friendsList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onFriendsListChanged(oldval_friendsList);
                        }
                    }

                    break;

                case 11:
                    MJ_LIST oldval_holds = holds;
                    holds = ((DATATYPE_MJ_LIST)EntityDef.id2datatypes[22]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onHoldsChanged(oldval_holds);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onHoldsChanged(oldval_holds);
                        }
                    }

                    break;

                case 4:
                    Byte oldval_inRoom = inRoom;
                    inRoom = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onInRoomChanged(oldval_inRoom);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onInRoomChanged(oldval_inRoom);
                        }
                    }

                    break;

                case 8:
                    Byte oldval_isNewPlayer = isNewPlayer;
                    isNewPlayer = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onIsNewPlayerChanged(oldval_isNewPlayer);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onIsNewPlayerChanged(oldval_isNewPlayer);
                        }
                    }

                    break;

                case 10:
                    Byte oldval_isReady = isReady;
                    isReady = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onIsReadyChanged(oldval_isReady);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onIsReadyChanged(oldval_isReady);
                        }
                    }

                    break;

                case 14:
                    MAIL_LIST oldval_mailList = mailList;
                    mailList = ((DATATYPE_MAIL_LIST)EntityDef.id2datatypes[25]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMailListChanged(oldval_mailList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMailListChanged(oldval_mailList);
                        }
                    }

                    break;

                case 7:
                    UInt32 oldval_playerGold = playerGold;
                    playerGold = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerGoldChanged(oldval_playerGold);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerGoldChanged(oldval_playerGold);
                        }
                    }

                    break;

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

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

                    break;

                case 3:
                    UInt16 oldval_playerID_base = playerID_base;
                    playerID_base = stream.readUint16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerID_baseChanged(oldval_playerID_base);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerID_baseChanged(oldval_playerID_base);
                        }
                    }

                    break;

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

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

                    break;

                case 2:
                    string oldval_playerName_base = playerName_base;
                    playerName_base = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerName_baseChanged(oldval_playerName_base);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerName_baseChanged(oldval_playerName_base);
                        }
                    }

                    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 9:
                    Byte oldval_roomSeatIndex = roomSeatIndex;
                    roomSeatIndex = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoomSeatIndexChanged(oldval_roomSeatIndex);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoomSeatIndexChanged(oldval_roomSeatIndex);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Account"];

            UInt16 methodUtype            = 0;
            UInt16 componentPropertyUType = 0;

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

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

            Method method = null;

            if (componentPropertyUType == 0)
            {
                method = sm.idmethods[methodUtype];
            }
            else
            {
                Property pComponentPropertyDescription = sm.idpropertys[componentPropertyUType];
                switch (pComponentPropertyDescription.properUtype)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 23:
                Byte OnReqCreateAvatar_arg1 = stream.readUint8();
                OnReqCreateAvatar(OnReqCreateAvatar_arg1);
                break;

            case 48:
                MAIL addMail_arg1 = ((DATATYPE_MAIL)method.args[0]).createFromStreamEx(stream);
                addMail(addMail_arg1);
                break;

            case 40:
                string callClientMsg_arg1 = stream.readUnicode();
                callClientMsg(callClientMsg_arg1);
                break;

            case 49:
                Int32 deleMail_arg1 = stream.readInt32();
                deleMail(deleMail_arg1);
                break;

            case 26:
                game_begin_push();
                break;

            case 29:
                game_chupai_push();
                break;

            case 31:
                SByte game_mopai_push_arg1 = stream.readInt8();
                game_mopai_push(game_mopai_push_arg1);
                break;

            case 37:
                TING_PAI_LIST hasTing_arg1 = ((DATATYPE_TING_PAI_LIST)method.args[0]).createFromStreamEx(stream);
                hasTing(hasTing_arg1);
                break;

            case 28:
                has_action();
                break;

            case 39:
                PLAYRE_DATA_LIST initFriendsListOK_arg1 = ((DATATYPE_PLAYRE_DATA_LIST)method.args[0]).createFromStreamEx(stream);
                initFriendsListOK(initFriendsListOK_arg1);
                break;

            case 38:
                onGameOver();
                break;

            case 34:
                UInt32 onGang_arg1 = stream.readUint32();
                SByte  onGang_arg2 = stream.readInt8();
                string onGang_arg3 = stream.readUnicode();
                onGang(onGang_arg1, onGang_arg2, onGang_arg3);
                break;

            case 25:
                ROOM_PUBLIC_INFO onGetRoomInfo_arg1 = ((DATATYPE_ROOM_PUBLIC_INFO)method.args[0]).createFromStreamEx(stream);
                onGetRoomInfo(onGetRoomInfo_arg1);
                break;

            case 35:
                UInt32 onHu_arg1 = stream.readUint32();
                Byte   onHu_arg2 = stream.readUint8();
                SByte  onHu_arg3 = stream.readInt8();
                onHu(onHu_arg1, onHu_arg2, onHu_arg3);
                break;

            case 30:
                UInt32 onPlayCard_arg1 = stream.readUint32();
                SByte  onPlayCard_arg2 = stream.readInt8();
                onPlayCard(onPlayCard_arg1, onPlayCard_arg2);
                break;

            case 36:
                UInt32 onPlayCardOver_arg1 = stream.readUint32();
                SByte  onPlayCardOver_arg2 = stream.readInt8();
                onPlayCardOver(onPlayCardOver_arg1, onPlayCardOver_arg2);
                break;

            case 32:
                UInt32 otherPlayerMopai_arg1 = stream.readUint32();
                otherPlayerMopai(otherPlayerMopai_arg1);
                break;

            case 33:
                UInt32 peng_notify_push_arg1 = stream.readUint32();
                SByte  peng_notify_push_arg2 = stream.readInt8();
                peng_notify_push(peng_notify_push_arg1, peng_notify_push_arg2);
                break;

            case 24:
                playerLevelRoom();
                break;

            case 27:
                ROOM_PUBLIC_INFO upDataClientRoomInfo_arg1 = ((DATATYPE_ROOM_PUBLIC_INFO)method.args[0]).createFromStreamEx(stream);
                upDataClientRoomInfo(upDataClientRoomInfo_arg1);
                break;

            default:
                break;
            }
            ;
        }
示例#16
0
 public void Client_onHelloCB(MemoryStream stream)
 {
     serverVersion_ = stream.readString();
     Int32 ctype = stream.readInt32();
     Dbg.DEBUG_MSG("KBEngine::Client_onHelloCB: verInfo(" + serverVersion_ + "), ctype(" + ctype + ")!");
 }
示例#17
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});
        }
        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 16:
                        component1.onUpdatePropertys(_t_child_utype, stream, -1);
                        break;

                    case 21:
                        component2.onUpdatePropertys(_t_child_utype, stream, -1);
                        break;

                    case 22:
                        component3.onUpdatePropertys(_t_child_utype, stream, -1);
                        break;

                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 47001:
                    Int32 oldval_HP = HP;
                    HP = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onHPChanged(oldval_HP);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onHPChanged(oldval_HP);
                        }
                    }

                    break;

                case 47002:
                    Int32 oldval_HP_Max = HP_Max;
                    HP_Max = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onHP_MaxChanged(oldval_HP_Max);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onHP_MaxChanged(oldval_HP_Max);
                        }
                    }

                    break;

                case 47003:
                    Int32 oldval_MP = MP;
                    MP = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMPChanged(oldval_MP);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMPChanged(oldval_MP);
                        }
                    }

                    break;

                case 47004:
                    Int32 oldval_MP_Max = MP_Max;
                    MP_Max = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onMP_MaxChanged(oldval_MP_Max);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onMP_MaxChanged(oldval_MP_Max);
                        }
                    }

                    break;

                case 16:
                    component1.createFromStream(stream);
                    break;

                case 21:
                    component2.createFromStream(stream);
                    break;

                case 22:
                    component3.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 47005:
                    Int32 oldval_forbids = forbids;
                    forbids = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onForbidsChanged(oldval_forbids);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onForbidsChanged(oldval_forbids);
                        }
                    }

                    break;

                case 41002:
                    UInt16 oldval_level = level;
                    level = stream.readUint16();

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

                    break;

                case 41006:
                    UInt32 oldval_modelID = modelID;
                    modelID = stream.readUint32();

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

                    break;

                case 41007:
                    Byte oldval_modelScale = modelScale;
                    modelScale = stream.readUint8();

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

                    break;

                case 11:
                    Byte oldval_moveSpeed = moveSpeed;
                    moveSpeed = stream.readUint8();

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

                    break;

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

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

                    break;

                case 6:
                    UInt16 oldval_own_val = own_val;
                    own_val = stream.readUint16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onOwn_valChanged(oldval_own_val);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onOwn_valChanged(oldval_own_val);
                        }
                    }

                    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 41001:
                    UInt32 oldval_spaceUType = spaceUType;
                    spaceUType = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onSpaceUTypeChanged(oldval_spaceUType);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onSpaceUTypeChanged(oldval_spaceUType);
                        }
                    }

                    break;

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

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

                    break;

                case 47007:
                    Byte oldval_subState = subState;
                    subState = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onSubStateChanged(oldval_subState);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onSubStateChanged(oldval_subState);
                        }
                    }

                    break;

                case 41004:
                    UInt32 oldval_uid = uid;
                    uid = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUidChanged(oldval_uid);
                        }
                    }

                    break;

                case 41005:
                    UInt32 oldval_utype = utype;
                    utype = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onUtypeChanged(oldval_utype);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#19
0
        public void Client_onUpdateData_xz_yp(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();

            Vector2 xz = stream.readPackXZ();

            SByte y = stream.readInt8();
            SByte p = stream.readInt8();

            _updateVolatileData(eid, xz[0], 0.0f, xz[1], y, p, KBE_FLT_MAX);
        }
示例#20
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;
                }
                ;
            }
        }
示例#21
0
        /*
            服务端通知一个实体进入了世界(如果实体是当前玩家则玩家第一次在一个space中创建了, 如果是其他实体则是其他实体进入了玩家的AOI)
        */
        public void Client_onEntityEnterWorld(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            if(entity_id > 0 && entity_id != eid)
                _entityIDAliasIDList.Add(eid);

            UInt16 uentityType;
            if(EntityDef.idmoduledefs.Count > 255)
                uentityType = stream.readUint16();
            else
                uentityType = stream.readUint8();

            sbyte isOnGround = 1;

            if(stream.length() > 0)
                isOnGround = stream.readInt8();

            string entityType = EntityDef.idmoduledefs[uentityType].name;
            // Dbg.DEBUG_MSG("KBEngine::Client_onEntityEnterWorld: " + entityType + "(" + eid + "), spaceID(" + KBEngineApp.app.spaceID + ")!");

            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                MemoryStream entityMessage = null;
                if(!_bufferedCreateEntityMessage.TryGetValue(eid, out entityMessage))
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: entity(" + eid + ") not found!");
                    return;
                }

                ScriptModule module = null;
                if(!EntityDef.moduledefs.TryGetValue(entityType, out module))
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: not found module(" + entityType + ")!");
                }

                Type runclass = module.script;
                if(runclass == null)
                    return;

                entity = (Entity)Activator.CreateInstance(runclass);
                entity.id = eid;
                entity.className = entityType;

                entity.cellMailbox = new Mailbox();
                entity.cellMailbox.id = eid;
                entity.cellMailbox.className = entityType;
                entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;

                entities[eid] = entity;

                Client_onUpdatePropertys(entityMessage);
                _bufferedCreateEntityMessage.Remove(eid);

                entity.isOnGround = isOnGround > 0;
                entity.set_direction(entity.getDefinedPropterty("direction"));
                entity.set_position(entity.getDefinedPropterty("position"));

                entity.__init__();
                entity.enterWorld();
            }
            else
            {
                if(!entity.inWorld)
                {
                    // 安全起见, 这里清空一下
                    // 如果服务端上使用giveClientTo切换控制权
                    // 之前的实体已经进入世界, 切换后的实体也进入世界, 这里可能会残留之前那个实体进入世界的信息
                    _entityIDAliasIDList.Clear();
                    clearEntities(false);
                    entities[entity.id] = entity;

                    entity.cellMailbox = new Mailbox();
                    entity.cellMailbox.id = eid;
                    entity.cellMailbox.className = entityType;
                    entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;

                    entity.set_direction(entity.getDefinedPropterty("direction"));
                    entity.set_position(entity.getDefinedPropterty("position"));

                    _entityServerPos = entity.position;
                    entity.isOnGround = isOnGround > 0;
                    entity.enterWorld();
                }
            }
        }
        public SKILL_INFOS createFromStreamEx(MemoryStream stream)
        {
            SKILL_INFOS datas = new SKILL_INFOS();

            datas.id                  = stream.readInt32();
            datas.name                = stream.readUnicode();
            datas.skill_icon          = stream.readUnicode();
            datas.skill_damage_chushi = stream.readInt32();
            datas.skill_damage_growth = stream.readInt32();
            datas.skill_ad_chushi     = stream.readInt32();
            datas.skill_ad_growth     = stream.readInt32();
            datas.skill_ap_chushi     = stream.readInt32();
            datas.skill_ap_growth     = stream.readInt32();
            datas.skill_type          = stream.readInt32();
            datas.skill_ongoing       = stream.readInt32();
            datas.skill_sing_time     = stream.readInt32();
            datas.skill_cutdown       = stream.readInt32();
            datas.skill_cutdownif     = stream.readInt32();
            datas.skill_cd            = stream.readInt32();
            return(datas);
        }
示例#23
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Robot"];
            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 18:
                    string oldval_nameS = nameS;
                    nameS = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onNameSChanged(oldval_nameS);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onNameSChanged(oldval_nameS);
                        }
                    }

                    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 19:
                    Int32 oldval_progress = progress;
                    progress = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onProgressChanged(oldval_progress);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onProgressChanged(oldval_progress);
                        }
                    }

                    break;

                case 21:
                    Int32 oldval_roomNo = roomNo;
                    roomNo = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoomNoChanged(oldval_roomNo);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoomNoChanged(oldval_roomNo);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#24
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 17:
                    componentFrameSync.onRemoteMethodCall(methodUtype, stream);
                    break;

                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 18:
                Int32 onExitMatch_arg1 = stream.readInt32();
                onExitMatch(onExitMatch_arg1);
                break;

            case 15:
                Int32 onHeroIdChanged_arg1 = stream.readInt32();
                Int32 onHeroIdChanged_arg2 = stream.readInt32();
                onHeroIdChanged(onHeroIdChanged_arg1, onHeroIdChanged_arg2);
                break;

            case 16:
                onLoadingToReadyBattleState();
                break;

            case 13:
                UInt32 onPushAvatarCurrentScene_arg1 = stream.readUint32();
                onPushAvatarCurrentScene(onPushAvatarCurrentScene_arg1);
                break;

            case 14:
                MATCHING_INFOS_LIST onPushMatchPlayersData_arg1 = ((DATATYPE_MATCHING_INFOS_LIST)method.args[0]).createFromStreamEx(stream);
                onPushMatchPlayersData(onPushMatchPlayersData_arg1);
                break;

            case 12:
                Int32 onPushStatisticalResult_arg1 = stream.readInt32();
                onPushStatisticalResult(onPushStatisticalResult_arg1);
                break;

            case 17:
                onReadyBattle();
                break;

            case 10:
                HERO_INFOS       onReqsChooseHeroResult_arg1 = ((DATATYPE_HERO_INFOS)method.args[0]).createFromStreamEx(stream);
                SKILL_INFOS_LIST onReqsChooseHeroResult_arg2 = ((DATATYPE_SKILL_INFOS_LIST)method.args[1]).createFromStreamEx(stream);
                onReqsChooseHeroResult(onReqsChooseHeroResult_arg1, onReqsChooseHeroResult_arg2);
                break;

            case 11:
                SKILL_INFOS_LIST onReqsSkillLstResult_arg1 = ((DATATYPE_SKILL_INFOS_LIST)method.args[0]).createFromStreamEx(stream);
                onReqsSkillLstResult(onReqsSkillLstResult_arg1);
                break;

            default:
                break;
            }
            ;
        }
示例#25
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 17:
                        componentFrameSync.onUpdatePropertys(_t_child_utype, stream, -1);
                        break;

                    default:
                        break;
                    }

                    return;
                }

                switch (prop.properUtype)
                {
                case 17:
                    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 13:
                    SByte oldval_gameStateC = gameStateC;
                    gameStateC = stream.readInt8();

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

                    break;

                case 5:
                    Int32 oldval_heroId = heroId;
                    heroId = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onHeroIdChanged(oldval_heroId);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onHeroIdChanged(oldval_heroId);
                        }
                    }

                    break;

                case 15:
                    SByte oldval_level = level;
                    level = stream.readInt8();

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

                    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 12:
                    SByte oldval_roundCount = roundCount;
                    roundCount = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoundCountChanged(oldval_roundCount);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoundCountChanged(oldval_roundCount);
                        }
                    }

                    break;

                case 14:
                    SByte oldval_seatNo = seatNo;
                    seatNo = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onSeatNoChanged(oldval_seatNo);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onSeatNoChanged(oldval_seatNo);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                case 9:
                    Int32 oldval_teamId = teamId;
                    teamId = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onTeamIdChanged(oldval_teamId);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onTeamIdChanged(oldval_teamId);
                        }
                    }

                    break;

                case 11:
                    SByte oldval_winRate = winRate;
                    winRate = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onWinRateChanged(oldval_winRate);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onWinRateChanged(oldval_winRate);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#26
0
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Account"];

            UInt16 methodUtype            = 0;
            UInt16 componentPropertyUType = 0;

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

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

            Method method = null;

            if (componentPropertyUType == 0)
            {
                method = sm.idmethods[methodUtype];
            }
            else
            {
                Property pComponentPropertyDescription = sm.idpropertys[componentPropertyUType];
                switch (pComponentPropertyDescription.properUtype)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 20:
                Int32 onBuyEquip_arg1 = stream.readInt32();
                Byte  onBuyEquip_arg2 = stream.readUint8();
                onBuyEquip(onBuyEquip_arg1, onBuyEquip_arg2);
                break;

            case 21:
                Int32 onChangeEquip_arg1 = stream.readInt32();
                Byte  onChangeEquip_arg2 = stream.readUint8();
                onChangeEquip(onChangeEquip_arg1, onChangeEquip_arg2);
                break;

            case 19:
                Int32 onExitRoom_arg1 = stream.readInt32();
                onExitRoom(onExitRoom_arg1);
                break;

            case 22:
                Int32 onGetGold_arg1 = stream.readInt32();
                onGetGold(onGetGold_arg1);
                break;

            case 17:
                Int32  onGetPropsClient_arg1 = stream.readInt32();
                string onGetPropsClient_arg2 = stream.readUnicode();
                Int32  onGetPropsClient_arg3 = stream.readInt32();
                onGetPropsClient(onGetPropsClient_arg1, onGetPropsClient_arg2, onGetPropsClient_arg3);
                break;

            case 14:
                Int32 onLoginState_arg1 = stream.readInt32();
                onLoginState(onLoginState_arg1);
                break;

            case 15:
                Int32 onMapModeChanged_arg1 = stream.readInt32();
                Int32 onMapModeChanged_arg2 = stream.readInt32();
                onMapModeChanged(onMapModeChanged_arg1, onMapModeChanged_arg2);
                break;

            case 16:
                Int32 onMatchingFinish_arg1 = stream.readInt32();
                onMatchingFinish(onMatchingFinish_arg1);
                break;

            case 18:
                Int32   onUseProp_arg1 = stream.readInt32();
                Int32   onUseProp_arg2 = stream.readInt32();
                Int32   onUseProp_arg3 = stream.readInt32();
                Vector3 onUseProp_arg4 = stream.readVector3();
                onUseProp(onUseProp_arg1, onUseProp_arg2, onUseProp_arg3, onUseProp_arg4);
                break;

            default:
                break;
            }
            ;
        }
        public void Client_onEntityEnterWorld(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            if(entity_id > 0 && entity_id != eid)
                entityIDAliasIDList.Add(eid);

            UInt16 uentityType;
            if(EntityDef.idmoduledefs.Count > 255)
                uentityType = stream.readUint16();
            else
                uentityType = stream.readUint8();

            sbyte isOnGound = 1;

            if(stream.opsize() > 0)
                isOnGound = stream.readInt8();

            string entityType = EntityDef.idmoduledefs[uentityType].name;
            Dbg.DEBUG_MSG("KBEngine::Client_onEntityEnterWorld: " + entityType + "(" + eid + "), spaceID(" + KBEngineApp.app.spaceID + ")!");

            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                MemoryStream entityMessage = null;
                if(!bufferedCreateEntityMessage.TryGetValue(eid, out entityMessage))
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: entity(" + eid + ") not found!");
                    return;
                }

                Type runclass = EntityDef.moduledefs[entityType].script;
                if(runclass == null)
                    return;

                entity = (Entity)Activator.CreateInstance(runclass);
                entity.id = eid;
                entity.classtype = entityType;

                entity.cellMailbox = new Mailbox();
                entity.cellMailbox.id = eid;
                entity.cellMailbox.classtype = entityType;
                entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;

                entities[eid] = entity;

                Client_onUpdatePropertys(entityMessage);
                bufferedCreateEntityMessage.Remove(eid);

                entity.isOnGound = isOnGound > 0;
                entity.__init__();
                entity.onEnterWorld();

                Event.fireOut("set_direction", new object[]{entity});
                Event.fireOut("set_position", new object[]{entity});
            }
            else
            {
                if(!entity.inWorld)
                {
                    entity.cellMailbox = new Mailbox();
                    entity.cellMailbox.id = eid;
                    entity.cellMailbox.classtype = entityType;
                    entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;

                    entityServerPos = entity.position;
                    entity.isOnGound = isOnGound > 0;
                    entity.onEnterWorld();
                }
            }
        }
示例#28
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 16:
                    ITEM_LIST oldval_bagItemList = bagItemList;
                    bagItemList = ((DATATYPE_ITEM_LIST)EntityDef.id2datatypes[23]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onBagItemListChanged(oldval_bagItemList);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onBagItemListChanged(oldval_bagItemList);
                        }
                    }

                    break;

                case 17:
                    EQUIP_DICT oldval_currentItemDict = currentItemDict;
                    currentItemDict = ((DATATYPE_EQUIP_DICT)EntityDef.id2datatypes[24]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onCurrentItemDictChanged(oldval_currentItemDict);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onCurrentItemDictChanged(oldval_currentItemDict);
                        }
                    }

                    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 8:
                    Int32 oldval_gold = gold;
                    gold = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onGoldChanged(oldval_gold);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onGoldChanged(oldval_gold);
                        }
                    }

                    break;

                case 3:
                    SByte oldval_lastLoginDate = lastLoginDate;
                    lastLoginDate = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onLastLoginDateChanged(oldval_lastLoginDate);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onLastLoginDateChanged(oldval_lastLoginDate);
                        }
                    }

                    break;

                case 7:
                    Int16 oldval_lastLoginDayLoginTimes = lastLoginDayLoginTimes;
                    lastLoginDayLoginTimes = stream.readInt16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onLastLoginDayLoginTimesChanged(oldval_lastLoginDayLoginTimes);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onLastLoginDayLoginTimesChanged(oldval_lastLoginDayLoginTimes);
                        }
                    }

                    break;

                case 5:
                    Int16 oldval_lastLoginDayPlayTime = lastLoginDayPlayTime;
                    lastLoginDayPlayTime = stream.readInt16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onLastLoginDayPlayTimeChanged(oldval_lastLoginDayPlayTime);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onLastLoginDayPlayTimeChanged(oldval_lastLoginDayPlayTime);
                        }
                    }

                    break;

                case 2:
                    string oldval_nameS = nameS;
                    nameS = stream.readUnicode();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onNameSChanged(oldval_nameS);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onNameSChanged(oldval_nameS);
                        }
                    }

                    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 13:
                    Int32 oldval_progress = progress;
                    progress = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onProgressChanged(oldval_progress);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onProgressChanged(oldval_progress);
                        }
                    }

                    break;

                case 15:
                    Int32 oldval_roomNo = roomNo;
                    roomNo = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoomNoChanged(oldval_roomNo);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoomNoChanged(oldval_roomNo);
                        }
                    }

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                case 6:
                    Int16 oldval_totalLoginTimes = totalLoginTimes;
                    totalLoginTimes = stream.readInt16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onTotalLoginTimesChanged(oldval_totalLoginTimes);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onTotalLoginTimesChanged(oldval_totalLoginTimes);
                        }
                    }

                    break;

                case 4:
                    Int16 oldval_totalPlayTime = totalPlayTime;
                    totalPlayTime = stream.readInt16();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onTotalPlayTimeChanged(oldval_totalPlayTime);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onTotalPlayTimeChanged(oldval_totalPlayTime);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#29
0
        public void Client_onUpdateData_y(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();

            float y = stream.readPackY();

            _updateVolatileData(eid, 0.0f, 0.0f, 0.0f, y, KBE_FLT_MAX, KBE_FLT_MAX);
        }
示例#30
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;
            }
            ;
        }
示例#31
0
        public void Client_onUpdatePropertys(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                MemoryStream entityMessage = null;
                if(bufferedCreateEntityMessage.TryGetValue(eid, out entityMessage))
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onUpdatePropertys: entity(" + eid + ") not found!");
                    return;
                }

                MemoryStream stream1 = new MemoryStream();
                stream1.wpos = stream.wpos;
                stream1.rpos = stream.rpos - 4;
                Array.Copy(stream.data(), stream1.data(), stream.data().Length);
                bufferedCreateEntityMessage[eid] = stream1;
                return;
            }

            Dictionary<UInt16, Property> pdatas = EntityDef.moduledefs[entity.classtype].idpropertys;
            while(stream.opsize() > 0)
            {
                UInt16 utype = stream.readUint16();
                Property propertydata = pdatas[utype];
                System.Reflection.MethodInfo setmethod = propertydata.setmethod;

                object val = propertydata.utype.createFromStream(stream);
                object oldval = entity.getDefinedProptertyByUType(utype);

                Dbg.DEBUG_MSG("KBEngine::Client_onUpdatePropertys: " + entity.classtype + "(id=" + eid  + " " + propertydata.name + "=" + val + "), hasSetMethod=" + setmethod + "!");

                entity.setDefinedProptertyByUType(utype, val);
                if(setmethod != null)
                {
                    setmethod.Invoke(entity, new object[]{oldval});
                }
            }
        }
示例#32
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;
                }
                ;
            }
        }
示例#33
0
        public void Client_onRemoteMethodCall(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

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

            UInt16 methodUtype = stream.readUint16();
            Method methoddata = EntityDef.moduledefs[entity.classtype].idmethods[methodUtype];

            Dbg.DEBUG_MSG("KBEngine::Client_onRemoteMethodCall: " + entity.classtype + "." + methoddata.name);

            object[] args = new object[methoddata.args.Count];

            for(int i=0; i<methoddata.args.Count; i++)
            {
                args[i] = methoddata.args[i].createFromStream(stream);
            }

            methoddata.handler.Invoke(entity, args);
        }
示例#34
0
        public D_HERO_INFOS createFromStreamEx(MemoryStream stream)
        {
            D_HERO_INFOS datas = new D_HERO_INFOS();

            datas.id                = stream.readInt32();
            datas.name              = stream.readString();
            datas.nick_name         = stream.readUnicode();
            datas.race              = stream.readInt32();
            datas.race_desc         = stream.readUnicode();
            datas.skill_1           = stream.readInt32();
            datas.skill_2           = stream.readInt32();
            datas.skill_3           = stream.readInt32();
            datas.skill_4           = stream.readInt32();
            datas.hero_hp           = stream.readInt32();
            datas.hero_mp           = stream.readInt32();
            datas.hero_strength     = stream.readInt32();
            datas.hero_agile        = stream.readInt32();
            datas.hero_intelligence = stream.readInt32();
            datas.hero_attacktime   = stream.readInt32();
            datas.hero_speed        = stream.readInt32();
            datas.hero_attackfront  = stream.readInt32();
            datas.hero_attackback   = stream.readInt32();
            datas.hero_skillfront   = stream.readInt32();
            datas.hero_skillback    = stream.readInt32();
            datas.hero_scope        = stream.readInt32();
            datas.hero_attack       = stream.readInt32();
            datas.hero_armor        = stream.readInt32();
            datas.hero_unarmor      = stream.readInt32();
            datas.hero_magic        = stream.readInt32();
            datas.hero_magicresist  = stream.readInt32();
            datas.hero_hprestored   = stream.readInt32();
            datas.hero_mprestored   = stream.readInt32();
            datas.hero_crit         = stream.readInt32();
            datas.hero_uncrit       = stream.readInt32();
            datas.hero_critunmber   = stream.readInt32();
            datas.hero_evade        = stream.readInt32();
            datas.hero_unevade      = stream.readInt32();
            datas.hero_parry        = stream.readInt32();
            datas.hero_unparry      = stream.readInt32();
            datas.hero_parrynumber  = stream.readInt32();
            datas.hero_xixue        = stream.readInt32();
            datas.atk_power         = stream.readInt32();
            datas.hurt_power        = stream.readInt32();
            datas.kill_power        = stream.readInt32();
            datas.hero_energe       = stream.readInt32();
            datas.head_icon         = stream.readString();
            return(datas);
        }
示例#35
0
        public void Client_onUpdateData(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

            if(!entities.TryGetValue(eid, out entity))
            {
                Dbg.ERROR_MSG("KBEngine::Client_onUpdateData: entity(" + eid + ") not found!");
                return;
            }
        }
示例#36
0
        public D_PROPS_INFOS createFromStreamEx(MemoryStream stream)
        {
            D_PROPS_INFOS datas = new D_PROPS_INFOS();

            datas.prop_id          = stream.readInt32();
            datas.prop_name        = stream.readUnicode();
            datas.prop_icon        = stream.readString();
            datas.prop_type        = stream.readInt32();
            datas.prop_quality     = stream.readInt32();
            datas.prop_order       = stream.readInt32();
            datas.prop_max         = stream.readInt32();
            datas.prop_resale      = stream.readInt32();
            datas.prop_diamond     = stream.readInt32();
            datas.prop_hanbing     = stream.readInt32();
            datas.prop_moba        = stream.readInt32();
            datas.prop_jjc         = stream.readInt32();
            datas.prop_maoxian     = stream.readInt32();
            datas.prop_describe    = stream.readUnicode();
            datas.prop_function    = stream.readInt32();
            datas.prop_parameters1 = stream.readInt32();
            datas.prop_parameters2 = stream.readInt32();
            datas.prop_parameters3 = stream.readInt32();
            datas.prop_parameters4 = stream.readInt32();
            datas.prop_parameters5 = stream.readInt32();
            datas.prop_parameters6 = stream.readInt32();
            datas.prop_drop1       = stream.readInt32();
            datas.prop_drop2       = stream.readInt32();
            datas.prop_drop3       = stream.readInt32();
            datas.prop_drop4       = stream.readInt32();
            datas.prop_gm          = stream.readInt32();
            datas.prop_buy         = stream.readInt32();
            return(datas);
        }
示例#37
0
        public void Client_onUpdateData_xyz_yr(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();

            Vector2 xz = stream.readPackXZ();
            float y = stream.readPackY();

            SByte yaw = stream.readInt8();
            SByte r = stream.readInt8();

            _updateVolatileData(eid, xz[0], y, xz[1], yaw, KBE_FLT_MAX, r);
        }
示例#38
0
        public D_SKILL_INFOS createFromStreamEx(MemoryStream stream)
        {
            D_SKILL_INFOS datas = new D_SKILL_INFOS();

            datas.id                  = stream.readInt32();
            datas.name                = stream.readUnicode();
            datas.skill_icon          = stream.readString();
            datas.skill_damage_chushi = stream.readInt32();
            datas.skill_damage_growth = stream.readInt32();
            datas.skill_ad_chushi     = stream.readInt32();
            datas.skill_ad_growth     = stream.readInt32();
            datas.skill_ap_chushi     = stream.readInt32();
            datas.skill_ap_growth     = stream.readInt32();
            datas.skill_type          = stream.readInt32();
            datas.skill_ongoing       = stream.readInt32();
            datas.skill_sing_time     = stream.readInt32();
            datas.skill_cutdown       = stream.readInt32();
            datas.skill_cutdownif     = stream.readInt32();
            datas.skill_cd            = stream.readInt32();
            datas.attack_distance     = stream.readInt32();
            datas.aoe_radius          = stream.readInt32();
            return(datas);
        }
示例#39
0
 /*
     服务端更新实体属性数据
 */
 public void Client_onUpdatePropertys(MemoryStream stream)
 {
     Int32 eid = stream.readInt32();
     onUpdatePropertys_(eid, stream);
 }
示例#40
0
 public override object createFromStream(MemoryStream stream)
 {
     return(stream.readInt32());
 }
示例#41
0
        /*
            服务端通知当前玩家进入了一个新的space
        */
        public void Client_onEntityEnterSpace(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            spaceID = stream.readUint32();

            sbyte isOnGround = 1;

            if(stream.length() > 0)
                isOnGround = stream.readInt8();

            Entity entity = null;

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

            entity.isOnGround = isOnGround > 0;
            _entityServerPos = entity.position;
            entity.enterSpace();
        }
示例#42
0
        public override void onUpdatePropertys(UInt16 propUtype, MemoryStream stream, int maxCount)
        {
            ScriptModule sm = EntityDef.moduledefs["Operation"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0 && maxCount-- != 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = propUtype;

                if (_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;

                prop = pdatas[_t_child_utype];

                switch (prop.properUtype)
                {
                case 10:
                    SByte oldval_isWathcher = isWathcher;
                    isWathcher = stream.readInt8();

                    if (prop.isBase())
                    {
                        if (owner.inited)
                        {
                            onIsWathcherChanged(oldval_isWathcher);
                        }
                    }
                    else
                    {
                        if (owner.inWorld)
                        {
                            onIsWathcherChanged(oldval_isWathcher);
                        }
                    }

                    break;

                case 9:
                    Int32 oldval_lossScore = lossScore;
                    lossScore = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (owner.inited)
                        {
                            onLossScoreChanged(oldval_lossScore);
                        }
                    }
                    else
                    {
                        if (owner.inWorld)
                        {
                            onLossScoreChanged(oldval_lossScore);
                        }
                    }

                    break;

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

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

                    break;

                case 8:
                    Int32 oldval_winScore = winScore;
                    winScore = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (owner.inited)
                        {
                            onWinScoreChanged(oldval_winScore);
                        }
                    }
                    else
                    {
                        if (owner.inWorld)
                        {
                            onWinScoreChanged(oldval_winScore);
                        }
                    }

                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#43
0
        /*
            握手之后服务端的回调
        */
        public void Client_onHelloCB(MemoryStream stream)
        {
            serverVersion = stream.readString();
            serverScriptVersion = stream.readString();
            serverProtocolMD5 = stream.readString();
            serverEntitydefMD5 = stream.readString();
            Int32 ctype = stream.readInt32();

            Dbg.DEBUG_MSG("KBEngine::Client_onHelloCB: verInfo(" + serverVersion
                + "), scriptVersion("+ serverScriptVersion + "), srvProtocolMD5("+ serverProtocolMD5
                + "), srvEntitydefMD5("+ serverEntitydefMD5 + "), + ctype(" + ctype + ")!");

            onServerDigest();

            if(currserver == "baseapp")
            {
                onLogin_baseapp();
            }
            else
            {
                onLogin_loginapp();
            }
        }
        public override void onUpdatePropertys(UInt16 propUtype, MemoryStream stream, int maxCount)
        {
            ScriptModule sm = EntityDef.moduledefs["TestNoBase"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            while (stream.length() > 0 && maxCount-- != 0)
            {
                UInt16 _t_utype       = 0;
                UInt16 _t_child_utype = propUtype;

                if (_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;

                prop = pdatas[_t_child_utype];

                switch (prop.properUtype)
                {
                case 24:
                    Int32 oldval_own = own;
                    own = stream.readInt32();

                    if (prop.isBase())
                    {
                        if (owner.inited)
                        {
                            onOwnChanged(oldval_own);
                        }
                    }
                    else
                    {
                        if (owner.inWorld)
                        {
                            onOwnChanged(oldval_own);
                        }
                    }

                    break;

                case 23:
                    Int32 oldval_state = state;
                    state = stream.readInt32();

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

                    break;

                default:
                    break;
                }
                ;
            }
        }
示例#45
0
        /*
            服务端强制设置了玩家的坐标
            例如:在服务端使用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);
        }
        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;
                }
                ;
            }
        }