-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
503e38f
commit 39e906a
Showing
17 changed files
with
197 additions
and
28 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
Assets/OxGFrame/AssetLoader/Example/BundleDemo/BundleDemoCollectorConfig.xml
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
Assets/OxGFrame/AssetLoader/Example/BundleDemo/BundleDemo_AssetBundleCollectorConfig.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root Version="2.4"> | ||
<Common AutoAddressable="True" UniqueBundleName="False" ShowPackageView="True" ShowEditorAlias="False" /> | ||
<Package PackageName="DefaultPackage" PackageDesc=""> | ||
<Group GroupActiveRule="EnableGroup" GroupName="ModelGroup" GroupDesc="" AssetTags="models"> | ||
<Collector CollectPath="Assets/OxGFrame/AssetLoader/Example/Prefabs/model_01.prefab" CollectGUID="b4ea3356cddbd8b41926c28adefdfbc5" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
</Group> | ||
<Group GroupActiveRule="EnableGroup" GroupName="SceneGroup" GroupDesc="" AssetTags="scenes"> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo01.unity" CollectGUID="97102f27cdcc74846bb0909829b431cd" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo02.unity" CollectGUID="9f25400e0da4e034294d5e153b0533ab" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo03.unity" CollectGUID="42b42b7f9b5995748ba85a54431669b3" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
</Group> | ||
</Package> | ||
<Package PackageName="OtherPackage" PackageDesc=""> | ||
<Group GroupActiveRule="EnableGroup" GroupName="ModelGroup" GroupDesc="" AssetTags="models"> | ||
<Collector CollectPath="Assets/OxGFrame/AssetLoader/Example/Prefabs/model_01.prefab" CollectGUID="b4ea3356cddbd8b41926c28adefdfbc5" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
</Group> | ||
<Group GroupActiveRule="EnableGroup" GroupName="SceneGroup" GroupDesc="" AssetTags="scenes"> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo01.unity" CollectGUID="97102f27cdcc74846bb0909829b431cd" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo02.unity" CollectGUID="9f25400e0da4e034294d5e153b0533ab" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
<Collector CollectPath="Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo03.unity" CollectGUID="42b42b7f9b5995748ba85a54431669b3" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
</Group> | ||
</Package> | ||
<Package PackageName="DlcPackage" PackageDesc=""> | ||
<Group GroupActiveRule="EnableGroup" GroupName="ModelGroup" GroupDesc="" AssetTags="models"> | ||
<Collector CollectPath="Assets/OxGFrame/AssetLoader/Example/Prefabs/model_01.prefab" CollectGUID="b4ea3356cddbd8b41926c28adefdfbc5" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" /> | ||
</Group> | ||
</Package> | ||
</root> |
2 changes: 1 addition & 1 deletion
2
...leDemo/BundleDemoCollectorConfig.xml.meta → ...eDemo_AssetBundleCollectorConfig.xml.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
Assets/OxGFrame/AssetLoader/Example/BundleDemo/BundleDemo_CDN.7z.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1. Unzip BundleDemo_CDN.7z and then upload CDN folder to server (Don't forget double check url path in burlconfig.conf). | ||
2. Open BundleDemo scene. | ||
3. Select HostMode on PatchLauncher. | ||
4. Play |
7 changes: 7 additions & 0 deletions
7
Assets/OxGFrame/AssetLoader/Example/BundleDemo/README.md.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
Assets/OxGFrame/AssetLoader/Scripts/Runtime/Utility/DownloadSpeedCalculator.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
|
||
namespace OxGFrame.AssetLoader.Utility | ||
{ | ||
public sealed class DownloadSpeedCalculator | ||
{ | ||
public delegate void OnDownloadSpeedProgress(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes, long downloadSpeedBytes); | ||
|
||
public OnDownloadSpeedProgress onDownloadSpeedProgress; | ||
private DateTime _lastTime = default; | ||
private long _lastDownloadBytes = 0; | ||
private long _downloadSpeedBytes = 0; | ||
private long _lastDownloadSpeedBytes = 0; | ||
private bool _isDone = false; | ||
|
||
public void OnDownloadProgress(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes) | ||
{ | ||
if (this._isDone) | ||
{ | ||
this._Reset(); | ||
return; | ||
} | ||
|
||
if (currentDownloadBytes >= totalDownloadBytes) this._isDone = true; | ||
|
||
var frag = currentDownloadBytes - this._lastDownloadBytes; | ||
this._lastDownloadBytes = currentDownloadBytes; | ||
this._Increment(frag); | ||
var speedBytes = this._GetSpeedBytes(); | ||
this.onDownloadSpeedProgress?.Invoke(totalDownloadCount, currentDownloadCount, totalDownloadBytes, currentDownloadBytes, speedBytes); | ||
} | ||
|
||
private void _Reset() | ||
{ | ||
this._lastTime = default; | ||
this._lastDownloadBytes = 0; | ||
this._downloadSpeedBytes = 0; | ||
this._lastDownloadSpeedBytes = 0; | ||
this._isDone = false; | ||
} | ||
|
||
private void _Increment(long bytes) | ||
{ | ||
lock (this) | ||
{ | ||
this._downloadSpeedBytes += bytes; | ||
} | ||
} | ||
|
||
private long _GetSpeedBytes() | ||
{ | ||
lock (this) | ||
{ | ||
if (DateTime.Now.Subtract(this._lastTime).TotalSeconds > 1) | ||
{ | ||
this._lastDownloadSpeedBytes = this._downloadSpeedBytes; | ||
this._downloadSpeedBytes = 0; | ||
this._lastTime = DateTime.Now; | ||
} | ||
return this._lastDownloadSpeedBytes; | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/OxGFrame/AssetLoader/Scripts/Runtime/Utility/DownloadSpeedCalculator.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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