public static void putInteger(OutputUnityBuffer data, uint value) { data.write((byte)(value >> 24)); data.write((byte)(value >> 16)); data.write((byte)(value >> 8)); data.write((byte)(value)); }
public static void putLength(OutputUnityBuffer data, uint length) { data.write((byte)(length >> 24)); data.write((byte)(length >> 16)); data.write((byte)(length >> 8)); data.write((byte)(length)); }
public static void putByteArray(OutputUnityBuffer data, byte[] value) { int len = value.Length; for (int i = 0; i < len; i++) { data.write(value [i]); } data.write(0); }
public static void setGameStatus(EGAMESTATUS gameStatus) { OutputUnityBuffer data = new OutputUnityBuffer(1 + 4 + 1 + 1 + 4 + 4); data.write((byte)ESERAILIZETAG.TAG_TYPE); putLength(data, 1); data.write((byte)ESERIALIZETYPE.TYPE_SETGAMESTATUS); data.write((byte)ESERAILIZETAG.TAG_GAME_STATUS); putLength(data, 4); putInteger(data, (uint)gameStatus); tss_unity_str(data.toByteArray(), data.getLength()); }
public static void setInitInfo(uint gameId) { OutputUnityBuffer data = new OutputUnityBuffer(1 + 4 + 1 + 1 + 4 + 4); data.write((byte)ESERAILIZETAG.TAG_TYPE); putLength(data, 1); data.write((byte)ESERIALIZETYPE.TYPE_INIT); data.write((byte)ESERAILIZETAG.TAG_GAME_ID); putLength(data, 4); putInteger(data, gameId); tss_unity_str(data.toByteArray(), data.getLength()); }
public static void setUserInfoEx(EENTRYID entryId, string uin, string appId, uint worldId, string roleId) { byte[] valOpenId = System.Text.Encoding.ASCII.GetBytes(uin); byte[] valAppId = System.Text.Encoding.ASCII.GetBytes(appId); byte[] valRoleId = System.Text.Encoding.ASCII.GetBytes(roleId); uint length = 0; OutputUnityBuffer data = new OutputUnityBuffer(6 * 1 + 6 * 4 + 1 + 4 + 4 + (uint)valOpenId.Length + 1 + (uint)valAppId.Length + 1 + (uint)valRoleId.Length + 1); data.write((byte)ESERAILIZETAG.TAG_TYPE); putLength(data, 1); data.write((byte)ESERIALIZETYPE.TYPE_SETUSERINFO); data.write((byte)ESERAILIZETAG.TAG_ENTRY_ID); putLength(data, 4); putInteger(data, (uint)entryId); data.write((byte)ESERAILIZETAG.TAG_OPENID); length = (uint)valOpenId.Length + 1; //if (GLog.IsLogInfoEnabled) GLog.LogInfo("openid length:" + length); putLength(data, length); putByteArray(data, valOpenId); data.write((byte)ESERAILIZETAG.TAG_APPID); length = (uint)valAppId.Length + 1; //if (GLog.IsLogInfoEnabled) GLog.LogInfo("appid length:" + length); putLength(data, length); putByteArray(data, valAppId); data.write((byte)ESERAILIZETAG.TAG_WORLD_ID); putLength(data, 4); putInteger(data, worldId); data.write((byte)ESERAILIZETAG.TAG_ROLEID); length = (uint)valRoleId.Length + 1; //if (GLog.IsLogInfoEnabled) GLog.LogInfo("roleid length:" + length); putLength(data, length); putByteArray(data, valRoleId); //if (GLog.IsLogInfoEnabled) GLog.LogInfo("data length:" + data.getLength()); tss_unity_str(data.toByteArray(), data.getLength()); }