Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Libraries/GameFramework.dll
Binary file not shown.
15 changes: 15 additions & 0 deletions Libraries/GameFramework.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14669,6 +14669,11 @@
获取当前是否正在播放。
</summary>
</member>
<member name="P:GameFramework.Sound.ISoundAgent.Length">
<summary>
获取声音长度。
</summary>
</member>
<member name="P:GameFramework.Sound.ISoundAgent.Time">
<summary>
获取或设置播放位置。
Expand Down Expand Up @@ -14793,6 +14798,11 @@
获取当前是否正在播放。
</summary>
</member>
<member name="P:GameFramework.Sound.ISoundAgentHelper.Length">
<summary>
获取声音长度。
</summary>
</member>
<member name="P:GameFramework.Sound.ISoundAgentHelper.Time">
<summary>
获取或设置播放位置。
Expand Down Expand Up @@ -15784,6 +15794,11 @@
获取当前是否正在播放。
</summary>
</member>
<member name="P:GameFramework.Sound.SoundManager.SoundAgent.Length">
<summary>
获取声音长度。
</summary>
</member>
<member name="P:GameFramework.Sound.SoundManager.SoundAgent.Time">
<summary>
获取或设置播放位置。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ private byte[] GetXorBytes(byte[] bytes, byte[] code, int length)
}

byte[] result = new byte[bytesLength];
System.Buffer.BlockCopy(bytes, 0, result, 0, bytesLength);
Buffer.BlockCopy(bytes, 0, result, 0, bytesLength);

for (int i = 0; i < length; i++)
{
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Editor/AssetBundleEditor/AssetBundleEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,15 @@ private void RefreshAssetBundleTree()
AssetBundle[] assetBundles = m_Controller.GetAssetBundles();
foreach (AssetBundle assetBundle in assetBundles)
{
string[] splitedPath = assetBundle.Name.Split('/');
string[] splitPath = assetBundle.Name.Split('/');
AssetBundleFolder folder = m_AssetBundleRoot;
for (int i = 0; i < splitedPath.Length - 1; i++)
for (int i = 0; i < splitPath.Length - 1; i++)
{
AssetBundleFolder subFolder = folder.GetFolder(splitedPath[i]);
folder = subFolder == null ? folder.AddFolder(splitedPath[i]) : subFolder;
AssetBundleFolder subFolder = folder.GetFolder(splitPath[i]);
folder = subFolder == null ? folder.AddFolder(splitPath[i]) : subFolder;
}

string assetBundleFullName = assetBundle.Variant != null ? Utility.Text.Format("{0}.{1}", splitedPath[splitedPath.Length - 1], assetBundle.Variant) : splitedPath[splitedPath.Length - 1];
string assetBundleFullName = assetBundle.Variant != null ? Utility.Text.Format("{0}.{1}", splitPath[splitPath.Length - 1], assetBundle.Variant) : splitPath[splitPath.Length - 1];
folder.AddItem(assetBundleFullName, assetBundle);
}
}
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Editor/AssetBundleEditor/AssetBundleEditorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,15 +556,15 @@ public void ScanSourceAssets()
}

string assetPath = fullPath.Substring(SourceAssetRootPath.Length + 1);
string[] splitedPath = assetPath.Split('/');
string[] splitPath = assetPath.Split('/');
SourceFolder folder = m_SourceAssetRoot;
for (int i = 0; i < splitedPath.Length - 1; i++)
for (int i = 0; i < splitPath.Length - 1; i++)
{
SourceFolder subFolder = folder.GetFolder(splitedPath[i]);
folder = subFolder == null ? folder.AddFolder(splitedPath[i]) : subFolder;
SourceFolder subFolder = folder.GetFolder(splitPath[i]);
folder = subFolder == null ? folder.AddFolder(splitPath[i]) : subFolder;
}

SourceAsset asset = folder.AddAsset(assetGuid, fullPath, splitedPath[splitedPath.Length - 1]);
SourceAsset asset = folder.AddAsset(assetGuid, fullPath, splitPath[splitPath.Length - 1]);
m_SourceAssets.Add(asset.Guid, asset);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Runtime/Config/DefaultConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace UnityGameFramework.Runtime
/// </summary>
public class DefaultConfigHelper : ConfigHelperBase
{
private static readonly string[] RowSplit = new string[] { "\r\n", "\r", "\n" };
private static readonly string[] ColumnSplit = new string[] { "\t" };
private static readonly string[] RowSplitSeparator = new string[] { "\r\n", "\r", "\n" };
private static readonly string[] ColumnSplitSeparator = new string[] { "\t" };
private const int ColumnCount = 4;

private ResourceComponent m_ResourceComponent = null;
Expand All @@ -35,15 +35,15 @@ public override bool ParseConfig(string text, object userData)
{
try
{
string[] rowTexts = text.Split(RowSplit, StringSplitOptions.None);
string[] rowTexts = text.Split(RowSplitSeparator, StringSplitOptions.None);
for (int i = 0; i < rowTexts.Length; i++)
{
if (rowTexts[i].Length <= 0 || rowTexts[i][0] == '#')
{
continue;
}

string[] splitLine = rowTexts[i].Split(ColumnSplit, StringSplitOptions.None);
string[] splitLine = rowTexts[i].Split(ColumnSplitSeparator, StringSplitOptions.None);
if (splitLine.Length != ColumnCount)
{
Log.Warning("Can not parse config '{0}'.", text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#else
using UnityEngine.Experimental.Networking;
#endif
using Utility = GameFramework.Utility;

namespace UnityGameFramework.Runtime
{
Expand Down Expand Up @@ -111,7 +112,7 @@ public override void Download(string downloadUri, int fromPosition, object userD

Dictionary<string, string> header = new Dictionary<string, string>
{
{ "Range", GameFramework.Utility.Text.Format("bytes={0}-", fromPosition.ToString()) }
{ "Range", Utility.Text.Format("bytes={0}-", fromPosition.ToString()) }
};

m_UnityWebRequest = UnityWebRequest.Post(downloadUri, header);
Expand Down Expand Up @@ -139,7 +140,7 @@ public override void Download(string downloadUri, int fromPosition, int toPositi

Dictionary<string, string> header = new Dictionary<string, string>
{
{ "Range", GameFramework.Utility.Text.Format("bytes={0}-{1}", fromPosition.ToString(), toPosition.ToString()) }
{ "Range", Utility.Text.Format("bytes={0}-{1}", fromPosition.ToString(), toPosition.ToString()) }
};

m_UnityWebRequest = UnityWebRequest.Post(downloadUri, header);
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Runtime/Entity/EntityLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public bool Visible
{
if (!m_Available)
{
throw new GameFrameworkException(Utility.Text.Format("Entity '{0}' is not available.", Name));
Log.Warning("Entity '{0}' is not available.", Name);
return;
}

if (m_Visible == value)
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Runtime/Localization/DefaultLocalizationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace UnityGameFramework.Runtime
/// </summary>
public class DefaultLocalizationHelper : LocalizationHelperBase
{
private static readonly string[] RowSplit = new string[] { "\r\n", "\r", "\n" };
private static readonly string[] ColumnSplit = new string[] { "\t" };
private static readonly string[] RowSplitSeparator = new string[] { "\r\n", "\r", "\n" };
private static readonly string[] ColumnSplitSeparator = new string[] { "\t" };
private const int ColumnCount = 4;

private ResourceComponent m_ResourceComponent = null;
Expand Down Expand Up @@ -92,15 +92,15 @@ public override bool ParseDictionary(string text, object userData)
{
try
{
string[] rowTexts = text.Split(RowSplit, StringSplitOptions.None);
string[] rowTexts = text.Split(RowSplitSeparator, StringSplitOptions.None);
for (int i = 0; i < rowTexts.Length; i++)
{
if (rowTexts[i].Length <= 0 || rowTexts[i][0] == '#')
{
continue;
}

string[] splitLine = rowTexts[i].Split(ColumnSplit, StringSplitOptions.None);
string[] splitLine = rowTexts[i].Split(ColumnSplitSeparator, StringSplitOptions.None);
if (splitLine.Length != ColumnCount)
{
Log.Warning("Can not parse dictionary '{0}'.", text);
Expand Down
11 changes: 6 additions & 5 deletions Scripts/Runtime/Resource/DefaultLoadResourceAgentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using UnityEngine.Networking;
#endif
using UnityEngine.SceneManagement;
using Utility = GameFramework.Utility;

namespace UnityGameFramework.Runtime
{
Expand Down Expand Up @@ -164,7 +165,7 @@ public override void ReadBytes(string fullPath, int loadType)
m_BytesFullPath = fullPath;
m_LoadType = loadType;
#if UNITY_5_4_OR_NEWER
m_UnityWebRequest = UnityWebRequest.Get(GameFramework.Utility.Path.GetRemotePath(fullPath));
m_UnityWebRequest = UnityWebRequest.Get(Utility.Path.GetRemotePath(fullPath));
#if UNITY_2017_2_OR_NEWER
m_UnityWebRequest.SendWebRequest();
#else
Expand Down Expand Up @@ -344,7 +345,7 @@ private void UpdateUnityWebRequest()
#else
isError = m_UnityWebRequest.isError;
#endif
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.NotExist, GameFramework.Utility.Text.Format("Can not load asset bundle '{0}' with error message '{1}'.", m_BytesFullPath, isError ? m_UnityWebRequest.error : null)));
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.NotExist, Utility.Text.Format("Can not load asset bundle '{0}' with error message '{1}'.", m_BytesFullPath, isError ? m_UnityWebRequest.error : null)));
}
}
else
Expand Down Expand Up @@ -399,7 +400,7 @@ private void UpdateFileAssetBundleCreateRequest()
}
else
{
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.NotExist, GameFramework.Utility.Text.Format("Can not load asset bundle from file '{0}' which is not a valid asset bundle.", m_FileFullPath)));
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.NotExist, Utility.Text.Format("Can not load asset bundle from file '{0}' which is not a valid asset bundle.", m_FileFullPath)));
}
}
else
Expand Down Expand Up @@ -451,7 +452,7 @@ private void UpdateAssetBundleRequest()
}
else
{
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.ChildAssetError, GameFramework.Utility.Text.Format("Can not load asset '{0}' from asset bundle which is not exist.", m_ResourceChildName)));
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.ChildAssetError, Utility.Text.Format("Can not load asset '{0}' from asset bundle which is not exist.", m_ResourceChildName)));
}
}
else
Expand All @@ -475,7 +476,7 @@ private void UpdateAsyncOperation()
}
else
{
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.SceneAssetError, GameFramework.Utility.Text.Format("Can not load scene asset '{0}' from asset bundle.", m_ResourceChildName)));
m_LoadResourceAgentHelperErrorEventHandler(this, new LoadResourceAgentHelperErrorEventArgs(LoadResourceStatus.SceneAssetError, Utility.Text.Format("Can not load scene asset '{0}' from asset bundle.", m_ResourceChildName)));
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Runtime/Resource/EditorResourceComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,11 @@ private bool ExistsFile(string assetName)
return false;
}

string[] splitedAssetFullName = assetFullName.Split('/');
string[] splitAssetFullName = assetFullName.Split('/');
string currentPath = Path.GetPathRoot(assetFullName);
for (int i = 1; i < splitedAssetFullName.Length - 1; i++)
for (int i = 1; i < splitAssetFullName.Length - 1; i++)
{
string[] directoryNames = Directory.GetDirectories(currentPath, splitedAssetFullName[i]);
string[] directoryNames = Directory.GetDirectories(currentPath, splitAssetFullName[i]);
if (directoryNames.Length != 1)
{
return false;
Expand All @@ -1045,7 +1045,7 @@ private bool ExistsFile(string assetName)
currentPath = directoryNames[0];
}

string[] fileNames = Directory.GetFiles(currentPath, splitedAssetFullName[splitedAssetFullName.Length - 1]);
string[] fileNames = Directory.GetFiles(currentPath, splitAssetFullName[splitAssetFullName.Length - 1]);
if (fileNames.Length != 1)
{
return false;
Expand Down
11 changes: 11 additions & 0 deletions Scripts/Runtime/Sound/DefaultSoundAgentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public override bool IsPlaying
}
}

/// <summary>
/// 获取声音长度。
/// </summary>
public override float Length
{
get
{
return m_AudioSource.clip != null ? m_AudioSource.clip.length : 0f;
}
}

/// <summary>
/// 获取或设置播放位置。
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions Scripts/Runtime/Sound/SoundAgentHelperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ public abstract bool IsPlaying
get;
}

/// <summary>
/// 获取声音长度。
/// </summary>
public abstract float Length
{
get;
}

/// <summary>
/// 获取或设置播放位置。
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Runtime/UI/UIFormLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public bool Visible
{
if (!m_Available)
{
throw new GameFrameworkException(Utility.Text.Format("UI form '{0}' is not available.", Name));
Log.Warning("UI form '{0}' is not available.", Name);
return;
}

if (m_Visible == value)
Expand Down
54 changes: 54 additions & 0 deletions Scripts/Runtime/Variable/VarColor32.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2019 Jiang Yin. All rights reserved.
// Homepage: http://gameframework.cn/
// Feedback: mailto:[email protected]
//------------------------------------------------------------

using GameFramework;
using UnityEngine;

namespace UnityGameFramework.Runtime
{
/// <summary>
/// UnityEngine.Color32 变量类。
/// </summary>
public sealed class VarColor32 : Variable<Color32>
{
/// <summary>
/// 初始化 UnityEngine.Color32 变量类的新实例。
/// </summary>
public VarColor32()
{

}

/// <summary>
/// 初始化 UnityEngine.Color32 变量类的新实例。
/// </summary>
/// <param name="value">值。</param>
public VarColor32(Color32 value)
: base(value)
{

}

/// <summary>
/// 从 UnityEngine.Color32 到 UnityEngine.Color32 变量类的隐式转换。
/// </summary>
/// <param name="value">值。</param>
public static implicit operator VarColor32(Color32 value)
{
return new VarColor32(value);
}

/// <summary>
/// 从 UnityEngine.Color32 变量类到 UnityEngine.Color32 的隐式转换。
/// </summary>
/// <param name="value">值。</param>
public static implicit operator Color32(VarColor32 value)
{
return value.Value;
}
}
}
11 changes: 11 additions & 0 deletions Scripts/Runtime/Variable/VarColor32.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.