Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }