当前位置: 首页>>代码示例>>C#>>正文


C# MemoryStream.readUint16方法代码示例

本文整理汇总了C#中KBEngine.MemoryStream.readUint16方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryStream.readUint16方法的具体用法?C# MemoryStream.readUint16怎么用?C# MemoryStream.readUint16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KBEngine.MemoryStream的用法示例。


在下文中一共展示了MemoryStream.readUint16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Client_onEntityEnterWorld

        /*
            服务端通知一个实体进入了世界(如果实体是当前玩家则玩家第一次在一个space中创建了, 如果是其他实体则是其他实体进入了玩家的AOI)
        */
        public void Client_onEntityEnterWorld(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            if(entity_id > 0 && entity_id != eid)
                _entityIDAliasIDList.Add(eid);

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

            sbyte isOnGround = 1;

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

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

            Entity entity = null;

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

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

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

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

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

                entities[eid] = entity;

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

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

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

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

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

                    _entityServerPos = entity.position;
                    entity.isOnGround = isOnGround > 0;
                    entity.enterWorld();
                }
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:90,代码来源:KBEngine.cs

示例2: onUpdatePropertys_

        public void onUpdatePropertys_(Int32 eid, MemoryStream stream)
        {
            Entity entity = null;

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

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

            ScriptModule sm = EntityDef.moduledefs[entity.className];
            Dictionary<UInt16, Property> pdatas = sm.idpropertys;

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

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

                Property propertydata = pdatas[utype];
                utype = propertydata.properUtype;
                System.Reflection.MethodInfo setmethod = propertydata.setmethod;

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

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

                entity.setDefinedProptertyByUType(utype, val);
                if(setmethod != null)
                {
                    if(propertydata.isBase() || entity.inWorld)
                        setmethod.Invoke(entity, new object[]{oldval});
                }
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:55,代码来源:KBEngine.cs

示例3: Client_onCreateAccountResult

        /*
            账号创建返回结果
        */
        public void Client_onCreateAccountResult(MemoryStream stream)
        {
            UInt16 retcode = stream.readUint16();
            byte[] datas = stream.readBlob();

            Event.fireOut("onCreateAccountResult", new object[]{retcode, datas});

            if(retcode != 0)
            {
                Dbg.WARNING_MSG("KBEngine::Client_onCreateAccountResult: " + username + " create is failed! code=" + retcode + "!");
                return;
            }

            Dbg.DEBUG_MSG("KBEngine::Client_onCreateAccountResult: " + username + " create is successfully!");
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:18,代码来源:KBEngine.cs

示例4: onImportServerErrorsDescr

        /*
            服务端错误描述导入了
        */
        public void onImportServerErrorsDescr(MemoryStream stream)
        {
            UInt16 size = stream.readUint16();
            while(size > 0)
            {
                size -= 1;

                ServerErr e;
                e.id = stream.readUint16();
                e.name = System.Text.Encoding.UTF8.GetString(stream.readBlob());
                e.descr = System.Text.Encoding.UTF8.GetString(stream.readBlob());

                serverErrs.Add(e.id, e);

                //Dbg.DEBUG_MSG("Client_onImportServerErrorsDescr: id=" + e.id + ", name=" + e.name + ", descr=" + e.descr);
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:20,代码来源:KBEngine.cs

示例5: onRemoteMethodCall_

        public void onRemoteMethodCall_(Int32 eid, MemoryStream stream)
        {
            Entity entity = null;

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

            UInt16 methodUtype = 0;

            if(EntityDef.moduledefs[entity.className].useMethodDescrAlias)
                methodUtype = stream.readUint8();
            else
                methodUtype = stream.readUint16();

            Method methoddata = EntityDef.moduledefs[entity.className].idmethods[methodUtype];

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

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

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

            try
            {
                methoddata.handler.Invoke(entity, args);
            }
            catch (Exception e)
            {
                if(methoddata.handler != null)
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onRemoteMethodCall: " + entity.className + "(" + eid + "), callMethod(" + entity.className + "." + methoddata.name + ") is error!\nerror=" + e.ToString());
                }
                else
                {
                    Dbg.ERROR_MSG("KBEngine::Client_onRemoteMethodCall: " + entity.className + "(" + eid + "), not found method(" + entity.className + "." + methoddata.name + ")!\nerror=" + e.ToString());
                }
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:44,代码来源:KBEngine.cs

示例6: Client_onEntityEnterWorld

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

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

            sbyte isOnGound = 1;

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

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

            Entity entity = null;

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

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

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

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

                entities[eid] = entity;

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

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

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

                    entityServerPos = entity.position;
                    entity.isOnGound = isOnGound > 0;
                    entity.onEnterWorld();
                }
            }
        }
开发者ID:kjdjpan,项目名称:kbengine_unity3d_plugins,代码行数:71,代码来源:KBEngine.cs

示例7: onImportClientMessages

        public void onImportClientMessages(MemoryStream stream)
        {
            UInt16 msgcount = stream.readUint16();

            Dbg.DEBUG_MSG(string.Format("KBEngine::Client_onImportClientMessages: start currserver=" + currserver + "(msgsize={0})...", msgcount));

            while(msgcount > 0)
            {
                msgcount--;

                MessageID msgid = stream.readUint16();
                Int16 msglen = stream.readInt16();

                string msgname = stream.readString();
                sbyte argstype = stream.readInt8();
                Byte argsize = stream.readUint8();
                List<Byte> argstypes = new List<Byte>();

                for(Byte i=0; i<argsize; i++)
                {
                    argstypes.Add(stream.readUint8());
                }

                System.Reflection.MethodInfo handler = null;
                bool isClientMethod = msgname.Contains("Client_");

                if(isClientMethod)
                {
                    handler = typeof(KBEngineApp).GetMethod(msgname);
                    if(handler == null)
                    {
                        Dbg.WARNING_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: interface({1}/{2}/{3}) no implement!",
                            currserver, msgname, msgid, msglen));

                        handler = null;
                    }
                    else
                    {
                        //Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages: imported({0}/{1}/{2}) successfully!",
                        //	msgname, msgid, msglen));
                    }
                }

                if(msgname.Length > 0)
                {
                    Message.messages[msgname] = new Message(msgid, msgname, msglen, argstype, argstypes, handler);

                    //if(!isClientMethod)
                    //	Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
                    //		currserver, msgname, msgid, msglen));

                    if(isClientMethod)
                    {
                        Message.clientMessages[msgid] = Message.messages[msgname];
                    }
                    else
                    {
                        if(currserver == "loginapp")
                            Message.loginappMessages[msgid] = Message.messages[msgname];
                        else
                            Message.baseappMessages[msgid] = Message.messages[msgname];
                    }
                }
                else
                {
                    Message msg = new Message(msgid, msgname, msglen, argstype, argstypes, handler);

                    //if(!isClientMethod)
                    //	Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
                    //		currserver, msgname, msgid, msglen));

                    if(currserver == "loginapp")
                        Message.loginappMessages[msgid] = msg;
                    else
                        Message.baseappMessages[msgid] = msg;
                }
            };

            onImportClientMessagesCompleted();
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:80,代码来源:KBEngine.cs

示例8: createDataTypeFromStream

        public void createDataTypeFromStream(MemoryStream stream, bool canprint)
        {
            UInt16 utype = stream.readUint16();
            string name = stream.readString();
            string valname = stream.readString();

            /* 有一些匿名类型,我们需要提供一个唯一名称放到datatypes中
                如:
                <onRemoveAvatar>
                    <Arg>	ARRAY <of> INT8 </of>		</Arg>
                </onRemoveAvatar>
            */
            if(valname.Length == 0)
                valname = "Null_" + utype;

            if(canprint)
                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(" + name + ":" + valname + ":" + utype + ")!");

            if(name == "FIXED_DICT")
            {
                KBEDATATYPE_FIXED_DICT datatype = new KBEDATATYPE_FIXED_DICT();
                Byte keysize = stream.readUint8();
                datatype.implementedBy = stream.readString();

                while(keysize > 0)
                {
                    keysize--;

                    string keyname = stream.readString();
                    UInt16 keyutype = stream.readUint16();
                    datatype.dicttype[keyname] = keyutype;
                };

                EntityDef.datatypes[valname] = datatype;
            }
            else if(name == "ARRAY")
            {
                UInt16 uitemtype = stream.readUint16();
                KBEDATATYPE_ARRAY datatype = new KBEDATATYPE_ARRAY();
                datatype.vtype = uitemtype;
                EntityDef.datatypes[valname] = datatype;
            }
            else
            {
                KBEDATATYPE_BASE val = null;
                EntityDef.datatypes.TryGetValue(name, out val);
                EntityDef.datatypes[valname] = val;
            }

            EntityDef.id2datatypes[utype] = EntityDef.datatypes[valname];

            // 将用户自定义的类型补充到映射表中
            EntityDef.datatype2id[valname] = utype;
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:54,代码来源:KBEngine.cs

示例9: createDataTypeFromStreams

        /*
            从二进制流创建entitydef支持的数据类型
        */
        public void createDataTypeFromStreams(MemoryStream stream, bool canprint)
        {
            UInt16 aliassize = stream.readUint16();
            Dbg.DEBUG_MSG("KBEngine::createDataTypeFromStreams: importAlias(size=" + aliassize + ")!");

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

            foreach(string datatype in EntityDef.datatypes.Keys)
            {
                if(EntityDef.datatypes[datatype] != null)
                {
                    EntityDef.datatypes[datatype].bind();
                }
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:22,代码来源:KBEngine.cs

示例10: Client_onImportMercuryErrorsDescr

        public void Client_onImportMercuryErrorsDescr(MemoryStream stream)
        {
            UInt16 size = stream.readUint16();
            while(size > 0)
            {
                size -= 1;

                MercuryErr e;
                e.id = stream.readUint16();
                e.name = stream.readString();
                e.descr = stream.readString();

                mercuryErrs.Add(e.id, e);

                Dbg.DEBUG_MSG("Client_onImportMercuryErrorsDescr: id=" + e.id + ", name=" + e.name + ", descr=" + e.descr);
            }
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:17,代码来源:KBEngine.cs

示例11: Client_onRemoteMethodCall

        public void Client_onRemoteMethodCall(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

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

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

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

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

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

            methoddata.handler.Invoke(entity, args);
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:25,代码来源:KBEngine.cs

示例12: Client_onImportClientEntityDef

        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--;
//.........这里部分代码省略.........
开发者ID:jsboys,项目名称:kbengine,代码行数:101,代码来源:KBEngine.cs

示例13: createDataTypeFromStream

        public void createDataTypeFromStream(MemoryStream stream, bool canprint)
        {
            UInt16 utype = stream.readUint16();
            string name = stream.readString();
            string valname = stream.readString();

            if(canprint)
                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(" + name + ":" + valname + ")!");

            if(valname == "FIXED_DICT")
            {
                KBEDATATYPE_FIXED_DICT datatype = new KBEDATATYPE_FIXED_DICT();
                Byte keysize = stream.readUint8();
                datatype.implementedBy = stream.readString();

                while(keysize > 0)
                {
                    keysize--;

                    string keyname = stream.readString();
                    UInt16 keyutype = stream.readUint16();
                    datatype.dicttype[keyname] = keyutype;
                };

                EntityDef.datatypes[name] = datatype;
            }
            else if(valname == "ARRAY")
            {
                UInt16 uitemtype = stream.readUint16();
                KBEDATATYPE_ARRAY datatype = new KBEDATATYPE_ARRAY();
                datatype.type = uitemtype;
                EntityDef.datatypes[name] = datatype;
            }
            else
            {
                KBEDATATYPE_BASE val = null;
                EntityDef.datatypes.TryGetValue(valname, out val);
                EntityDef.datatypes[name] = val;
            }

            EntityDef.iddatatypes[utype] = EntityDef.datatypes[name];
            EntityDef.datatype2id[name] = EntityDef.datatype2id[valname];
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:43,代码来源:KBEngine.cs

示例14: Client_onUpdatePropertys

        public void Client_onUpdatePropertys(MemoryStream stream)
        {
            Int32 eid = stream.readInt32();
            Entity entity = null;

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

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

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

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

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

                entity.setDefinedProptertyByUType(utype, val);
                if(setmethod != null)
                {
                    setmethod.Invoke(entity, new object[]{oldval});
                }
            }
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:41,代码来源:KBEngine.cs

示例15: Client_onLoginFailed

 /*
     登录loginapp失败了
 */
 public void Client_onLoginFailed(MemoryStream stream)
 {
     UInt16 failedcode = stream.readUint16();
     _serverdatas = stream.readBlob();
     Dbg.ERROR_MSG("KBEngine::Client_onLoginFailed: failedcode(" + failedcode + "), datas(" + _serverdatas.Length + ")!");
     Event.fireAll("onLoginFailed", new object[]{failedcode});
 }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:10,代码来源:KBEngine.cs


注:本文中的KBEngine.MemoryStream.readUint16方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。