public bool GetWorldInfo2(int type, string info) { StoreArchive ar = new StoreArchive(m_buffer, m_buffer.Length); ar.WriteInt8(GlobalClineMsgId.CLIENT_WORLD_INFO);//消息ID ar.WriteInt32(type); ar.WriteWideStr(info); return(m_sender.Send(ar.GetData(), ar.GetLength())); }
public bool AddMsgVarList(StoreArchive ar, VarList args, int beg, int end) { try { for (int i = beg; i < end; ++i) { switch (args.GetType(i)) { case VarType.Int: ar.WriteInt8(VarType.Int); ar.WriteInt32(args.GetInt(i)); break; case VarType.Int64: ar.WriteInt8(VarType.Int64); ar.WriteInt64(args.GetInt64(i)); break; case VarType.Float: ar.WriteInt8(VarType.Float); ar.WriteFloat(args.GetFloat(i)); break; case VarType.Double: ar.WriteInt8(VarType.Double); ar.WriteDouble(args.GetDouble(i)); break; case VarType.String: ar.WriteInt8(VarType.String); ar.WriteString(args.GetString(i)); break; case VarType.WideStr: ar.WriteInt8(VarType.WideStr); ar.WriteWideStr(args.GetWideStr(i)); break; case VarType.Object: ar.WriteInt8(VarType.Object); ar.WriteObject(args.GetObject(i)); break; default: break; } } } catch (Exception ex) { LogSystem.LogError(ex.ToString()); return(false); } return(true); }
bool AddMsgVarList(ref StoreArchive storeAr, ref VarList args, int beg, int end) { try { for (int i = beg; i < end; i++) { switch (args.GetType(i)) { case VarType.Int: { storeAr.WriteInt8(VarType.Int); storeAr.WriteInt32(args.GetInt(i)); } break; case VarType.Int64: { storeAr.WriteInt8(VarType.Int64); storeAr.WriteInt64(args.GetInt64(i)); } break; case VarType.Float: { storeAr.WriteInt8(VarType.Float); storeAr.WriteFloat(args.GetFloat(i)); } break; case VarType.Double: { storeAr.WriteInt8(VarType.Double); storeAr.WriteDouble(args.GetDouble(i)); } break; case VarType.String: { storeAr.WriteInt8(VarType.String); storeAr.WriteString(args.GetString(i)); } break; case VarType.WideStr: { storeAr.WriteInt8(VarType.WideStr); storeAr.WriteWideStr(args.GetWideStr(i)); } break; case VarType.Object: { storeAr.WriteInt8(VarType.Object); storeAr.WriteObject(args.GetObject(i)); } break; default: //Log.Trace("unkown data type"); break; } //end switch } //end for } catch (Exception ex) { //Log.Trace("Exception:" + ex.ToString()); return(false); }//end try catch return(true); }
public bool LoginReconnect(string account, string pswd, string validate_string, string device_uid, bool in_stub = false, string strRoleName = "", string strRoleInfo = "") { if (account == null || pswd == null || validate_string == null || device_uid == null) { return(false); } StoreArchive ar = StoreArchive.Load(m_buffer, m_buffer.Length); ar.WriteInt8(GlobalClineMsgId.CLIENT_LOGIN);//消息ID int iVerson = fxVerify.GetVersion(); ar.WriteInt32(iVerson);//版本号 Array.Clear(varifyLoginReconnect, 0, varifyLoginReconnect.Length); fxVerify.GetLoginVerify(ref varifyLoginReconnect); ar.WriteUserDataNoLen(varifyLoginReconnect); byte[] btAccount = null; byte[] btPassword = null; int iAccountSize = 0; int iPasswordSize = 0; bool bVerifyok1 = fxVerify.EncodeAccount(account, ref btAccount, ref iAccountSize); bool bVerifyok2 = fxVerify.EncodePassword(pswd, ref btPassword, ref iPasswordSize); if (bVerifyok1 && bVerifyok2) { ar.WriteUserData(btAccount); //账号 ar.WriteUserData(btPassword); //密码 } else { ar.WriteString(account); ar.WriteString(pswd); } ar.WriteString(validate_string); //登录串 ar.WriteInt32(100); //登录类型 LOGIN_TYPE_RECONNECT 100 if (in_stub) { ar.WriteInt8(1); } else { ar.WriteInt8(0); } ar.WriteString(device_uid); string strPropMd5 = string.Empty; string strRecdMd5 = string.Empty; if (mRecver != null) { strPropMd5 = mRecver.GetPropertyTableMd5(); strRecdMd5 = mRecver.GetRecordTableMd5(); } if (strPropMd5 != null) { ar.WriteString(strPropMd5); } else { ar.WriteString(string.Empty); } if (strRecdMd5 != null) { ar.WriteString(strRecdMd5); } else { ar.WriteString(string.Empty); } //发送角色名称 if (strRoleName != null) { ar.WriteWideStr(strRoleName); } else { ar.WriteWideStr(string.Empty); } //发送角色名称 if (strRoleInfo != null) { ar.WriteString(strRoleInfo); } else { ar.WriteString(string.Empty); } return(m_sender.Send(ar.GetData(), ar.GetLength())); }