public static void LoadData(string strDbPath = null)
    {
        if (gIdxId >= 0)
        {
            return;
        }

        gIdxId      = -1;
        gIdxLangCur = 0;
        gIdxLangEng = 0;
        gLangs      = new List <string> ();
        gEnIdMap    = new Dictionary <string, int> ();
        gCurStrMap  = new Dictionary <int, string> ();

        SqliteAccessCS   i18nDb = strDbPath != null ? new SqliteAccessCS(strDbPath) : LocalDatabase.Instance;
        SqliteDataReader reader = i18nDb.ReadFullTable("Translation");
        int n = reader.FieldCount;

        for (int i = 0; i < n; i++)
        {
            string colName = reader.GetName(i).ToLower();
            if (colName == "id")
            {
                gIdxId = i;
            }
            else
            {
                gLangs.Add(colName);
                if (colName == SystemSettingData.Instance.mLanguage)
                {
                    gIdxLangCur = i;
                }
                if (colName == "english")
                {
                    gIdxLangEng = i;
                }
            }
        }

        while (reader.Read())
        {
            int id = reader.GetInt32(gIdxId);
            gCurStrMap[id] = reader.GetString(gIdxLangCur);
            if (gIdxLangCur != gIdxLangEng)
            {
                gEnIdMap[reader.GetString(gIdxLangEng).ToLower()] = id;
            }
        }
        reader.Close();

        if (strDbPath != null)
        {
            i18nDb.CloseDB();
        }
    }
Example #2
0
    public static void FreeAllData()
    {
#if UNITY_EDITOR
        Debug.Log("Mem size before ocl CleanUp :" + GC.GetTotalMemory(true));

        Pathea.NpcProtoDb.Release();
        Pathea.MonsterProtoDb.Release();
        Pathea.RandomNpcDb.Release();
        Pathea.PlayerProtoDb.Release();
        Pathea.TowerProtoDb.Release();
        Pathea.DoodadProtoDb.Release();
        Pathea.AttPlusNPCData.Release();
        Pathea.AttPlusBuffDb.Release();
        Pathea.NpcTypeDb.Release();
        Pathea.NpcRandomTalkDb.Release();
        Pathea.NpcThinkDb.Release();
        Pathea.NpcEatDb.Release();
        Pathea.NPCScheduleData.Release();
        Pathea.NpcVoiceDb.Release();
        CampPathDb.Release();
        MountsSkillDb.Relese();

        //		ItemAsset.ModeInfo.s_tblModeInfo = null;
        //ItemAsset.ItemType.s_tblItemType = null;
        //ItemAsset.ItemData.s_tblItemData = null;
        //		ItemAsset.VeinData.s_tblVeinData = null;
        NaturalResAsset.NaturalRes.s_tblNaturalRes = null;
        SkillAsset.EffSkill.s_tblEffSkills         = null;
        //SkillAsset.MergeSkill.s_tblMergeSkills = null;
        //AnimData.s_tblAnimData = null;
        SoundAsset.SESoundBuff.s_tblSeSoundBuffs = null;

        DestroyImmediate(VFVoxelTerrain.self);
        Debug.Log("Mem size after VFVoxelTerrain CleanUp :" + GC.GetTotalMemory(true));
        //DestroyImmediate(PlayerFactory.self);
        //DestroyImmediate(PlayerFactory.mMianPlayerObj);
        Resources.UnloadUnusedAssets();
        Debug.Log("Mem size after all CleanUp :" + GC.GetTotalMemory(true));
        //VFVoxelTerrain.DestroyImmediate(VFVoxelTerrain.self);
#endif
        s_localDatabase.CloseDB();
        File.Delete(s_tmpDbFileName);
    }