PO/Library/Artifacts/dd/dd844d1433f86d29f7f4e103961...

198 lines
10 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>*,2019.4.19f1<00><><EFBFBD><EFBFBD> <00><>f<EFBFBD><66>!<21>5<>9<EFBFBD>4Q<0E><>B<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> E<00> <00><00>#<00>.<00>,<00>5a<00> <00><00>#<00>.<00>,<00><00><00>r<00> <00><00># <00>.<00>,
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00><00><00>J<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>\<00><00><><EFBFBD><EFBFBD><EFBFBD><00>H<00>r<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>w<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#!<00>.<00>,"<00><00><><00><><EFBFBD><EFBFBD>#@1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$<00><00><00>%.<00>j<00>&<00><00><><00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD>+<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>,@<00><00><00>-Q<00>j<00>.y<00>
<00> /<00><00>#0<00>.<00>,1<00> <00><>2@<00><00><> 3@<00><00>#4<00>.<00>,5<00>H<00><><00><><EFBFBD><EFBFBD>6<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>7@<00><00><00>8Q<00>j<00>9H<00><><00><><EFBFBD><EFBFBD>:<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>;@<00><00><00><Q<00>j<00>=H<00><><00><><EFBFBD><EFBFBD>><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>?@<00><00><00>@Q<00>j<00>AMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>G<EFBFBD><47>܏Z56<35>:!@i<>J*<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00>E<00> <00><00><00>.<00><00>(a<00> <00><00><00>.<00><00><00><00>r<00> <00><00> <00>.<00>
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>=<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00><00>.<00><00>y<00>Q <00><00><00>.<00> <00><00><00>X!H<00>i<00><><EFBFBD><EFBFBD>"<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>#@<00><00><00>$Q<00>j<00>%H<00>u<00><><EFBFBD><EFBFBD>&<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>'@<00><00><00>(Q<00>j<00>)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\<00>y<EFBFBD>`<00><00>y<EFBFBD> DrawHelpPanelCusing System.Diagnostics;
using UnityEditor;
using UnityEngine;
using Codice.Client.Common;
using PlasticGui;
using Unity.PlasticSCM.Editor.UI;
namespace Unity.PlasticSCM.Editor.Help
{
internal static class DrawHelpPanel
{
internal static void For(
HelpPanel helpPanel)
{
if (!helpPanel.Visible)
return;
DoHelpPanelToolbar(helpPanel);
GUILayout.Space(10);
DoHelpPanelContent(helpPanel);
}
static void DoHelpPanelToolbar(
HelpPanel helpPanel)
{
Rect rect = GUILayoutUtility.GetLastRect();
rect.y = rect.yMax;
rect.height = 22;
GUILayout.Space(1);
GUIStyle expandableToolbar = new GUIStyle(EditorStyles.toolbar);
expandableToolbar.fixedHeight = 0;
GUI.Label(rect, GUIContent.none, expandableToolbar);
using (new EditorGUILayout.HorizontalScope())
{
if (GUILayout.Button("<", EditorStyles.miniButtonLeft))
{
// TODO(codice): On Left Clicked
}
if (GUILayout.Button(">", EditorStyles.miniButtonRight))
{
// TODO(codice): On Right Clicked
}
GUILayout.FlexibleSpace();
// TODO(codice): The bool used here must be loaded and persisted by some means
helpPanel.Data.ShouldShowAgain = EditorGUILayout.ToggleLeft(
PlasticLocalization.GetString(PlasticLocalization.Name.DontShowItAgain),
helpPanel.Data.ShouldShowAgain, UnityStyles.MiniToggle);
bool okWasPressed = GUILayout.Button(
PlasticLocalization.GetString(PlasticLocalization.Name.OkButton),
EditorStyles.miniButton);
if (okWasPressed)
{
helpPanel.Hide();
// TODO(codice): Do on helppanel dismiss actions
return;
}
}
}
static void DoHelpPanelContent(
HelpPanel helpPanel)
{
using (new EditorGUILayout.HorizontalScope())
{
Texture image = Images.GetHelpImage(helpPanel.Image);
var imgRect = GUILayoutUtility.GetRect(
image.width, image.width, image.height, image.height);
GUI.DrawTexture(imgRect, image, ScaleMode.ScaleToFit);
using (new EditorGUILayout.VerticalScope())
{
GUIStyle helpParagraph = UnityStyles.Paragraph;
helpPanel.TextScroll = GUILayout.BeginScrollView(helpPanel.TextScroll);
GUILayout.Label(helpPanel.GUIContent, helpParagraph);
if (Event.current.type != EventType.Layout)
DoHelpPanelLinks(helpPanel, helpParagraph);
GUILayout.EndScrollView();
Rect scrollRect = GUILayoutUtility.GetLastRect();
if (Mouse.IsRightMouseButtonPressed(Event.current) &&
scrollRect.Contains(Event.current.mousePosition))
{
GenericMenu contextMenu = BuildHelpPanelMenu(helpPanel.Data.CleanText);
contextMenu.ShowAsContext();
}
}
}
}
static void DoHelpPanelLinks(
HelpPanel helpPanel,
GUIStyle helpParagraph)
{
var lastRect = GUILayoutUtility.GetLastRect();
bool linkWasClicked = false;
GUIContent charContent = new GUIContent();
for (int charIdx = 0; charIdx < helpPanel.GUIContent.text.Length; charIdx++)
{
HelpLink link;
if (!helpPanel.TryGetLinkAtChar(charIdx, out link))
continue;
charContent.text = helpPanel.GUIContent.text[charIdx].ToString();
var pos = helpParagraph.GetCursorPixelPosition(
lastRect, helpPanel.GUIContent, charIdx);
float charWidth = helpParagraph.CalcSize(charContent).x;
Rect charRect = new Rect(pos, new Vector2(
charWidth - 4, helpParagraph.lineHeight));
if (!linkWasClicked &&
Mouse.IsLeftMouseButtonPressed(Event.current) &&
charRect.Contains(Event.current.mousePosition))
{
linkWasClicked = true;
OnHelpLinkClicked(helpPanel, link);
}
// Underline for links
charRect.y = charRect.yMax - 1;
charRect.height = 1;
GUI.DrawTexture(charRect, Images.GetLinkUnderlineImage());
}
}
static void OnHelpLinkClicked(
HelpPanel helpPanel,
HelpLink helpLink)
{
HelpLink.LinkType linkType;
string content;
if (!HelpLinkData.TryGet(helpLink.Link, out linkType, out content))
return;
switch (linkType)
{
case HelpLink.LinkType.Action:
GuiMessage.ShowInformation(
"An ACTION link has been clicked:\n" + content);
break;
case HelpLink.LinkType.Help:
helpPanel.Show(
PlasticGui.Help.HelpImage.GenericBuho,
content == "sample1" ?
TestingHelpData.GetSample1() :
TestingHelpData.GetSample2());
break;
case HelpLink.LinkType.Link:
Process.Start(content);
break;
}
}
static void CopyToClipboard(string data)
{
EditorGUIUtility.systemCopyBuffer = data;
}
static GenericMenu BuildHelpPanelMenu(string cleanText)
{
GenericMenu result = new GenericMenu();
result.AddItem(
new GUIContent(PlasticLocalization.GetString(PlasticLocalization.Name.Copy)),
false,
() => CopyToClipboard(cleanText)
);
return result;
}
}
}
DrawHelpPanelUnity.PlasticSCM.Editor.Help