Merge branch 'master' into LouDi_Pig
This commit is contained in:
commit
f429a4d202
@ -7,10 +7,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace QFramework
|
namespace QFramework
|
||||||
{
|
{
|
||||||
public class ResSearchKeys : IPoolable,IPoolType
|
public class ResSearchKeys : IPoolable, IPoolType
|
||||||
{
|
{
|
||||||
public string AssetName { get; set; }
|
public string AssetName { get; set; }
|
||||||
|
|
||||||
@ -24,7 +25,20 @@ namespace QFramework
|
|||||||
public static ResSearchKeys Allocate(string assetName, string ownerBundleName = null, Type assetType = null)
|
public static ResSearchKeys Allocate(string assetName, string ownerBundleName = null, Type assetType = null)
|
||||||
{
|
{
|
||||||
var resSearchRule = SafeObjectPool<ResSearchKeys>.Instance.Allocate();
|
var resSearchRule = SafeObjectPool<ResSearchKeys>.Instance.Allocate();
|
||||||
|
|
||||||
|
if (assetName.Contains("netimage:") ||
|
||||||
|
assetName.Contains("localimage:") ||
|
||||||
|
assetName.Contains("localaudio:") ||
|
||||||
|
assetName.Contains("localtext:") ||
|
||||||
|
assetName.Contains("localbytes:"))
|
||||||
|
{
|
||||||
|
// 暂时这样写死处理
|
||||||
|
resSearchRule.AssetName = assetName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
resSearchRule.AssetName = assetName.ToLower();
|
resSearchRule.AssetName = assetName.ToLower();
|
||||||
|
}
|
||||||
resSearchRule.OwnerBundle = ownerBundleName == null ? null : ownerBundleName.ToLower();
|
resSearchRule.OwnerBundle = ownerBundleName == null ? null : ownerBundleName.ToLower();
|
||||||
resSearchRule.AssetType = assetType;
|
resSearchRule.AssetType = assetType;
|
||||||
resSearchRule.OriginalAssetName = assetName;
|
resSearchRule.OriginalAssetName = assetName;
|
||||||
|
|||||||
@ -60,7 +60,6 @@ public class TimeLineAction : IAction
|
|||||||
|
|
||||||
public void OnExecute(float dt)
|
public void OnExecute(float dt)
|
||||||
{
|
{
|
||||||
Debug.LogError($"time:{play.time * fps} >= curEnd:{curEndFrame} ");
|
|
||||||
if (curEndFrame != -1 && play.time * fps >= curEndFrame)
|
if (curEndFrame != -1 && play.time * fps >= curEndFrame)
|
||||||
{
|
{
|
||||||
play.time = curEndFrame / 24;
|
play.time = curEndFrame / 24;
|
||||||
@ -69,7 +68,6 @@ public class TimeLineAction : IAction
|
|||||||
}
|
}
|
||||||
if (play.state != PlayState.Playing)
|
if (play.state != PlayState.Playing)
|
||||||
{
|
{
|
||||||
Debug.LogError("Finished");
|
|
||||||
Finished();
|
Finished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
using UnityEditor.Build;
|
using UnityEditor.Build;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -18,7 +20,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
|
|||||||
if (Directory.Exists(dataFolderPath))
|
if (Directory.Exists(dataFolderPath))
|
||||||
{
|
{
|
||||||
// 目标目录强制小写
|
// 目标目录强制小写
|
||||||
string targetDataPath = Path.Combine(buildOutputPath, "data");
|
string targetDataPath = Path.Combine(buildOutputPath, "Data");
|
||||||
CopyDirectoryWithLowerCaseNames(dataFolderPath, targetDataPath);
|
CopyDirectoryWithLowerCaseNames(dataFolderPath, targetDataPath);
|
||||||
Debug.Log($"数据目录已复制到: {targetDataPath}");
|
Debug.Log($"数据目录已复制到: {targetDataPath}");
|
||||||
}
|
}
|
||||||
@ -26,6 +28,72 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
|
|||||||
{
|
{
|
||||||
Debug.LogWarning("未找到数据目录: " + dataFolderPath);
|
Debug.LogWarning("未找到数据目录: " + dataFolderPath);
|
||||||
}
|
}
|
||||||
|
DeletAssetBundle(buildOutputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除不属于当前平台的资源
|
||||||
|
/// </summary>
|
||||||
|
public void DeletAssetBundle(string buildOutPutPath)
|
||||||
|
{
|
||||||
|
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebGL)
|
||||||
|
{
|
||||||
|
string path = Path.Combine(buildOutPutPath, "StreamingAssets", "AssetBundles");
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
string[] allDirectories = Directory.GetDirectories(path);
|
||||||
|
foreach (string dir in allDirectories)
|
||||||
|
{
|
||||||
|
string dirName = Path.GetFileName(dir);
|
||||||
|
if (!dirName.Equals("WebGL", StringComparison.OrdinalIgnoreCase)) // 忽略大小写
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(dir, true);
|
||||||
|
Debug.Log($"Deleted directory: {dir}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Failed to delete {dir}: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"Directory not found: {path}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows|| EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
|
||||||
|
{
|
||||||
|
string path = Path.Combine(buildOutPutPath, "VirtualFramwork_Data", "StreamingAssets", "AssetBundles");
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
string[] allDirectories = Directory.GetDirectories(path);
|
||||||
|
foreach (string dir in allDirectories)
|
||||||
|
{
|
||||||
|
string dirName = Path.GetFileName(dir);
|
||||||
|
if (!dirName.Equals("Windows", StringComparison.OrdinalIgnoreCase)) // 忽略大小写
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(dir, true);
|
||||||
|
Debug.Log($"Deleted directory: {dir}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Failed to delete {dir}: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"Directory not found: {path}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetValidBuildPath(BuildReport report)
|
private string GetValidBuildPath(BuildReport report)
|
||||||
@ -41,23 +109,25 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
|
|||||||
private void CopyDirectoryWithLowerCaseNames(string sourceDir, string targetDir)
|
private void CopyDirectoryWithLowerCaseNames(string sourceDir, string targetDir)
|
||||||
{
|
{
|
||||||
// 创建小写目标目录
|
// 创建小写目标目录
|
||||||
var lowerTargetDir = ConvertToLowerPath(targetDir);
|
//var lowerTargetDir = ConvertToLowerPath(targetDir);
|
||||||
Directory.CreateDirectory(lowerTargetDir);
|
Directory.CreateDirectory(targetDir);
|
||||||
|
|
||||||
// 复制文件(带小写转换)
|
// 复制文件(带小写转换)
|
||||||
foreach (var file in Directory.GetFiles(sourceDir))
|
foreach (var file in Directory.GetFiles(sourceDir))
|
||||||
{
|
{
|
||||||
string fileName = Path.GetFileName(file);
|
string fileName = Path.GetFileName(file);
|
||||||
string lowerName = ConvertToLowerPath(fileName);
|
// 暂时废弃小写转换
|
||||||
File.Copy(file, Path.Combine(lowerTargetDir, lowerName), true);
|
//string lowerName = ConvertToLowerPath(fileName);
|
||||||
|
File.Copy(file, Path.Combine(targetDir, fileName), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 递归处理子目录(带小写转换)
|
// 递归处理子目录(带小写转换)
|
||||||
foreach (var dir in Directory.GetDirectories(sourceDir))
|
foreach (var dir in Directory.GetDirectories(sourceDir))
|
||||||
{
|
{
|
||||||
string dirName = Path.GetFileName(dir);
|
string dirName = Path.GetFileName(dir);
|
||||||
string lowerDirName = ConvertToLowerPath(dirName);
|
// 暂时废弃小写转换
|
||||||
CopyDirectoryWithLowerCaseNames(dir, Path.Combine(lowerTargetDir, lowerDirName));
|
//string lowerDirName = ConvertToLowerPath(dirName);
|
||||||
|
CopyDirectoryWithLowerCaseNames(dir, Path.Combine(targetDir, dirName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,11 @@ public class Global : Singleton<Global>
|
|||||||
public XMLTool.AppData appData;
|
public XMLTool.AppData appData;
|
||||||
public Module curModule;
|
public Module curModule;
|
||||||
public Body3D.Body cur3DPart;
|
public Body3D.Body cur3DPart;
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
public static string dataPath = Application.dataPath + "/Data";
|
||||||
|
#else
|
||||||
public static string dataPath = Application.dataPath + "/../Data";
|
public static string dataPath = Application.dataPath + "/../Data";
|
||||||
|
#endif
|
||||||
public static string deviceIconsPath = dataPath + "/DeviceIcons/";
|
public static string deviceIconsPath = dataPath + "/DeviceIcons/";
|
||||||
public static string audioPath = dataPath + "/Audio/";
|
public static string audioPath = dataPath + "/Audio/";
|
||||||
public static string appXmlPath = dataPath + "/App.xml";
|
public static string appXmlPath = dataPath + "/App.xml";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user