Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
jyb-games
Commits
1c847220
Commit
1c847220
authored
Jun 28, 2021
by
jang dong hyeok
Browse files
.
parent
076f0c68
Changes
638
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
638 of 638+
files are displayed.
Plain diff
Email patch
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EditorWindowFocus.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
using
UnityEditorInternal
;
namespace
Unity.PlasticSCM.Editor.UI
{
[
InitializeOnLoad
]
internal
static
class
EditorWindowFocus
{
internal
static
event
Action
OnApplicationActivated
;
internal
static
event
Action
OnApplicationDeactivated
;
static
EditorWindowFocus
()
{
EditorApplication
.
update
+=
Update
;
}
static
void
Update
()
{
bool
isApplicationActive
=
InternalEditorUtility
.
isApplicationActive
;
if
(!
mLastIsApplicationFocused
&&
isApplicationActive
)
{
mLastIsApplicationFocused
=
isApplicationActive
;
if
(
OnApplicationActivated
!=
null
)
OnApplicationActivated
();
return
;
}
if
(
mLastIsApplicationFocused
&&
!
isApplicationActive
)
{
mLastIsApplicationFocused
=
isApplicationActive
;
if
(
OnApplicationDeactivated
!=
null
)
OnApplicationDeactivated
();
return
;
}
}
static
bool
mLastIsApplicationFocused
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EnumPopupSetting.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
EnumPopupSetting
<
E
>
{
internal
static
E
Load
(
string
popupSettingName
,
E
defaultValue
)
{
string
enumValue
=
EditorPrefs
.
GetString
(
GetSettingKey
(
popupSettingName
));
if
(
string
.
IsNullOrEmpty
(
enumValue
))
return
defaultValue
;
return
(
E
)
Enum
.
Parse
(
typeof
(
E
),
enumValue
);
}
internal
static
void
Save
(
E
selected
,
string
popupSettingName
)
{
EditorPrefs
.
SetString
(
GetSettingKey
(
popupSettingName
),
selected
.
ToString
());
}
internal
static
void
Clear
(
string
popupSettingName
)
{
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
popupSettingName
));
}
static
string
GetSettingKey
(
string
popupSettingName
)
{
return
string
.
Format
(
popupSettingName
,
PlayerSettings
.
productGUID
,
SELECTED_ENUM_VALUE_KEY
);
}
static
string
SELECTED_ENUM_VALUE_KEY
=
"SelectedEnumValue"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/FindEditorWindow.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
FindEditorWindow
{
internal
static
EditorWindow
ProjectWindow
()
{
Type
projectBrowserType
=
typeof
(
EditorWindow
).
Assembly
.
GetType
(
"UnityEditor.ProjectBrowser"
);
UnityEngine
.
Object
[]
windows
=
Resources
.
FindObjectsOfTypeAll
(
projectBrowserType
);
if
(
windows
.
Length
==
0
)
return
null
;
return
windows
[
0
]
as
EditorWindow
;
}
internal
static
EditorWindow
ToDock
<
T
>()
{
List
<
EditorWindow
>
windows
=
GetAvailableWindows
();
IEnumerable
<
EditorWindow
>
candidateWindows
=
windows
.
Where
(
w
=>
!(
w
is
T
))
.
Where
(
w
=>
w
.
position
.
width
>
400
&&
w
.
position
.
height
>
300
)
.
OrderByDescending
(
w
=>
w
.
position
.
width
*
w
.
position
.
height
);
return
candidateWindows
.
FirstOrDefault
();
}
static
List
<
EditorWindow
>
GetAvailableWindows
()
{
List
<
EditorWindow
>
result
=
new
List
<
EditorWindow
>();
var
hostViewField
=
typeof
(
EditorWindow
).
GetField
(
"m_Parent"
,
BindingFlags
.
Instance
|
BindingFlags
.
NonPublic
);
if
(
hostViewField
==
null
)
return
null
;
var
hostViewType
=
hostViewField
.
FieldType
;
var
actualViewField
=
hostViewType
.
GetField
(
"m_ActualView"
,
BindingFlags
.
Instance
|
BindingFlags
.
NonPublic
);
if
(
actualViewField
==
null
)
return
null
;
foreach
(
var
window
in
Resources
.
FindObjectsOfTypeAll
<
EditorWindow
>())
{
var
hostView
=
hostViewField
.
GetValue
(
window
);
if
(
hostView
==
null
)
continue
;
EditorWindow
actualDrawnWindow
=
actualViewField
.
GetValue
(
hostView
)
as
EditorWindow
;
if
(
actualDrawnWindow
==
null
)
continue
;
if
(
result
.
Contains
(
actualDrawnWindow
))
continue
;
result
.
Add
(
actualDrawnWindow
);
}
return
result
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/GUIActionRunner.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Threading
;
using
Codice.LogWrapper
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
GUIActionRunner
{
internal
delegate
void
ActionDelegate
();
internal
static
void
RunGUIAction
(
ActionDelegate
action
)
{
if
(
EditorDispatcher
.
IsOnMainThread
)
{
action
();
return
;
}
lock
(
mLock
)
{
ManualResetEvent
syncEvent
=
new
ManualResetEvent
(
false
);
EditorDispatcher
.
Dispatch
(
delegate
{
try
{
action
();
}
catch
(
Exception
e
)
{
mLog
.
ErrorFormat
(
"GUI action failed: {0}"
,
e
.
Message
);
mLog
.
DebugFormat
(
"Stack trace:{0}{1}"
,
Environment
.
NewLine
,
e
.
StackTrace
);
throw
;
}
finally
{
syncEvent
.
Set
();
}
});
syncEvent
.
WaitOne
();
}
}
static
object
mLock
=
new
object
();
static
readonly
ILog
mLog
=
LogManager
.
GetLogger
(
"GUIActionRunner"
);
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/GUISpace.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
GUISpace
{
internal
static
void
ForToolbar
()
{
#if UNITY_2019_1_OR_NEWER
GUILayout
.
Space
(
5
);
#endif
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/GetPlasticShortcut.cs
0 → 100644
View file @
1c847220
using
Codice.Utils
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
GetPlasticShortcut
{
internal
static
string
ForOpen
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityOpenShortcut
);
}
internal
static
string
ForDelete
()
{
if
(
PlatformIdentifier
.
IsWindows
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityDeleteShortcutForWindows
);
if
(
PlatformIdentifier
.
IsMac
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityDeleteShortcutForMacOS
);
return
string
.
Empty
;
}
internal
static
string
ForDiff
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityDiffShortcut
);
}
internal
static
string
ForAssetDiff
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityAssetDiffShortcut
);
}
internal
static
string
ForHistory
()
{
if
(
PlatformIdentifier
.
IsWindows
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityHistoryShortcutForWindows
);
if
(
PlatformIdentifier
.
IsMac
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UnityHistoryShortcutForMacOS
);
return
string
.
Empty
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/GuiEnabled.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
GuiEnabled
:
IDisposable
{
internal
GuiEnabled
(
bool
enabled
)
{
mEnabled
=
GUI
.
enabled
;
GUI
.
enabled
=
enabled
&&
mEnabled
;
}
void
IDisposable
.
Dispose
()
{
GUI
.
enabled
=
mEnabled
;
}
bool
mEnabled
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/HandleMenuItem.cs
0 → 100644
View file @
1c847220
using
PlasticGui
;
using
System
;
using
System.Reflection
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
HandleMenuItem
{
internal
static
void
AddMenuItem
(
string
name
,
int
priority
,
Action
execute
,
Func
<
bool
>
validate
)
{
AddMenuItem
(
name
,
string
.
Empty
,
priority
,
execute
,
validate
);
}
internal
static
void
AddMenuItem
(
string
name
,
string
shortcut
,
int
priority
,
Action
execute
,
Func
<
bool
>
validate
)
{
MethodInfo
InternalAddMenuItem
=
MenuType
.
GetMethod
(
"AddMenuItem"
,
BindingFlags
.
Static
|
BindingFlags
.
NonPublic
);
if
(
InternalAddMenuItem
==
null
)
{
Debug
.
LogWarningFormat
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ErrorAddPlasticSCMMenuItem
),
name
);
return
;
}
InternalAddMenuItem
.
Invoke
(
null
,
new
object
[]
{
name
,
shortcut
,
false
,
priority
,
execute
,
validate
});
}
internal
static
void
RemoveMenuItem
(
string
name
)
{
MethodInfo
InternalRemoveMenuItem
=
MenuType
.
GetMethod
(
"RemoveMenuItem"
,
BindingFlags
.
Static
|
BindingFlags
.
NonPublic
);
if
(
InternalRemoveMenuItem
==
null
)
{
Debug
.
LogWarningFormat
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ErrorRemovePlasticSCMMenuItem
),
name
);
return
;
}
InternalRemoveMenuItem
.
Invoke
(
null
,
new
object
[]
{
name
});
}
internal
static
void
UpdateAllMenus
()
{
MethodInfo
InternalUpdateAllMenus
=
EditorUtilityType
.
GetMethod
(
"Internal_UpdateAllMenus"
,
BindingFlags
.
Static
|
BindingFlags
.
NonPublic
);
if
(
InternalUpdateAllMenus
==
null
)
{
Debug
.
LogWarning
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ErrorUpdatePlasticSCMMenus
));
return
;
}
InternalUpdateAllMenus
.
Invoke
(
null
,
null
);
}
static
readonly
Type
MenuType
=
typeof
(
UnityEditor
.
Menu
);
static
readonly
Type
EditorUtilityType
=
typeof
(
UnityEditor
.
EditorUtility
);
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Images.cs
0 → 100644
View file @
1c847220
using
System.IO
;
using
System.Reflection
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.LogWrapper
;
using
Codice.Utils
;
using
PlasticGui
;
using
PlasticGui.Help
;
using
Unity.PlasticSCM.Editor.AssetUtils
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
Images
{
internal
enum
Name
{
None
,
IconPlastic
,
IconCloseButton
,
IconPressedCloseButton
,
IconAdded
,
IconDeleted
,
IconChanged
,
IconMoved
,
IconMergeLink
,
Ignored
,
IconMergeConflict
,
IconMerged
,
IconFsChanged
,
IconMergeCategory
,
XLink
,
Ok
,
NotOnDisk
,
IconRepository
,
IconPlasticView
,
Loading
,
IconEmptyGravatar
,
Step1
,
Step2
,
Step3
,
StepOk
,
ButtonSsoSignInUnity
,
ButtonSsoSignInEmail
,
ButtonSsoSignInGoogle
,
}
internal
static
Texture2D
GetHelpImage
(
HelpImage
image
)
{
// We use the dark version for both the light/dark skins since it matches the grey background better
string
helpImageFileName
=
string
.
Format
(
"d_{0}.png"
,
HelpImageName
.
FromHelpImage
(
image
));
string
imageRelativePath
=
GetImageFileRelativePath
(
helpImageFileName
);
Texture2D
result
=
TryLoadImage
(
imageRelativePath
,
imageRelativePath
);
if
(
result
!=
null
)
return
result
;
mLog
.
WarnFormat
(
"Image not found: {0}"
,
helpImageFileName
);
return
GetEmptyImage
();
}
internal
static
Texture2D
GetImage
(
Name
image
)
{
string
imageFileName
=
image
.
ToString
().
ToLower
()
+
".png"
;
string
imageFileName2x
=
image
.
ToString
().
ToLower
()
+
"@2x.png"
;
string
darkImageFileName
=
string
.
Format
(
"d_{0}"
,
imageFileName
);
string
darkImageFileName2x
=
string
.
Format
(
"d_{0}"
,
imageFileName2x
);
string
imageFileRelativePath
=
GetImageFileRelativePath
(
imageFileName
);
string
imageFileRelativePath2x
=
GetImageFileRelativePath
(
imageFileName
);
string
darkImageFileRelativePath
=
GetImageFileRelativePath
(
darkImageFileName
);
string
darkImageFileRelativePath2x
=
GetImageFileRelativePath
(
darkImageFileName2x
);
Texture2D
result
=
null
;
if
(
EditorGUIUtility
.
isProSkin
)
result
=
TryLoadImage
(
darkImageFileRelativePath
,
darkImageFileRelativePath2x
);
if
(
result
!=
null
)
return
result
;
result
=
TryLoadImage
(
imageFileRelativePath
,
imageFileRelativePath2x
);
if
(
result
!=
null
)
return
result
;
mLog
.
WarnFormat
(
"Image not found: {0}"
,
imageFileName
);
return
GetEmptyImage
();
}
internal
static
Texture
GetFileIcon
(
string
path
)
{
string
relativePath
=
GetRelativePath
.
ToApplication
(
path
);
return
GetFileIconFromRelativePath
(
relativePath
);
}
internal
static
Texture
GetFileIconFromCmPath
(
string
path
)
{
return
GetFileIconFromRelativePath
(
path
.
Substring
(
1
).
Replace
(
"/"
,
Path
.
DirectorySeparatorChar
.
ToString
()));
}
internal
static
Texture
GetDropDownIcon
()
{
if
(
mPopupIcon
==
null
)
mPopupIcon
=
EditorGUIUtility
.
IconContent
(
"icon dropdown"
).
image
;
return
mPopupIcon
;
}
internal
static
Texture
GetDirectoryIcon
()
{
if
(
mDirectoryIcon
==
null
)
mDirectoryIcon
=
EditorGUIUtility
.
IconContent
(
"Folder Icon"
).
image
;
return
mDirectoryIcon
;
}
internal
static
Texture
GetPrivatedOverlayIcon
()
{
if
(
mPrivatedOverlayIcon
==
null
)
mPrivatedOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_Local"
).
image
;
return
mPrivatedOverlayIcon
;
}
internal
static
Texture
GetAddedOverlayIcon
()
{
if
(
mAddedOverlayIcon
==
null
)
mAddedOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_AddedLocal"
).
image
;
return
mAddedOverlayIcon
;
}
internal
static
Texture
GetDeletedOverlayIcon
()
{
if
(
mDeletedOverlayIcon
==
null
)
mDeletedOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_DeletedLocal"
).
image
;
return
mDeletedOverlayIcon
;
}
internal
static
Texture
GetCheckedOutOverlayIcon
()
{
if
(
mCheckedOutOverlayIcon
==
null
)
mCheckedOutOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_CheckOutLocal"
).
image
;
return
mCheckedOutOverlayIcon
;
}
internal
static
Texture
GetDeletedRemoteOverlayIcon
()
{
if
(
mDeletedRemoteOverlayIcon
==
null
)
mDeletedRemoteOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_DeletedRemote"
).
image
;
return
mDeletedRemoteOverlayIcon
;
}
internal
static
Texture
GetOutOfSyncOverlayIcon
()
{
if
(
mOutOfSyncOverlayIcon
==
null
)
mOutOfSyncOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_OutOfSync"
).
image
;
return
mOutOfSyncOverlayIcon
;
}
internal
static
Texture
GetConflictedOverlayIcon
()
{
if
(
mConflictedOverlayIcon
==
null
)
mConflictedOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_Conflicted"
).
image
;
return
mConflictedOverlayIcon
;
}
internal
static
Texture
GetLockedLocalOverlayIcon
()
{
if
(
mLockedLocalOverlayIcon
==
null
)
mLockedLocalOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_LockedLocal"
).
image
;
return
mLockedLocalOverlayIcon
;
}
internal
static
Texture
GetLockedRemoteOverlayIcon
()
{
if
(
mLockedRemoteOverlayIcon
==
null
)
mLockedRemoteOverlayIcon
=
EditorGUIUtility
.
IconContent
(
"P4_LockedRemote"
).
image
;
return
mLockedRemoteOverlayIcon
;
}
internal
static
Texture
GetWarnIcon
()
{
if
(
mWarnIcon
==
null
)
mWarnIcon
=
EditorGUIUtility
.
IconContent
(
"console.warnicon.sml"
).
image
;
return
mWarnIcon
;
}
internal
static
Texture
GetInfoIcon
()
{
if
(
mInfoIcon
==
null
)
mInfoIcon
=
EditorGUIUtility
.
IconContent
(
"console.infoicon.sml"
).
image
;
return
mInfoIcon
;
}
internal
static
Texture
GetErrorDialogIcon
()
{
if
(
mErrorDialogIcon
==
null
)
mErrorDialogIcon
=
EditorGUIUtility
.
IconContent
(
"console.erroricon"
).
image
;
return
mErrorDialogIcon
;
}
internal
static
Texture
GetWarnDialogIcon
()
{
if
(
mWarnDialogIcon
==
null
)
mWarnDialogIcon
=
EditorGUIUtility
.
IconContent
(
"console.warnicon"
).
image
;
return
mWarnDialogIcon
;
}
internal
static
Texture
GetInfoDialogIcon
()
{
if
(
mInfoDialogIcon
==
null
)
mInfoDialogIcon
=
EditorGUIUtility
.
IconContent
(
"console.infoicon"
).
image
;
return
mInfoDialogIcon
;
}
internal
static
Texture
GetRefreshIcon
()
{
if
(
mRefreshIcon
==
null
)
mRefreshIcon
=
EditorGUIUtility
.
FindTexture
(
"Refresh"
);
return
mRefreshIcon
;
}
internal
static
Texture
GetCloseIcon
()
{
if
(
mCloseIcon
==
null
)
mCloseIcon
=
EditorGUIUtility
.
FindTexture
(
"winbtn_win_close"
);
return
mCloseIcon
;
}
internal
static
Texture
GetClickedCloseIcon
()
{
if
(
mClickedCloseIcon
==
null
)
mClickedCloseIcon
=
EditorGUIUtility
.
FindTexture
(
"winbtn_win_close_a"
);
return
mClickedCloseIcon
;
}
internal
static
Texture
GetHoveredCloseIcon
()
{
if
(
mHoveredCloseIcon
==
null
)
mHoveredCloseIcon
=
EditorGUIUtility
.
FindTexture
(
"winbtn_win_close_h"
);
return
mHoveredCloseIcon
;
}
internal
static
Texture
GetFileIcon
()
{
if
(
mFileIcon
==
null
)
mFileIcon
=
EditorGUIUtility
.
FindTexture
(
"DefaultAsset Icon"
);
if
(
mFileIcon
==
null
)
mFileIcon
=
AssetPreview
.
GetMiniTypeThumbnail
(
typeof
(
DefaultAsset
));
if
(
mFileIcon
==
null
)
mFileIcon
=
GetEmptyImage
();
return
mFileIcon
;
}
internal
static
Texture2D
GetLinkUnderlineImage
()
{
if
(
mLinkUnderlineImage
==
null
)
{
mLinkUnderlineImage
=
new
Texture2D
(
1
,
1
);
mLinkUnderlineImage
.
SetPixel
(
0
,
0
,
UnityStyles
.
Colors
.
Link
);
mLinkUnderlineImage
.
Apply
();
}
return
mLinkUnderlineImage
;
}
static
Texture2D
GetEmptyImage
()
{
if
(
mEmptyImage
==
null
)
{
mEmptyImage
=
new
Texture2D
(
1
,
1
);
mEmptyImage
.
SetPixel
(
0
,
0
,
Color
.
clear
);
mEmptyImage
.
Apply
();
}
return
mEmptyImage
;
}
static
Texture
GetFileIconFromRelativePath
(
string
relativePath
)
{
Texture
result
=
AssetDatabase
.
GetCachedIcon
(
relativePath
);
if
(
result
==
null
)
return
GetFileIcon
();
return
result
;
}
static
string
GetImageFileRelativePath
(
string
imageFileName
)
{
return
Path
.
Combine
(
AssetsPath
.
GetImagesFolderRelativePath
(),
imageFileName
);
}
static
Texture2D
TryLoadImage
(
string
imageFileRelativePath
,
string
image2xFilePath
)
{
if
(
EditorGUIUtility
.
pixelsPerPoint
>
1f
&&
File
.
Exists
(
image2xFilePath
))
return
LoadTextureFromFile
(
image2xFilePath
);
if
(
File
.
Exists
(
Path
.
GetFullPath
(
imageFileRelativePath
)))
return
LoadTextureFromFile
(
imageFileRelativePath
);
return
null
;
}
static
Texture2D
LoadTextureFromFile
(
string
path
)
{
byte
[]
fileData
=
File
.
ReadAllBytes
(
path
);
Texture2D
result
=
new
Texture2D
(
1
,
1
);
result
.
LoadImage
(
fileData
);
//auto-resizes the texture dimensions
return
result
;
}
static
Texture
mFileIcon
;
static
Texture
mDirectoryIcon
;
static
Texture
mPrivatedOverlayIcon
;
static
Texture
mAddedOverlayIcon
;
static
Texture
mDeletedOverlayIcon
;
static
Texture
mCheckedOutOverlayIcon
;
static
Texture
mDeletedRemoteOverlayIcon
;
static
Texture
mOutOfSyncOverlayIcon
;
static
Texture
mConflictedOverlayIcon
;
static
Texture
mLockedLocalOverlayIcon
;
static
Texture
mLockedRemoteOverlayIcon
;
static
Texture
mWarnIcon
;
static
Texture
mInfoIcon
;
static
Texture
mErrorDialogIcon
;
static
Texture
mWarnDialogIcon
;
static
Texture
mInfoDialogIcon
;
static
Texture
mRefreshIcon
;
static
Texture
mCloseIcon
;
static
Texture
mClickedCloseIcon
;
static
Texture
mHoveredCloseIcon
;
static
Texture2D
mLinkUnderlineImage
;
static
Texture2D
mEmptyImage
;
static
Texture
mPopupIcon
;
static
readonly
ILog
mLog
=
LogManager
.
GetLogger
(
"Images"
);
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/MeasureMaxWidth.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
MeasureMaxWidth
{
internal
static
float
ForTexts
(
GUIStyle
style
,
params
string
[]
texts
)
{
float
result
=
0
;
GUIContent
content
=
new
GUIContent
();
foreach
(
string
text
in
texts
)
{
content
.
text
=
text
;
result
=
Math
.
Max
(
result
,
style
.
CalcSize
(
content
).
x
);
}
return
result
+
10
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Message/DrawDialogIcon.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.Common
;
namespace
Unity.PlasticSCM.Editor.UI.Message
{
internal
static
class
DrawDialogIcon
{
internal
static
void
ForMessage
(
GuiMessage
.
GuiMessageType
alertType
)
{
using
(
new
EditorGUILayout
.
VerticalScope
(
GUILayout
.
Width
(
80
)))
{
Rect
iconRect
=
GUILayoutUtility
.
GetRect
(
GUIContent
.
none
,
EditorStyles
.
label
,
GUILayout
.
Width
(
60
),
GUILayout
.
Height
(
60
));
GUI
.
DrawTexture
(
iconRect
,
Images
.
GetImage
(
Images
.
Name
.
IconPlastic
),
ScaleMode
.
ScaleToFit
);
Rect
overlayIconRect
=
new
Rect
(
iconRect
.
xMax
-
30
,
iconRect
.
yMax
-
24
,
32
,
32
);
GUI
.
DrawTexture
(
overlayIconRect
,
GetHelpIcon
(
alertType
),
ScaleMode
.
ScaleToFit
);
}
}
static
Texture
GetHelpIcon
(
GuiMessage
.
GuiMessageType
alertType
)
{
switch
(
alertType
)
{
case
GuiMessage
.
GuiMessageType
.
Critical
:
return
Images
.
GetErrorDialogIcon
();
case
GuiMessage
.
GuiMessageType
.
Warning
:
return
Images
.
GetWarnDialogIcon
();
default
:
return
Images
.
GetInfoDialogIcon
();
}
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Message/PlasticQuestionAlert.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.Common
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI.Message
{
internal
class
PlasticQuestionAlert
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
string
buttonsText
=
mFirst
+
mSecond
+
(
mThird
??
string
.
Empty
);
int
textWidth
=
(
int
)((
GUIStyle
)
UnityStyles
.
Dialog
.
AcceptButtonText
)
.
CalcSize
(
new
GUIContent
(
buttonsText
)).
x
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
Math
.
Max
(
500
,
textWidth
+
150
),
180
);
}
}
internal
static
ResponseType
Show
(
string
title
,
string
message
,
string
first
,
string
second
,
string
third
,
bool
isFirstButtonEnabled
,
GuiMessage
.
GuiMessageType
alertType
,
EditorWindow
parentWindow
)
{
PlasticQuestionAlert
alert
=
Create
(
title
,
message
,
first
,
second
,
third
,
isFirstButtonEnabled
,
alertType
);
return
alert
.
RunModal
(
parentWindow
);
}
protected
override
void
OnModalGUI
()
{
DoMessageArea
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
Space
(
20
);
DoButtonsArea
();
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PlasticSCM
);
}
void
DoMessageArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
DrawDialogIcon
.
ForMessage
(
mAlertType
);
using
(
new
EditorGUILayout
.
VerticalScope
())
{
GUILayout
.
Label
(
mTitle
,
UnityStyles
.
Dialog
.
MessageTitle
);
GUIContent
message
=
new
GUIContent
(
mMessage
);
Rect
lastRect
=
GUILayoutUtility
.
GetLastRect
();
GUIStyle
scrollPlaceholder
=
new
GUIStyle
(
UnityStyles
.
Dialog
.
MessageText
);
scrollPlaceholder
.
normal
.
textColor
=
Color
.
clear
;
scrollPlaceholder
.
clipping
=
TextClipping
.
Clip
;
if
(
Event
.
current
.
type
==
EventType
.
Repaint
)
{
mMessageDesiredHeight
=
((
GUIStyle
)
UnityStyles
.
Dialog
.
MessageText
)
.
CalcHeight
(
message
,
lastRect
.
width
-
20
)
+
20
;
mMessageViewHeight
=
Mathf
.
Min
(
mMessageDesiredHeight
,
60
);
}
GUILayout
.
Space
(
mMessageViewHeight
);
Rect
scrollPanelRect
=
new
Rect
(
lastRect
.
xMin
,
lastRect
.
yMax
,
lastRect
.
width
+
20
,
mMessageViewHeight
);
Rect
contentRect
=
new
Rect
(
scrollPanelRect
.
xMin
,
scrollPanelRect
.
yMin
,
scrollPanelRect
.
width
-
20
,
mMessageDesiredHeight
);
mScroll
=
GUI
.
BeginScrollView
(
scrollPanelRect
,
mScroll
,
contentRect
);
GUI
.
Label
(
contentRect
,
mMessage
,
UnityStyles
.
Dialog
.
MessageText
);
GUI
.
EndScrollView
();
}
}
}
void
DoButtonsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoFirstButton
();
DoSecondButton
();
DoThirdButton
();
return
;
}
DoThirdButton
();
DoSecondButton
();
DoFirstButton
();
}
}
void
DoFirstButton
()
{
GUI
.
enabled
=
mIsFirstButtonEnabled
;
bool
pressed
=
mIsFirstButtonEnabled
?
AcceptButton
(
mFirst
)
:
NormalButton
(
mFirst
);
GUI
.
enabled
=
true
;
if
(!
pressed
)
return
;
OkButtonAction
();
}
void
DoSecondButton
()
{
if
(!
NormalButton
(
mSecond
))
return
;
CancelButtonAction
();
}
void
DoThirdButton
()
{
if
(
mThird
==
null
)
return
;
bool
pressed
=
mIsFirstButtonEnabled
?
NormalButton
(
mThird
)
:
AcceptButton
(
mThird
);
if
(!
pressed
)
return
;
ApplyButtonAction
();
}
static
PlasticQuestionAlert
Create
(
string
title
,
string
message
,
string
first
,
string
second
,
string
third
,
bool
isFirstButtonEnabled
,
GuiMessage
.
GuiMessageType
alertType
)
{
var
instance
=
CreateInstance
<
PlasticQuestionAlert
>();
instance
.
titleContent
=
new
GUIContent
(
title
);
instance
.
mTitle
=
title
;
instance
.
mMessage
=
message
;
instance
.
mFirst
=
first
;
instance
.
mSecond
=
second
;
instance
.
mThird
=
third
;
instance
.
mIsFirstButtonEnabled
=
isFirstButtonEnabled
;
instance
.
mAlertType
=
alertType
;
instance
.
mEnterKeyAction
=
GetEnterKeyAction
(
isFirstButtonEnabled
,
instance
);
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
return
instance
;
}
static
Action
GetEnterKeyAction
(
bool
isFirstButtonEnabled
,
PlasticQuestionAlert
instance
)
{
if
(
isFirstButtonEnabled
)
return
instance
.
OkButtonAction
;
return
instance
.
ApplyButtonAction
;
}
string
mTitle
;
string
mMessage
,
mFirst
,
mSecond
,
mThird
;
bool
mIsFirstButtonEnabled
;
GuiMessage
.
GuiMessageType
mAlertType
;
Vector2
mScroll
;
float
mMessageDesiredHeight
;
float
mMessageViewHeight
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/PlasticDialog.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEngine
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI
{
[
InitializeOnLoad
]
internal
abstract
class
PlasticDialog
:
EditorWindow
,
IPlasticDialogCloser
{
protected
virtual
Rect
DefaultRect
{
get
{
int
pixelWidth
=
Screen
.
currentResolution
.
width
;
float
x
=
(
pixelWidth
-
DEFAULT_WIDTH
)
/
2
;
return
new
Rect
(
x
,
200
,
DEFAULT_WIDTH
,
DEFAULT_HEIGHT
);
}
}
protected
virtual
bool
IsResizable
{
get
;
set
;
}
internal
void
OkButtonAction
()
{
CompleteModal
(
ResponseType
.
Ok
);
}
internal
void
CancelButtonAction
()
{
CompleteModal
(
ResponseType
.
Cancel
);
}
internal
void
CloseButtonAction
()
{
CompleteModal
(
ResponseType
.
None
);
}
internal
void
ApplyButtonAction
()
{
CompleteModal
(
ResponseType
.
Apply
);
}
internal
ResponseType
RunModal
(
EditorWindow
parentWindow
)
{
InitializeVars
(
parentWindow
);
if
(!
IsResizable
)
MakeNonResizable
();
if
(
UI
.
RunModal
.
IsAvailable
())
{
UI
.
RunModal
.
Dialog
(
this
);
return
mAnswer
;
}
EditorUtility
.
DisplayDialog
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PlasticSCM
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PluginModalInformation
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CloseButton
));
return
ResponseType
.
None
;
}
protected
void
OnGUI
()
{
try
{
// If the Dialog has been saved into the Unity editor layout and persisted between restarts, the methods
// to configure the dialogs will be skipped. Simple fix here is to close it when this state is detected.
// Fixes a NPE loop when the state mentioned above is occuring.
if
(!
mIsConfigured
)
{
mIsClosed
=
true
;
Close
();
return
;
}
if
(
Event
.
current
.
type
==
EventType
.
Layout
)
{
EditorDispatcher
.
Update
();
}
if
(!
mFocusedOnce
)
{
// Somehow the prevents the dialog from jumping when dragged
// NOTE(rafa): We cannot do every frame because the modal kidnaps focus for all processes (in mac at least)
Focus
();
mFocusedOnce
=
true
;
}
ProcessKeyActions
();
if
(
mIsClosed
)
return
;
GUI
.
Box
(
new
Rect
(
0
,
0
,
position
.
width
,
position
.
height
),
GUIContent
.
none
,
EditorStyles
.
label
);
float
margin
=
25
;
float
marginTop
=
25
;
using
(
new
EditorGUILayout
.
HorizontalScope
(
GUILayout
.
Height
(
position
.
height
)))
{
GUILayout
.
Space
(
margin
);
using
(
new
EditorGUILayout
.
VerticalScope
(
GUILayout
.
Height
(
position
.
height
)))
{
GUILayout
.
Space
(
marginTop
);
OnModalGUI
();
GUILayout
.
Space
(
margin
);
}
GUILayout
.
Space
(
margin
);
}
var
lastRect
=
GUILayoutUtility
.
GetLastRect
();
float
desiredHeight
=
lastRect
.
yMax
;
Rect
newPos
=
position
;
newPos
.
height
=
desiredHeight
;
if
(
position
.
height
<
desiredHeight
)
position
=
newPos
;
if
(
Event
.
current
.
type
==
EventType
.
Repaint
)
{
if
(
mIsCompleted
)
{
mIsClosed
=
true
;
Close
();
}
}
}
finally
{
if
(
mIsClosed
)
EditorGUIUtility
.
ExitGUI
();
}
}
void
OnDestroy
()
{
if
(!
mIsConfigured
)
return
;
SaveSettings
();
mParentWindow
.
Focus
();
}
protected
virtual
void
SaveSettings
()
{
}
protected
abstract
void
OnModalGUI
();
protected
abstract
string
GetTitle
();
protected
void
Paragraph
(
string
text
)
{
GUILayout
.
Label
(
text
,
UnityStyles
.
Paragraph
);
GUILayout
.
Space
(
DEFAULT_PARAGRAPH_SPACING
);
}
protected
void
TextBlockWithEndLink
(
string
url
,
string
formattedExplanation
,
GUIStyle
textblockStyle
)
{
string
explanation
=
string
.
Format
(
formattedExplanation
,
""
);
GUILayout
.
Label
(
explanation
,
textblockStyle
);
if
(
explanation
==
formattedExplanation
)
return
;
string
coloredUrl
=
string
.
Format
(
"<color=\"{0}\">{1}</color>"
,
UnityStyles
.
HexColors
.
LINK_COLOR
,
url
);
float
linkWidth
=
textblockStyle
.
CalcSize
(
new
GUIContent
(
url
)).
x
;
if
(
GUILayout
.
Button
(
coloredUrl
,
textblockStyle
,
GUILayout
.
Width
(
linkWidth
)))
Application
.
OpenURL
(
url
);
EditorGUIUtility
.
AddCursorRect
(
GUILayoutUtility
.
GetLastRect
(),
MouseCursor
.
Link
);
}
protected
static
void
Title
(
string
text
)
{
GUILayout
.
Label
(
text
,
UnityStyles
.
Dialog
.
Toggle
);
}
protected
static
bool
TitleToggle
(
string
text
,
bool
isOn
)
{
return
EditorGUILayout
.
ToggleLeft
(
text
,
isOn
,
UnityStyles
.
Dialog
.
Toggle
);
}
protected
static
bool
TitleToggle
(
string
text
,
bool
isOn
,
GUIStyle
style
)
{
return
EditorGUILayout
.
ToggleLeft
(
text
,
isOn
,
style
);
}
protected
static
string
TextEntry
(
string
label
,
string
value
,
float
width
,
float
x
)
{
return
TextEntry
(
label
,
value
,
null
,
width
,
x
);
}
protected
static
string
TextEntry
(
string
label
,
string
value
,
string
controlName
,
float
width
,
float
x
)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
EntryLabel
(
label
);
GUILayout
.
FlexibleSpace
();
var
rt
=
GUILayoutUtility
.
GetRect
(
new
GUIContent
(
value
),
UnityStyles
.
Dialog
.
EntryLabel
);
rt
.
width
=
width
;
rt
.
x
=
x
;
if
(!
string
.
IsNullOrEmpty
(
controlName
))
GUI
.
SetNextControlName
(
controlName
);
return
GUI
.
TextField
(
rt
,
value
);
}
}
protected
static
string
ComboBox
(
string
label
,
string
value
,
string
controlName
,
List
<
string
>
dropDownOptions
,
GenericMenu
.
MenuFunction2
optionSelected
,
float
width
,
float
x
)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
EntryLabel
(
label
);
GUILayout
.
FlexibleSpace
();
var
rt
=
GUILayoutUtility
.
GetRect
(
new
GUIContent
(
value
),
UnityStyles
.
Dialog
.
EntryLabel
);
rt
.
width
=
width
;
rt
.
x
=
x
;
return
DropDownTextField
.
DoDropDownTextField
(
value
,
label
,
dropDownOptions
,
optionSelected
,
rt
);
}
}
protected
static
string
PasswordEntry
(
string
label
,
string
value
,
float
width
,
float
x
)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
EntryLabel
(
label
);
GUILayout
.
FlexibleSpace
();
var
rt
=
GUILayoutUtility
.
GetRect
(
new
GUIContent
(
value
),
UnityStyles
.
Dialog
.
EntryLabel
);
rt
.
width
=
width
;
rt
.
x
=
x
;
return
GUI
.
PasswordField
(
rt
,
value
,
'*'
);
}
}
protected
static
bool
ToggleEntry
(
string
label
,
bool
value
,
float
width
,
float
x
)
{
var
rt
=
GUILayoutUtility
.
GetRect
(
new
GUIContent
(
label
),
UnityStyles
.
Dialog
.
EntryLabel
);
rt
.
width
=
width
;
rt
.
x
=
x
;
return
GUI
.
Toggle
(
rt
,
value
,
label
);
}
protected
static
bool
NormalButton
(
string
text
)
{
return
GUILayout
.
Button
(
text
,
UnityStyles
.
Dialog
.
NormalButton
,
GUILayout
.
MinWidth
(
80
),
GUILayout
.
Height
(
25
));
}
void
IPlasticDialogCloser
.
CloseDialog
()
{
OkButtonAction
();
}
void
ProcessKeyActions
()
{
Event
e
=
Event
.
current
;
if
(
mEnterKeyAction
!=
null
&&
Keyboard
.
IsReturnOrEnterKeyPressed
(
e
))
{
mEnterKeyAction
.
Invoke
();
e
.
Use
();
return
;
}
if
(
mEscapeKeyAction
!=
null
&&
Keyboard
.
IsKeyPressed
(
e
,
KeyCode
.
Escape
))
{
mEscapeKeyAction
.
Invoke
();
e
.
Use
();
return
;
}
}
protected
static
bool
AcceptButton
(
string
text
)
{
GUI
.
color
=
new
Color
(
0.098f
,
0.502f
,
0.965f
,
.
8f
);
int
textWidth
=
(
int
)((
GUIStyle
)
UnityStyles
.
Dialog
.
AcceptButtonText
)
.
CalcSize
(
new
GUIContent
(
text
)).
x
;
bool
pressed
=
GUILayout
.
Button
(
string
.
Empty
,
GetEditorSkin
().
button
,
GUILayout
.
MinWidth
(
Math
.
Max
(
80
,
textWidth
+
10
)),
GUILayout
.
Height
(
25
));
GUI
.
color
=
Color
.
white
;
Rect
buttonRect
=
GUILayoutUtility
.
GetLastRect
();
GUI
.
Label
(
buttonRect
,
text
,
UnityStyles
.
Dialog
.
AcceptButtonText
);
return
pressed
;
}
void
CompleteModal
(
ResponseType
answer
)
{
mIsCompleted
=
true
;
mAnswer
=
answer
;
}
void
InitializeVars
(
EditorWindow
parentWindow
)
{
mIsConfigured
=
true
;
mIsCompleted
=
false
;
mIsClosed
=
false
;
mAnswer
=
ResponseType
.
Cancel
;
titleContent
=
new
GUIContent
(
GetTitle
());
mFocusedOnce
=
false
;
position
=
DefaultRect
;
mParentWindow
=
parentWindow
;
}
void
MakeNonResizable
()
{
maxSize
=
DefaultRect
.
size
;
minSize
=
maxSize
;
}
static
void
EntryLabel
(
string
labelText
)
{
GUIContent
labelContent
=
new
GUIContent
(
labelText
);
GUIStyle
labelStyle
=
UnityStyles
.
Dialog
.
EntryLabel
;
Rect
rt
=
GUILayoutUtility
.
GetRect
(
labelContent
,
labelStyle
);
GUI
.
Label
(
rt
,
labelText
,
EditorStyles
.
label
);
}
static
GUISkin
GetEditorSkin
()
{
return
EditorGUIUtility
.
isProSkin
?
EditorGUIUtility
.
GetBuiltinSkin
(
EditorSkin
.
Scene
)
:
EditorGUIUtility
.
GetBuiltinSkin
(
EditorSkin
.
Inspector
);
}
bool
mIsConfigured
;
bool
mIsCompleted
;
bool
mIsClosed
;
ResponseType
mAnswer
;
protected
Action
mEnterKeyAction
=
null
;
protected
Action
mEscapeKeyAction
=
null
;
bool
mFocusedOnce
;
Dictionary
<
string
,
string
[
]>
mWrappedTextLines
=
new
Dictionary
<
string
,
string
[
]>
();
EditorWindow
mParentWindow
;
protected
const
float
DEFAULT_LINE_SPACING
=
-
5
;
const
float
DEFAULT_WIDTH
=
500
;
const
float
DEFAULT_HEIGHT
=
180
;
const
float
DEFAULT_PARAGRAPH_SPACING
=
10f
;
static
class
BuildLine
{
internal
static
string
ForIndex
(
string
text
,
int
index
)
{
if
(
index
<
0
||
index
>
text
.
Length
)
return
string
.
Empty
;
return
text
.
Substring
(
index
).
Trim
();
}
internal
static
string
ForIndexAndLenght
(
string
text
,
int
index
,
int
lenght
)
{
if
(
index
<
0
||
index
>
text
.
Length
)
return
string
.
Empty
;
return
text
.
Substring
(
index
,
lenght
);
}
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/PlasticSplitterGUILayout.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Reflection
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
PlasticSplitterGUILayout
{
internal
static
void
BeginHorizontalSplit
(
object
splitterState
)
{
InternalBeginHorizontalSplit
.
Invoke
(
null
,
new
object
[]
{
splitterState
,
new
GUILayoutOption
[]
{
}});
}
internal
static
void
EndHorizontalSplit
()
{
InternalEndHorizontalSplit
.
Invoke
(
null
,
new
object
[]
{
});
}
internal
static
void
BeginVerticalSplit
(
object
splitterState
)
{
InternalBeginVerticalSplit
.
Invoke
(
null
,
new
object
[]
{
splitterState
,
new
GUILayoutOption
[]
{
}});
}
internal
static
void
EndVerticalSplit
()
{
InternalEndVerticalSplit
.
Invoke
(
null
,
new
object
[]
{
});
}
internal
static
object
InitSplitterState
(
float
[]
relativeSizes
,
int
[]
minSizes
,
int
[]
maxSizes
)
{
ConstructorInfo
ctorInfo
=
SplitterState
.
GetConstructor
(
new
Type
[]
{
typeof
(
float
[]),
typeof
(
int
[]),
typeof
(
int
[])});
return
ctorInfo
.
Invoke
(
new
object
[]
{
relativeSizes
,
minSizes
,
maxSizes
});
}
static
readonly
Type
SplitterState
=
typeof
(
UnityEditor
.
Editor
).
Assembly
.
GetType
(
"UnityEditor.SplitterState"
);
static
readonly
Type
InternalSplitterGUILayout
=
typeof
(
UnityEditor
.
Editor
).
Assembly
.
GetType
(
"UnityEditor.SplitterGUILayout"
);
static
readonly
MethodInfo
InternalBeginHorizontalSplit
=
InternalSplitterGUILayout
.
GetMethod
(
"BeginHorizontalSplit"
,
new
Type
[]
{
SplitterState
,
typeof
(
GUILayoutOption
[])
});
static
readonly
MethodInfo
InternalEndHorizontalSplit
=
InternalSplitterGUILayout
.
GetMethod
(
"EndHorizontalSplit"
);
static
readonly
MethodInfo
InternalBeginVerticalSplit
=
InternalSplitterGUILayout
.
GetMethod
(
"BeginVerticalSplit"
,
new
Type
[]
{
SplitterState
,
typeof
(
GUILayoutOption
[])
});
static
readonly
MethodInfo
InternalEndVerticalSplit
=
InternalSplitterGUILayout
.
GetMethod
(
"EndVerticalSplit"
);
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/DrawProgressForDialogs.cs
0 → 100644
View file @
1c847220
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
(
GUILayoutUtility
.
GetLastRect
().
width
,
30
);
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
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/DrawProgressForOperations.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI.Progress
{
internal
static
class
DrawProgressForOperations
{
internal
static
void
For
(
PlasticGUIClient
plasticClient
,
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
(
plasticClient
);
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
(
PlasticGUIClient
plasticClient
)
{
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
;
plasticClient
.
CancelCurrentOperation
();
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/DrawProgressForViews.cs
0 → 100644
View file @
1c847220
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
ForIndeterminateProgress
(
ProgressControlsForViews
.
Data
data
)
{
EditorGUILayout
.
BeginHorizontal
(
EditorStyles
.
toolbar
);
GUILayout
.
Space
(
10
);
DoProgressBar
(
data
.
ProgressPercent
);
GUILayout
.
Space
(
3
);
DoProgressLabel
(
data
.
ProgressMessage
);
GUILayout
.
FlexibleSpace
();
EditorGUILayout
.
EndHorizontal
();
}
static
void
DoProgressBar
(
float
progressPercent
)
{
EditorGUILayout
.
BeginVertical
();
GUILayout
.
FlexibleSpace
();
Rect
progressRect
=
GUILayoutUtility
.
GetRect
(
30
,
10
);
EditorGUI
.
ProgressBar
(
progressRect
,
progressPercent
,
string
.
Empty
);
GUILayout
.
FlexibleSpace
();
EditorGUILayout
.
EndVertical
();
}
static
void
DoProgressLabel
(
string
progressMessage
)
{
EditorGUILayout
.
BeginVertical
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
Label
(
progressMessage
,
UnityStyles
.
ProgressLabel
);
GUILayout
.
FlexibleSpace
();
EditorGUILayout
.
EndVertical
();
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/OperationProgressData.cs
0 → 100644
View file @
1c847220
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
();
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/ProgressControlsForDialogs.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
using
UnityEngine
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI.Progress
{
internal
class
ProgressControlsForDialogs
:
IProgressControls
{
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
ForcedUpdateProgress
(
EditorWindow
dialog
)
{
double
updateTime
;
float
progressPercent
;
GetUpdateProgress
(
mLastUpdateTime
,
mData
.
ProgressPercent
,
out
updateTime
,
out
progressPercent
);
mLastUpdateTime
=
updateTime
;
if
(!
mData
.
IsWaitingAsyncResult
)
return
;
mData
.
ProgressPercent
=
progressPercent
;
if
(
Event
.
current
.
type
==
EventType
.
Repaint
)
dialog
.
Repaint
();
}
void
IProgressControls
.
HideProgress
()
{
mData
.
IsWaitingAsyncResult
=
false
;
mData
.
ProgressMessage
=
string
.
Empty
;
}
void
IProgressControls
.
ShowProgress
(
string
message
)
{
CleanStatusMessage
(
mData
);
mData
.
IsWaitingAsyncResult
=
true
;
mData
.
ProgressPercent
=
0f
;
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
;
}
static
void
GetUpdateProgress
(
double
lastUpdateTime
,
float
lastProgressPercent
,
out
double
updateTime
,
out
float
progressPercent
)
{
updateTime
=
EditorApplication
.
timeSinceStartup
;
double
deltaTime
=
Math
.
Min
(
0.1
,
updateTime
-
lastUpdateTime
);
double
deltaPercent
=
(
deltaTime
/
0.1
)
*
PERCENT_PER_SECONDS
;
progressPercent
=
Mathf
.
Repeat
(
lastProgressPercent
+
(
float
)
deltaPercent
,
1f
);
}
double
mLastUpdateTime
=
0.0
;
Data
mData
=
new
Data
();
const
double
PERCENT_PER_SECONDS
=
0.06
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Progress/ProgressControlsForViews.cs
0 → 100644
View file @
1c847220
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
UpdateDeterminateProgress
(
EditorWindow
parentWindow
)
{
if
(
IsOperationRunning
()
||
mRequestedRepaint
)
{
parentWindow
.
Repaint
();
mRequestedRepaint
=
false
;
}
}
internal
void
UpdateProgress
(
EditorWindow
parentWindow
)
{
if
(
IsOperationRunning
()
||
mRequestedRepaint
)
{
if
(
IsOperationRunning
())
UpdateIndeterminateProgress
();
parentWindow
.
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
;
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
;
}
void
UpdateIndeterminateProgress
()
{
// NOTE(rafa): there is no support for indeterminate progress bar
// i use this neverending progress bar as workaround
mData
.
ProgressPercent
+=
.
003f
;
if
(
mData
.
ProgressPercent
>
1f
)
mData
.
ProgressPercent
=
.
1f
;
}
Data
mData
=
new
Data
();
bool
mRequestedRepaint
;
}
}
Prev
1
…
22
23
24
25
26
27
28
29
30
…
32
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment