```
feat(gameplay): 更新单位属性和材质配置 - 调整多个单位的基础生命值和攻击力数值平衡 - 修改CoreBattleGround材质的纹理缩放比例 - 更新地砖材质颜色为白色 - 优化纹理资源设置,调整最大纹理尺寸并添加PlayableAds平台支持 - 修复弓箭手技能目标查找逻辑,改用统一的敌人检测方法 - 为水晶矿添加中立阵营设置和光球视觉效果同步 - 调整预制体中的全局缩放参数 - 为狼人和石巨人添加NavMeshAgent组件支持 - 优化水晶矿血条显示位置计算方式 ```
This commit is contained in:
1 parent
0e7de5f885
commit
53d95802e5
448 files changed
+133333
-472
No files matched your search
+74
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Codely.Newtonsoft.Json.Linq;
|
||||
using UnityTcp.Editor.Helpers;
|
||||
using UnityTcp.Editor.Tools.Jobs;
|
||||
|
||||
namespace UnityTcp.Editor.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// [EXPERIMENTAL] Handles Unity Package Manager (UPM) operations.
|
||||
/// Supports installing, removing, and querying packages.
|
||||
/// Compatible with Unity 2022.3 LTS.
|
||||
///
|
||||
/// Every action runs as a <see cref="StepJob"/> and answers only when the operation has
|
||||
/// actually finished — see <see cref="UpmJob"/> for why installing and removing cannot be
|
||||
/// tracked any other way (UPM reloads the domain, which used to destroy the in-flight request
|
||||
/// and its update callback and strand the job as Pending).
|
||||
/// </summary>
|
||||
public static class ManagePackage
|
||||
{
|
||||
// UPM resolution reloads the domain, so the whole operation runs as a StepJob and answers
|
||||
// once it has actually finished. 300s covers a registry fetch plus the reload it triggers.
|
||||
private const int DefaultTimeoutSeconds = 300;
|
||||
|
||||
private static object Run(StepJob job, JObject @params)
|
||||
=> StepJobRunner.Start(
|
||||
CommandContext.RequestId, CommandContext.CommandType, job,
|
||||
@params["timeoutSeconds"]?.ToObject<int?>() ?? DefaultTimeoutSeconds);
|
||||
|
||||
private static readonly Dictionary<string, Func<JObject, object>> ActionHandlers =
|
||||
new Dictionary<string, Func<JObject, object>>
|
||||
{
|
||||
{ "install_package", InstallPackage },
|
||||
{ "remove_package", RemovePackage },
|
||||
{ "list_packages", p => Run(new ListPackagesJob(), p) },
|
||||
};
|
||||
|
||||
public static object HandleCommand(JObject @params)
|
||||
=> ActionRouter.Route(@params, ActionHandlers);
|
||||
|
||||
private static object InstallPackage(JObject @params)
|
||||
{
|
||||
string idOrUrl = @params["id_or_url"]?.ToString();
|
||||
string version = @params["version"]?.ToString();
|
||||
|
||||
// "com.unity.package" + "1.2.3" -> "com.unity.package@1.2.3"
|
||||
if (!string.IsNullOrEmpty(version) &&
|
||||
!string.IsNullOrEmpty(idOrUrl) &&
|
||||
!idOrUrl.Contains("@") &&
|
||||
!idOrUrl.StartsWith("http"))
|
||||
{
|
||||
idOrUrl = $"{idOrUrl}@{version}";
|
||||
}
|
||||
|
||||
return Run(new UpmJob
|
||||
{
|
||||
Remove = false,
|
||||
Target = idOrUrl,
|
||||
PackageName = UpmJob.RegistryNameOf(idOrUrl),
|
||||
}, @params);
|
||||
}
|
||||
|
||||
private static object RemovePackage(JObject @params)
|
||||
{
|
||||
string packageName = @params["package_name"]?.ToString();
|
||||
return Run(new UpmJob
|
||||
{
|
||||
Remove = true,
|
||||
Target = packageName,
|
||||
PackageName = packageName,
|
||||
}, @params);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user