Example #1
0
        public void ExtractData()
        {
            EventMgr.Instance.TriggerEvent(GlobalEvent.DATA_LOAD_PROGRESS, "数据资源初始化...开始...", 3, 0);

            tableMap = ResourcesMgr.Instance.LoadResource <DataTableMap>(DataPath + "DataTableMap.asset");
            tableMap.Init();
            m_DataDic.Add("DataTableMap", tableMap);

            tableModel = ResourcesMgr.Instance.LoadResource <DataTableModel>(DataPath + "DataTableModel.asset");
            tableModel.Init();
            m_DataDic.Add("DataTableModel", tableModel);

            tableMonster = ResourcesMgr.Instance.LoadResource <DataTableMonster>(DataPath + "DataTableMonster.asset");
            tableMonster.Init();
            m_DataDic.Add("DataTableMonster", tableMonster);

            tableMonsterRefresh = ResourcesMgr.Instance.LoadResource <DataTableMonsterRefresh>(DataPath + "DataTableMonsterRefresh.asset");
            tableMonsterRefresh.Init();
            m_DataDic.Add("DataTableMonsterRefresh", tableMonsterRefresh);

            tableNpc = ResourcesMgr.Instance.LoadResource <DataTableNpc>(DataPath + "DataTableNpc.asset");
            tableNpc.Init();
            m_DataDic.Add("DataTableNpc", tableNpc);

            tableTransfer = ResourcesMgr.Instance.LoadResource <DataTableTransfer>(DataPath + "DataTableTransfer.asset");
            tableTransfer.Init();
            m_DataDic.Add("DataTableTransfer", tableTransfer);

            EventMgr.Instance.TriggerEvent(GlobalEvent.DATA_LOAD_PROGRESS, "数据资源初始化中...", 3, 30);



            EventMgr.Instance.TriggerEvent(GlobalEvent.DATA_LOAD_PROGRESS, "数据资源初始化中...", 3, 60);



            tableUI = ResourcesMgr.Instance.LoadResource <DataTableUi>(DataPath + "DataTableUi.asset");
            tableUI.Init();
            m_DataDic.Add("DataTableUi", tableUI);

            EventMgr.Instance.TriggerEvent(GlobalEvent.DATA_LOAD_PROGRESS, "数据资源初始化中...", 3, 90);


            EventMgr.Instance.TriggerEvent(DataConst.DATA_LOAD_COMPLETE);
            EventMgr.Instance.TriggerEvent(GlobalEvent.DATA_LOAD_PROGRESS, "数据资源初始化完成!!!", 3, 100);
        }
    void OnEnable()
    {
        selectTypeDic.Add(0, "Null");
        selectTypeDic.Add(1, "PlayerBorn");
        selectTypeDic.Add(2, "Monster");
        selectTypeDic.Add(3, "MonsterRefresh");
        selectTypeDic.Add(4, "Npc");
        selectTypeDic.Add(5, "Transfer");

        _scriptEditPath   = EditorPrefs.GetString(SAVE_EDIT_PATH, _scriptEditPath);
        _scriptClientPath = EditorPrefs.GetString(SAVE_CLIENT_PATH, _scriptClientPath);

        tableMap = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableMap.asset") as DataTableMap;
        tableMap.Init();
        tableMapDic = tableMap.GetInfo();

        tableMonster = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableMonster.asset") as DataTableMonster;
        tableMonster.Init();
        tableMonsterDic = tableMonster.GetInfo();

        tableMonsterRefresh = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableMonsterRefresh.asset") as DataTableMonsterRefresh;
        tableMonsterRefresh.Init();
        tableMonsterRefreshDic = tableMonsterRefresh.GetInfo();

        tableNpc = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableNpc.asset") as DataTableNpc;
        tableNpc.Init();
        tableNpcDic = tableNpc.GetInfo();

        tableTransfer = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableTransfer.asset") as DataTableTransfer;
        tableTransfer.Init();
        tableTransferDic = tableTransfer.GetInfo();

        tableModel = UnityEditor.AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Resources/Data/DataTableModel.asset") as DataTableModel;
        tableModel.Init();

        //ScriptableObject tempObj = UnityEditor.AssetDatabase.LoadAssetAtPath<ScriptableObject>("Assets/Resources/Data/DataTableUi.asset");
        //DataTableUi testAsset = tempObj as DataTableUi;
        //foreach (UiExcel gd in testAsset.DataList)
        //{
        //    Debug.Log(gd.id);
        //    Debug.Log(gd.name);
        //}
        //testAsset.Init();
        //UiExcel tempData = testAsset.GetInfoById(1);
        //Debug.Log(tempData.id);
    }