Exemple #1
0
        public AVATAR_DATA createFromStreamEx(MemoryStream stream)
        {
            AVATAR_DATA datas = new AVATAR_DATA();

            datas.param1 = stream.readInt8();
            datas.param2 = stream.readBlob();
            return(datas);
        }
Exemple #2
0
        public FS_ENTITY_DATA createFromStreamEx(MemoryStream stream)
        {
            FS_ENTITY_DATA datas = new FS_ENTITY_DATA();

            datas.entityid = stream.readInt32();
            datas.cmd_type = stream.readUint8();
            datas.datas    = stream.readBlob();
            return(datas);
        }
Exemple #3
0
 static int readBlob(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         KBEngine.MemoryStream obj = (KBEngine.MemoryStream)ToLua.CheckObject <KBEngine.MemoryStream>(L, 1);
         byte[] o = obj.readBlob();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #4
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 object createFromStream(MemoryStream stream)
 {
     return(stream.readBlob());
 }
 public override object createFromStream(MemoryStream stream)
 {
     return(System.Text.Encoding.UTF8.GetString(stream.readBlob()));
 }
        /*
            登录loginapp成功了
        */
        public void Client_onLoginSuccessfully(MemoryStream stream)
        {
            var accountName = stream.readString();
            username = accountName;
            baseappIP = stream.readString();
            baseappPort = stream.readUint16();

            Dbg.DEBUG_MSG("KBEngine::Client_onLoginSuccessfully: accountName(" + accountName + "), addr(" +
                    baseappIP + ":" + baseappPort + "), datas(" + _serverdatas.Length + ")!");

            _serverdatas = stream.readBlob();
            login_baseapp(true);
        }
 /*
     登录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});
 }
        /*
            账号创建返回结果
        */
        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!");
        }
        /*
            服务端错误描述导入了
        */
        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);
            }
        }
		public override object createFromStream(MemoryStream stream)
		{
			return stream.readBlob();
		}
		public override object createFromStream(MemoryStream stream)
		{
			return System.Text.Encoding.UTF8.GetString(stream.readBlob());
		}