コード例 #1
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);
    }
コード例 #2
0
ファイル: Camp.cs プロジェクト: shrubba/planetexplorers
    public static void LoadData()
    {
        _camps.Clear();
        SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("sceneCampList");

        //reader.Read(); // skip title if needed
        while (reader.Read())
        {
            int id = Convert.ToInt32(reader.GetString(0));
            //lz-2016.09.23 这个字段只有蒲及用了,可以直接改成翻译映射ID
            int      nameID = Convert.ToInt32((reader.GetString(1)));
            string[] pos    = reader.GetString(2).Split(',');
            Vector3  vPos   = new Vector3(
                Convert.ToSingle(pos[0]),
                Convert.ToSingle(pos[1]),
                Convert.ToSingle(pos[2]));
            float      radius   = Convert.ToSingle(reader.GetString(3));
            List <int> assetIds = StrToCampAssetDesc(reader.GetString(4));
            Camp       _camp    = new Camp(id, nameID, vPos, radius, assetIds);

            string   strTmp = reader.GetString(reader.GetOrdinal("Sleep"));
            string[] tmpList;
            tmpList = strTmp.Split('_');
            if (tmpList.Length == 2)
            {
                _camp.mSleepTime  = Convert.ToSingle(tmpList[0]) + UnityEngine.Random.Range(0.1f, 0.2f);
                _camp.mWakeupTime = Convert.ToSingle(tmpList[1]) + UnityEngine.Random.Range(0.1f, 0.2f);
            }
            string[] tmpList1;
            strTmp = reader.GetString(reader.GetOrdinal("Eat"));
            if (strTmp != "0")
            {
                tmpList = strTmp.Split(':');
                _camp.mEatInfo.assesID = Convert.ToInt32(tmpList[0]);
                tmpList1 = tmpList[1].Split(',');
                string[] tmpList1_1;
                for (int i = 0; i < tmpList1.Length; i++)
                {
                    if (tmpList1[i] == "0")
                    {
                        continue;
                    }

                    tmpList1_1 = tmpList1[i].Split('_');
                    if (tmpList1_1.Length != 2)
                    {
                        continue;
                    }

                    _camp.mEatInfo.Eattimes.Add(new TimeSlot(Convert.ToSingle(tmpList1_1[0]), Convert.ToSingle(tmpList1_1[1])));
                }
            }


            strTmp          = reader.GetString(reader.GetOrdinal("SleepPos"));
            _camp._LayDatas = StrToSleepPostion(strTmp);

            strTmp = reader.GetString(reader.GetOrdinal("PatrolPos"));
            if (strTmp != "0")
            {
                _camp.mPaths = strTmp.Split(';');
            }

            _camp.MedicalType  = PETools.PEUtil.ToArrayInt32(reader.GetString(9), ',');
            _camp.RepairType   = PETools.PEUtil.ToArrayInt32(reader.GetString(10), ',');
            _camp.ComputerType = PETools.PEUtil.ToArrayInt32(reader.GetString(11), ',');
            _camp.TentType     = PETools.PEUtil.ToArrayInt32(reader.GetString(12), ',');
            _camp.CampIsActive = Convert.ToBoolean(PETools.PEUtil.ToArrayByte(reader.GetString(13), ',')[0]);
            _camps.Add(_camp);

            CampPathDb.LoadData(_camp.mPaths);
        }
    }