public static void PreloadWrap <K, V>(ref Dictionary <K, List <V> > maps, byte[] buffer, MonoBehaviour mono, Action <IDictionary> onEnd, Action <float> onProcess = null) where V : ConfigBase <K>, new() { if (buffer == null || buffer.Length <= 0 || mono == null) { if (onEnd != null) { onEnd(null); } return; } if (maps != null) { maps.Clear(); } MemoryStream stream = new MemoryStream(buffer); ConfigWrap.InitDictMap(stream, ref maps); Coroutine cor = ConfigWrap.ToObjectListAsync <K, V>(stream, maps, mono, true, onEnd, onProcess); if (cor == null) { stream.Close(); stream.Dispose(); if (onEnd != null) { onEnd(null); } } }
public static Dictionary <K, V> ToWrapSingleType <K, V>(byte[] buffer) { if (buffer == null || buffer.Length <= 0) { return(null); } MemoryStream stream = new MemoryStream(buffer); Dictionary <K, V> ret = null; ConfigWrap.InitDictMap(stream, ref ret); ConfigWrap.ToSingleVarType <K, V>(stream, ret); return(ret); }
public static void PreloadWrapOfSingleType <K, V>(ref Dictionary <K, V> maps, byte[] buffer, MonoBehaviour mono, Action <IDictionary> onEnd, Action <float> onProcess) { if (buffer == null || buffer.Length <= 0 || mono == null) { if (onEnd != null) { onEnd(null); } return; } if (maps != null) { maps.Clear(); } MemoryStream stream = new MemoryStream(buffer); ConfigWrap.InitDictMap(stream, ref maps); ConfigWrap.ToSingleVarType <K, V>(stream, maps, mono, onEnd, onProcess); }
public static void ThreadPreloadWrap <K, V>(ref Dictionary <K, V> maps, byte[] buffer, Action <IDictionary> onEnd, Action <float> onProcess) where V : ConfigBase <K>, new() { if (buffer == null || buffer.Length <= 0) { if (onEnd != null) { onEnd(null); } return; } if (maps != null) { maps.Clear(); } MemoryStream stream = new MemoryStream(buffer); ConfigWrap.InitDictMap(stream, ref maps); ConfigWrap.ToObjectThreadAsync <K, V>(stream, maps, true, onEnd, onProcess); }