Ejemplo n.º 1
0
        public static DeclareMasterTarget Create(string in_describe, int in_id, int in_level, int in_rewards, string in_target, int in_type)
        {
            DeclareMasterTarget tmp = new DeclareMasterTarget();

            tmp._describe = in_describe;
            tmp._id       = in_id;
            tmp._level    = in_level;
            tmp._rewards  = in_rewards;
            tmp._target   = in_target;
            tmp._type     = in_type;

            return(tmp);
        }
Ejemplo n.º 2
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[]> >("DataMasterTarget");
                if (dic == null)
                {
                    LuaEnv.SharedLuaEnv.DoString("DataMasterTarget = require 'Lua/Config/DataMasterTarget'");
                    dic = LuaEnv.SharedLuaEnv.Global.Get <Dictionary <int, int[]> >("DataMasterTarget");
                }

                if (dic != null)
                {
                    _dataCaches = new Dictionary <int, DeclareMasterTarget>();
                    foreach (var item in dic)
                    {
                        DeclareMasterTarget tmp = new DeclareMasterTarget();
                        tmp.Describe = CfgStringLua.Get(item.Value[0]);
                        tmp.Id       = item.Value[1];
                        tmp.Level    = item.Value[2];
                        tmp.Rewards  = item.Value[3];
                        tmp.Target   = CfgStringLua.Get(item.Value[4]);
                        tmp.Type     = item.Value[5];

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