New Version 1.42

Moving cam replay.
Fixed the bugs.

New Version 1.42

Moving cam replay.
Fixed the bugs.

New Version 1.42

Moving cam replay,
Fixed the bugs.
This commit is contained in:
SkunkStudios 2025-01-29 09:54:37 +07:00
parent dcb7df5fd1
commit 1c033119df
7079 changed files with 186851 additions and 48991 deletions

View file

@ -0,0 +1,34 @@
using System;
using UnityEditor.PackageManager.Requests;
using System.Linq;
namespace UnityEditor.PackageManager.UI
{
internal class UpmAddOperation : UpmBaseOperation, IAddOperation
{
public PackageInfo PackageInfo { get; protected set; }
public event Action<PackageInfo> OnOperationSuccess = delegate { };
public void AddPackageAsync(PackageInfo packageInfo, Action<PackageInfo> doneCallbackAction = null, Action<Error> errorCallbackAction = null)
{
PackageInfo = packageInfo;
OnOperationError += errorCallbackAction;
OnOperationSuccess += doneCallbackAction;
Start();
}
protected override Request CreateRequest()
{
return Client.Add(PackageInfo.PackageId);
}
protected override void ProcessData()
{
var request = CurrentRequest as AddRequest;
var package = FromUpmPackageInfo(request.Result).First();
OnOperationSuccess(package);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9f091dea68a1452cb6c04a6dfa73d5f5
timeCreated: 1504190581

View file

@ -0,0 +1,229 @@
using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using Semver;
using UnityEngine;
using UnityEditor.PackageManager.Requests;
namespace UnityEditor.PackageManager.UI
{
internal abstract class UpmBaseOperation : IBaseOperation
{
public static string GroupName(PackageSource origin)
{
var group = PackageGroupOrigins.Packages.ToString();
if (origin == PackageSource.BuiltIn)
group = PackageGroupOrigins.BuiltInPackages.ToString();
return group;
}
protected static IEnumerable<PackageInfo> FromUpmPackageInfo(PackageManager.PackageInfo info, bool isCurrent=true)
{
var packages = new List<PackageInfo>();
var displayName = info.displayName;
if (string.IsNullOrEmpty(displayName))
{
displayName = info.name.Replace("com.unity.modules.", "");
displayName = displayName.Replace("com.unity.", "");
displayName = new CultureInfo("en-US").TextInfo.ToTitleCase(displayName);
}
string author = info.author.name;
if (string.IsNullOrEmpty(info.author.name) && info.name.StartsWith("com.unity."))
author = "Unity Technologies Inc.";
var lastCompatible = info.versions.latestCompatible;
var versions = new List<string>();
versions.AddRange(info.versions.compatible);
if (versions.FindIndex(version => version == info.version) == -1)
{
versions.Add(info.version);
versions.Sort((left, right) =>
{
if (left == null || right == null) return 0;
SemVersion leftVersion = left;
SemVersion righVersion = right;
return leftVersion.CompareByPrecedence(righVersion);
});
SemVersion packageVersion = info.version;
if (!string.IsNullOrEmpty(lastCompatible))
{
SemVersion lastCompatibleVersion =
string.IsNullOrEmpty(lastCompatible) ? (SemVersion) null : lastCompatible;
if (packageVersion != null && string.IsNullOrEmpty(packageVersion.Prerelease) &&
packageVersion.CompareByPrecedence(lastCompatibleVersion) > 0)
lastCompatible = info.version;
}
else
{
if (packageVersion != null && string.IsNullOrEmpty(packageVersion.Prerelease))
lastCompatible = info.version;
}
}
foreach(var version in versions)
{
var isVersionCurrent = version == info.version && isCurrent;
var isBuiltIn = info.source == PackageSource.BuiltIn;
var isVerified = string.IsNullOrEmpty(SemVersion.Parse(version).Prerelease) && version == info.versions.recommended;
var state = (isBuiltIn || info.version == lastCompatible || !isCurrent ) ? PackageState.UpToDate : PackageState.Outdated;
// Happens mostly when using a package that hasn't been in production yet.
if (info.versions.all.Length <= 0)
state = PackageState.UpToDate;
if (info.errors.Length > 0)
state = PackageState.Error;
var packageInfo = new PackageInfo
{
Name = info.name,
DisplayName = displayName,
PackageId = version == info.version ? info.packageId : null,
Version = version,
Description = info.description,
Category = info.category,
IsCurrent = isVersionCurrent,
IsLatest = version == lastCompatible,
IsVerified = isVerified,
Errors = info.errors.ToList(),
Group = GroupName(info.source),
State = state,
Origin = isBuiltIn || isVersionCurrent ? info.source : PackageSource.Registry,
Author = author,
Info = info
};
packages.Add(packageInfo);
}
return packages;
}
public static event Action<UpmBaseOperation> OnOperationStart = delegate { };
public event Action<Error> OnOperationError = delegate { };
public event Action OnOperationFinalized = delegate { };
public Error ForceError { get; set; } // Allow external component to force an error on the requests (eg: testing)
public Error Error { get; protected set; } // Keep last error
public bool IsCompleted { get; private set; }
protected abstract Request CreateRequest();
[SerializeField]
protected Request CurrentRequest;
public readonly ThreadedDelay Delay = new ThreadedDelay();
protected abstract void ProcessData();
protected void Start()
{
Error = null;
OnOperationStart(this);
Delay.Start();
if (TryForcedError())
return;
EditorApplication.update += Progress;
}
// Common progress code for all classes
private void Progress()
{
if (!Delay.IsDone)
return;
// Create the request after the delay
if (CurrentRequest == null)
{
CurrentRequest = CreateRequest();
}
// Since CurrentRequest's error property is private, we need to simulate
// an error instead of just setting it.
if (TryForcedError())
return;
if (CurrentRequest.IsCompleted)
{
if (CurrentRequest.Status == StatusCode.Success)
OnDone();
else if (CurrentRequest.Status >= StatusCode.Failure)
OnError(CurrentRequest.Error);
else
Debug.LogError("Unsupported progress state " + CurrentRequest.Status);
}
}
private void OnError(Error error)
{
try
{
Error = error;
var message = "Cannot perform upm operation.";
if (error != null)
message = "Cannot perform upm operation: " + Error.message + " [" + Error.errorCode + "]";
Debug.LogError(message);
OnOperationError(Error);
}
catch (Exception exception)
{
Debug.LogError("Package Manager Window had an error while reporting an error in an operation: " + exception);
}
FinalizeOperation();
}
private void OnDone()
{
try
{
ProcessData();
}
catch (Exception error)
{
Debug.LogError("Package Manager Window had an error while completing an operation: " + error);
}
FinalizeOperation();
}
private void FinalizeOperation()
{
EditorApplication.update -= Progress;
OnOperationFinalized();
IsCompleted = true;
}
public void Cancel()
{
EditorApplication.update -= Progress;
OnOperationError = delegate { };
OnOperationFinalized = delegate { };
IsCompleted = true;
}
private bool TryForcedError()
{
if (ForceError != null)
{
OnError(ForceError);
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4e830e2dbc3315b4b97cd5311a54e4fe
timeCreated: 1502918867
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.PackageManager.Requests;
namespace UnityEditor.PackageManager.UI
{
internal class UpmListOperation : UpmBaseOperation, IListOperation
{
[SerializeField]
private Action<IEnumerable<PackageInfo>> _doneCallbackAction;
public UpmListOperation(bool offlineMode) : base()
{
OfflineMode = offlineMode;
}
public bool OfflineMode { get; set; }
public void GetPackageListAsync(Action<IEnumerable<PackageInfo>> doneCallbackAction, Action<Error> errorCallbackAction = null)
{
this._doneCallbackAction = doneCallbackAction;
OnOperationError += errorCallbackAction;
Start();
}
protected override Request CreateRequest()
{
return Client.List(OfflineMode);
}
protected override void ProcessData()
{
var request = CurrentRequest as ListRequest;
var packages = new List<PackageInfo>();
foreach (var upmPackage in request.Result)
{
var packageInfos = FromUpmPackageInfo(upmPackage);
packages.AddRange(packageInfos);
}
_doneCallbackAction(packages);
}
}
}

View file

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 9a2c874c382e2419184b302497279dd9
timeCreated: 1502224642
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,25 @@
namespace UnityEditor.PackageManager.UI
{
internal class UpmOperationFactory : IOperationFactory
{
public IListOperation CreateListOperation(bool offlineMode = false)
{
return new UpmListOperation(offlineMode);
}
public ISearchOperation CreateSearchOperation()
{
return new UpmSearchOperation();
}
public IAddOperation CreateAddOperation()
{
return new UpmAddOperation();
}
public IRemoveOperation CreateRemoveOperation()
{
return new UpmRemoveOperation();
}
}
}

View file

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e6925bb38494e6a43ba0921e65e424fe
timeCreated: 1502915478
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,33 @@
using System;
using UnityEngine;
using UnityEditor.PackageManager.Requests;
namespace UnityEditor.PackageManager.UI
{
internal class UpmRemoveOperation : UpmBaseOperation, IRemoveOperation
{
[SerializeField]
private PackageInfo _package;
public event Action<PackageInfo> OnOperationSuccess = delegate { };
public void RemovePackageAsync(PackageInfo package, Action<PackageInfo> doneCallbackAction = null, Action<Error> errorCallbackAction = null)
{
_package = package;
OnOperationError += errorCallbackAction;
OnOperationSuccess += doneCallbackAction;
Start();
}
protected override Request CreateRequest()
{
return Client.Remove(_package.Name);
}
protected override void ProcessData()
{
OnOperationSuccess(_package);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5a61f8cc87394b28aec6b88b4083217
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.PackageManager.Requests;
namespace UnityEditor.PackageManager.UI
{
internal class UpmSearchOperation : UpmBaseOperation, ISearchOperation
{
[SerializeField]
private Action<IEnumerable<PackageInfo>> _doneCallbackAction;
public void GetAllPackageAsync(Action<IEnumerable<PackageInfo>> doneCallbackAction = null, Action<Error> errorCallbackAction = null)
{
_doneCallbackAction = doneCallbackAction;
OnOperationError += errorCallbackAction;
Start();
}
protected override Request CreateRequest()
{
return Client.SearchAll();
}
protected override void ProcessData()
{
var request = CurrentRequest as SearchRequest;
var packages = new List<PackageInfo>();
foreach (var upmPackage in request.Result)
{
var packageInfos = FromUpmPackageInfo(upmPackage, false);
packages.AddRange(packageInfos);
}
_doneCallbackAction(packages);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ef5a2781610c4f12a79939f717f789cf
timeCreated: 1508160183