Beispiel #1
0
 public virtual void OnLuaParseEnd()
 {
     if (MetaTable == null)
     {
         MetaTable = GetDynVal(LuaTableKey);
     }
     Default = (T)LuaReader.Read(MetaTable, typeof(T));
 }
Beispiel #2
0
 public override void Awake()
 {
     if (Ins == null)
     {
         Ins = this;
     }
     //创建临时对象
     TempGO           = new GameObject("TempGO");
     TempGO.hideFlags = HideFlags.HideInHierarchy;
     //使应用程序无法关闭
     Application.wantsToQuit += OnWantsToQuit;
     WinUtil.DisableSysMenuButton();
     //创建必要的文件目录
     FileUtil.EnsureDirectory(Const.Path_Dev);
     FileUtil.EnsureDirectory(Const.Path_Screenshot);
     FileUtil.EnsureDirectory(Const.Path_LocalDB);
     FileUtil.EnsureDirectory(Const.Path_CloudDB);
     //添加必要的组件
     SetupComponent <Videoer>();
     SetupComponent <Prefers>();
     SetupComponent <Feedback>();
     SetupComponent <FPSCounter>();
     SetupComponent <GlobalMonoMgr>();
     SetupComponent <GlobalUITextMgr>();
     SetupComponent <IMUIErrorCatcher>();
     SetupComponent <IMUIWaterMarker>();
     SetupComponent <IMUIOptions>();
     //初始化LuaReader
     LuaReader.Init(BuildConfig.NameSpace);
     DOTween.Init();
     DOTween.instance.transform.SetParent(Trans);
     Timing.Instance.transform.SetParent(Trans);
     QueueHub.Instance.transform.SetParent(Trans);
     Delay.Ins.transform.SetParent(Trans);
     RapidGUIBehaviour.Instance.transform.SetParent(Trans);
     //创建所有DataParse
     OnProcessAssembly();
     base.Awake();
     //添加SDK组件
     OnAddPlatformSDKComponet();
     //读取命令行参数
     OnProcessCMDArgs();
     DontDestroyOnLoad(this);
     //携程
     CommonCoroutineter    = new Coroutineter("Common");
     MainUICoroutineter    = new Coroutineter("MainUI");
     BattleCoroutineter    = new Coroutineter("Battle");
     SubBattleCoroutineter = new Coroutineter("SubBattle");
     Pos = Const.VEC_GlobalPos;
     //CALLBACK
     LoaderMgr.Callback_OnAllLoadEnd1 += OnAllLoadEnd1;
     LoaderMgr.Callback_OnAllLoadEnd2 += OnAllLoadEnd2;
     LuaMgr.Callback_OnParseStart     += OnLuaParseStart;
     LuaMgr.Callback_OnParseEnd       += OnLuaParseEnd;
     //Test
     OnTest();
 }
Beispiel #3
0
        public virtual void Add(DynValue table)
        {
            if (MetaTable == null)
            {
                MetaTable = GetDynVal(LuaTableKey);
            }
            if (!MetaTable.IsNil())
            {
                baseTable = AddByDefault(MetaTable, table);
            }
            else
            {
                baseTable = table;
            }

            //获得Lua类模板
            string temp      = GetStrByBaseTable(Template);
            Type   classType = typeof(T);

            if (temp != null)
            {
                classType = Type.GetType(NameSpace + "." + temp, true, false);
                if (classType == null)
                {
                    CLog.Error("无法找到此类型:" + temp);
                }
                TempClassData = classType.Assembly.CreateInstance(classType.FullName) as T;
            }
            else
            {
                TempClassData = new T();
            }

            TempClassData = (T)LuaReader.Read(baseTable, classType);
            if (TempClassData == null)
            {
                return;
            }
            string key = TempClassData.TDID;

            if (Data.ContainsKey(key))
            {
                CLog.Error(baseTable.ToString() + "已经存在这个key:" + key);
                return;
            }
            //TempClassData.OnBeAddedToData();
            //Add(key, TempClassData);
            //Keys.Add(key);
            TempClassData.TDID = key;
            Register(TempClassData);
        }