Example #1
0
        public static DeclarePreload Create(int in_id, string in_path, int in_type)
        {
            DeclarePreload tmp = new DeclarePreload();

            tmp._id   = in_id;
            tmp._path = in_path;
            tmp._type = in_type;

            return(tmp);
        }
Example #2
0
 public static void Convert(Dictionary <int, DeclarePreload> data)
 {
     if (data == null)
     {
         return;
     }
     data.Clear();
     data.Add(1, DeclarePreload.Create(1, StringDefines.Key_18192, 5));
     data.Add(2, DeclarePreload.Create(2, StringDefines.Key_18193, 5));
     data.Add(3, DeclarePreload.Create(3, StringDefines.Key_18194, 6));
     data.Add(4, DeclarePreload.Create(4, StringDefines.Key_18195, 6));
     data.Add(5, DeclarePreload.Create(5, StringDefines.Key_18196, 4));
     data.Add(6, DeclarePreload.Create(6, StringDefines.Key_18197, 4));
     data.Add(7, DeclarePreload.Create(7, StringDefines.Key_18198, 4));
     data.Add(8, DeclarePreload.Create(8, StringDefines.Key_18199, 4));
     data.Add(9, DeclarePreload.Create(9, StringDefines.Key_18200, 8));
     data.Add(10, DeclarePreload.Create(10, StringDefines.Key_18201, 5));
 }
Example #3
0
        public static void SetData()
        {
            if (_dataCaches == null && LuaEnv.isLoadLuaCfg)
            {
                long startTime = DateTime.Now.Ticks;
                Dictionary <int, int[]> dic = LuaEnv.SharedLuaEnv.Global.Get <Dictionary <int, int[]> >("DataPreload");
                if (dic == null)
                {
                    LuaEnv.SharedLuaEnv.DoString("DataPreload = require 'Lua/Config/DataPreload'");
                    dic = LuaEnv.SharedLuaEnv.Global.Get <Dictionary <int, int[]> >("DataPreload");
                }

                if (dic != null)
                {
                    _dataCaches = new Dictionary <int, DeclarePreload>(10);
                    foreach (var item in dic)
                    {
                        DeclarePreload tmp = new DeclarePreload();
                        tmp.Id   = item.Value[0];
                        tmp.Path = CfgStringLua.Get(item.Value[1]);
                        tmp.Type = item.Value[2];

                        _dataCaches.Add(item.Key, tmp);
                    }
                }
                Record(startTime, DateTime.Now.Ticks, "Preload");
            }
            if (_dataCaches == null && _fillDataCallBack != null)
            {
                if (_dataCaches == null)
                {
                    long startTime = DateTime.Now.Ticks;
                    _dataCaches = new Dictionary <int, DeclarePreload>(10);
                    _fillDataCallBack(_dataCaches);
                    Record(startTime, DateTime.Now.Ticks, "Preload");
                }
            }
        }