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


C# MemoryStream.readInt16方法代码示例

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


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

示例1: 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

示例2: 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();
                    Int16 ialiasID = stream.readInt16();
                    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.aliasID = ialiasID;
                    savedata.defaultValStr = defaultValStr;
                    savedata.utype = utype;
                    savedata.setmethod = setmethod;

                    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.iddatatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
//.........这里部分代码省略.........
开发者ID:QiuleiWang,项目名称:kbengine,代码行数:101,代码来源:KBEngine.cs

示例3: onImportClientEntityDef

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

示例4: createFromStream

		public override object createFromStream(MemoryStream stream)
		{
			return stream.readInt16();
		}
开发者ID:kjdjpan,项目名称:kbengine_unity3d_plugins,代码行数:4,代码来源:DataTypes.cs


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