Example #1
0
    private IEnumerator PreLoadMonster()
    {
        XLevelSpawnInfo spawner = XLevelSpawnMgr.singleton.currSpawn;

        if (spawner != null)
        {
            _sub_progress = 0;
            float per = 1f / spawner.preloadInfo.Count;
            foreach (var item in spawner.preloadInfo)
            {
                var entity = XTableMgr.GetTable <XEntityStatistics>().GetByID(item.Key);
                if (entity == null)
                {
                    continue;
                }
                var pres = XTableMgr.GetTable <XEntityPresentation>().GetItemID(entity.PresentID);
                if (pres == null)
                {
                    continue;
                }
                XResources.CreateInAdvance("Prefabs/" + pres.Prefab, item.Value);
                _sub_progress += per;
                yield return(null);
            }
        }
    }