Beispiel #1
0
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Test"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Int32    oldval_own = own;
            Property prop_own   = pdatas[4];

            if (prop_own.isBase())
            {
                if (owner.inited && !owner.inWorld)
                {
                    onOwnChanged(oldval_own);
                }
            }
            else
            {
                if (owner.inWorld)
                {
                    if (prop_own.isOwnerOnly() && !owner.isPlayer())
                    {
                    }
                    else
                    {
                        onOwnChanged(oldval_own);
                    }
                }
            }

            Int32    oldval_state = state;
            Property prop_state   = pdatas[5];

            if (prop_state.isBase())
            {
                if (owner.inited && !owner.inWorld)
                {
                    onStateChanged(oldval_state);
                }
            }
            else
            {
                if (owner.inWorld)
                {
                    if (prop_state.isOwnerOnly() && !owner.isPlayer())
                    {
                    }
                    else
                    {
                        onStateChanged(oldval_state);
                    }
                }
            }
        }
        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)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 5:
                Int32 onNetworkDelay_arg1 = stream.readInt32();
                onNetworkDelay(onNetworkDelay_arg1);
                break;

            case 4:
                FRAME_DATA onRspFrameMessage_arg1 = ((DATATYPE_FRAME_DATA)method.args[0]).createFromStreamEx(stream);
                onRspFrameMessage(onRspFrameMessage_arg1);
                break;

            default:
                break;
            }
            ;
        }
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Battlefield"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }
        }
Beispiel #4
0
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Operation"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Int32    oldval_lossScore = lossScore;
            Property prop_lossScore   = pdatas[4];

            if (prop_lossScore.isBase())
            {
                if (owner.inited && !owner.inWorld)
                {
                    onLossScoreChanged(oldval_lossScore);
                }
            }
            else
            {
                if (owner.inWorld)
                {
                    if (prop_lossScore.isOwnerOnly() && !owner.isPlayer())
                    {
                    }
                    else
                    {
                        onLossScoreChanged(oldval_lossScore);
                    }
                }
            }

            Int32    oldval_winScore = winScore;
            Property prop_winScore   = pdatas[5];

            if (prop_winScore.isBase())
            {
                if (owner.inited && !owner.inWorld)
                {
                    onWinScoreChanged(oldval_winScore);
                }
            }
            else
            {
                if (owner.inWorld)
                {
                    if (prop_winScore.isOwnerOnly() && !owner.isPlayer())
                    {
                    }
                    else
                    {
                        onWinScoreChanged(oldval_winScore);
                    }
                }
            }
        }
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Account"];

            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)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 24:
                AVATAR_INFOS onCreateAvatarResult_arg1 = ((DATATYPE_AVATAR_INFOS)method.args[0]).createFromStreamEx(stream);
                onCreateAvatarResult(onCreateAvatarResult_arg1);
                break;

            case 23:
                AVATAR_INFOS_LIST onReqAvatarList_arg1 = ((DATATYPE_AVATAR_INFOS_LIST)method.args[0]).createFromStreamEx(stream);
                onReqAvatarList(onReqAvatarList_arg1);
                break;

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

            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)
                {
                default:
                    break;
                }

                return;
            }

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

            case 10:
                playerLevelRoom();
                break;

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

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            default:
                break;
            }
            ;
        }
Beispiel #8
0
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Monster"];

            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)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 52:
                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;
            }
            ;
        }
Beispiel #9
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)
            {
            default:
                break;
            }
            ;
        }
Beispiel #10
0
        public override void onRemoteMethodCall(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Mine"];

            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)
                {
                default:
                    break;
                }

                return;
            }

            switch (method.methodUtype)
            {
            case 61005:
                Int32  onMineDestroy_arg1 = stream.readInt32();
                UInt16 onMineDestroy_arg2 = stream.readUint16();
                onMineDestroy(onMineDestroy_arg1, onMineDestroy_arg2);
                break;

            default:
                break;
            }
            ;
        }
Beispiel #11
0
        public override void onRemoteMethodCall(UInt16 methodUtype, MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Operation"];

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            case 14:
                Byte      onCreateRoomResult_arg1 = stream.readUint8();
                ROOM_INFO onCreateRoomResult_arg2 = ((DATATYPE_ROOM_INFO)method.args[1]).createFromStreamEx(stream);
                onCreateRoomResult(onCreateRoomResult_arg1, onCreateRoomResult_arg2);
                break;

            case 11:
                Byte      onEnterRoomResult_arg1 = stream.readUint8();
                ROOM_INFO onEnterRoomResult_arg2 = ((DATATYPE_ROOM_INFO)method.args[1]).createFromStreamEx(stream);
                onEnterRoomResult(onEnterRoomResult_arg1, onEnterRoomResult_arg2);
                break;

            case 13:
                Byte onGameBeginResult_arg1 = stream.readUint8();
                onGameBeginResult(onGameBeginResult_arg1);
                break;

            case 12:
                Byte onLeaveRoomResult_arg1 = stream.readUint8();
                onLeaveRoomResult(onLeaveRoomResult_arg1);
                break;

            case 10:
                ROOM_LIST onReqRoomList_arg1 = ((DATATYPE_ROOM_LIST)method.args[0]).createFromStreamEx(stream);
                onReqRoomList(onReqRoomList_arg1);
                break;

            case 15:
                Byte   onTrueSyncData_arg1 = stream.readUint8();
                byte[] onTrueSyncData_arg2 = stream.readBlob();
                onTrueSyncData(onTrueSyncData_arg1, onTrueSyncData_arg2);
                break;

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

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            case 30:
                Int32 helloCB_arg1 = stream.readInt32();
                helloCB(helloCB_arg1);
                break;

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

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            case 21:
                FS_FRAME_DATA onFrameMessage_arg1 = ((DATATYPE_FS_FRAME_DATA)method.args[0]).createFromStreamEx(stream);
                onFrameMessage(onFrameMessage_arg1);
                break;

            default:
                break;
            }
            ;
        }
Beispiel #14
0
        public override void onRemoteMethodCall(UInt16 methodUtype, MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Chat"];

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            case 28:
                string reply_arg1 = stream.readString();
                string reply_arg2 = stream.readUnicode();
                reply(reply_arg1, reply_arg2);
                break;

            default:
                break;
            }
            ;
        }
Beispiel #15
0
        public override void onRemoteMethodCall(UInt16 methodUtype, MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Operation"];

            Method method = sm.idmethods[methodUtype];

            switch (method.methodUtype)
            {
            case 16:
                UInt64 onCreateSpaceResult_arg1 = stream.readUint64();
                onCreateSpaceResult(onCreateSpaceResult_arg1);
                break;

            case 19:
                UInt32 onGamePause_arg1 = stream.readUint32();
                onGamePause(onGamePause_arg1);
                break;

            case 18:
                Int32  onLoginOutSpaceResult_arg1 = stream.readInt32();
                UInt64 onLoginOutSpaceResult_arg2 = stream.readUint64();
                onLoginOutSpaceResult(onLoginOutSpaceResult_arg1, onLoginOutSpaceResult_arg2);
                break;

            case 17:
                UInt64 onLoginSpaceResult_arg1 = stream.readUint64();
                onLoginSpaceResult(onLoginSpaceResult_arg1);
                break;

            case 15:
                SPACE_LIST onReqSpaceList_arg1 = ((DATATYPE_SPACE_LIST)method.args[0]).createFromStreamEx(stream);
                onReqSpaceList(onReqSpaceList_arg1);
                break;

            default:
                break;
            }
            ;
        }
        public override void onUpdatePropertys(UInt16 propUtype, MemoryStream stream, int maxCount)
        {
            ScriptModule sm = EntityDef.moduledefs["MatchRoomReport"];
            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)
                {
                default:
                    break;
                }
                ;
            }
        }
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["SpaceDuplicate"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            UInt32   oldval_modelID = modelID;
            Property prop_modelID   = pdatas[4];

            if (prop_modelID.isBase())
            {
                if (inited && !inWorld)
                {
                    onModelIDChanged(oldval_modelID);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_modelID.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onModelIDChanged(oldval_modelID);
                    }
                }
            }

            Byte     oldval_modelScale = modelScale;
            Property prop_modelScale   = pdatas[5];

            if (prop_modelScale.isBase())
            {
                if (inited && !inWorld)
                {
                    onModelScaleChanged(oldval_modelScale);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_modelScale.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onModelScaleChanged(oldval_modelScale);
                    }
                }
            }

            string   oldval_name = name;
            Property prop_name   = pdatas[6];

            if (prop_name.isBase())
            {
                if (inited && !inWorld)
                {
                    onNameChanged(oldval_name);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_name.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onNameChanged(oldval_name);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }

            UInt32   oldval_uid = uid;
            Property prop_uid   = pdatas[7];

            if (prop_uid.isBase())
            {
                if (inited && !inWorld)
                {
                    onUidChanged(oldval_uid);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_uid.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onUidChanged(oldval_uid);
                    }
                }
            }

            UInt32   oldval_utype = utype;
            Property prop_utype   = pdatas[8];

            if (prop_utype.isBase())
            {
                if (inited && !inWorld)
                {
                    onUtypeChanged(oldval_utype);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_utype.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onUtypeChanged(oldval_utype);
                    }
                }
            }
        }
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["SpaceDuplicate"];
            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 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;
                }
                ;
            }
        }
Beispiel #19
0
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Smash"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Byte     oldval_modelID = modelID;
            Property prop_modelID   = pdatas[4];

            if (prop_modelID.isBase())
            {
                if (inited && !inWorld)
                {
                    onModelIDChanged(oldval_modelID);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_modelID.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onModelIDChanged(oldval_modelID);
                    }
                }
            }

            float    oldval_modelScale = modelScale;
            Property prop_modelScale   = pdatas[5];

            if (prop_modelScale.isBase())
            {
                if (inited && !inWorld)
                {
                    onModelScaleChanged(oldval_modelScale);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_modelScale.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onModelScaleChanged(oldval_modelScale);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }
        }
Beispiel #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:
                    UInt64 oldval_lastSelCharacter = lastSelCharacter;
                    lastSelCharacter = stream.readUint64();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onLastSelCharacterChanged(oldval_lastSelCharacter);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onLastSelCharacterChanged(oldval_lastSelCharacter);
                        }
                    }

                    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;
                }
                ;
            }
        }
Beispiel #21
0
        public void cellCall(string methodname, params object[] arguments)
        {
            if (KBEngineApp.app.currserver == "loginapp")
            {
                Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "), currserver=!" + KBEngineApp.app.currserver);
                return;
            }

            ScriptModule module = null;

            if (!EntityDef.moduledefs.TryGetValue(className, out module))
            {
                Dbg.ERROR_MSG("entity::cellCall:  entity-module(" + className + ") error, can not find from EntityDef.moduledefs!");
                return;
            }

            Method method = null;

            if (!module.cell_methods.TryGetValue(methodname, out method))
            {
                Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "), not found method!");
                return;
            }

            UInt16 methodID = method.methodUtype;

            if (arguments.Length != method.args.Count)
            {
                Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): args(" + (arguments.Length) + "!= " + method.args.Count + ") size is error!");
                return;
            }

            EntityCall cellEntityCall = getCellEntityCall();

            if (cellEntityCall == null)
            {
                Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): no cell!");
                return;
            }

            cellEntityCall.newCall();
            cellEntityCall.bundle.writeUint16(0);
            cellEntityCall.bundle.writeUint16(methodID);

            try
            {
                for (var i = 0; i < method.args.Count; i++)
                {
                    if (method.args[i].isSameType(arguments[i]))
                    {
                        method.args[i].addToStream(cellEntityCall.bundle, arguments[i]);
                    }
                    else
                    {
                        throw new Exception("arg" + i + ": " + method.args[i].ToString());
                    }
                }
            }
            catch (Exception e)
            {
                Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): args is error(" + e.Message + ")!");
                cellEntityCall.bundle = null;
                return;
            }

            cellEntityCall.sendCall(null);
        }
Beispiel #22
0
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Room"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Int32    oldval_gameMupe = gameMupe;
            Property prop_gameMupe   = pdatas[4];

            if (prop_gameMupe.isBase())
            {
                if (inited && !inWorld)
                {
                    onGameMupeChanged(oldval_gameMupe);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_gameMupe.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onGameMupeChanged(oldval_gameMupe);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }

            Int64    oldval_roomId = roomId;
            Property prop_roomId   = pdatas[5];

            if (prop_roomId.isBase())
            {
                if (inited && !inWorld)
                {
                    onRoomIdChanged(oldval_roomId);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_roomId.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onRoomIdChanged(oldval_roomId);
                    }
                }
            }

            Byte     oldval_roomType = roomType;
            Property prop_roomType   = pdatas[6];

            if (prop_roomType.isBase())
            {
                if (inited && !inWorld)
                {
                    onRoomTypeChanged(oldval_roomType);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_roomType.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onRoomTypeChanged(oldval_roomType);
                    }
                }
            }
        }
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Account"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Byte     oldval_isNewPlayer = isNewPlayer;
            Property prop_isNewPlayer   = pdatas[4];

            if (prop_isNewPlayer.isBase())
            {
                if (inited && !inWorld)
                {
                    onIsNewPlayerChanged(oldval_isNewPlayer);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_isNewPlayer.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onIsNewPlayerChanged(oldval_isNewPlayer);
                    }
                }
            }

            UInt16   oldval_playerID = playerID;
            Property prop_playerID   = pdatas[5];

            if (prop_playerID.isBase())
            {
                if (inited && !inWorld)
                {
                    onPlayerIDChanged(oldval_playerID);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_playerID.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPlayerIDChanged(oldval_playerID);
                    }
                }
            }

            UInt16   oldval_playerID_base = playerID_base;
            Property prop_playerID_base   = pdatas[6];

            if (prop_playerID_base.isBase())
            {
                if (inited && !inWorld)
                {
                    onPlayerID_baseChanged(oldval_playerID_base);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_playerID_base.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPlayerID_baseChanged(oldval_playerID_base);
                    }
                }
            }

            string   oldval_playerName = playerName;
            Property prop_playerName   = pdatas[7];

            if (prop_playerName.isBase())
            {
                if (inited && !inWorld)
                {
                    onPlayerNameChanged(oldval_playerName);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_playerName.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPlayerNameChanged(oldval_playerName);
                    }
                }
            }

            string   oldval_playerName_base = playerName_base;
            Property prop_playerName_base   = pdatas[8];

            if (prop_playerName_base.isBase())
            {
                if (inited && !inWorld)
                {
                    onPlayerName_baseChanged(oldval_playerName_base);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_playerName_base.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPlayerName_baseChanged(oldval_playerName_base);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }
        }
        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 5:
                    Byte oldval_isNewPlayer = isNewPlayer;
                    isNewPlayer = stream.readUint8();

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

                    break;

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

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

                    break;

                case 2:
                    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 3:
                    string oldval_playerName = playerName;
                    playerName = stream.readUnicode();

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

                    break;

                case 1:
                    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 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Avatar"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            component1.callPropertysSetMethods();

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Byte     oldval_modelID = modelID;
            Property prop_modelID   = pdatas[5];

            if (prop_modelID.isBase())
            {
                if (inited && !inWorld)
                {
                    onModelIDChanged(oldval_modelID);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_modelID.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onModelIDChanged(oldval_modelID);
                    }
                }
            }

            string   oldval_name = name;
            Property prop_name   = pdatas[6];

            if (prop_name.isBase())
            {
                if (inited && !inWorld)
                {
                    onNameChanged(oldval_name);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_name.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onNameChanged(oldval_name);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }
        }
        public void onImportClientEntityDef(MemoryStream stream)
        {
            createDataTypeFromStreams(stream, true);

            while(stream.length() > 0)
            {
                string scriptmethod_name = stream.readString();
                UInt16 scriptUtype = stream.readUint16();
                UInt16 propertysize = stream.readUint16();
                UInt16 methodsize = stream.readUint16();
                UInt16 base_methodsize = stream.readUint16();
                UInt16 cell_methodsize = stream.readUint16();

                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: import(" + scriptmethod_name + "), propertys(" + propertysize + "), " +
                        "clientMethods(" + methodsize + "), baseMethods(" + base_methodsize + "), cellMethods(" + cell_methodsize + ")!");

                ScriptModule module = new ScriptModule(scriptmethod_name);
                EntityDef.moduledefs[scriptmethod_name] = module;
                EntityDef.idmoduledefs[scriptUtype] = module;

                Type Class = module.script;

                while(propertysize > 0)
                {
                    propertysize--;

                    UInt16 properUtype = stream.readUint16();
                    UInt32 properFlags = stream.readUint32();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    string defaultValStr = stream.readString();
                    KBEDATATYPE_BASE utype = EntityDef.id2datatypes[stream.readUint16()];

                    System.Reflection.MethodInfo setmethod = null;

                    if(Class != null)
                    {
                        try{
                            setmethod = Class.GetMethod("set_" + name);
                        }
                        catch (Exception e)
                        {
                            string err = "KBEngine::Client_onImportClientEntityDef: " +
                                scriptmethod_name + ".set_" + name + ", error=" + e.ToString();

                            throw new Exception(err);
                        }
                    }

                    Property savedata = new Property();
                    savedata.name = name;
                    savedata.utype = utype;
                    savedata.properUtype = properUtype;
                    savedata.properFlags = properFlags;
                    savedata.aliasID = ialiasID;
                    savedata.defaultValStr = defaultValStr;
                    savedata.setmethod = setmethod;
                    savedata.val = savedata.utype.parseDefaultValStr(savedata.defaultValStr);

                    module.propertys[name] = savedata;

                    if(ialiasID >= 0)
                    {
                        module.usePropertyDescrAlias = true;
                        module.idpropertys[(UInt16)ialiasID] = savedata;
                    }
                    else
                    {
                        module.usePropertyDescrAlias = false;
                        module.idpropertys[properUtype] = savedata;
                    }

                    //Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), property(" + name + "/" + properUtype + ").");
                };

                while(methodsize > 0)
                {
                    methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.id2datatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.aliasID = ialiasID;
                    savedata.args = args;

                    if(Class != null)
                    {
                        try{
                            savedata.handler = Class.GetMethod(name);
                        }
                        catch (Exception e)
                        {
                            string err = "KBEngine::Client_onImportClientEntityDef: " + scriptmethod_name + "." + name + ", error=" + e.ToString();
                            throw new Exception(err);
                        }
                    }

                    module.methods[name] = savedata;

                    if(ialiasID >= 0)
                    {
                        module.useMethodDescrAlias = true;
                        module.idmethods[(UInt16)ialiasID] = savedata;
                    }
                    else
                    {
                        module.useMethodDescrAlias = false;
                        module.idmethods[methodUtype] = savedata;
                    }

                    //Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), method(" + name + ").");
                };

                while(base_methodsize > 0)
                {
                    base_methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.id2datatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.aliasID = ialiasID;
                    savedata.args = args;

                    module.base_methods[name] = savedata;
                    module.idbase_methods[methodUtype] = savedata;

                    //Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), base_method(" + name + ").");
                };

                while(cell_methodsize > 0)
                {
                    cell_methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.id2datatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.aliasID = ialiasID;
                    savedata.args = args;

                    module.cell_methods[name] = savedata;
                    module.idcell_methods[methodUtype] = savedata;
                    //Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), cell_method(" + name + ").");
                };

                if(module.script == null)
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onImportClientEntityDef: module(" + scriptmethod_name + ") not found!");
                }

                foreach(string name in module.methods.Keys)
                {
                    // Method infos = module.methods[name];

                    if(module.script != null && module.script.GetMethod(name) == null)
                    {
                        Dbg.WARNING_MSG(scriptmethod_name + "(" + module.script + "):: method(" + name + ") no implement!");
                    }
                };
            }

            onImportEntityDefCompleted();
        }
Beispiel #27
0
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Room"];
            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 8:
                    Byte oldval_isPrivate = isPrivate;
                    isPrivate = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onIsPrivateChanged(oldval_isPrivate);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onIsPrivateChanged(oldval_isPrivate);
                        }
                    }

                    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 7:
                    UInt16 oldval_roomKey = roomKey;
                    roomKey = stream.readUint16();

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

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
        public override void onUpdatePropertys(MemoryStream stream)
        {
            ScriptModule sm = EntityDef.moduledefs["Room"];
            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 19:
                    Byte oldval_RoomType = RoomType;
                    RoomType = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onRoomTypeChanged(oldval_RoomType);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onRoomTypeChanged(oldval_RoomType);
                        }
                    }

                    break;

                case 24:
                    Byte oldval_cur_turn = cur_turn;
                    cur_turn = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onCur_turnChanged(oldval_cur_turn);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onCur_turnChanged(oldval_cur_turn);
                        }
                    }

                    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 22:
                    Byte oldval_numOfMJ = numOfMJ;
                    numOfMJ = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onNumOfMJChanged(oldval_numOfMJ);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onNumOfMJChanged(oldval_numOfMJ);
                        }
                    }

                    break;

                case 21:
                    Byte oldval_playerMaxCount = playerMaxCount;
                    playerMaxCount = stream.readUint8();

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPlayerMaxCountChanged(oldval_playerMaxCount);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPlayerMaxCountChanged(oldval_playerMaxCount);
                        }
                    }

                    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 23:
                    ROOM_PUBLIC_INFO oldval_public_roomInfo = public_roomInfo;
                    public_roomInfo = ((DATATYPE_ROOM_PUBLIC_INFO)EntityDef.id2datatypes[31]).createFromStreamEx(stream);

                    if (prop.isBase())
                    {
                        if (inited)
                        {
                            onPublic_roomInfoChanged(oldval_public_roomInfo);
                        }
                    }
                    else
                    {
                        if (inWorld)
                        {
                            onPublic_roomInfoChanged(oldval_public_roomInfo);
                        }
                    }

                    break;

                case 18:
                    UInt64 oldval_roomKey = roomKey;
                    roomKey = stream.readUint64();

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

                    break;

                case 40002:
                    stream.readUint32();
                    break;

                default:
                    break;
                }
                ;
            }
        }
Beispiel #29
0
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Room"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Byte     oldval_isPrivate = isPrivate;
            Property prop_isPrivate   = pdatas[4];

            if (prop_isPrivate.isBase())
            {
                if (inited && !inWorld)
                {
                    onIsPrivateChanged(oldval_isPrivate);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_isPrivate.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onIsPrivateChanged(oldval_isPrivate);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }

            UInt16   oldval_roomKey = roomKey;
            Property prop_roomKey   = pdatas[5];

            if (prop_roomKey.isBase())
            {
                if (inited && !inWorld)
                {
                    onRoomKeyChanged(oldval_roomKey);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_roomKey.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onRoomKeyChanged(oldval_roomKey);
                    }
                }
            }
        }
        public override void callPropertysSetMethods()
        {
            ScriptModule sm = EntityDef.moduledefs["Room"];
            Dictionary <UInt16, Property> pdatas = sm.idpropertys;

            Byte     oldval_RoomType = RoomType;
            Property prop_RoomType   = pdatas[4];

            if (prop_RoomType.isBase())
            {
                if (inited && !inWorld)
                {
                    onRoomTypeChanged(oldval_RoomType);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_RoomType.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onRoomTypeChanged(oldval_RoomType);
                    }
                }
            }

            Byte     oldval_cur_turn = cur_turn;
            Property prop_cur_turn   = pdatas[5];

            if (prop_cur_turn.isBase())
            {
                if (inited && !inWorld)
                {
                    onCur_turnChanged(oldval_cur_turn);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_cur_turn.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onCur_turnChanged(oldval_cur_turn);
                    }
                }
            }

            Vector3  oldval_direction = direction;
            Property prop_direction   = pdatas[2];

            if (prop_direction.isBase())
            {
                if (inited && !inWorld)
                {
                    onDirectionChanged(oldval_direction);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_direction.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onDirectionChanged(oldval_direction);
                    }
                }
            }

            Byte     oldval_numOfMJ = numOfMJ;
            Property prop_numOfMJ   = pdatas[6];

            if (prop_numOfMJ.isBase())
            {
                if (inited && !inWorld)
                {
                    onNumOfMJChanged(oldval_numOfMJ);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_numOfMJ.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onNumOfMJChanged(oldval_numOfMJ);
                    }
                }
            }

            Byte     oldval_playerMaxCount = playerMaxCount;
            Property prop_playerMaxCount   = pdatas[7];

            if (prop_playerMaxCount.isBase())
            {
                if (inited && !inWorld)
                {
                    onPlayerMaxCountChanged(oldval_playerMaxCount);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_playerMaxCount.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPlayerMaxCountChanged(oldval_playerMaxCount);
                    }
                }
            }

            Vector3  oldval_position = position;
            Property prop_position   = pdatas[1];

            if (prop_position.isBase())
            {
                if (inited && !inWorld)
                {
                    onPositionChanged(oldval_position);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_position.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPositionChanged(oldval_position);
                    }
                }
            }

            ROOM_PUBLIC_INFO oldval_public_roomInfo = public_roomInfo;
            Property         prop_public_roomInfo   = pdatas[8];

            if (prop_public_roomInfo.isBase())
            {
                if (inited && !inWorld)
                {
                    onPublic_roomInfoChanged(oldval_public_roomInfo);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_public_roomInfo.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onPublic_roomInfoChanged(oldval_public_roomInfo);
                    }
                }
            }

            UInt64   oldval_roomKey = roomKey;
            Property prop_roomKey   = pdatas[9];

            if (prop_roomKey.isBase())
            {
                if (inited && !inWorld)
                {
                    onRoomKeyChanged(oldval_roomKey);
                }
            }
            else
            {
                if (inWorld)
                {
                    if (prop_roomKey.isOwnerOnly() && !isPlayer())
                    {
                    }
                    else
                    {
                        onRoomKeyChanged(oldval_roomKey);
                    }
                }
            }
        }
Beispiel #31
0
        public override void onUpdatePropertys(UInt16 propUtype, MemoryStream stream, int maxCount)
        {
            ScriptModule sm = EntityDef.moduledefs["FrameSyncReport"];
            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 9:
                    UInt32 oldval_farmeID = farmeID;
                    farmeID = stream.readUint32();

                    if (prop.isBase())
                    {
                        if (owner.inited)
                        {
                            onFarmeIDChanged(oldval_farmeID);
                        }
                    }
                    else
                    {
                        if (owner.inWorld)
                        {
                            onFarmeIDChanged(oldval_farmeID);
                        }
                    }

                    break;

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

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

                    break;

                default:
                    break;
                }
                ;
            }
        }
Beispiel #32
0
        public void Client_onImportClientEntityDef(MemoryStream stream)
        {
            UInt16 aliassize = stream.readUint16();
            Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(size=" + aliassize + ")!");

            while(aliassize > 0)
            {
                aliassize--;
                createDataTypeFromStream(stream, true);
            };

            foreach(string datatype in EntityDef.datatypes.Keys)
            {
                if(EntityDef.datatypes[datatype] != null)
                {
                    EntityDef.datatypes[datatype].bind();
                }
            }

            while(stream.opsize() > 0)
            {
                string scriptmethod_name = stream.readString();
                UInt16 scriptUtype = stream.readUint16();
                UInt16 propertysize = stream.readUint16();
                UInt16 methodsize = stream.readUint16();
                UInt16 base_methodsize = stream.readUint16();
                UInt16 cell_methodsize = stream.readUint16();

                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: import(" + scriptmethod_name + "), propertys(" + propertysize + "), " +
                        "clientMethods(" + methodsize + "), baseMethods(" + base_methodsize + "), cellMethods(" + cell_methodsize + ")!");

                ScriptModule module = new ScriptModule(scriptmethod_name);
                EntityDef.moduledefs[scriptmethod_name] = module;
                EntityDef.idmoduledefs[scriptUtype] = module;

                Dictionary<string, Property> defpropertys = new Dictionary<string, Property>();
                Entity.alldefpropertys.Add(scriptmethod_name, defpropertys);

                Type Class = module.script;

                while(propertysize > 0)
                {
                    propertysize--;

                    UInt16 properUtype = stream.readUint16();
                    string name = stream.readString();
                    string defaultValStr = stream.readString();
                    KBEDATATYPE_BASE utype = EntityDef.iddatatypes[stream.readUint16()];

                    System.Reflection.MethodInfo setmethod = null;

                    if(Class != null)
                    {
                        setmethod = Class.GetMethod("set_" + name);
                    }

                    Property savedata = new Property();
                    savedata.name = name;
                    savedata.properUtype = properUtype;
                    savedata.defaultValStr = defaultValStr;
                    savedata.utype = utype;
                    savedata.setmethod = setmethod;

                    module.propertys[name] = savedata;
                    module.idpropertys[properUtype] = savedata;

                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), property(" + name + "/" + properUtype + ").");
                };

                while(methodsize > 0)
                {
                    methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.iddatatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.args = args;

                    if(Class != null)
                        savedata.handler = Class.GetMethod(name);

                    module.methods[name] = savedata;
                    module.idmethods[methodUtype] = savedata;
                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), method(" + name + ").");
                };

                while(base_methodsize > 0)
                {
                    base_methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.iddatatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.args = args;

                    module.base_methods[name] = savedata;
                    module.idbase_methods[methodUtype] = savedata;

                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), base_method(" + name + ").");
                };

                while(cell_methodsize > 0)
                {
                    cell_methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.iddatatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.args = args;

                    module.cell_methods[name] = savedata;
                    module.idcell_methods[methodUtype] = savedata;
                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), cell_method(" + name + ").");
                };

                if(module.script == null)
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onImportClientEntityDef: module(" + scriptmethod_name + ") not found!");
                }

                foreach(string name in module.propertys.Keys)
                {
                    Property infos = module.propertys[name];

                    Property newp = new Property();
                    newp.name = infos.name;
                    newp.properUtype = infos.properUtype;
                    newp.utype = infos.utype;
                    newp.val = infos.utype.parseDefaultValStr(infos.defaultValStr);
                    newp.setmethod = infos.setmethod;

                    defpropertys.Add(infos.name, newp);
                    if(module.script != null && module.script.GetMember(name) == null)
                    {
                        Dbg.ERROR_MSG(scriptmethod_name + "(" + module.script + "):: property(" + name + ") no defined!");
                    }
                };

                foreach(string name in module.methods.Keys)
                {
                    Method infos = module.methods[name];

                    if(module.script != null && module.script.GetMethod(name) == null)
                    {
                        Dbg.WARNING_MSG(scriptmethod_name + "(" + module.script + "):: method(" + name + ") no implement!");
                    }
                };
            }

            onImportEntityDefCompleted();
        }