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/Tool/FindTool.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Linq
;
using
System.Collections.Generic
;
using
System.IO
;
namespace
Unity.PlasticSCM.Editor.Tool
{
internal
static
class
FindTool
{
internal
static
string
ObtainToolCommand
(
string
toolName
,
List
<
string
>
installationPaths
)
{
List
<
string
>
processPaths
=
GetPathsFromEnvVariable
(
PATH_ENVIRONMENT_VARIABLE
,
EnvironmentVariableTarget
.
Process
);
List
<
string
>
machinePaths
=
GetPathsFromEnvVariable
(
PATH_ENVIRONMENT_VARIABLE
,
EnvironmentVariableTarget
.
Machine
);
List
<
string
>
pathsToLookup
=
new
List
<
string
>();
pathsToLookup
.
AddRange
(
processPaths
);
pathsToLookup
.
AddRange
(
machinePaths
);
pathsToLookup
.
AddRange
(
installationPaths
);
string
toolPath
=
FindToolInPaths
(
toolName
,
pathsToLookup
);
if
(
string
.
IsNullOrEmpty
(
toolPath
))
return
null
;
EnsureIsInProcessPathEnvVariable
(
toolPath
,
processPaths
);
return
toolPath
;
}
static
string
FindToolInPaths
(
string
toolName
,
List
<
string
>
paths
)
{
foreach
(
string
path
in
paths
)
{
if
(
path
==
null
)
continue
;
if
(
path
.
Trim
()
==
string
.
Empty
)
continue
;
string
filePath
=
CleanFolderPath
(
path
);
filePath
=
Path
.
Combine
(
filePath
,
toolName
);
if
(
File
.
Exists
(
filePath
))
return
Path
.
GetFullPath
(
filePath
);
}
return
null
;
}
static
string
CleanFolderPath
(
string
folderPath
)
{
foreach
(
char
c
in
Path
.
GetInvalidPathChars
())
folderPath
=
folderPath
.
Replace
(
c
.
ToString
(),
string
.
Empty
);
return
folderPath
;
}
static
List
<
string
>
GetPathsFromEnvVariable
(
string
variableName
,
EnvironmentVariableTarget
target
)
{
string
value
=
Environment
.
GetEnvironmentVariable
(
variableName
,
target
);
return
new
List
<
string
>(
value
.
Split
(
Path
.
PathSeparator
));
}
static
void
EnsureIsInProcessPathEnvVariable
(
string
toolPath
,
List
<
string
>
processPaths
)
{
string
plasticInstallDir
=
Path
.
GetDirectoryName
(
toolPath
);
if
(
processPaths
.
Contains
(
plasticInstallDir
,
StringComparer
.
OrdinalIgnoreCase
))
return
;
Environment
.
SetEnvironmentVariable
(
PATH_ENVIRONMENT_VARIABLE
,
string
.
Concat
(
plasticInstallDir
,
Path
.
PathSeparator
,
processPaths
),
EnvironmentVariableTarget
.
Process
);
}
const
string
PATH_ENVIRONMENT_VARIABLE
=
"PATH"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Tool/IsExeAvailable.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
Codice.Utils
;
namespace
Unity.PlasticSCM.Editor.Tool
{
internal
static
class
IsExeAvailable
{
internal
static
bool
ForMode
(
bool
isGluonMode
)
{
string
toolPath
=
isGluonMode
?
PlasticInstallPath
.
GetGluonExePath
()
:
PlasticInstallPath
.
GetPlasticExePath
();
return
!
string
.
IsNullOrEmpty
(
toolPath
);
}
}
internal
static
class
PlasticInstallPath
{
internal
static
string
GetClientBinDir
()
{
if
(
PlatformIdentifier
.
IsWindows
())
{
string
plasticExePath
=
GetPlasticExePath
();
if
(
plasticExePath
==
null
)
return
null
;
return
Path
.
GetDirectoryName
(
plasticExePath
);
}
if
(
PlatformIdentifier
.
IsMac
())
return
GetExistingDir
(
ToolConstants
.
MACOS_BINDIR
);
return
null
;
}
internal
static
string
GetPlasticExePath
()
{
if
(
PlatformIdentifier
.
IsWindows
())
return
FindTool
.
ObtainToolCommand
(
Plastic
.
GUI_WINDOWS
,
new
List
<
String
>()
{
GetWindowsInstallationFolder
()
});
if
(
PlatformIdentifier
.
IsMac
())
return
GetToolCommand
(
Plastic
.
GUI_MACOS
);
return
null
;
}
internal
static
string
GetGluonExePath
()
{
if
(
PlatformIdentifier
.
IsWindows
())
return
FindTool
.
ObtainToolCommand
(
Gluon
.
GUI_WINDOWS
,
new
List
<
String
>()
{
GetWindowsInstallationFolder
()
});
if
(
PlatformIdentifier
.
IsMac
())
return
GetToolCommand
(
Gluon
.
GUI_MACOS
);
return
null
;
}
static
string
GetToolCommand
(
string
tool
)
{
return
File
.
Exists
(
tool
)
?
tool
:
null
;
}
static
string
GetExistingDir
(
string
directory
)
{
return
Directory
.
Exists
(
directory
)
?
directory
:
null
;
}
static
string
GetWindowsInstallationFolder
()
{
string
programFilesFolder
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
ProgramFiles
);
return
Path
.
Combine
(
Path
.
Combine
(
programFilesFolder
,
PLASTICSCM_FOLDER
),
PLASTICSCM_SUBFOLDER
);
}
const
string
PLASTICSCM_FOLDER
=
"PlasticSCM5"
;
const
string
PLASTICSCM_SUBFOLDER
=
"client"
;
class
Plastic
{
internal
const
string
GUI_WINDOWS
=
"plastic.exe"
;
internal
const
string
GUI_MACOS
=
"/Applications/PlasticSCM.app/Contents/MacOS/PlasticSCM"
;
}
class
Gluon
{
internal
const
string
GUI_WINDOWS
=
"gluon.exe"
;
internal
const
string
GUI_MACOS
=
"/Applications/Gluon.app/Contents/MacOS/Gluon"
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Tool/LaunchInstaller.cs
0 → 100644
View file @
1c847220
using
System.Diagnostics
;
using
Codice.Utils
;
namespace
Unity.PlasticSCM.Editor.Tool
{
internal
static
class
LaunchInstaller
{
internal
static
Process
ForPlatform
(
string
installerPath
)
{
if
(
PlatformIdentifier
.
IsMac
())
{
return
Process
.
Start
(
ToolConstants
.
Installer
.
INSTALLER_MACOS_OPEN
,
string
.
Format
(
ToolConstants
.
Installer
.
INSTALLER_MACOS_OPEN_ARGS
,
installerPath
));
}
return
Process
.
Start
(
installerPath
,
ToolConstants
.
Installer
.
INSTALLER_WINDOWS_ARGS
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Tool/LaunchTool.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Diagnostics
;
using
System.IO
;
using
Codice.Client.BaseCommands.EventTracking
;
using
Codice.CM.Common
;
using
Codice.LogWrapper
;
using
Codice.Utils
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.Tool
{
internal
static
class
LaunchTool
{
internal
static
Process
OpenConfigurationForMode
(
bool
isGluonMode
)
{
mLog
.
Debug
(
"Opening Configuration'."
);
if
(
isGluonMode
)
{
Process
gluonProcess
=
ExecuteProcess
(
PlasticInstallPath
.
GetGluonExePath
(),
ToolConstants
.
Gluon
.
GUI_CONFIGURE_ARG
);
if
(
gluonProcess
!=
null
)
mGluonProcessId
=
gluonProcess
.
Id
;
return
gluonProcess
;
}
Process
plasticProcess
=
ExecuteProcess
(
PlasticInstallPath
.
GetPlasticExePath
(),
ToolConstants
.
Plastic
.
GUI_CONFIGURE_ARG
);
if
(
plasticProcess
!=
null
)
mPlasticProcessId
=
plasticProcess
.
Id
;
return
plasticProcess
;
}
internal
static
void
OpenGUIForMode
(
WorkspaceInfo
wkInfo
,
bool
isGluonMode
)
{
mLog
.
DebugFormat
(
"Opening GUI on wkPath '{0}'."
,
wkInfo
.
ClientPath
);
TrackFeatureUseEvent
.
For
(
Plastic
.
API
.
GetRepositorySpec
(
wkInfo
),
isGluonMode
?
TrackFeatureUseEvent
.
Features
.
LaunchGluonTool
:
TrackFeatureUseEvent
.
Features
.
LaunchPlasticTool
);
if
(
isGluonMode
)
{
Process
gluonProcess
=
ExecuteGUI
(
PlasticInstallPath
.
GetGluonExePath
(),
string
.
Format
(
ToolConstants
.
Gluon
.
GUI_WK_EXPLORER_ARG
,
wkInfo
.
ClientPath
),
ToolConstants
.
Gluon
.
GUI_COMMAND_FILE_ARG
,
ToolConstants
.
Gluon
.
GUI_COMMAND_FILE
,
mGluonProcessId
);
if
(
gluonProcess
!=
null
)
mGluonProcessId
=
gluonProcess
.
Id
;
return
;
}
if
(
PlatformIdentifier
.
IsMac
())
{
Process
plasticProcess
=
ExecuteGUI
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_MACOS_WK_EXPLORER_ARG
,
wkInfo
.
ClientPath
),
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE_ARG
,
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE
,
mPlasticProcessId
);
if
(
plasticProcess
!=
null
)
mPlasticProcessId
=
plasticProcess
.
Id
;
return
;
}
ExecuteProcess
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_WINDOWS_WK_ARG
,
wkInfo
.
ClientPath
));
}
internal
static
void
OpenBranchExplorer
(
WorkspaceInfo
wkInfo
)
{
mLog
.
DebugFormat
(
"Opening Branch Explorer on wkPath '{0}'."
,
wkInfo
.
ClientPath
);
TrackFeatureUseEvent
.
For
(
Plastic
.
API
.
GetRepositorySpec
(
wkInfo
),
TrackFeatureUseEvent
.
Features
.
LaunchBranchExplorer
);
if
(
PlatformIdentifier
.
IsMac
())
{
Process
plasticProcess
=
ExecuteGUI
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_MACOS_BREX_ARG
,
wkInfo
.
ClientPath
),
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE_ARG
,
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE
,
mPlasticProcessId
);
if
(
plasticProcess
!=
null
)
mPlasticProcessId
=
plasticProcess
.
Id
;
return
;
}
Process
brexProcess
=
ExecuteWindowsGUI
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_WINDOWS_BREX_ARG
,
wkInfo
.
ClientPath
),
mBrexProcessId
);
if
(
brexProcess
!=
null
)
mBrexProcessId
=
brexProcess
.
Id
;
}
internal
static
void
OpenChangesetDiffs
(
string
fullChangesetSpec
,
bool
isGluonMode
)
{
mLog
.
DebugFormat
(
"Launching changeset diffs for '{0}'"
,
fullChangesetSpec
);
string
exePath
=
(
isGluonMode
)
?
PlasticInstallPath
.
GetGluonExePath
()
:
PlasticInstallPath
.
GetPlasticExePath
();
string
changesetDiffArg
=
(
isGluonMode
)
?
ToolConstants
.
Gluon
.
GUI_CHANGESET_DIFF_ARG
:
ToolConstants
.
Plastic
.
GUI_CHANGESET_DIFF_ARG
;
ExecuteProcess
(
exePath
,
string
.
Format
(
changesetDiffArg
,
fullChangesetSpec
));
}
internal
static
void
OpenSelectedChangesetsDiffs
(
string
srcFullChangesetSpec
,
string
dstFullChangesetSpec
,
bool
isGluonMode
)
{
mLog
.
DebugFormat
(
"Launching selected changesets diffs for '{0}' and '{1}'"
,
srcFullChangesetSpec
,
dstFullChangesetSpec
);
string
exePath
=
(
isGluonMode
)
?
PlasticInstallPath
.
GetGluonExePath
()
:
PlasticInstallPath
.
GetPlasticExePath
();
string
selectedChangesetsDiffArgs
=
(
isGluonMode
)
?
ToolConstants
.
Gluon
.
GUI_SELECTED_CHANGESETS_DIFF_ARGS
:
ToolConstants
.
Plastic
.
GUI_SELECTED_CHANGESETS_DIFF_ARGS
;
ExecuteProcess
(
exePath
,
string
.
Format
(
selectedChangesetsDiffArgs
,
srcFullChangesetSpec
,
dstFullChangesetSpec
));
}
internal
static
void
OpenBranchDiffs
(
string
fullBranchSpec
,
bool
isGluonMode
)
{
mLog
.
DebugFormat
(
"Launching branch diffs for '{0}'"
,
fullBranchSpec
);
string
exePath
=
(
isGluonMode
)
?
PlasticInstallPath
.
GetGluonExePath
()
:
PlasticInstallPath
.
GetPlasticExePath
();
string
branchDiffArg
=
(
isGluonMode
)
?
ToolConstants
.
Gluon
.
GUI_BRANCH_DIFF_ARG
:
ToolConstants
.
Plastic
.
GUI_BRANCH_DIFF_ARG
;
ExecuteProcess
(
exePath
,
string
.
Format
(
branchDiffArg
,
fullBranchSpec
));
}
internal
static
void
OpenWorkspaceConfiguration
(
WorkspaceInfo
wkInfo
)
{
mLog
.
DebugFormat
(
"Opening Workspace Configuration on wkPath '{0}'."
,
wkInfo
.
ClientPath
);
TrackFeatureUseEvent
.
For
(
Plastic
.
API
.
GetRepositorySpec
(
wkInfo
),
TrackFeatureUseEvent
.
Features
.
LaunchPartialConfigure
);
Process
gluonProcess
=
ExecuteGUI
(
PlasticInstallPath
.
GetGluonExePath
(),
string
.
Format
(
ToolConstants
.
Gluon
.
GUI_WK_CONFIGURATION_ARG
,
wkInfo
.
ClientPath
),
ToolConstants
.
Gluon
.
GUI_COMMAND_FILE_ARG
,
ToolConstants
.
Gluon
.
GUI_COMMAND_FILE
,
mGluonProcessId
);
if
(
gluonProcess
==
null
)
return
;
mGluonProcessId
=
gluonProcess
.
Id
;
}
internal
static
void
OpenMerge
(
string
wkPath
)
{
mLog
.
DebugFormat
(
"Opening Merge on wkPath '{0}'."
,
wkPath
);
if
(
PlatformIdentifier
.
IsMac
())
{
Process
plasticProcess
=
ExecuteGUI
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_MACOS_MERGE_ARG
,
wkPath
),
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE_ARG
,
ToolConstants
.
Plastic
.
GUI_MACOS_COMMAND_FILE
,
mPlasticProcessId
);
if
(
plasticProcess
!=
null
)
mPlasticProcessId
=
plasticProcess
.
Id
;
return
;
}
ExecuteProcess
(
PlasticInstallPath
.
GetPlasticExePath
(),
string
.
Format
(
ToolConstants
.
Plastic
.
GUI_WINDOWS_MERGE_ARG
,
wkPath
));
}
static
Process
ExecuteGUI
(
string
program
,
string
args
,
string
commandFileArg
,
string
commandFileName
,
int
processId
)
{
string
commandFile
=
Path
.
Combine
(
Path
.
GetTempPath
(),
commandFileName
);
Process
process
=
GetGUIProcess
(
program
,
processId
);
if
(
process
==
null
)
{
mLog
.
DebugFormat
(
"Executing {0} (new process)."
,
program
);
return
ExecuteProcess
(
program
,
args
+
string
.
Format
(
commandFileArg
,
commandFile
));
}
mLog
.
DebugFormat
(
"Executing {0} (reuse process pid:{1})."
,
program
,
processId
);
using
(
StreamWriter
writer
=
new
StreamWriter
(
new
FileStream
(
commandFile
,
FileMode
.
Append
,
FileAccess
.
Write
,
FileShare
.
Read
)))
{
writer
.
WriteLine
(
args
);
}
return
process
;
}
static
Process
ExecuteWindowsGUI
(
string
program
,
string
args
,
int
processId
)
{
Process
process
=
GetGUIProcess
(
program
,
processId
);
if
(
process
==
null
)
{
mLog
.
DebugFormat
(
"Executing {0} (new process)."
,
program
);
return
ExecuteProcess
(
program
,
args
);
}
mLog
.
DebugFormat
(
"Not executing {0} (existing process pid:{1})."
,
program
,
processId
);
BringWindowToFront
.
ForWindowsProcess
(
process
.
Id
);
return
process
;
}
static
Process
ExecuteProcess
(
string
program
,
string
args
)
{
mLog
.
DebugFormat
(
"Execute process: '{0} {1}'"
,
program
,
args
);
Process
process
=
BuildProcess
(
program
,
args
);
try
{
process
.
Start
();
return
process
;
}
catch
(
Exception
ex
)
{
mLog
.
ErrorFormat
(
"Couldn't execute the program {0}: {1}"
,
program
,
ex
.
Message
);
mLog
.
DebugFormat
(
"Stack trace: {0}"
,
ex
.
StackTrace
);
return
null
;
}
}
static
Process
BuildProcess
(
string
program
,
string
args
)
{
Process
result
=
new
Process
();
result
.
StartInfo
.
FileName
=
program
;
result
.
StartInfo
.
Arguments
=
args
;
result
.
StartInfo
.
CreateNoWindow
=
false
;
return
result
;
}
static
Process
GetGUIProcess
(
string
program
,
int
processId
)
{
if
(
processId
==
-
1
)
return
null
;
mLog
.
DebugFormat
(
"Checking {0} process [pid:{1}]."
,
program
,
processId
);
try
{
Process
process
=
Process
.
GetProcessById
(
processId
);
if
(
process
==
null
)
return
null
;
return
process
.
HasExited
?
null
:
process
;
}
catch
{
// process is not running
return
null
;
}
}
static
int
mPlasticProcessId
=
-
1
;
static
int
mGluonProcessId
=
-
1
;
static
int
mBrexProcessId
=
-
1
;
static
readonly
ILog
mLog
=
LogManager
.
GetLogger
(
"LaunchTool"
);
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Tool/ToolConstants.cs
0 → 100644
View file @
1c847220
namespace
Unity.PlasticSCM.Editor.Tool
{
internal
static
class
ToolConstants
{
internal
static
class
Plastic
{
internal
const
string
GUI_CONFIGURE_ARG
=
"--configure"
;
internal
const
string
GUI_WINDOWS_WK_ARG
=
"--wk=\"{0}\""
;
internal
const
string
GUI_WINDOWS_BREX_ARG
=
"--branchexplorer=\"{0}\""
;
internal
const
string
GUI_WINDOWS_MERGE_ARG
=
"--resolve=\"{0}\""
;
internal
const
string
GUI_WINDOWS_INCOMING_CHANGES_ARG
=
"--resolve=\"{0}\" --incomingmerge"
;
internal
const
string
GUI_MACOS_WK_EXPLORER_ARG
=
"--wk=\"{0}\" --view=ItemsView"
;
internal
const
string
GUI_MACOS_BREX_ARG
=
"--wk=\"{0}\" --view=BranchExplorerView"
;
internal
const
string
GUI_MACOS_MERGE_ARG
=
"--wk=\"{0}\" --view=MergeView"
;
internal
const
string
GUI_MACOS_INCOMING_CHANGES_ARG
=
"--wk=\"{0}\" --view=IncomingChangesView"
;
internal
const
string
GUI_MACOS_COMMAND_FILE_ARG
=
" --command-file=\"{0}\""
;
internal
const
string
GUI_MACOS_COMMAND_FILE
=
"macplastic-command-file.txt"
;
internal
const
string
GUI_CHANGESET_DIFF_ARG
=
"--diffchangeset=\"{0}\""
;
internal
const
string
GUI_SELECTED_CHANGESETS_DIFF_ARGS
=
"--diffchangesetsrc=\"{0}\" --diffchangesetdst=\"{1}\""
;
internal
const
string
GUI_BRANCH_DIFF_ARG
=
"--diffbranch=\"{0}\""
;
}
internal
static
class
Gluon
{
internal
const
string
GUI_CONFIGURE_ARG
=
"--configure"
;
internal
const
string
GUI_WK_EXPLORER_ARG
=
"--wk=\"{0}\" --view=WorkspaceExplorerView"
;
internal
const
string
GUI_WK_CONFIGURATION_ARG
=
"--wk=\"{0}\" --view=WorkspaceConfigurationView"
;
internal
const
string
GUI_WK_INCOMING_CHANGES_ARG
=
"--wk=\"{0}\" --view=IncomingChangesView"
;
internal
const
string
GUI_COMMAND_FILE_ARG
=
" --command-file=\"{0}\""
;
internal
const
string
GUI_COMMAND_FILE
=
"gluon-command-file.txt"
;
internal
const
string
GUI_CHANGESET_DIFF_ARG
=
"--diffchangeset=\"{0}\""
;
internal
const
string
GUI_SELECTED_CHANGESETS_DIFF_ARGS
=
"--diffchangesetsrc=\"{0}\" --diffchangesetdst=\"{1}\""
;
internal
const
string
GUI_BRANCH_DIFF_ARG
=
"--diffbranch=\"{0}\""
;
}
internal
static
class
Installer
{
internal
const
string
INSTALLER_WINDOWS_ARGS
=
"--mode unattended --unattendedmodeui minimal"
;
internal
const
string
INSTALLER_MACOS_OPEN
=
"open"
;
internal
const
string
INSTALLER_MACOS_OPEN_ARGS
=
"-W -n {0}"
;
}
internal
const
string
MACOS_BINDIR
=
"/Applications/PlasticSCM.app/Contents/MonoBundle"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Avatar/ApplyCircleMask.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI.Avatar
{
internal
static
class
ApplyCircleMask
{
internal
static
Texture2D
For
(
Texture2D
sourceImage
)
{
int
width
=
sourceImage
.
width
;
int
height
=
sourceImage
.
height
;
int
centerx
=
sourceImage
.
width
/
2
;
int
centery
=
sourceImage
.
height
/
2
;
int
radius
=
sourceImage
.
width
/
2
;
Texture2D
result
=
new
Texture2D
(
height
,
width
);
for
(
int
i
=
(
centerx
-
radius
);
i
<
centerx
+
radius
;
i
++)
{
for
(
int
j
=
(
centery
-
radius
);
j
<
centery
+
radius
;
j
++)
{
float
dx
=
i
-
centerx
;
float
dy
=
j
-
centery
;
float
d
=
Mathf
.
Sqrt
(
dx
*
dx
+
dy
*
dy
);
float
borderSize
=
1f
;
if
(
d
<=
(
radius
-
borderSize
))
{
result
.
SetPixel
(
i
-
(
centerx
-
radius
),
j
-
(
centery
-
radius
),
sourceImage
.
GetPixel
(
i
,
j
));
continue
;
}
Color
color
=
sourceImage
.
GetPixel
(
i
,
j
);
result
.
SetPixel
(
i
-
(
centerx
-
radius
),
j
-
(
centery
-
radius
),
Color
.
Lerp
(
Color
.
clear
,
color
,
GetAntialiasAlpha
(
radius
,
d
,
borderSize
)));
}
}
result
.
Apply
();
return
result
;
}
static
float
GetAntialiasAlpha
(
float
radius
,
float
d
,
float
borderSize
)
{
if
(
d
>=
(
radius
+
borderSize
))
return
0f
;
if
(
d
-
radius
-
borderSize
==
0
)
return
0
;
float
proportion
=
Mathf
.
Abs
(
d
-
radius
-
borderSize
)
/
(
radius
+
borderSize
)
-
(
radius
-
borderSize
);
return
Mathf
.
Max
(
0
,
1.0f
-
proportion
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Avatar/AvatarImages.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI.Avatar
{
internal
static
class
AvatarImages
{
internal
static
void
Dispose
()
{
foreach
(
Texture2D
image
in
mAvatars
.
Values
)
UnityEngine
.
Object
.
DestroyImmediate
(
image
,
true
);
mAvatars
.
Clear
();
}
internal
static
bool
HasGravatar
(
string
email
)
{
return
mAvatars
.
ContainsKey
(
email
);
}
internal
static
void
AddGravatar
(
string
email
,
Texture2D
image
)
{
if
(
mAvatars
.
ContainsKey
(
email
))
return
;
mAvatars
.
Add
(
email
,
image
);
}
internal
static
void
UpdateGravatar
(
string
email
,
byte
[]
rawImage
)
{
if
(!
mAvatars
.
ContainsKey
(
email
))
return
;
Texture2D
result
=
GetTexture
(
rawImage
);
mAvatars
[
email
]
=
result
;
}
internal
static
Texture2D
GetAvatar
(
string
email
)
{
Texture2D
image
=
GetGravatarImage
(
email
);
if
(
image
!=
null
)
return
image
;
return
GetDefaultImage
();
}
internal
static
Texture2D
GetDefaultImage
()
{
return
Images
.
GetImage
(
Images
.
Name
.
IconEmptyGravatar
);
}
static
Texture2D
GetGravatarImage
(
string
email
)
{
Texture2D
avatar
;
mAvatars
.
TryGetValue
(
email
,
out
avatar
);
return
avatar
;
}
static
Texture2D
GetTexture
(
byte
[]
rawImage
)
{
Texture2D
result
=
new
Texture2D
(
32
,
32
);
result
.
LoadImage
(
rawImage
);
Texture2D
maskImage
=
ApplyCircleMask
.
For
(
result
);
UnityEngine
.
Object
.
DestroyImmediate
(
result
,
true
);
return
maskImage
;
}
static
readonly
Dictionary
<
string
,
Texture2D
>
mAvatars
=
new
Dictionary
<
string
,
Texture2D
>();
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/Avatar/GetAvatar.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEngine
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI.Avatar
{
internal
static
class
GetAvatar
{
internal
static
Texture2D
ForEmail
(
string
email
,
Action
avatarLoadedAction
)
{
if
(
string
.
IsNullOrEmpty
(
email
))
return
AvatarImages
.
GetDefaultImage
();
if
(
AvatarImages
.
HasGravatar
(
email
))
return
AvatarImages
.
GetAvatar
(
email
);
Texture2D
defaultImage
=
AvatarImages
.
GetDefaultImage
();
AvatarImages
.
AddGravatar
(
email
,
defaultImage
);
LoadAvatar
.
ForEmail
(
email
,
avatarLoadedAction
,
AfterDownloadSucceed
);
return
defaultImage
;
}
static
void
AfterDownloadSucceed
(
string
email
,
byte
[]
avatarBytes
,
Action
avatarLoadedAction
)
{
AvatarImages
.
UpdateGravatar
(
email
,
avatarBytes
);
avatarLoadedAction
();
}
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/BoolSetting.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
BoolSetting
{
internal
static
bool
Load
(
string
boolSettingName
,
bool
defaultValue
)
{
return
EditorPrefs
.
GetBool
(
GetSettingKey
(
boolSettingName
),
defaultValue
);
}
internal
static
void
Save
(
bool
value
,
string
boolSettingName
)
{
EditorPrefs
.
SetBool
(
GetSettingKey
(
boolSettingName
),
value
);
}
internal
static
void
Clear
(
string
boolSettingName
)
{
EditorPrefs
.
DeleteKey
(
GetSettingKey
(
boolSettingName
));
}
static
string
GetSettingKey
(
string
boolSettingName
)
{
return
string
.
Format
(
boolSettingName
,
PlayerSettings
.
productGUID
,
PREFERENCE_VALUE_KEY
);
}
static
string
PREFERENCE_VALUE_KEY
=
"PreferenceValue"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/CooldownWindowDelayer.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
CooldownWindowDelayer
{
internal
CooldownWindowDelayer
(
Action
action
,
double
cooldownSeconds
)
{
mAction
=
action
;
mCooldownSeconds
=
cooldownSeconds
;
}
internal
void
Ping
()
{
if
(
mIsOnCooldown
)
{
RefreshCooldown
();
return
;
}
StartCooldown
();
}
void
RefreshCooldown
()
{
mIsOnCooldown
=
true
;
mSecondsOnCooldown
=
mCooldownSeconds
;
}
void
StartCooldown
()
{
mLastUpdateTime
=
EditorApplication
.
timeSinceStartup
;
EditorApplication
.
update
+=
OnUpdate
;
RefreshCooldown
();
}
void
EndCooldown
()
{
EditorApplication
.
update
-=
OnUpdate
;
mIsOnCooldown
=
false
;
mAction
();
}
void
OnUpdate
()
{
double
updateTime
=
EditorApplication
.
timeSinceStartup
;
double
deltaSeconds
=
updateTime
-
mLastUpdateTime
;
mSecondsOnCooldown
-=
deltaSeconds
;
if
(
mSecondsOnCooldown
<
0
)
EndCooldown
();
mLastUpdateTime
=
updateTime
;
}
readonly
Action
mAction
;
readonly
double
mCooldownSeconds
;
double
mLastUpdateTime
;
bool
mIsOnCooldown
;
double
mSecondsOnCooldown
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DockEditorWindow.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Reflection
;
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
[
InitializeOnLoad
]
internal
static
class
DockEditorWindow
{
static
DockEditorWindow
()
{
InitializeInfo
();
}
internal
static
bool
IsAvailable
()
{
return
mParentField
!=
null
&&
mAddTabMethod
!=
null
;
}
internal
static
void
To
(
EditorWindow
dockWindow
,
EditorWindow
window
)
{
var
dockArea
=
mParentField
.
GetValue
(
dockWindow
);
mAddTabMethod
.
Invoke
(
dockArea
,
new
object
[]
{
window
});
}
static
void
InitializeInfo
()
{
var
flags
=
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
|
BindingFlags
.
Public
|
BindingFlags
.
Static
;
mParentField
=
typeof
(
EditorWindow
).
GetField
(
"m_Parent"
,
flags
);
var
dockAreaType
=
typeof
(
EditorWindow
).
Assembly
.
GetType
(
"UnityEditor.DockArea"
);
if
(
dockAreaType
==
null
)
return
;
mAddTabMethod
=
dockAreaType
.
GetMethod
(
"AddTab"
,
flags
,
null
,
new
Type
[]
{
typeof
(
EditorWindow
)
},
null
);
}
static
MethodInfo
mAddTabMethod
;
static
FieldInfo
mParentField
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DrawActionButton.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
DrawActionButton
{
internal
static
bool
For
(
string
buttonText
)
{
GUIContent
buttonContent
=
new
GUIContent
(
buttonText
);
GUIStyle
buttonStyle
=
EditorStyles
.
miniButton
;
Rect
rt
=
GUILayoutUtility
.
GetRect
(
buttonContent
,
buttonStyle
,
GUILayout
.
MinWidth
(
UnityConstants
.
REGULAR_BUTTON_WIDTH
));
return
GUI
.
Button
(
rt
,
buttonText
,
buttonStyle
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DrawActionHelpBox.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
DrawActionHelpBox
{
internal
static
void
For
(
Texture
image
,
string
labelText
,
string
buttonText
,
Action
buttonAction
)
{
EditorGUILayout
.
BeginHorizontal
(
EditorStyles
.
helpBox
,
GUILayout
.
MinHeight
(
40
));
DoNotificationLabel
(
image
,
labelText
);
GUILayout
.
Space
(
10
);
DoActionButton
(
buttonText
,
buttonAction
);
GUILayout
.
FlexibleSpace
();
EditorGUILayout
.
EndHorizontal
();
}
static
void
DoNotificationLabel
(
Texture
image
,
string
labelText
)
{
GUILayout
.
BeginVertical
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
Label
(
new
GUIContent
(
labelText
,
image
),
UnityStyles
.
HelpBoxLabel
);
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndVertical
();
}
static
void
DoActionButton
(
string
buttonText
,
Action
buttonAction
)
{
GUILayout
.
BeginVertical
();
GUILayout
.
FlexibleSpace
();
GUIContent
buttonContent
=
new
GUIContent
(
buttonText
);
float
width
=
GetButtonWidth
(
buttonContent
,
EditorStyles
.
miniButton
);
if
(
GUILayout
.
Button
(
buttonContent
,
EditorStyles
.
miniButton
,
GUILayout
.
MinWidth
(
Math
.
Max
(
50
,
width
))))
{
buttonAction
();
}
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndVertical
();
}
static
float
GetButtonWidth
(
GUIContent
buttonContent
,
GUIStyle
buttonStyle
)
{
return
buttonStyle
.
CalcSize
(
buttonContent
).
x
+
10
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DrawSearchField.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
DrawSearchField
{
internal
static
void
For
(
SearchField
searchField
,
TreeView
treeView
,
float
width
)
{
Rect
searchFieldRect
=
GUILayoutUtility
.
GetRect
(
width
/
2
,
EditorGUIUtility
.
singleLineHeight
);
searchFieldRect
.
y
+=
2
;
treeView
.
searchString
=
searchField
.
OnToolbarGUI
(
searchFieldRect
,
treeView
.
searchString
);
if
(!
string
.
IsNullOrEmpty
(
treeView
.
searchString
))
return
;
GUI
.
Label
(
searchFieldRect
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
SearchTooltip
),
UnityStyles
.
Search
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DrawSplitter.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
DrawSplitter
{
internal
static
void
ForHorizontalIndicator
()
{
GUIStyle
style
=
UnityStyles
.
SplitterIndicator
;
Rect
splitterRect
=
GUILayoutUtility
.
GetRect
(
EditorGUIUtility
.
currentViewWidth
,
UnityConstants
.
SPLITTER_INDICATOR_HEIGHT
,
style
);
GUI
.
Label
(
splitterRect
,
string
.
Empty
,
style
);
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/DropDownTextField.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
DropDownTextField
{
internal
static
string
DoDropDownTextField
(
string
text
,
string
controlName
,
List
<
string
>
dropDownOptions
,
GenericMenu
.
MenuFunction2
optionSelected
,
params
GUILayoutOption
[]
options
)
{
GUIContent
textContent
=
new
GUIContent
(
text
);
Rect
textFieldRect
=
GUILayoutUtility
.
GetRect
(
textContent
,
EditorStyles
.
textField
,
options
);
return
DoDropDownTextField
(
text
,
controlName
,
dropDownOptions
,
optionSelected
,
textFieldRect
);
}
internal
static
string
DoDropDownTextField
(
string
text
,
string
controlName
,
List
<
string
>
dropDownOptions
,
GenericMenu
.
MenuFunction2
optionSelected
,
Rect
textFieldRect
)
{
Texture
popupIcon
=
Images
.
GetDropDownIcon
();
Rect
popupButtonRect
=
new
Rect
(
textFieldRect
.
x
+
textFieldRect
.
width
-
BUTTON_WIDTH
,
textFieldRect
.
y
,
BUTTON_WIDTH
,
textFieldRect
.
height
);
if
(
GUI
.
Button
(
popupButtonRect
,
string
.
Empty
,
EditorStyles
.
label
))
{
GenericMenu
menu
=
new
GenericMenu
();
foreach
(
string
option
in
dropDownOptions
)
{
menu
.
AddItem
(
new
GUIContent
(
UnityMenuItem
.
EscapedText
(
option
)),
false
,
optionSelected
,
option
);
}
menu
.
DropDown
(
textFieldRect
);
}
Rect
popupIconRect
=
new
Rect
(
popupButtonRect
.
x
,
popupButtonRect
.
y
+
UnityConstants
.
DROPDOWN_ICON_Y_OFFSET
,
popupButtonRect
.
width
,
popupButtonRect
.
height
);
GUI
.
SetNextControlName
(
controlName
);
string
result
=
GUI
.
TextField
(
textFieldRect
,
text
);
GUI
.
Label
(
popupIconRect
,
popupIcon
);
return
result
;
}
const
int
BUTTON_WIDTH
=
16
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EditorDispatcher.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
System.Threading
;
using
UnityEditor
;
namespace
Unity.PlasticSCM.Editor.UI
{
[
InitializeOnLoad
]
internal
static
class
EditorDispatcher
{
static
EditorDispatcher
()
{
mMainThread
=
Thread
.
CurrentThread
;
}
internal
static
bool
IsOnMainThread
{
get
{
return
Thread
.
CurrentThread
==
mMainThread
;
}
}
internal
static
void
Dispatch
(
Action
task
)
{
lock
(
mDispatchQueue
)
{
if
(
mDispatchQueue
.
Count
==
0
)
EditorApplication
.
update
+=
Update
;
mDispatchQueue
.
Enqueue
(
task
);
}
}
internal
static
void
Update
()
{
Action
[]
actions
;
lock
(
mDispatchQueue
)
{
if
(
mDispatchQueue
.
Count
==
0
)
return
;
actions
=
mDispatchQueue
.
ToArray
();
mDispatchQueue
.
Clear
();
EditorApplication
.
update
-=
Update
;
}
foreach
(
Action
action
in
actions
)
action
();
}
static
readonly
Queue
<
Action
>
mDispatchQueue
=
new
Queue
<
Action
>();
static
Thread
mMainThread
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EditorProgressBar.cs
0 → 100644
View file @
1c847220
using
System.Linq
;
using
System.Reflection
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
static
class
EditorProgressBar
{
static
EditorProgressBar
()
{
var
type
=
typeof
(
UnityEditor
.
Editor
).
Assembly
.
GetTypes
().
Where
(
t
=>
t
.
Name
==
"AsyncProgressBar"
).
FirstOrDefault
();
if
(
type
==
null
)
return
;
mDisplayMethod
=
type
.
GetMethod
(
"Display"
);
mClearMethod
=
type
.
GetMethod
(
"Clear"
);
}
internal
static
void
ShowProgressBar
(
string
text
,
float
progress
)
{
if
(
mDisplayMethod
==
null
)
return
;
mDisplayMethod
.
Invoke
(
null
,
new
object
[]
{
text
,
progress
});
}
internal
static
void
ClearProgressBar
()
{
if
(
mClearMethod
==
null
)
return
;
mClearMethod
.
Invoke
(
null
,
null
);
}
static
MethodInfo
mDisplayMethod
=
null
;
static
MethodInfo
mClearMethod
=
null
;
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EditorProgressControls.cs
0 → 100644
View file @
1c847220
using
Codice.Client.Common
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
EditorProgressControls
:
IProgressControls
{
internal
EditorProgressControls
(
GuiMessage
.
IGuiMessage
guiMessage
)
{
mGuiMessage
=
guiMessage
;
}
void
IProgressControls
.
HideProgress
()
{
EditorProgressBar
.
ClearProgressBar
();
}
void
IProgressControls
.
ShowError
(
string
message
)
{
mGuiMessage
.
ShowError
(
message
);
}
void
IProgressControls
.
ShowNotification
(
string
message
)
{
mGuiMessage
.
ShowMessage
(
UnityConstants
.
PLASTIC_WINDOW_TITLE
,
message
,
GuiMessage
.
GuiMessageType
.
Informational
);
}
void
IProgressControls
.
ShowProgress
(
string
message
)
{
EditorProgressBar
.
ShowProgressBar
(
message
,
1f
);
}
void
IProgressControls
.
ShowSuccess
(
string
message
)
{
mGuiMessage
.
ShowMessage
(
UnityConstants
.
PLASTIC_WINDOW_TITLE
,
message
,
GuiMessage
.
GuiMessageType
.
Informational
);
}
void
IProgressControls
.
ShowWarning
(
string
message
)
{
mGuiMessage
.
ShowMessage
(
UnityConstants
.
PLASTIC_WINDOW_TITLE
,
message
,
GuiMessage
.
GuiMessageType
.
Warning
);
}
GuiMessage
.
IGuiMessage
mGuiMessage
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/UI/EditorVersion.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor.UI
{
internal
class
EditorVersion
{
internal
int
Year
;
internal
int
Release
;
internal
int
Update
;
EditorVersion
(
int
year
,
int
release
,
int
update
)
{
Year
=
year
;
Release
=
release
;
Update
=
update
;
}
public
override
string
ToString
()
{
return
String
.
Format
(
"{0}.{1}.{2}"
,
Year
,
Release
,
Update
);
}
internal
static
bool
IsCurrentEditorOlderThan
(
string
version
)
{
return
IsEditorOlderThan
(
Application
.
unityVersion
,
version
);
}
internal
static
bool
IsEditorOlderThan
(
string
versionA
,
string
versionB
)
{
#if UNITY_2017_1_OR_NEWER
var
editorA
=
Parse
(
versionA
);
var
editorB
=
Parse
(
versionB
);
if
(
editorA
.
Year
==
editorB
.
Year
)
{
if
(
editorA
.
Release
==
editorB
.
Release
)
{
return
editorA
.
Update
<
editorB
.
Update
;
}
return
editorA
.
Release
<
editorB
.
Release
;
}
return
editorA
.
Year
<
editorB
.
Year
;
#else
return
false
;
#endif
}
static
int
ParseUpdateString
(
string
version
)
{
int
pos
=
0
;
char
[]
characters
=
version
.
ToCharArray
();
while
(
Char
.
IsDigit
(
characters
[
pos
]))
{
++
pos
;
}
return
int
.
Parse
(
version
.
Substring
(
0
,
pos
));
}
static
EditorVersion
Parse
(
string
version
)
{
var
versions
=
version
.
Split
(
'.'
);
var
year
=
0
;
year
=
int
.
Parse
(
versions
[
0
]);
var
release
=
0
;
release
=
int
.
Parse
(
versions
[
1
]);
var
update
=
0
;
update
=
ParseUpdateString
(
versions
[
2
]);
return
new
EditorVersion
(
year
,
release
,
update
);
}
}
}
Prev
1
…
21
22
23
24
25
26
27
28
29
…
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