View Infos.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Xml; | |
using System.Xml.Serialization; | |
[XmlRoot] | |
public sealed class TileInfo : DatabaseEntry | |
{ | |
[XmlElement] | |
public int Height { get; private set; } |
View AsyncMapBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncMapBuilder : MapBuilder | |
{ | |
protected override void InitMapObjects() | |
{ | |
for (int y = 0; y < Height; ++y) | |
{ | |
for (int x = 0; x < Width; ++x) | |
{ | |
int height = HeightField[y * Width + x]; | |
int tempX = x; |
View ResourceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ValidateAssetBundleAssetsInternal() | |
{ | |
// Get all asset infos from the database and iterate over them | |
AssetInfo[] assetInfos = Database.Instance.GetEntries<AssetInfo>(); | |
foreach (AssetInfo assetInfo in assetInfos) | |
{ | |
// Load the object referenced by the asset info. Warn if the | |
// object fails to load | |
Object asset = Resources.LoadAssetAtPath<Object>(assetInfo.Path); | |
if (!asset) |
View ResourceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerator LoadBundlesCo(System.Action onComplete) | |
{ | |
// Get bundle infos from the database | |
AssetBundleInfo[] bundleInfos = Database.Instance.GetEntries<AssetBundleInfo>(); | |
// Load each bundle using the path in the bundle info | |
foreach (AssetBundleInfo info in bundleInfos) | |
{ | |
string url = "file://" + AssetBundlePath + "/" + info.Name + ".unity3d"; |
View ResourceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerator LoadAssetAsyncCo<T>(AssetInfo info, System.Action<T> onComplete) where T : UnityEngine.Object | |
{ | |
if (info.AssetBundleInfoRef != null) | |
{ | |
// Get the bundle from the loaded bundles collection | |
AssetBundle bundle; | |
if (!loadedBundles.TryGetValue(info.AssetBundleInfoRef.Entry.DatabaseID, out bundle)) | |
{ | |
throw new System.Exception("Asset bundle not found: " + info.AssetBundleInfoRef.Entry.Name); | |
} |
View ResourceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MenuItem("Assets/Build AssetBundles")] | |
private static void BuildAssetBundles() | |
{ | |
ClearAssetBundles(); | |
// You would probably want to parameterize this part | |
Database.Instance.ReadFiles(AssetInfoXMLPath); | |
// Validate asset infos | |
ValidateAssetBundleAssetsInternal(); |
View AssetData.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Database> | |
<!-- Asset Bundle Infos --> | |
<AssetBundleInfo ID="ASSET_BUNDLE_MAIN_CONTENT"> | |
<Name>MainContent</Name> | |
<URL>StreamingAssets/AssetBundles/MainContent.unity3d</URL> | |
</AssetBundleInfo> | |
<!-- Asset Infos --> |
View AssetInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.IO; | |
using System.Text; | |
using System.Xml; | |
using System.Xml.Serialization; | |
[XmlRoot("AssetInfo")] | |
public sealed class AssetInfo : DatabaseEntry | |
{ |
View AssetBundleInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.IO; | |
using System.Text; | |
using System.Xml; | |
using System.Xml.Serialization; | |
[XmlRoot("AssetBundleInfo")] | |
public sealed class AssetBundleInfo : DatabaseEntry | |
{ |
View ID.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Xml; | |
using System.Xml.Schema; | |
using System.Xml.Serialization; | |
public class ID | |
{ |
NewerOlder