Exemplo n.º 1
0
        static void Create()
        {
            ResKitConfig config = CreateInstance <ResKitConfig>();

            AssetDatabase.CreateAsset(config, "Assets/PTUGame/customconfig/Resources/reskitconfig.asset");
            AssetDatabase.SaveAssets();
        }
Exemplo n.º 2
0
        public IEnumerator Init()
        {
            mIsInited = false;

            if (ResMgr.SimulationMode)
            {
                SimulateInit();
                yield break;
            }

            List <ResGroupConfig> abGroups = !ResMgr.SimulationMode ? ResKitConfig.GetResGroups() : null;

            mResGroups = new List <ResDataGroup>();
            if (abGroups == null || abGroups.Count == 0)
            {
                mResGroups.Add(new ResDataGroup(""));
            }
            else
            {
                abGroups.ForEach(group =>
                {
                    if (group.DefaultLoad)
                    {
                        mResGroups.Add(new ResDataGroup(group.GroupName));
                    }
                });
            }

            foreach (ResDataGroup group in mResGroups)
            {
                yield return(group.Load());
            }

            mIsInited = true;
        }
Exemplo n.º 3
0
        private bool CheckSimulateLoad()
        {
            if (!ResMgr.SimulationMode)
            {
                return(false);
            }

#if UNITY_EDITOR
            string[] assets = UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundle(Name.ABName);
            for (int i = 0; i < assets.Length; i++)
            {
                //isStreamedSceneAssetBundle can't use similation load. Reason is given in SceneRes.cs
                if (assets[i].EndsWith(".unity", StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
            foreach (var group in ResKitConfig.GetResGroups())
            {
                if (group.GroupName == Name.ABGroup && group.SimulateLoad)
                {
                    return(false);
                }
            }
#endif
            return(true);
        }
Exemplo n.º 4
0
        public static ResKitConfig GetConfig()
        {
            ResKitConfig config = Resources.Load <ResKitConfig>("reskitconfig");

            if (config == null)
            {
                Debug.Log(">>>[ResKit]: There is no reskitconfig.asset under \"/PTUGame/customconfig/Resources/\", use default directory");
                return(null);
            }
            return(config);
        }
Exemplo n.º 5
0
        private IEnumerator SimulateInitAB()
        {
            List <ResGroupConfig> abGroups = ResKitConfig.GetResGroups();

            abGroups.ForEach(group =>
            {
                if (group.SimulateLoad)
                {
                    mResGroups.Add(new ResDataGroup(group.GroupName));
                }
            });
            for (int i = 1; i < mResGroups.Count; i++)
            {
                yield return(mResGroups[i].Load());
            }
            mIsInited = true;
        }
Exemplo n.º 6
0
        public ResName[] GetABDepencecies(string abName, bool recursive = false)
        {
            if (!mABDict.ContainsKey(abName))
            {
                return(null);
            }

            string[] dependencies;

#if UNITY_EDITOR
            if (ResMgr.SimulationMode)
            {
                dependencies = UnityEditor.AssetDatabase.GetAssetBundleDependencies(abName, recursive);

                foreach (var group in ResKitConfig.GetResGroups())
                {
                    if (group.SimulateLoad && group.GroupName == GroupName && group.SimulateLoad)
                    {
                        dependencies = recursive ? mABManifest.GetAllDependencies(abName) : mABManifest.GetDirectDependencies(abName);
                    }
                }
            }
            else
            #endif
            {
                dependencies = recursive ? mABManifest.GetAllDependencies(abName) : mABManifest.GetDirectDependencies(abName);
            }

            ResName[] resNames = new ResName[dependencies.Length];
            for (int i = 0; i < dependencies.Length; i++)
            {
                SearchResNameFailInfo failInfo;
                resNames[i] = GetResName(null, dependencies[i], out failInfo);
            }
            return(resNames);
        }