public static void writeB2Int(Stream os, B2Int v) { WriteByte(os, B2Type.INT_B2); writeInt(os, v.value); }
public static void writeObject(Stream os, Object obj) { if (obj == null) { writeNull(os); } else if (B2Type.isMap(obj)) { Hashtable v = (Hashtable)obj; writeMap(os, v); } else if (B2Type.isInt(obj)) { int v = ((Int32)obj); writeInt(os, v); } else if (B2Type.isString(obj)) { String v = (String)obj; writeString(os, v); } else if (B2Type.isBool(obj)) { bool v = ((Boolean)obj); writeBoolean(os, v); } else if (B2Type.isByte(obj)) { int v = ((Byte)obj); writeByte(os, v); } else if (B2Type.isBytes(obj)) { byte[] v = (byte[])obj; writeBytes(os, v); } else if (B2Type.isList(obj)) { ArrayList v = (ArrayList)obj; writeVector(os, v); } else if (B2Type.isShort(obj)) { int v = (Int16)obj; writeShort(os, v); } else if (B2Type.isLong(obj)) { long v = ((Int64)obj); writeLong(os, v); } else if (B2Type.isDouble(obj)) { double v = ((Double)obj); writeDouble(os, v); } else if (B2Type.isIntArray(obj)) { int[] v = (int[])obj; writeIntArray(os, v); // } else if(obj instanceof int[][]){ // int[][] v = (int[][]) obj; // writeInt2DArray(os, v); } else if (B2Type.isB2Int(obj)) { B2Int v = (B2Int)obj; writeB2Int(os, v); } else { //throw new IOException("unsupported obj:" + obj); UnityEngine.Debug.LogError("B2IO unsupported error: type=[" + obj.GetType() + "] val=[" + obj + "]"); } }