首次提交
This commit is contained in:
59
Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs
Normal file
59
Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC.Asset
|
||||
{
|
||||
public static class Const
|
||||
{
|
||||
public const string BundleDirName = "Bundles";
|
||||
public const string VersionFileName = "version.json";
|
||||
|
||||
public static bool IsWebGLPlatform => Application.platform == RuntimePlatform.WebGLPlayer;
|
||||
|
||||
|
||||
public static readonly string SavePath =
|
||||
$"{Application.persistentDataPath}{Path.DirectorySeparatorChar}{BundleDirName}{Path.DirectorySeparatorChar}";
|
||||
|
||||
public static readonly string StreamingAssetsPath =
|
||||
$"{Application.streamingAssetsPath}{Path.DirectorySeparatorChar}";
|
||||
|
||||
public static string RemoteUrl = "http://127.0.0.1:8181/";
|
||||
|
||||
public static bool Offline;
|
||||
public static bool Simulate;
|
||||
public static bool NotCache;
|
||||
|
||||
public static int DownloadTimeOut = 10;
|
||||
|
||||
|
||||
public static string GetStreamingPath(string file)
|
||||
{
|
||||
return $"{StreamingAssetsPath}{file}";
|
||||
}
|
||||
|
||||
public static string GetCachePath(string file)
|
||||
{
|
||||
if (NotCache)
|
||||
{
|
||||
return GetStreamingPath(file);
|
||||
}
|
||||
|
||||
return $"{SavePath}{file}";
|
||||
}
|
||||
|
||||
public static string GetCacheTempPath(string file)
|
||||
{
|
||||
return $"{SavePath}{file}.temp";
|
||||
}
|
||||
|
||||
public static string GetRemotePath(string file)
|
||||
{
|
||||
if (!Application.isEditor && IsWebGLPlatform)
|
||||
{
|
||||
return $"{RemoteUrl}/{file}";
|
||||
}
|
||||
|
||||
return $"{RemoteUrl}{BundleDirName}/{file}";
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs.meta
Normal file
3
Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de19e53b3f774094918543bbbc7318a0
|
||||
timeCreated: 1624159347
|
||||
Reference in New Issue
Block a user