Adaug proiectul Unity

This commit is contained in:
2026-11-01 23:39:55 +02:00
parent cb14d9d37d
commit 863eac8f2c
23463 changed files with 5412601 additions and 0 deletions
@@ -0,0 +1,37 @@
using UnityEditor;
using UnityEngine;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal static class DrawProgressForDialogs
{
internal static void For(ProgressControlsForDialogs.Data data)
{
Rect rect = GUILayoutUtility.GetRect(0, 30, GUILayout.ExpandWidth(true));
if (!string.IsNullOrEmpty(data.StatusMessage))
{
EditorGUI.HelpBox(rect, data.StatusMessage, data.StatusType);
return;
}
if (data.IsWaitingAsyncResult)
DoProgressBar(rect, data.ProgressMessage, data.ProgressPercent);
}
static void DoProgressBar(
Rect rect,
string progressMessage,
float progressPercent)
{
Rect messageRect = new Rect(
rect.xMin, rect.yMin + 2, rect.width, 16);
Rect progresRect = new Rect(
rect.xMin, rect.yMin + 20, rect.width, 6);
GUI.Label(messageRect, progressMessage);
EditorGUI.ProgressBar(progresRect, progressPercent, string.Empty);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5c32dc56ff6d08947a329b5c4789c728
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
using UnityEditor;
using UnityEngine;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal static class DrawProgressForOperations
{
internal static void For(
WorkspaceWindow workspaceWindow,
OperationProgressData operationProgressData,
float width)
{
EditorGUILayout.BeginVertical(
EditorStyles.helpBox, GUILayout.Height(60));
GUILayout.Label(
operationProgressData.ProgressHeader ?? string.Empty,
EditorStyles.miniLabel);
DoProgressBar(
operationProgressData.TotalProgressMessage,
(float)operationProgressData.TotalProgressPercent,
operationProgressData.CanCancelProgress, width);
if (operationProgressData.CanCancelProgress)
DoCancelButton(workspaceWindow);
if (operationProgressData.ShowCurrentBlock)
{
GUILayout.Space(6);
DoProgressBar(
operationProgressData.CurrentBlockProgressMessage,
(float)operationProgressData.CurrentBlockProgressPercent,
operationProgressData.CanCancelProgress, width);
}
EditorGUILayout.EndVertical();
}
static void DoProgressBar(
string message,
float progressPercent,
bool canCancel,
float width)
{
Rect progressRect = GUILayoutUtility.GetRect(width, 15);
if (canCancel)
progressRect.width -= UnityConstants.CANCEL_BUTTON_SIZE + 2;
EditorGUI.ProgressBar(progressRect, progressPercent, string.Empty);
progressRect.xMin += 4;
GUI.Label(progressRect, message, EditorStyles.miniLabel);
}
static void DoCancelButton(
WorkspaceWindow workspaceWindow)
{
Rect beginRect = GUILayoutUtility.GetLastRect();
Rect endRect = GUILayoutUtility.GetLastRect();
float freeVerticalSpace = endRect.yMax - beginRect.yMin;
Rect cancelButtonRect = new Rect(
endRect.xMax - UnityConstants.CANCEL_BUTTON_SIZE + 1,
beginRect.yMin + (freeVerticalSpace - UnityConstants.CANCEL_BUTTON_SIZE) / 2,
UnityConstants.CANCEL_BUTTON_SIZE, UnityConstants.CANCEL_BUTTON_SIZE);
if (!GUI.Button(cancelButtonRect, GUIContent.none, UnityStyles.CancelButton))
return;
workspaceWindow.CancelCurrentOperation();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa1cd36edf652db46b5fa11c2ed355b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,119 @@
using UnityEditor;
using UnityEngine;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal static class DrawProgressForViews
{
internal static void ForNotificationArea(
ProgressControlsForViews.Data data)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox(
data.NotificationMessage,
data.NotificationType);
EditorGUILayout.EndHorizontal();
}
internal static void ForDeterminateProgressBar(
ProgressControlsForViews.Data data)
{
ForProgressBar(data, true);
}
static void ForProgressBar(ProgressControlsForViews.Data data, bool showPercentage)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(10);
DoProgressBar(data.ProgressPercent);
GUILayout.Space(3);
DoProgressBarLabel(data, showPercentage);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
internal static void ForIndeterminateProgressSpinner(
ProgressControlsForViews.Data data)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(10);
DoProgressSpinner(data.ProgressPercent);
DoProgressSpinnerLabel(data.ProgressMessage);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void DoProgressBar(float progressPercent)
{
EditorGUILayout.BeginVertical(GUILayout.Height(22));
GUILayout.FlexibleSpace();
Rect progressRect = GUILayoutUtility.GetRect(30, 10);
EditorGUI.ProgressBar(progressRect, progressPercent, string.Empty);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
static void DoProgressSpinner(float progressPercent)
{
EditorGUILayout.BeginVertical(GUILayout.Height(22));
GUILayout.FlexibleSpace();
LoadingSpinner.OnGUI(progressPercent);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
static void DoProgressBarLabel(ProgressControlsForViews.Data data, bool showPercentage)
{
EditorGUILayout.BeginVertical(GUILayout.Height(22));
GUILayout.FlexibleSpace();
GUILayout.Label(
showPercentage ?
string.Format("{0} ({1}%)", data.ProgressMessage, (int)(data.ProgressPercent * 100)) :
data.ProgressMessage,
UnityStyles.ProgressLabel);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
static void DoProgressSpinnerLabel(string progressMessage)
{
EditorGUILayout.BeginVertical(GUILayout.Height(EditorGUIUtility.singleLineHeight));
GUILayout.FlexibleSpace();
GUILayout.Space(1);
GUILayout.Label(progressMessage, UnityStyles.ProgressLabel);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab0090fd6aa8c604a828244d4ba93c84
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,54 @@
using UnityEditor;
using UnityEngine;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal static class DrawProgressForWindow
{
internal static void ForIndeterminateProgress(
ProgressControlsForWindow.Data data)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(3);
DoProgressSpinner(data.ProgressPercent);
DoProgressLabel(data.ProgressMessage);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void DoProgressSpinner(float progressPercent)
{
EditorGUILayout.BeginVertical();
GUILayout.FlexibleSpace();
LoadingSpinner.OnGUI(progressPercent);
GUILayout.Space(1);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
static void DoProgressLabel(string progressMessage)
{
EditorGUILayout.BeginVertical();
GUILayout.Space(1);
GUILayout.FlexibleSpace();
GUILayout.Label(progressMessage, UnityStyles.StatusBar.Label);
GUILayout.FlexibleSpace();
EditorGUILayout.EndVertical();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 22c746898109437d88d4bc5eaa84b89d
timeCreated: 1748960179
@@ -0,0 +1,40 @@
using UnityEngine;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal static class LoadingSpinner
{
internal static void OnGUI(
float progressPercent,
string progressTooltip = null)
{
Matrix4x4 oldMatrix = GUI.matrix;
Rect layoutRect = GUILayoutUtility.GetRect(
SPINNER_SIZE, SPINNER_SIZE);
Rect position = new Rect(
layoutRect.x + (layoutRect.width - SPINNER_SIZE) / 2,
layoutRect.y + (layoutRect.height - SPINNER_SIZE) / 2,
SPINNER_SIZE, SPINNER_SIZE);
Vector2 pivot = new Vector2(
position.x + SPINNER_SIZE / 2f,
position.y + SPINNER_SIZE / 2f);
int rotation = (int)(360 * progressPercent);
GUIUtility.RotateAroundPivot(rotation, pivot);
GUI.Label(
position,
new GUIContent(
Images.GetImage(Images.Name.Loading),
progressTooltip),
UnityStyles.StatusBar.Icon);
GUI.matrix = oldMatrix;
}
const int SPINNER_SIZE = 16;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8cee66aefde0415886a851167a19c933
timeCreated: 1747403475
@@ -0,0 +1,155 @@
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal class OperationProgressData
{
internal string ProgressHeader
{
get
{
lock (mLockGuard)
{
return mProgressHeader;
}
}
set
{
lock (mLockGuard)
{
mProgressHeader = value;
}
}
}
internal string TotalProgressMessage
{
get
{
lock (mLockGuard)
{
return mTotalProgressMessage;
}
}
set
{
lock (mLockGuard)
{
mTotalProgressMessage = value;
}
}
}
internal string CurrentBlockProgressMessage
{
get
{
lock (mLockGuard)
{
return mBlockProgressMessage;
}
}
set
{
lock (mLockGuard)
{
mBlockProgressMessage = value;
}
}
}
internal double TotalProgressPercent
{
get
{
lock (mLockGuard)
{
return mTotalProgressPercent;
}
}
set
{
lock (mLockGuard)
{
mTotalProgressPercent = value;
}
}
}
internal double CurrentBlockProgressPercent
{
get
{
lock (mLockGuard)
{
return mBlockProgressPercent;
}
}
set
{
lock (mLockGuard)
{
mBlockProgressPercent = value;
}
}
}
internal bool ShowCurrentBlock
{
get
{
lock (mLockGuard)
{
return mShowCurrentBlock;
}
}
set
{
lock (mLockGuard)
{
mShowCurrentBlock = value;
}
}
}
internal bool CanCancelProgress
{
get
{
lock (mLockGuard)
{
return mCanCancelProgress;
}
}
set
{
lock (mLockGuard)
{
mCanCancelProgress = value;
}
}
}
internal void ResetProgress()
{
lock (mLockGuard)
{
mProgressHeader = string.Empty;
mTotalProgressMessage = string.Empty;
mBlockProgressMessage = string.Empty;
mTotalProgressPercent = 0;
mBlockProgressPercent = 0;
mShowCurrentBlock = false;
mCanCancelProgress = false;
}
}
string mProgressHeader;
string mTotalProgressMessage;
string mBlockProgressMessage;
double mTotalProgressPercent;
double mBlockProgressPercent;
bool mShowCurrentBlock;
bool mCanCancelProgress;
object mLockGuard = new object();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3e858d866b71d5245b9b869476a487f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,108 @@
using UnityEditor;
using UnityEngine;
using Codice.Client.Common.Authentication;
using PlasticGui;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
class ProgressControlsForDialogs : IProgressControls, IAuthenticationProgressControls
{
internal class Data
{
internal bool IsWaitingAsyncResult;
internal float ProgressPercent;
internal string ProgressMessage;
internal MessageType StatusType;
internal string StatusMessage;
internal void CopyInto(Data other)
{
other.IsWaitingAsyncResult = IsWaitingAsyncResult;
other.ProgressPercent = ProgressPercent;
other.ProgressMessage = ProgressMessage;
other.StatusType = StatusType;
other.StatusMessage = StatusMessage;
}
}
internal Data ProgressData { get { return mData; } }
internal void UpdateProgress(EditorWindow dialog)
{
if (!mData.IsWaitingAsyncResult)
return;
if (Event.current.type == EventType.Repaint)
dialog.Repaint();
}
void IProgressControls.HideProgress()
{
InternalHideProgress();
}
void IAuthenticationProgressControls.HideProgress()
{
InternalHideProgress();
}
void InternalHideProgress()
{
mData.IsWaitingAsyncResult = false;
mData.ProgressMessage = string.Empty;
}
void IProgressControls.ShowProgress(string message)
{
InternalShowProgress(message);
}
void IAuthenticationProgressControls.ShowProgress(string message)
{
InternalShowProgress(message);
}
void InternalShowProgress(string message)
{
CleanStatusMessage(mData);
mData.IsWaitingAsyncResult = true;
mData.ProgressPercent = -1;
mData.ProgressMessage = message;
}
void IProgressControls.ShowError(string message)
{
mData.StatusMessage = message;
mData.StatusType = MessageType.Error;
}
void IProgressControls.ShowNotification(string message)
{
mData.StatusMessage = message;
mData.StatusType = MessageType.Info;
}
void IProgressControls.ShowSuccess(string message)
{
mData.StatusMessage = message;
mData.StatusType = MessageType.Info;
}
void IProgressControls.ShowWarning(string message)
{
mData.StatusMessage = message;
mData.StatusType = MessageType.Warning;
}
static void CleanStatusMessage(Data data)
{
data.StatusMessage = string.Empty;
data.StatusType = MessageType.None;
}
Data mData = new Data();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa3f399d17e1dcf4c9e417ffce5eb905
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,121 @@
using System;
using UnityEditor;
using PlasticGui;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal class ProgressControlsForViews : IProgressControls
{
internal class Data
{
internal bool IsOperationRunning;
internal float ProgressPercent;
internal string ProgressMessage;
internal MessageType NotificationType;
internal string NotificationMessage;
internal void CopyInto(Data other)
{
other.IsOperationRunning = IsOperationRunning;
other.ProgressPercent = ProgressPercent;
other.ProgressMessage = ProgressMessage;
other.NotificationType = NotificationType;
other.NotificationMessage = NotificationMessage;
}
}
internal Data ProgressData { get { return mData; } }
internal bool IsOperationRunning()
{
return mData.IsOperationRunning;
}
internal bool HasNotification()
{
return !string.IsNullOrEmpty(mData.NotificationMessage);
}
internal void UpdateProgress(EditorWindow parentWindow)
{
UpdateProgress(parentWindow.Repaint);
}
internal void UpdateProgress(Action repaint)
{
if (IsOperationRunning() || mRequestedRepaint)
{
repaint();
mRequestedRepaint = false;
}
}
void IProgressControls.HideProgress()
{
HideNotification();
mData.IsOperationRunning = false;
mData.ProgressMessage = string.Empty;
mRequestedRepaint = true;
}
void IProgressControls.ShowProgress(string message)
{
HideNotification();
mData.IsOperationRunning = true;
mData.ProgressMessage = message;
mData.ProgressPercent = -1;
mRequestedRepaint = true;
}
void IProgressControls.ShowError(string message)
{
mData.NotificationMessage = message;
mData.NotificationType = MessageType.Error;
mRequestedRepaint = true;
}
void IProgressControls.ShowNotification(string message)
{
mData.NotificationMessage = message;
mData.NotificationType = MessageType.Info;
mRequestedRepaint = true;
}
void IProgressControls.ShowSuccess(string message)
{
mData.NotificationMessage = message;
mData.NotificationType = MessageType.Info;
mRequestedRepaint = true;
}
void IProgressControls.ShowWarning(string message)
{
mData.NotificationMessage = message;
mData.NotificationType = MessageType.Warning;
mRequestedRepaint = true;
}
void HideNotification()
{
mData.NotificationMessage = string.Empty;
mData.NotificationType = MessageType.None;
mRequestedRepaint = true;
}
Data mData = new Data();
bool mRequestedRepaint;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2837297e95f28c44eb67b93417fce9d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,78 @@
using System;
using UnityEditor;
using Codice.Client.Common.Threading;
using PlasticGui;
namespace Unity.PlasticSCM.Editor.UI.Progress
{
internal class ProgressControlsForWindow : IProgressControls
{
internal class Data
{
internal bool IsOperationRunning;
internal float ProgressPercent;
internal string ProgressMessage;
}
internal Data ProgressData { get { return mData; } }
internal void UpdateProgress(EditorWindow parentWindow)
{
if (IsOperationRunning() || mRequestedRepaint)
{
parentWindow.Repaint();
mRequestedRepaint = false;
}
}
void IProgressControls.HideProgress()
{
mData.IsOperationRunning = false;
mData.ProgressMessage = string.Empty;
mRequestedRepaint = true;
}
void IProgressControls.ShowProgress(string message)
{
mData.IsOperationRunning = true;
mData.ProgressMessage = message;
mData.ProgressPercent = -1;
mRequestedRepaint = true;
}
void IProgressControls.ShowError(string message)
{
ExceptionsHandler.HandleError(message);
}
void IProgressControls.ShowNotification(string message)
{
throw new NotImplementedException();
}
void IProgressControls.ShowSuccess(string message)
{
throw new NotImplementedException();
}
void IProgressControls.ShowWarning(string message)
{
throw new NotImplementedException();
}
bool IsOperationRunning()
{
return mData.IsOperationRunning;
}
Data mData = new Data();
bool mRequestedRepaint;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 304090ddaffb4aff8f35cc005018d302
timeCreated: 1748959818