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/ResponseType.cs
0 → 100644
View file @
1c847220
namespace
Unity.PlasticSCM.Editor.UI
{
internal
enum
ResponseType
{
None
,
Ok
,
Cancel
,
Apply
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/RunModal.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Reflection
;
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
[
InitializeOnLoad
]
internal
static
class
RunModal
{
static
RunModal
()
{
InitializeInfo
();
}
internal
static
bool
IsAvailable
()
{
return
mShowWithModeMethod
!=
null
&&
mCreateSavedGUIState
!=
null
&&
mApplyAndForgetMethod
!=
null
&&
mParentField
!=
null
&&
mParentWindowProp
!=
null
&&
mMakeModalMethod
!=
null
;
}
internal
static
void
Dialog
(
EditorWindow
window
)
{
ShowAsUtility
(
window
);
object
savedGUIState
=
CreateSavedGUIState
();
PushDispatcherContext
(
window
);
MakeModal
(
window
);
PopDispatcherContext
(
window
);
ApplySavedGUIState
(
savedGUIState
);
}
static
void
MakeModal
(
EditorWindow
window
)
{
// MakeModal(m_Parent.window);
var
hostView
=
mParentField
.
GetValue
(
window
);
var
parentWindow
=
mParentWindowProp
.
GetValue
(
hostView
,
null
);
mMakeModalMethod
.
Invoke
(
mMakeModalMethod
.
IsStatic
?
null
:
window
,
new
object
[]
{
parentWindow
});
}
static
void
ShowAsUtility
(
EditorWindow
window
)
{
// ShowWithMode(ShowMode.Utility);
mShowWithModeMethod
.
Invoke
(
window
,
new
object
[]
{
2
});
}
static
object
CreateSavedGUIState
()
{
// SavedGUIState guiState = SavedGUIState.Create();
return
mCreateSavedGUIState
.
Invoke
(
null
,
null
);
}
static
void
ApplySavedGUIState
(
object
savedGUIState
)
{
// guiState.ApplyAndForget();
mApplyAndForgetMethod
.
Invoke
(
savedGUIState
,
null
);
}
static
void
PopDispatcherContext
(
EditorWindow
window
)
{
#if UNITY_2020_1_OR_NEWER
//UnityEngine.UIElements.EventDispatcher.editorDispatcher.PopDispatcherContext();
object
editorDispatcher
=
mEditorDispatcherProp2020
.
GetValue
(
null
);
mPopContextMethod2020
.
Invoke
(
editorDispatcher
,
null
);
#else
// m_Parent.visualTree.panel.dispatcher?.PopDispatcherContext();
object
dispatcher
=
GetDispatcher
(
window
);
if
(
dispatcher
!=
null
)
mPopContextMethod
.
Invoke
(
dispatcher
,
null
);
#endif
}
static
void
PushDispatcherContext
(
EditorWindow
window
)
{
#if UNITY_2020_1_OR_NEWER
//UnityEngine.UIElements.EventDispatcher.editorDispatcher.PushDispatcherContext();
object
editorDispatcher
=
mEditorDispatcherProp2020
.
GetValue
(
null
);
mPushContextMethod2020
.
Invoke
(
editorDispatcher
,
null
);
#else
// m_Parent.visualTree.panel.dispatcher?.PushDispatcherContext();
object
dispatcher
=
GetDispatcher
(
window
);
if
(
dispatcher
!=
null
)
mPushContextMethod
.
Invoke
(
dispatcher
,
null
);
#endif
}
static
object
GetDispatcher
(
EditorWindow
window
)
{
object
dispatcher
=
null
;
if
(
MayHaveDispatcher
())
{
var
parent
=
mParentField
.
GetValue
(
window
);
if
(
parent
!=
null
)
{
var
visualTree
=
mVisualTreeProp
.
GetValue
(
parent
,
null
);
if
(
visualTree
!=
null
)
{
var
panel
=
mPanelProp
.
GetValue
(
visualTree
,
null
);
if
(
panel
!=
null
)
{
dispatcher
=
mDispatcherProp
.
GetValue
(
panel
,
null
);
}
}
}
}
return
dispatcher
;
}
static
bool
MayHaveDispatcher
()
{
return
mDispatcherType
!=
null
&&
mPushContextMethod
!=
null
&&
mPopContextMethod
!=
null
;
}
static
void
InitializeInfo
()
{
var
flags
=
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
|
BindingFlags
.
Public
|
BindingFlags
.
Static
;
mMakeModalMethod
=
BuildMakeModalMethodInfo
(
flags
);
mShowWithModeMethod
=
typeof
(
EditorWindow
).
GetMethod
(
"ShowWithMode"
,
flags
);
mParentField
=
typeof
(
EditorWindow
).
GetField
(
"m_Parent"
,
flags
);
var
hostViewType
=
mParentField
.
FieldType
;
mParentWindowProp
=
hostViewType
.
GetProperty
(
"window"
,
flags
);
var
savedGUIStateType
=
typeof
(
EditorWindow
).
Assembly
.
GetType
(
"UnityEditor.SavedGUIState"
);
mCreateSavedGUIState
=
savedGUIStateType
.
GetMethod
(
"Create"
,
flags
);
mApplyAndForgetMethod
=
savedGUIStateType
.
GetMethod
(
"ApplyAndForget"
,
flags
);
#if UNITY_2020_1_OR_NEWER
mEditorDispatcherProp2020
=
typeof
(
UnityEngine
.
UIElements
.
EventDispatcher
).
GetProperty
(
"editorDispatcher"
,
flags
);
mPushContextMethod2020
=
mEditorDispatcherProp2020
.
PropertyType
.
GetMethod
(
"PushDispatcherContext"
,
flags
);
mPopContextMethod2020
=
mEditorDispatcherProp2020
.
PropertyType
.
GetMethod
(
"PopDispatcherContext"
,
flags
);
#endif
flags
=
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
|
BindingFlags
.
Public
;
mParentField
=
typeof
(
EditorWindow
).
GetField
(
"m_Parent"
,
flags
);
if
(
mParentField
!=
null
)
hostViewType
=
mParentField
.
FieldType
;
if
(
hostViewType
!=
null
)
mVisualTreeProp
=
hostViewType
.
GetProperty
(
"visualTree"
);
if
(
mVisualTreeProp
!=
null
)
{
var
visualTreeType
=
mVisualTreeProp
.
PropertyType
;
if
(
visualTreeType
!=
null
)
{
mPanelProp
=
visualTreeType
.
GetProperty
(
"panel"
);
if
(
mPanelProp
!=
null
)
{
var
panelType
=
mPanelProp
.
PropertyType
;
if
(
panelType
!=
null
)
{
mDispatcherProp
=
panelType
.
GetProperty
(
"dispatcher"
);
if
(
mDispatcherProp
!=
null
)
{
mDispatcherType
=
mDispatcherProp
.
PropertyType
;
if
(
mDispatcherType
!=
null
)
{
mPushContextMethod
=
mDispatcherType
.
GetMethod
(
"PushDispatcherContext"
,
flags
);
mPopContextMethod
=
mDispatcherType
.
GetMethod
(
"PopDispatcherContext"
,
flags
);
}
}
}
}
}
}
}
static
MethodInfo
BuildMakeModalMethodInfo
(
BindingFlags
flags
)
{
if
(
EditorVersion
.
IsCurrentEditorOlderThan
(
"2019.3.10f1"
))
return
typeof
(
EditorWindow
).
GetMethod
(
"MakeModal"
,
flags
);
return
typeof
(
EditorWindow
).
GetMethod
(
"Internal_MakeModal"
,
flags
);
}
static
FieldInfo
mParentField
;
static
PropertyInfo
mParentWindowProp
;
static
MethodInfo
mMakeModalMethod
;
static
MethodInfo
mShowWithModeMethod
;
static
MethodInfo
mCreateSavedGUIState
;
static
MethodInfo
mApplyAndForgetMethod
;
static
PropertyInfo
mVisualTreeProp
;
static
Type
mDispatcherType
;
static
MethodInfo
mPushContextMethod
;
static
MethodInfo
mPopContextMethod
;
static
PropertyInfo
mPanelProp
;
static
PropertyInfo
mDispatcherProp
;
#if UNITY_2020_1_OR_NEWER
static
PropertyInfo
mEditorDispatcherProp2020
;
static
MethodInfo
mPushContextMethod2020
;
static
MethodInfo
mPopContextMethod2020
;
#endif
// // How ContainerWindows are visualized. Used with ContainerWindow.Show
// internal enum ShowMode
// {
// // Show as a normal window with max, min & close buttons.
// NormalWindow = 0,
// // Used for a popup menu. On mac this means light shadow and no titlebar.
// PopupMenu = 1,
// // Utility window - floats above the app. Disappears when app loses focus.
// Utility = 2,
// // Window has no shadow or decorations. Used internally for dragging stuff around.
// NoShadow = 3,
// // The Unity main window. On mac, this is the same as NormalWindow, except window doesn't have a close button.
// MainWindow = 4,
// // Aux windows. The ones that close the moment you move the mouse out of them.
// AuxWindow = 5,
// // Like PopupMenu, but without keyboard focus
// Tooltip = 6
// }
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/ShowWindow.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
ShowWindow
{
internal
static
PlasticWindow
Plastic
()
{
return
ShowPlasticWindow
(
false
);
}
internal
static
PlasticWindow
PlasticAfterDownloadingProject
()
{
return
ShowPlasticWindow
(
true
);
}
static
PlasticWindow
ShowPlasticWindow
(
bool
disableCollabWhenLoaded
)
{
PlasticWindow
window
=
EditorWindow
.
GetWindow
<
PlasticWindow
>(
UnityConstants
.
PLASTIC_WINDOW_TITLE
,
true
,
mConsoleWindowType
,
mProjectBrowserType
);
if
(
disableCollabWhenLoaded
)
window
.
DisableCollabIfEnabledWhenLoaded
();
window
.
SetupWindowTitle
();
return
window
;
}
static
Type
mConsoleWindowType
=
typeof
(
EditorWindow
).
Assembly
.
GetType
(
"UnityEditor.ConsoleWindow"
);
static
Type
mProjectBrowserType
=
typeof
(
EditorWindow
).
Assembly
.
GetType
(
"UnityEditor.ProjectBrowser"
);
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/SortOrderComparer.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
SortOrderComparer
<
T
>
:
IComparer
<
T
>
{
internal
SortOrderComparer
(
IComparer
<
T
>
comparer
,
bool
isAscending
)
{
mComparer
=
comparer
;
mIsAscending
=
isAscending
;
}
int
IComparer
<
T
>.
Compare
(
T
x
,
T
y
)
{
int
result
=
mComparer
.
Compare
(
x
,
y
);
return
mIsAscending
?
result
:
-
result
;
}
bool
mIsAscending
;
IComparer
<
T
>
mComparer
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/TabButton.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
TabButton
{
internal
bool
DrawTabButton
(
string
buttonText
,
bool
wasActive
,
float
width
)
{
bool
isCloseButtonClicked
;
return
DrawClosableTabButton
(
buttonText
,
wasActive
,
false
,
width
,
null
,
out
isCloseButtonClicked
);
}
internal
bool
DrawClosableTabButton
(
string
buttonText
,
bool
wasActive
,
bool
isClosable
,
float
width
,
Action
repaintAction
,
out
bool
isCloseButtonClicked
)
{
isCloseButtonClicked
=
false
;
GUIContent
buttonContent
=
new
GUIContent
(
buttonText
);
GUIStyle
buttonStyle
=
(
wasActive
)
?
UnityStyles
.
PlasticWindow
.
ActiveTabButton
:
EditorStyles
.
toolbarButton
;
Rect
toggleRect
=
GUILayoutUtility
.
GetRect
(
buttonContent
,
buttonStyle
,
GUILayout
.
Width
(
width
));
if
(
isClosable
&&
Event
.
current
.
type
==
EventType
.
MouseMove
)
{
if
(
mCloseButtonRect
.
Contains
(
Event
.
current
.
mousePosition
))
{
SetCloseButtonState
(
CloseButtonState
.
Hovered
,
repaintAction
);
}
else
{
SetCloseButtonState
(
CloseButtonState
.
Normal
,
repaintAction
);
}
}
if
(
isClosable
&&
Event
.
current
.
type
==
EventType
.
MouseDown
)
{
if
(
mCloseButtonRect
.
Contains
(
Event
.
current
.
mousePosition
))
{
SetCloseButtonState
(
CloseButtonState
.
Clicked
,
repaintAction
);
Event
.
current
.
Use
();
}
}
if
(
isClosable
&&
Event
.
current
.
type
==
EventType
.
MouseUp
)
{
if
(
mCloseButtonRect
.
Contains
(
Event
.
current
.
mousePosition
))
{
Event
.
current
.
Use
();
isCloseButtonClicked
=
true
;
}
if
(
IsTabClickWithMiddleButton
(
toggleRect
,
Event
.
current
))
{
Event
.
current
.
Use
();
isCloseButtonClicked
=
true
;
}
SetCloseButtonState
(
CloseButtonState
.
Normal
,
repaintAction
);
}
bool
isActive
=
GUI
.
Toggle
(
toggleRect
,
wasActive
,
buttonText
,
buttonStyle
);
if
(
isClosable
&&
toggleRect
.
height
>
1
)
{
mCloseButtonRect
=
DrawCloseButton
(
toggleRect
,
mCloseButtonState
);
}
if
(
wasActive
)
{
DrawUnderline
(
toggleRect
);
}
return
isActive
;
}
static
Rect
DrawCloseButton
(
Rect
toggleRect
,
CloseButtonState
state
)
{
int
closeButtonSize
=
15
;
GUIContent
closeImage
=
new
GUIContent
(
GetCloseImage
(
state
));
Rect
closeTabRect
=
new
Rect
(
toggleRect
.
xMax
-
closeButtonSize
-
1
,
toggleRect
.
y
+
(
toggleRect
.
height
/
2
-
closeButtonSize
/
2
),
closeButtonSize
,
closeButtonSize
);
GUI
.
Button
(
closeTabRect
,
closeImage
,
EditorStyles
.
label
);
return
new
Rect
(
closeTabRect
.
x
-
1
,
closeTabRect
.
y
-
1
,
closeTabRect
.
width
+
2
,
closeTabRect
.
height
+
2
);
}
static
void
DrawUnderline
(
Rect
toggleRect
)
{
GUIStyle
activeTabStyle
=
UnityStyles
.
PlasticWindow
.
ActiveTabUnderline
;
Rect
underlineRect
=
new
Rect
(
toggleRect
.
x
,
toggleRect
.
yMax
-
activeTabStyle
.
fixedHeight
,
toggleRect
.
width
,
activeTabStyle
.
fixedHeight
);
GUI
.
Label
(
underlineRect
,
string
.
Empty
,
activeTabStyle
);
}
static
bool
IsTabClickWithMiddleButton
(
Rect
toggleRect
,
Event
currentEvent
)
{
if
(
currentEvent
.
button
!=
2
)
return
false
;
return
toggleRect
.
height
>
1
&&
toggleRect
.
Contains
(
Event
.
current
.
mousePosition
);
}
static
Texture
GetCloseImage
(
CloseButtonState
state
)
{
if
(
state
==
CloseButtonState
.
Hovered
)
return
Images
.
GetHoveredCloseIcon
();
if
(
state
==
CloseButtonState
.
Clicked
)
return
Images
.
GetClickedCloseIcon
();
return
Images
.
GetCloseIcon
();
}
void
SetCloseButtonState
(
CloseButtonState
newState
,
Action
repaintAction
)
{
if
(
mCloseButtonState
==
newState
)
return
;
mCloseButtonState
=
newState
;
if
(
repaintAction
!=
null
)
repaintAction
();
}
Rect
mCloseButtonRect
;
CloseButtonState
mCloseButtonState
;
enum
CloseButtonState
{
Normal
,
Clicked
,
Hovered
,
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/DrawTreeViewItem.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
static
class
DrawTreeViewItem
{
internal
static
void
InitializeStyles
()
{
if
(
EditorStyles
.
label
==
null
)
return
;
TreeView
.
DefaultStyles
.
label
=
UnityStyles
.
Tree
.
Label
;
TreeView
.
DefaultStyles
.
boldLabel
=
UnityStyles
.
Tree
.
BoldLabel
;
}
internal
static
void
ForCategoryItem
(
Rect
rowRect
,
float
rowHeight
,
int
depth
,
Texture
icon
,
string
label
,
bool
isSelected
,
bool
isFocused
)
{
float
indent
=
GetIndent
(
depth
);
rowRect
.
x
+=
indent
;
rowRect
.
width
-=
indent
;
rowRect
=
DrawIconLeft
(
rowRect
,
rowHeight
,
icon
,
null
);
TreeView
.
DefaultGUI
.
Label
(
rowRect
,
label
,
isSelected
,
isFocused
);
}
internal
static
bool
ForCheckableCategoryItem
(
Rect
rowRect
,
float
rowHeight
,
int
depth
,
Texture
icon
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
wasChecked
,
bool
hadCheckedChildren
)
{
float
indent
=
GetIndent
(
depth
);
rowRect
.
x
+=
indent
;
rowRect
.
width
-=
indent
;
Rect
checkRect
=
GetCheckboxRect
(
rowRect
,
rowHeight
);
if
(!
wasChecked
&&
hadCheckedChildren
)
EditorGUI
.
showMixedValue
=
true
;
bool
isChecked
=
EditorGUI
.
Toggle
(
checkRect
,
wasChecked
);
EditorGUI
.
showMixedValue
=
false
;
rowRect
.
x
=
checkRect
.
xMax
-
4
;
rowRect
.
width
-=
checkRect
.
width
;
rowRect
=
DrawIconLeft
(
rowRect
,
rowHeight
,
icon
,
null
);
TreeView
.
DefaultGUI
.
Label
(
rowRect
,
label
,
isSelected
,
isFocused
);
return
isChecked
;
}
internal
static
void
ForItemCell
(
Rect
rect
,
float
rowHeight
,
int
depth
,
Texture
icon
,
GetChangesOverlayIcon
.
Data
overlayIconData
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
isBoldText
,
bool
isSecondaryLabel
)
{
float
indent
=
GetIndent
(
depth
);
rect
.
x
+=
indent
;
rect
.
width
-=
indent
;
rect
=
DrawIconLeft
(
rect
,
rowHeight
,
icon
,
overlayIconData
);
if
(
isSecondaryLabel
)
{
ForSecondaryLabel
(
rect
,
label
,
isSelected
,
isFocused
,
isBoldText
);
return
;
}
ForLabel
(
rect
,
label
,
isSelected
,
isFocused
,
isBoldText
);
}
internal
static
bool
ForCheckableItemCell
(
Rect
rect
,
float
rowHeight
,
int
depth
,
Texture
icon
,
GetChangesOverlayIcon
.
Data
overlayIconData
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
isHighlighted
,
bool
wasChecked
)
{
float
indent
=
GetIndent
(
depth
);
rect
.
x
+=
indent
;
rect
.
width
-=
indent
;
Rect
checkRect
=
GetCheckboxRect
(
rect
,
rowHeight
);
bool
isChecked
=
EditorGUI
.
Toggle
(
checkRect
,
wasChecked
);
rect
.
x
=
checkRect
.
xMax
;
rect
.
width
-=
checkRect
.
width
;
rect
=
DrawIconLeft
(
rect
,
rowHeight
,
icon
,
overlayIconData
);
if
(
isHighlighted
)
TreeView
.
DefaultGUI
.
BoldLabel
(
rect
,
label
,
isSelected
,
isFocused
);
else
TreeView
.
DefaultGUI
.
Label
(
rect
,
label
,
isSelected
,
isFocused
);
return
isChecked
;
}
static
Rect
DrawIconLeft
(
Rect
rect
,
float
rowHeight
,
Texture
icon
,
GetChangesOverlayIcon
.
Data
overlayIconData
)
{
if
(
icon
==
null
)
return
rect
;
float
iconWidth
=
rowHeight
*
((
float
)
icon
.
width
/
icon
.
height
);
Rect
iconRect
=
new
Rect
(
rect
.
x
,
rect
.
y
,
iconWidth
,
rowHeight
);
EditorGUI
.
LabelField
(
iconRect
,
new
GUIContent
(
icon
),
UnityStyles
.
Tree
.
IconStyle
);
if
(
overlayIconData
!=
null
&&
overlayIconData
.
Texture
!=
null
)
{
Rect
overlayIconRect
=
new
Rect
(
iconRect
.
x
+
overlayIconData
.
XOffset
,
iconRect
.
y
+
overlayIconData
.
YOffset
,
overlayIconData
.
Size
,
overlayIconData
.
Size
);
GUI
.
DrawTexture
(
overlayIconRect
,
overlayIconData
.
Texture
,
ScaleMode
.
ScaleToFit
);
}
rect
.
x
+=
iconRect
.
width
;
rect
.
width
-=
iconRect
.
width
;
return
rect
;
}
static
Rect
GetCheckboxRect
(
Rect
rect
,
float
rowHeight
)
{
return
new
Rect
(
rect
.
x
,
rect
.
y
+
UnityConstants
.
TREEVIEW_CHECKBOX_Y_OFFSET
,
UnityConstants
.
TREEVIEW_CHECKBOX_SIZE
,
rect
.
height
);
}
static
float
GetIndent
(
int
depth
)
{
if
(
depth
==
-
1
)
return
0
;
return
16
+
(
depth
*
16
);
}
internal
static
void
ForSecondaryLabelRightAligned
(
Rect
rect
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
isBoldText
)
{
if
(
Event
.
current
.
type
!=
EventType
.
Repaint
)
return
;
if
(
isBoldText
)
{
GUIStyle
secondaryBoldRightAligned
=
UnityStyles
.
Tree
.
SecondaryLabelBoldRightAligned
;
secondaryBoldRightAligned
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
return
;
}
GUIStyle
secondaryLabelRightAligned
=
UnityStyles
.
Tree
.
SecondaryLabelRightAligned
;
secondaryLabelRightAligned
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
}
internal
static
void
ForSecondaryLabel
(
Rect
rect
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
isBoldText
)
{
if
(
Event
.
current
.
type
!=
EventType
.
Repaint
)
return
;
if
(
isBoldText
)
{
GUIStyle
secondaryBoldLabel
=
UnityStyles
.
Tree
.
SecondaryBoldLabel
;
secondaryBoldLabel
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
return
;
}
GUIStyle
secondaryLabel
=
UnityStyles
.
Tree
.
SecondaryLabel
;
secondaryLabel
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
}
internal
static
void
ForLabel
(
Rect
rect
,
string
label
,
bool
isSelected
,
bool
isFocused
,
bool
isBoldText
)
{
if
(
Event
.
current
.
type
!=
EventType
.
Repaint
)
return
;
if
(
isBoldText
)
{
TreeView
.
DefaultStyles
.
boldLabel
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
return
;
}
TreeView
.
DefaultStyles
.
label
.
Draw
(
rect
,
label
,
false
,
true
,
isSelected
,
isFocused
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/GetChangesOverlayIcon.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Commands
;
using
Codice.ThemeImages
;
using
PlasticGui.WorkspaceWindow.IncomingChanges
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
GluonIncomingChangeInfo
=
PlasticGui
.
Gluon
.
WorkspaceWindow
.
Views
.
IncomingChanges
.
IncomingChangeInfo
;
using
GluonIncomingChangeCategory
=
PlasticGui
.
Gluon
.
WorkspaceWindow
.
Views
.
IncomingChanges
.
IncomingChangeCategory
;
using
Unity.PlasticSCM.Editor.AssetsOverlays
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
static
class
GetChangesOverlayIcon
{
internal
class
Data
{
internal
readonly
Texture
Texture
;
internal
readonly
float
XOffset
;
internal
readonly
float
YOffset
;
internal
readonly
float
Size
;
internal
Data
(
Texture
texture
,
float
xOffset
,
float
yOffset
,
float
size
)
{
Texture
=
texture
;
XOffset
=
xOffset
;
YOffset
=
yOffset
;
Size
=
size
;
}
}
internal
static
Data
ForPlasticIncomingChange
(
IncomingChangeInfo
incomingChange
,
bool
isSolvedConflict
)
{
if
(
incomingChange
.
CategoryType
==
IncomingChangesCategory
.
Type
.
FileConflicts
||
incomingChange
.
CategoryType
==
IncomingChangesCategory
.
Type
.
DirectoryConflicts
)
return
ForConflict
(
isSolvedConflict
);
if
(
incomingChange
.
IsXLink
())
return
BuildData
.
ForXLink
();
if
(
incomingChange
.
CategoryType
==
IncomingChangesCategory
.
Type
.
Deleted
)
return
BuildData
.
ForDeletedOnServer
();
if
(
incomingChange
.
CategoryType
==
IncomingChangesCategory
.
Type
.
Changed
)
return
BuildData
.
ForOutOfDate
();
return
null
;
}
internal
static
Data
ForGluonIncomingChange
(
GluonIncomingChangeInfo
incomingChange
,
bool
isSolvedConflict
)
{
if
(
incomingChange
.
CategoryType
==
GluonIncomingChangeCategory
.
Type
.
Conflicted
)
return
ForConflict
(
isSolvedConflict
);
if
(
incomingChange
.
IsXLink
())
return
BuildData
.
ForXLink
();
if
(
incomingChange
.
CategoryType
==
GluonIncomingChangeCategory
.
Type
.
Deleted
)
return
BuildData
.
ForDeletedOnServer
();
if
(
incomingChange
.
CategoryType
==
GluonIncomingChangeCategory
.
Type
.
Changed
)
return
BuildData
.
ForOutOfDate
();
return
null
;
}
internal
static
Data
ForPendingChange
(
ChangeInfo
changeInfo
,
bool
isConflict
)
{
if
(
isConflict
)
return
BuildData
.
ForConflicted
();
ItemIconImageType
type
=
ChangeInfoView
.
GetIconImageType
(
changeInfo
);
if
(
ChangeTypesOperator
.
AreAllSet
(
changeInfo
.
ChangeTypes
,
ChangeTypes
.
Added
))
return
BuildData
.
ForAdded
();
switch
(
type
)
{
case
ItemIconImageType
.
Ignored
:
return
BuildData
.
ForIgnored
();
case
ItemIconImageType
.
Private
:
return
BuildData
.
ForPrivated
();
case
ItemIconImageType
.
Deleted
:
return
BuildData
.
ForDeleted
();
case
ItemIconImageType
.
CheckedOut
:
return
BuildData
.
ForCheckedOut
();
default
:
return
null
;
}
}
internal
static
Data
ForAssetStatus
(
AssetStatus
status
)
{
switch
(
status
)
{
case
AssetStatus
.
Ignored
:
return
BuildData
.
ForIgnored
();
case
AssetStatus
.
Private
:
return
BuildData
.
ForPrivated
();
case
AssetStatus
.
Added
:
return
BuildData
.
ForAdded
();
case
AssetStatus
.
Checkout
:
return
BuildData
.
ForCheckedOut
();
case
AssetStatus
.
OutOfDate
:
return
BuildData
.
ForOutOfDate
();
case
AssetStatus
.
Conflicted
:
return
BuildData
.
ForConflicted
();
case
AssetStatus
.
DeletedOnServer
:
return
BuildData
.
ForDeletedOnServer
();
case
AssetStatus
.
Locked
:
return
BuildData
.
ForLocked
();
case
AssetStatus
.
LockedRemote
:
return
BuildData
.
ForLockedRemote
();
}
return
null
;
}
static
Data
ForConflict
(
bool
isResolved
)
{
if
(
isResolved
)
return
BuildData
.
ForOk
();
return
BuildData
.
ForConflicted
();
}
static
class
BuildData
{
internal
static
Data
ForOk
()
{
return
new
Data
(
Images
.
GetImage
(
Images
.
Name
.
Ok
),
4f
,
4f
,
SIZE
);
}
internal
static
Data
ForXLink
()
{
return
new
Data
(
Images
.
GetImage
(
Images
.
Name
.
XLink
),
2f
,
3f
,
SIZE
);
}
internal
static
Data
ForIgnored
()
{
return
new
Data
(
Images
.
GetImage
(
Images
.
Name
.
Ignored
),
GetLeftXOffset
(),
GetBottomYOffset
(),
SIZE
);
}
internal
static
Data
ForPrivated
()
{
return
new
Data
(
Images
.
GetPrivatedOverlayIcon
(),
GetLeftXOffset
(),
GetBottomYOffset
(),
SIZE
);
}
internal
static
Data
ForAdded
()
{
return
new
Data
(
Images
.
GetAddedOverlayIcon
(),
GetLeftXOffset
(),
GetTopYOffset
(),
SIZE
);
}
internal
static
Data
ForDeleted
()
{
return
new
Data
(
Images
.
GetDeletedOverlayIcon
(),
GetLeftXOffset
(),
GetTopYOffset
(),
SIZE
);
}
internal
static
Data
ForCheckedOut
()
{
return
new
Data
(
Images
.
GetCheckedOutOverlayIcon
(),
GetLeftXOffset
(),
GetTopYOffset
(),
SIZE
);
}
internal
static
Data
ForDeletedOnServer
()
{
return
new
Data
(
Images
.
GetDeletedRemoteOverlayIcon
(),
GetRightXOffset
(),
GetTopYOffset
(),
SIZE
);
}
internal
static
Data
ForOutOfDate
()
{
return
new
Data
(
Images
.
GetOutOfSyncOverlayIcon
(),
GetRightXOffset
(),
GetBottomYOffset
(),
SIZE
);
}
internal
static
Data
ForLocked
()
{
return
new
Data
(
Images
.
GetLockedLocalOverlayIcon
(),
GetLeftXOffset
(),
GetTopYOffset
(),
SIZE
);
}
internal
static
Data
ForLockedRemote
()
{
return
new
Data
(
Images
.
GetLockedRemoteOverlayIcon
(),
GetRightXOffset
(),
GetTopYOffset
(),
SIZE
);
}
static
float
GetLeftXOffset
()
{
return
-
4f
;
}
internal
static
Data
ForConflicted
()
{
return
new
Data
(
Images
.
GetConflictedOverlayIcon
(),
GetLeftXOffset
(),
GetBottomYOffset
(),
SIZE
);
}
static
float
GetRightXOffset
()
{
return
8f
;
}
static
float
GetBottomYOffset
()
{
return
UnityConstants
.
TREEVIEW_ROW_HEIGHT
-
SIZE
+
2f
;
}
static
float
GetTopYOffset
()
{
return
-
1f
;
}
const
float
SIZE
=
16
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/ListViewItemIds.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
class
ListViewItemIds
<
I
>
{
internal
void
Clear
()
{
mCacheByInfo
.
Clear
();
}
internal
List
<
KeyValuePair
<
I
,
int
>>
GetInfoItems
()
{
return
mCacheByInfo
.
ToList
();
}
internal
bool
TryGetInfoItemId
(
I
info
,
out
int
itemId
)
{
return
mCacheByInfo
.
TryGetValue
(
info
,
out
itemId
);
}
internal
int
AddInfoItem
(
I
info
)
{
int
itemId
=
GetNextItemId
();
mCacheByInfo
.
Add
(
info
,
itemId
);
return
itemId
;
}
int
GetNextItemId
()
{
return
mCacheByInfo
.
Count
+
1
;
}
Dictionary
<
I
,
int
>
mCacheByInfo
=
new
Dictionary
<
I
,
int
>();
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/TableViewOperations.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor.IMGUI.Controls
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
static
class
TableViewOperations
{
internal
static
int
GetFirstSelectedRow
(
TreeView
treeView
)
{
IList
<
int
>
selectedIds
=
treeView
.
GetSelection
();
if
(
selectedIds
.
Count
==
0
)
return
-
1
;
return
selectedIds
[
0
];
}
internal
static
void
SelectFirstRow
(
TreeView
treeView
)
{
int
rowCount
=
treeView
.
GetRows
().
Count
;
if
(
rowCount
==
0
)
return
;
SetSelectionAndScroll
(
treeView
,
new
List
<
int
>
{
1
});
}
internal
static
void
SelectDefaultRow
(
TreeView
treeView
,
int
defaultRow
)
{
int
rowCount
=
treeView
.
GetRows
().
Count
;
if
(
defaultRow
==
-
1
||
rowCount
==
0
)
return
;
if
(
defaultRow
>=
rowCount
)
defaultRow
=
rowCount
-
1
;
SetSelectionAndScroll
(
treeView
,
new
List
<
int
>
{
defaultRow
});
}
internal
static
void
SetSelectionAndScroll
(
TreeView
treeView
,
List
<
int
>
idsToSelect
)
{
treeView
.
SetSelection
(
idsToSelect
,
TreeViewSelectionOptions
.
FireSelectionChanged
|
TreeViewSelectionOptions
.
RevealAndFrame
);
}
internal
static
void
ScrollToSelection
(
TreeView
treeView
)
{
if
(!
treeView
.
HasSelection
())
return
;
int
itemId
=
treeView
.
GetSelection
()[
0
];
if
(!
IsVisible
(
itemId
,
treeView
))
return
;
treeView
.
FrameItem
(
itemId
);
}
static
bool
IsVisible
(
int
id
,
TreeView
treeView
)
{
foreach
(
TreeViewItem
item
in
treeView
.
GetRows
())
{
if
(
item
.
id
==
id
)
return
true
;
}
return
false
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/TreeHeaderColumns.cs
0 → 100644
View file @
1c847220
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
static
class
TreeHeaderColumns
{
internal
static
void
SetTitles
(
MultiColumnHeaderState
.
Column
[]
columns
,
string
[]
headerTitles
)
{
for
(
int
i
=
0
;
i
<
headerTitles
.
Length
;
i
++)
columns
[
i
].
headerContent
=
new
GUIContent
(
headerTitles
[
i
]);
}
internal
static
void
SetVisibilities
(
MultiColumnHeaderState
.
Column
[]
columns
,
bool
[]
visibilities
)
{
for
(
int
i
=
0
;
i
<
visibilities
.
Length
;
i
++)
columns
[
i
].
allowToggleVisibility
=
visibilities
[
i
];
}
internal
static
void
SetWidths
(
MultiColumnHeaderState
.
Column
[]
columns
,
float
[]
widths
)
{
for
(
int
i
=
0
;
i
<
widths
.
Length
;
i
++)
columns
[
i
].
width
=
widths
[
i
];
}
internal
static
string
[]
GetTitles
(
MultiColumnHeaderState
.
Column
[]
columns
)
{
string
[]
titles
=
new
string
[
columns
.
Length
];
for
(
int
i
=
0
;
i
<
columns
.
Length
;
i
++)
titles
[
i
]
=
columns
[
i
].
headerContent
.
text
;
return
titles
;
}
internal
static
bool
[]
GetVisibilities
(
MultiColumnHeaderState
.
Column
[]
columns
)
{
bool
[]
visibilities
=
new
bool
[
columns
.
Length
];
for
(
int
i
=
0
;
i
<
columns
.
Length
;
i
++)
visibilities
[
i
]
=
columns
[
i
].
allowToggleVisibility
;
return
visibilities
;
}
internal
static
float
[]
GetWidths
(
MultiColumnHeaderState
.
Column
[]
columns
)
{
float
[]
widths
=
new
float
[
columns
.
Length
];
for
(
int
i
=
0
;
i
<
columns
.
Length
;
i
++)
widths
[
i
]
=
columns
[
i
].
width
;
return
widths
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/TreeHeaderSettings.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Linq
;
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
static
class
TreeHeaderSettings
{
internal
static
void
Load
(
MultiColumnHeaderState
headerState
,
string
treeSettingsName
,
int
defaultSortColumnIdx
,
bool
defaultSortedAscending
=
true
)
{
var
visibleColumns
=
EditorPrefs
.
GetString
(
GetSettingKey
(
treeSettingsName
,
VISIBLE_COLUMNS_KEY
),
string
.
Empty
)
.
Split
(
","
.
ToCharArray
(),
StringSplitOptions
.
RemoveEmptyEntries
)
.
Select
(
idx
=>
int
.
Parse
(
idx
))
.
ToArray
();
var
columnWidths
=
EditorPrefs
.
GetString
(
GetSettingKey
(
treeSettingsName
,
COLUMNS_WIDTHS_KEY
),
string
.
Empty
)
.
Split
(
","
.
ToCharArray
(),
StringSplitOptions
.
RemoveEmptyEntries
)
.
Select
(
w
=>
float
.
Parse
(
w
))
.
ToArray
();
if
(
visibleColumns
.
Length
>
0
)
headerState
.
visibleColumns
=
visibleColumns
;
if
(
headerState
.
columns
.
Length
==
columnWidths
.
Length
)
TreeHeaderColumns
.
SetWidths
(
headerState
.
columns
,
columnWidths
);
if
(
defaultSortColumnIdx
==
UnityConstants
.
UNSORT_COLUMN_ID
)
return
;
var
sortColumnIdx
=
EditorPrefs
.
GetInt
(
GetSettingKey
(
treeSettingsName
,
SORT_COLUMN_INDEX_KEY
),
defaultSortColumnIdx
);
var
sortColumnAscending
=
EditorPrefs
.
GetBool
(
GetSettingKey
(
treeSettingsName
,
SORT_ASCENDING_KEY
),
defaultSortedAscending
);
headerState
.
sortedColumnIndex
=
sortColumnIdx
;
headerState
.
columns
[
sortColumnIdx
].
sortedAscending
=
sortColumnAscending
;
}
internal
static
void
Save
(
MultiColumnHeaderState
headerState
,
string
treeSettingsName
)
{
int
[]
visibleColumns
=
headerState
.
visibleColumns
;
float
[]
columnWidths
=
TreeHeaderColumns
.
GetWidths
(
headerState
.
columns
);
EditorPrefs
.
SetString
(
GetSettingKey
(
treeSettingsName
,
VISIBLE_COLUMNS_KEY
),
string
.
Join
(
","
,
visibleColumns
.
Select
(
idx
=>
idx
.
ToString
()).
ToArray
()));
EditorPrefs
.
SetString
(
GetSettingKey
(
treeSettingsName
,
COLUMNS_WIDTHS_KEY
),
string
.
Join
(
","
,
columnWidths
.
Select
(
w
=>
w
.
ToString
()).
ToArray
()));
int
sortColumnIdx
=
headerState
.
sortedColumnIndex
;
if
(
sortColumnIdx
==
UnityConstants
.
UNSORT_COLUMN_ID
)
return
;
bool
sortColumnAscending
=
headerState
.
columns
[
headerState
.
sortedColumnIndex
].
sortedAscending
;
EditorPrefs
.
SetInt
(
GetSettingKey
(
treeSettingsName
,
SORT_COLUMN_INDEX_KEY
),
sortColumnIdx
);
EditorPrefs
.
SetBool
(
GetSettingKey
(
treeSettingsName
,
SORT_ASCENDING_KEY
),
sortColumnAscending
);
}
internal
static
void
Clear
(
string
treeSettingsName
)
{
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
treeSettingsName
,
VISIBLE_COLUMNS_KEY
));
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
treeSettingsName
,
COLUMNS_WIDTHS_KEY
));
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
treeSettingsName
,
SORT_COLUMN_INDEX_KEY
));
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
treeSettingsName
,
SORT_ASCENDING_KEY
));
}
static
string
GetSettingKey
(
string
treeSettingsName
,
string
key
)
{
return
string
.
Format
(
treeSettingsName
,
PlayerSettings
.
productGUID
,
key
);
}
static
string
VISIBLE_COLUMNS_KEY
=
"VisibleColumns"
;
static
string
COLUMNS_WIDTHS_KEY
=
"ColumnWidths"
;
static
string
SORT_COLUMN_INDEX_KEY
=
"SortColumnIdx"
;
static
string
SORT_ASCENDING_KEY
=
"SortAscending"
;
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Tree/TreeViewItemIds.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Unity.PlasticSCM.Editor.UI.Tree
{
internal
class
TreeViewItemIds
<
C
,
I
>
{
internal
void
Clear
()
{
mCacheByCategories
.
Clear
();
mCacheByInfo
.
Clear
();
}
internal
List
<
int
>
GetCategoryIds
()
{
return
new
List
<
int
>(
mCacheByCategories
.
Values
);
}
internal
List
<
KeyValuePair
<
I
,
int
>>
GetInfoItems
()
{
return
mCacheByInfo
.
ToList
();
}
internal
bool
TryGetCategoryItemId
(
C
category
,
out
int
itemId
)
{
return
mCacheByCategories
.
TryGetValue
(
category
,
out
itemId
);
}
internal
bool
TryGetInfoItemId
(
I
info
,
out
int
itemId
)
{
return
mCacheByInfo
.
TryGetValue
(
info
,
out
itemId
);
}
internal
int
AddCategoryItem
(
C
category
)
{
int
itemId
=
GetNextItemId
();
mCacheByCategories
.
Add
(
category
,
itemId
);
return
itemId
;
}
internal
int
AddInfoItem
(
I
info
)
{
int
itemId
=
GetNextItemId
();
mCacheByInfo
.
Add
(
info
,
itemId
);
return
itemId
;
}
int
GetNextItemId
()
{
return
mCacheByCategories
.
Count
+
mCacheByInfo
.
Count
+
1
;
}
Dictionary
<
C
,
int
>
mCacheByCategories
=
new
Dictionary
<
C
,
int
>();
Dictionary
<
I
,
int
>
mCacheByInfo
=
new
Dictionary
<
I
,
int
>();
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UIElements/LoadingSpinner.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
using
UnityEditor
;
using
UnityEngine.UIElements
;
namespace
Unity.PlasticSCM.Editor.UI.UIElements
{
internal
class
LoadingSpinner
:
VisualElement
{
internal
LoadingSpinner
()
{
mStarted
=
false
;
// add child elements to set up centered spinner rotation
VisualElement
spinner
=
new
VisualElement
();
Add
(
spinner
);
spinner
.
style
.
backgroundImage
=
Images
.
GetImage
(
Images
.
Name
.
Loading
);
spinner
.
style
.
width
=
16
;
spinner
.
style
.
height
=
16
;
spinner
.
style
.
left
=
-
8
;
spinner
.
style
.
top
=
-
8
;
style
.
position
=
Position
.
Relative
;
style
.
width
=
16
;
style
.
height
=
16
;
style
.
left
=
8
;
style
.
top
=
8
;
}
internal
void
Dispose
()
{
if
(
mStarted
)
EditorApplication
.
update
-=
UpdateProgress
;
}
internal
void
Start
()
{
if
(
mStarted
)
return
;
mRotation
=
0
;
mLastRotationTime
=
EditorApplication
.
timeSinceStartup
;
EditorApplication
.
update
+=
UpdateProgress
;
mStarted
=
true
;
}
internal
void
Stop
()
{
if
(!
mStarted
)
return
;
EditorApplication
.
update
-=
UpdateProgress
;
mStarted
=
false
;
}
void
UpdateProgress
()
{
double
currentTime
=
EditorApplication
.
timeSinceStartup
;
double
deltaTime
=
currentTime
-
mLastRotationTime
;
transform
.
rotation
=
Quaternion
.
Euler
(
0
,
0
,
mRotation
);
mRotation
+=
(
int
)(
ROTATION_SPEED
*
deltaTime
);
mRotation
=
mRotation
%
360
;
if
(
mRotation
<
0
)
mRotation
+=
360
;
mLastRotationTime
=
currentTime
;
}
int
mRotation
;
double
mLastRotationTime
;
bool
mStarted
;
const
int
ROTATION_SPEED
=
360
;
// Euler degrees per second
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UIElements/TabView.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEngine.UIElements
;
using
Unity.PlasticSCM.Editor
;
namespace
Unity.PlasticSCM.Editor.UI.UIElements
{
internal
class
TabView
:
VisualElement
{
internal
TabView
()
{
InitializeLayoutAndStyles
();
BuildComponents
();
}
internal
Button
AddTab
(
string
name
,
VisualElement
content
)
{
mTabs
.
Add
(
name
,
content
);
Button
newButton
=
new
Button
()
{
text
=
name
,
name
=
name
};
mButtons
.
Add
(
name
,
newButton
);
newButton
.
clickable
.
clickedWithEventInfo
+=
OnClickButton
;
mTabArea
.
Add
(
newButton
);
if
(
mTabs
.
Count
==
1
)
ButtonClicked
(
newButton
);
return
newButton
;
}
internal
void
SwitchContent
(
VisualElement
content
)
{
mContentArea
.
Clear
();
mContentArea
.
Add
(
content
);
foreach
(
Button
button
in
mButtons
.
Values
)
button
.
RemoveFromClassList
(
"active"
);
}
void
OnClickButton
(
EventBase
eventBase
)
{
ButtonClicked
((
Button
)
eventBase
.
target
);
}
void
ButtonClicked
(
Button
clickedButton
)
{
VisualElement
content
;
mTabs
.
TryGetValue
(
clickedButton
.
text
,
out
content
);
mContentArea
.
Clear
();
mContentArea
.
Add
(
content
);
foreach
(
Button
button
in
mButtons
.
Values
)
button
.
RemoveFromClassList
(
"active"
);
clickedButton
.
AddToClassList
(
"active"
);
}
void
BuildComponents
()
{
mTabArea
=
this
.
Query
<
VisualElement
>(
"TabArea"
).
First
();
mContentArea
=
this
.
Query
<
VisualElement
>(
"ContentArea"
).
First
();
}
void
InitializeLayoutAndStyles
()
{
this
.
LoadLayout
(
typeof
(
TabView
).
Name
);
this
.
LoadStyle
(
typeof
(
TabView
).
Name
);
}
VisualElement
mContentArea
;
VisualElement
mTabArea
;
Dictionary
<
string
,
VisualElement
>
mTabs
=
new
Dictionary
<
string
,
VisualElement
>();
Dictionary
<
string
,
Button
>
mButtons
=
new
Dictionary
<
string
,
Button
>();
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UIElements/UIElementsExtensions.cs
0 → 100644
View file @
1c847220
using
System.IO
;
using
UnityEditor
;
using
UnityEngine.UIElements
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.AssetUtils
;
namespace
Unity.PlasticSCM.Editor.UI.UIElements
{
internal
static
class
UIElementsExtensions
{
internal
static
void
LoadLayout
(
this
VisualElement
element
,
string
className
)
{
string
uxmlRelativePath
=
Path
.
Combine
(
AssetsPath
.
GetLayoutsFolderRelativePath
(),
string
.
Format
(
"{0}.uxml"
,
className
));
VisualTreeAsset
visualTree
=
AssetDatabase
.
LoadAssetAtPath
<
VisualTreeAsset
>(
uxmlRelativePath
);
if
(
visualTree
==
null
)
{
UnityEngine
.
Debug
.
LogErrorFormat
(
"Layout {0} not found at path {1}"
,
className
,
uxmlRelativePath
);
return
;
}
visualTree
.
CloneTree
(
element
);
}
internal
static
void
LoadStyle
(
this
VisualElement
element
,
string
className
)
{
string
ussRelativePath
=
Path
.
Combine
(
AssetsPath
.
GetStylesFolderRelativePath
(),
string
.
Format
(
"{0}.uss"
,
className
));
StyleSheet
sheet
=
AssetDatabase
.
LoadAssetAtPath
<
StyleSheet
>(
ussRelativePath
);
if
(
sheet
!=
null
)
{
element
.
styleSheets
.
Add
(
sheet
);
}
string
ussSkinRelativePath
=
Path
.
Combine
(
AssetsPath
.
GetStylesFolderRelativePath
(),
string
.
Format
(
"{0}.{1}.uss"
,
className
,
EditorGUIUtility
.
isProSkin
?
"dark"
:
"light"
));
StyleSheet
skinSheet
=
AssetDatabase
.
LoadAssetAtPath
<
StyleSheet
>(
ussSkinRelativePath
);
if
(
skinSheet
==
null
)
return
;
element
.
styleSheets
.
Add
(
skinSheet
);
}
internal
static
void
FocusOnceLoaded
(
this
TextField
elem
)
{
// Really weird behavior from UIElements, apperently in order
// to focus a text field you have to wait for it to attach to
// the panel and then focus it's TextInputBaseField child
// control rather than the TextField itself. For more see:
// https://forum.unity.com/threads/focus-doesnt-seem-to-work.901130/
elem
.
RegisterCallback
<
AttachToPanelEvent
>(
_
=>
elem
.
Q
(
TextInputBaseField
<
string
>.
textInputUssName
).
Focus
());
}
internal
static
void
FocusWorkaround
(
this
TextField
textField
)
{
// https://issuetracker.unity3d.com/issues/uielements-textfield-is-not-focused-and-you-are-not-able-to-type-in-characters-when-using-focus-method
textField
.
Q
(
"unity-text-input"
).
Focus
();
}
internal
static
void
SetControlImage
(
this
VisualElement
element
,
string
name
,
Images
.
Name
imageName
)
{
Image
imageElem
=
element
.
Query
<
Image
>(
name
).
First
();
imageElem
.
image
=
Images
.
GetImage
(
imageName
);
}
internal
static
void
SetControlImage
(
this
VisualElement
element
,
string
name
,
PlasticGui
.
Help
.
HelpImage
imageName
)
{
Image
imageElem
=
element
.
Query
<
Image
>(
name
).
First
();
imageElem
.
image
=
Images
.
GetHelpImage
(
imageName
);
}
internal
static
void
SetControlText
<
T
>(
this
VisualElement
element
,
string
name
,
PlasticLocalization
.
Name
fieldName
,
params
string
[]
format
)
where
T
:
VisualElement
{
dynamic
control
=
element
.
Query
<
T
>(
name
).
First
();
string
str
=
PlasticLocalization
.
GetString
(
fieldName
);
control
.
text
=
format
.
Length
>
0
?
string
.
Format
(
str
,
format
)
:
str
;
}
internal
static
void
SetControlLabel
<
T
>(
this
VisualElement
element
,
string
name
,
PlasticLocalization
.
Name
fieldName
)
where
T
:
VisualElement
{
dynamic
control
=
element
.
Query
<
T
>(
name
).
First
();
control
.
label
=
PlasticLocalization
.
GetString
(
fieldName
);
}
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UnityConstants.cs
0 → 100644
View file @
1c847220
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
UnityConstants
{
internal
const
float
CANCEL_BUTTON_SIZE
=
15
;
internal
const
float
SMALL_BUTTON_WIDTH
=
40
;
internal
const
float
REGULAR_BUTTON_WIDTH
=
60
;
internal
const
float
LARGE_BUTTON_WIDTH
=
100
;
internal
const
float
EXTRA_LARGE_BUTTON_WIDTH
=
130
;
internal
const
float
SEARCH_FIELD_WIDTH
=
550
;
internal
const
string
TREEVIEW_META_LABEL
=
" +meta"
;
internal
const
float
TREEVIEW_CHECKBOX_SIZE
=
17
;
internal
const
float
TREEVIEW_BASE_INDENT
=
16f
;
internal
const
float
FIRST_COLUMN_WITHOUT_ICON_INDENT
=
5
;
#if UNITY_2019_1_OR_NEWER
internal
const
float
DROPDOWN_ICON_Y_OFFSET
=
2
;
internal
const
float
TREEVIEW_FOLDOUT_Y_OFFSET
=
0
;
internal
const
float
TREEVIEW_ROW_HEIGHT
=
21
;
internal
const
float
TREEVIEW_HEADER_CHECKBOX_Y_OFFSET
=
0
;
internal
const
float
TREEVIEW_CHECKBOX_Y_OFFSET
=
0
;
internal
static
float
DIR_CONFLICT_VALIDATION_WARNING_LABEL_HEIGHT
=
21
;
#else
internal
const
float
DROPDOWN_ICON_Y_OFFSET
=
5
;
internal
const
float
TREEVIEW_FOLDOUT_Y_OFFSET
=
1
;
internal
const
float
TREEVIEW_ROW_HEIGHT
=
20
;
internal
const
float
TREEVIEW_HEADER_CHECKBOX_Y_OFFSET
=
6
;
internal
const
float
TREEVIEW_CHECKBOX_Y_OFFSET
=
2
;
internal
static
float
DIR_CONFLICT_VALIDATION_WARNING_LABEL_HEIGHT
=
18
;
#endif
#if UNITY_2020_1_OR_NEWER
internal
const
float
INSPECTOR_ACTIONS_BACK_RECTANGLE_TOP_MARGIN
=
-
2
;
#else
internal
const
float
INSPECTOR_ACTIONS_BACK_RECTANGLE_TOP_MARGIN
=
0
;
#endif
#if UNITY_2019
internal
const
int
INSPECTOR_ACTIONS_HEADER_BACK_RECTANGLE_HEIGHT
=
24
;
#else
internal
const
int
INSPECTOR_ACTIONS_HEADER_BACK_RECTANGLE_HEIGHT
=
7
;
#endif
internal
const
int
LEFT_MOUSE_BUTTON
=
0
;
internal
const
int
RIGHT_MOUSE_BUTTON
=
1
;
internal
const
int
UNSORT_COLUMN_ID
=
-
1
;
internal
const
string
PLASTIC_WINDOW_TITLE
=
"Plastic SCM"
;
internal
const
string
LOGIN_WINDOW_TITLE
=
"Sign in to Plastic SCM"
;
internal
const
int
ACTIVE_TAB_UNDERLINE_HEIGHT
=
2
;
internal
const
int
SPLITTER_INDICATOR_HEIGHT
=
1
;
internal
const
double
SEARCH_DELAYED_INPUT_ACTION_INTERVAL
=
0.25
;
internal
const
double
SELECTION_DELAYED_INPUT_ACTION_INTERVAL
=
0.25
;
internal
const
double
AUTO_REFRESH_DELAYED_INTERVAL
=
0.25
;
internal
const
double
AUTO_REFRESH_PENDING_CHANGES_DELAYED_INTERVAL
=
0.1
;
internal
const
string
PENDING_CHANGES_TABLE_SETTINGS_NAME
=
"{0}_PendingChangesTreeV2_{1}"
;
internal
const
string
GLUON_INCOMING_CHANGES_TABLE_SETTINGS_NAME
=
"{0}_GluonIncomingChangesTree_{1}"
;
internal
const
string
GLUON_INCOMING_ERRORS_TABLE_SETTINGS_NAME
=
"{0}_GluonIncomingErrorsList_{1}"
;
internal
const
string
GLUON_UPDATE_REPORT_TABLE_SETTINGS_NAME
=
"{0}_GluonUpdateReportList_{1}"
;
internal
const
string
DEVELOPER_INCOMING_CHANGES_TABLE_SETTINGS_NAME
=
"{0}_DeveloperIncomingChangesTree_{1}"
;
internal
const
string
DEVELOPER_UPDATE_REPORT_TABLE_SETTINGS_NAME
=
"{0}_DeveloperUpdateReportList_{1}"
;
internal
const
string
REPOSITORIES_TABLE_SETTINGS_NAME
=
"{0}_RepositoriesList_{1}"
;
internal
const
string
CHANGESETS_TABLE_SETTINGS_NAME
=
"{0}_ChangesetsList_{1}"
;
internal
const
string
CHANGESETS_DATE_FILTER_SETTING_NAME
=
"{0}_ChangesetsDateFilter_{1}"
;
internal
const
string
CHANGESETS_SHOW_CHANGES_SETTING_NAME
=
"{0}_ShowChanges_{1}"
;
internal
const
string
HISTORY_TABLE_SETTINGS_NAME
=
"{0}_HistoryList_{1}"
;
internal
static
class
ChangesetsColumns
{
internal
const
float
CHANGESET_NUMBER_WIDTH
=
80
;
internal
const
float
CHANGESET_NUMBER_MIN_WIDTH
=
50
;
internal
const
float
CREATION_DATE_WIDTH
=
150
;
internal
const
float
CREATION_DATE_MIN_WIDTH
=
100
;
internal
const
float
CREATED_BY_WIDTH
=
200
;
internal
const
float
CREATED_BY_MIN_WIDTH
=
110
;
internal
const
float
COMMENT_WIDTH
=
300
;
internal
const
float
COMMENT_MIN_WIDTH
=
100
;
internal
const
float
BRANCH_WIDTH
=
160
;
internal
const
float
BRANCH_MIN_WIDTH
=
90
;
internal
const
float
REPOSITORY_WIDTH
=
210
;
internal
const
float
REPOSITORY_MIN_WIDTH
=
90
;
internal
const
float
GUID_WIDTH
=
270
;
internal
const
float
GUID_MIN_WIDTH
=
100
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UnityEvents.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
using
Codice.Utils
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
Keyboard
{
internal
static
bool
IsShiftPressed
(
Event
e
)
{
return
e
.
type
==
EventType
.
KeyDown
&&
e
.
shift
;
}
internal
static
bool
IsReturnOrEnterKeyPressed
(
Event
e
)
{
return
IsKeyPressed
(
e
,
KeyCode
.
Return
)
||
IsKeyPressed
(
e
,
KeyCode
.
KeypadEnter
);
}
internal
static
bool
IsKeyPressed
(
Event
e
,
KeyCode
keyCode
)
{
return
e
.
type
==
EventType
.
KeyDown
&&
e
.
keyCode
==
keyCode
;
}
internal
static
bool
IsControlOrCommandKeyPressed
(
Event
e
)
{
if
(
PlatformIdentifier
.
IsMac
())
return
e
.
type
==
EventType
.
KeyDown
&&
e
.
command
;
return
e
.
type
==
EventType
.
KeyDown
&&
e
.
control
;
}
}
internal
class
Mouse
{
internal
static
bool
IsLeftMouseButtonPressed
(
Event
e
)
{
if
(!
e
.
isMouse
)
return
false
;
return
e
.
button
==
UnityConstants
.
LEFT_MOUSE_BUTTON
&&
e
.
type
==
EventType
.
MouseDown
;
}
internal
static
bool
IsRightMouseButtonPressed
(
Event
e
)
{
if
(!
e
.
isMouse
)
return
false
;
return
e
.
button
==
UnityConstants
.
RIGHT_MOUSE_BUTTON
&&
e
.
type
==
EventType
.
MouseDown
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UnityMenuItem.cs
0 → 100644
View file @
1c847220
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
UnityMenuItem
{
internal
static
string
GetText
(
string
menuName
,
string
subMenuName
)
{
return
string
.
Format
(
"{0}{1}{2}"
,
menuName
,
SEPARATOR
,
subMenuName
);
}
internal
static
string
EscapedText
(
string
menuName
)
{
return
menuName
.
Replace
(
SEPARATOR
,
ESCAPED_SEPARATOR
);
}
const
string
SEPARATOR
=
"/"
;
const
string
ESCAPED_SEPARATOR
=
"\u200A\u2215\u200A"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UnityPlasticGuiMessage.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
Codice.Client.Common
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
UnityPlasticGuiMessage
:
GuiMessage
.
IGuiMessage
{
internal
UnityPlasticGuiMessage
(
EditorWindow
parentWindow
)
{
mParentWindow
=
parentWindow
;
}
void
GuiMessage
.
IGuiMessage
.
ShowMessage
(
string
title
,
string
message
,
GuiMessage
.
GuiMessageType
alertType
)
{
EditorUtility
.
DisplayDialog
(
BuildDialogTitle
(
title
,
alertType
),
message
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CloseButton
));
}
void
GuiMessage
.
IGuiMessage
.
ShowError
(
string
message
)
{
EditorUtility
.
DisplayDialog
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ErrorPlasticSCM
),
message
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CloseButton
));
}
GuiMessage
.
GuiMessageResponseButton
GuiMessage
.
IGuiMessage
.
ShowQuestion
(
string
title
,
string
message
,
string
firstActionButton
,
string
secondActionButton
,
string
thirdActionButton
,
bool
isFirstButtonEnabled
)
{
if
(!
isFirstButtonEnabled
)
{
bool
result
=
EditorUtility
.
DisplayDialog
(
title
,
message
,
secondActionButton
,
thirdActionButton
);
return
(
result
)
?
GuiMessage
.
GuiMessageResponseButton
.
Second
:
GuiMessage
.
GuiMessageResponseButton
.
Third
;
}
int
intResult
=
EditorUtility
.
DisplayDialogComplex
(
title
,
message
,
firstActionButton
,
secondActionButton
,
thirdActionButton
);
return
GetResponse
(
intResult
);
}
bool
GuiMessage
.
IGuiMessage
.
ShowQuestion
(
string
title
,
string
message
,
string
yesButton
)
{
return
EditorUtility
.
DisplayDialog
(
title
,
message
,
yesButton
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
NoButton
));
}
bool
GuiMessage
.
IGuiMessage
.
ShowYesNoQuestion
(
string
title
,
string
message
)
{
return
EditorUtility
.
DisplayDialog
(
title
,
message
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
YesButton
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
NoButton
));
}
GuiMessage
.
GuiMessageResponseButton
GuiMessage
.
IGuiMessage
.
ShowYesNoCancelQuestion
(
string
title
,
string
message
)
{
int
intResult
=
EditorUtility
.
DisplayDialogComplex
(
title
,
message
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
YesButton
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
NoButton
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
));
return
GetResponse
(
intResult
);
}
bool
GuiMessage
.
IGuiMessage
.
ShowYesNoQuestionWithType
(
string
title
,
string
message
,
GuiMessage
.
GuiMessageType
messageType
)
{
return
EditorUtility
.
DisplayDialog
(
BuildDialogTitle
(
title
,
messageType
),
message
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
YesButton
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
NoButton
));
}
static
GuiMessage
.
GuiMessageResponseButton
GetResponse
(
int
dialogResult
)
{
switch
(
dialogResult
)
{
case
0
:
return
GuiMessage
.
GuiMessageResponseButton
.
First
;
case
1
:
return
GuiMessage
.
GuiMessageResponseButton
.
Second
;
case
2
:
return
GuiMessage
.
GuiMessageResponseButton
.
Third
;
default
:
return
GuiMessage
.
GuiMessageResponseButton
.
Second
;
}
}
static
string
BuildDialogTitle
(
string
title
,
GuiMessage
.
GuiMessageType
alertType
)
{
string
alertTypeText
=
GetAlertTypeText
(
alertType
);
return
string
.
Format
(
"{0} - {1}"
,
alertTypeText
,
title
);
}
static
string
GetAlertTypeText
(
GuiMessage
.
GuiMessageType
alertType
)
{
string
alertTypeText
=
string
.
Empty
;
switch
(
alertType
)
{
case
GuiMessage
.
GuiMessageType
.
Informational
:
alertTypeText
=
"Information"
;
break
;
case
GuiMessage
.
GuiMessageType
.
Warning
:
alertTypeText
=
"Warning"
;
break
;
case
GuiMessage
.
GuiMessageType
.
Critical
:
alertTypeText
=
"Error"
;
break
;
case
GuiMessage
.
GuiMessageType
.
Question
:
alertTypeText
=
"Question"
;
break
;
}
return
alertTypeText
;
}
EditorWindow
mParentWindow
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/UnityPlasticTimer.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Timers
;
using
Codice.Client.Common.Threading
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
UnityPlasticTimerBuilder
:
IPlasticTimerBuilder
{
IPlasticTimer
IPlasticTimerBuilder
.
Get
(
bool
bModalMode
,
ThreadWaiter
.
TimerTick
timerTickDelegate
)
{
return
new
UnityPlasticTimer
(
DEFAULT_TIMER_INTERVAL
,
timerTickDelegate
);
}
IPlasticTimer
IPlasticTimerBuilder
.
Get
(
bool
bModalMode
,
int
timerInterval
,
ThreadWaiter
.
TimerTick
timerTickDelegate
)
{
return
new
UnityPlasticTimer
(
timerInterval
,
timerTickDelegate
);
}
const
int
DEFAULT_TIMER_INTERVAL
=
100
;
}
internal
class
UnityPlasticTimer
:
IPlasticTimer
{
internal
UnityPlasticTimer
(
int
timerInterval
,
ThreadWaiter
.
TimerTick
timerTickDelegate
)
{
mTimerInterval
=
timerInterval
;
mTimerTickDelegate
=
timerTickDelegate
;
}
void
IPlasticTimer
.
Start
()
{
mTimer
=
new
Timer
();
mTimer
.
Interval
=
mTimerInterval
;
mTimer
.
Elapsed
+=
OnTimerTick
;
mTimer
.
Start
();
}
void
IPlasticTimer
.
Stop
()
{
mTimer
.
Stop
();
mTimer
.
Elapsed
-=
OnTimerTick
;
mTimer
.
Dispose
();
}
void
OnTimerTick
(
object
sender
,
EventArgs
e
)
{
mTimerTickDelegate
();
}
Timer
mTimer
;
int
mTimerInterval
;
ThreadWaiter
.
TimerTick
mTimerTickDelegate
;
}
}
Prev
1
…
23
24
25
26
27
28
29
30
31
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