Update HotReload
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b94f2314a044b109de488be1ccd5640
|
||||
timeCreated: 1674233674
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/AssemblyOmission.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1674233674
|
||||
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f41ad09ae4f04088bf6c9ad9a4fc0885
|
||||
timeCreated: 1674220023
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/BuildInfoHelper.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1674220023
|
||||
@@ -9,10 +9,3 @@ MonoImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/EditorWindowHelper.cs
|
||||
uploadId: 870414
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SingularityGroup.HotReload.Editor {
|
||||
@@ -8,6 +9,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
EventsNew,
|
||||
Recompile,
|
||||
Logo,
|
||||
LogoNew,
|
||||
Close,
|
||||
FoldoutOpen,
|
||||
FoldoutClosed,
|
||||
@@ -18,16 +20,16 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
|
||||
internal static class GUIHelper {
|
||||
private static readonly Dictionary<InvertibleIcon, string> supportedInvertibleIcons = new Dictionary<InvertibleIcon, string> {
|
||||
{ InvertibleIcon.BugReport, "report_bug" },
|
||||
{ InvertibleIcon.Events, "events" },
|
||||
{ InvertibleIcon.Recompile, "refresh" },
|
||||
{ InvertibleIcon.Logo, "logo" },
|
||||
{ InvertibleIcon.Close, "close" },
|
||||
{ InvertibleIcon.FoldoutOpen, "foldout_open" },
|
||||
{ InvertibleIcon.FoldoutClosed, "foldout_closed" },
|
||||
{ InvertibleIcon.Spinner, "icon_loading_star_light_mode_96" },
|
||||
{ InvertibleIcon.Stop, "Icn_Stop" },
|
||||
{ InvertibleIcon.Start, "Icn_play" },
|
||||
{ InvertibleIcon.BugReport, "Hot_Reload_report_bug" },
|
||||
{ InvertibleIcon.Events, "Hot_Reload_events" },
|
||||
{ InvertibleIcon.Recompile, "Hot_Reload_refresh" },
|
||||
{ InvertibleIcon.Logo, "Hot_Reload_logo" },
|
||||
{ InvertibleIcon.Close, "Hot_Reload_close" },
|
||||
{ InvertibleIcon.FoldoutOpen, "Hot_Reload_foldout_open" },
|
||||
{ InvertibleIcon.FoldoutClosed, "Hot_Reload_foldout_closed" },
|
||||
{ InvertibleIcon.Spinner, "Hot_Reload_icon_loading_star_light_mode_96" },
|
||||
{ InvertibleIcon.Stop, "Hot_Reload_Icn_Stop" },
|
||||
{ InvertibleIcon.Start, "Hot_Reload_Icn_play" },
|
||||
};
|
||||
|
||||
private static readonly Dictionary<InvertibleIcon, Texture2D> invertibleIconCache = new Dictionary<InvertibleIcon, Texture2D>();
|
||||
@@ -66,7 +68,12 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
var cache = HotReloadWindowStyles.IsDarkMode ? invertibleIconInvertedCache : invertibleIconCache;
|
||||
|
||||
if (!cache.TryGetValue(invertibleIcon, out iconTexture) || !iconTexture) {
|
||||
var type = invertibleIcon == InvertibleIcon.EventsNew ? InvertibleIcon.Events : invertibleIcon;
|
||||
var type = invertibleIcon;
|
||||
if (invertibleIcon == InvertibleIcon.EventsNew) {
|
||||
type = InvertibleIcon.Events;
|
||||
} else if (invertibleIcon == InvertibleIcon.LogoNew) {
|
||||
type = InvertibleIcon.Logo;
|
||||
}
|
||||
iconTexture = Resources.Load<Texture2D>(supportedInvertibleIcons[type]);
|
||||
|
||||
// we assume icons are for light mode by default
|
||||
@@ -78,10 +85,10 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
cache[type] = iconTexture;
|
||||
|
||||
// we combine dot image with Events icon to create a new alert version
|
||||
if (invertibleIcon == InvertibleIcon.EventsNew) {
|
||||
var redDot = Resources.Load<Texture2D>("red_dot");
|
||||
if (invertibleIcon == InvertibleIcon.LogoNew || invertibleIcon == InvertibleIcon.EventsNew) {
|
||||
var redDot = Resources.Load<Texture2D>("Hot_Reload_red_dot");
|
||||
iconTexture = CombineImages(iconTexture, redDot);
|
||||
cache[InvertibleIcon.EventsNew] = iconTexture;
|
||||
cache[invertibleIcon] = iconTexture;
|
||||
}
|
||||
}
|
||||
return cache[invertibleIcon];
|
||||
@@ -127,7 +134,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
|
||||
private static readonly Dictionary<string, Texture2D> grayTextureCache = new Dictionary<string, Texture2D>();
|
||||
private static readonly Dictionary<string, Color> colorFactor = new Dictionary<string, Color> {
|
||||
{ "error", new Color(0.6f, 0.587f, 0.114f) },
|
||||
{ "Hot_Reload_error", new Color(0.6f, 0.587f, 0.114f) },
|
||||
};
|
||||
|
||||
internal static Texture2D ConvertToGrayscale(string localIcon) {
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4be912211814333ab61898b6440dc8e
|
||||
timeCreated: 1694518358
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/GUIHelper.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1694518358
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cc471e812b143599ef5dde1d7ec022a
|
||||
timeCreated: 1694632601
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/HotReloadSuggestionsHelper.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1694632601
|
||||
@@ -61,8 +61,9 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
public readonly bool detiled;
|
||||
public readonly DateTime createdAt;
|
||||
public readonly string[] patchedMembersDisplayNames;
|
||||
public readonly bool isCompile;
|
||||
|
||||
public AlertData(AlertEntryType alertEntryType, DateTime createdAt, bool detiled = false, EntryType entryType = EntryType.Standalone, string errorString = null, string methodName = null, string methodSimpleName = null, PartiallySupportedChange partiallySupportedChange = default(PartiallySupportedChange), string[] patchedMembersDisplayNames = null) {
|
||||
public AlertData(AlertEntryType alertEntryType, DateTime createdAt, bool detiled = false, EntryType entryType = EntryType.Standalone, string errorString = null, string methodName = null, string methodSimpleName = null, PartiallySupportedChange partiallySupportedChange = default(PartiallySupportedChange), string[] patchedMembersDisplayNames = null, bool isCompile = false) {
|
||||
this.alertEntryType = alertEntryType;
|
||||
this.createdAt = createdAt;
|
||||
this.detiled = detiled;
|
||||
@@ -72,6 +73,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
this.methodSimpleName = methodSimpleName;
|
||||
this.partiallySupportedChange = partiallySupportedChange;
|
||||
this.patchedMembersDisplayNames = patchedMembersDisplayNames;
|
||||
this.isCompile = isCompile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +143,8 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
case AlertEntryType.PatchApplied:
|
||||
CreateReloadFinishedEventEntry(
|
||||
createdAt: alertData.createdAt,
|
||||
patchedMethodsDisplayNames: alertData.patchedMembersDisplayNames
|
||||
patchedMethodsDisplayNames: alertData.patchedMembersDisplayNames,
|
||||
isCompile: alertData.isCompile
|
||||
);
|
||||
break;
|
||||
case AlertEntryType.PartiallySupportedChange:
|
||||
@@ -185,12 +188,12 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
}
|
||||
|
||||
internal static readonly Dictionary<AlertType, string> alertIconString = new Dictionary<AlertType, string> {
|
||||
{ AlertType.Suggestion, "alert_info" },
|
||||
{ AlertType.UnsupportedChange, "warning" },
|
||||
{ AlertType.CompileError, "error" },
|
||||
{ AlertType.PartiallySupportedChange, "infos" },
|
||||
{ AlertType.AppliedChange, "applied_patch" },
|
||||
{ AlertType.UndetectedChange, "undetected" },
|
||||
{ AlertType.Suggestion, "Hot_Reload_alert_info" },
|
||||
{ AlertType.UnsupportedChange, "Hot_Reload_warning" },
|
||||
{ AlertType.CompileError, "Hot_Reload_error" },
|
||||
{ AlertType.PartiallySupportedChange, "Hot_Reload_infos" },
|
||||
{ AlertType.AppliedChange, "Hot_Reload_applied_patch" },
|
||||
{ AlertType.UndetectedChange, "Hot_Reload_status_undetected" },
|
||||
};
|
||||
|
||||
#pragma warning disable CS0612 // obsolete
|
||||
@@ -210,13 +213,27 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
{PartiallySupportedChange.MultipleFieldsEditedInTheSameType, Translations.Timeline.PartiallySupportedMultipleFieldsEditedInTheSameType},
|
||||
};
|
||||
#pragma warning restore CS0612
|
||||
|
||||
public static int CountTimelineEnties(Predicate<AlertEntry> predicate = null) {
|
||||
var count = 0;
|
||||
foreach (var alertEntry in EventsTimeline) {
|
||||
if (predicate == null || predicate(alertEntry)) {
|
||||
count++;
|
||||
}
|
||||
if (!HotReloadPrefs.TimelineViewAll && alertEntry.alertData?.isCompile == true) {
|
||||
// break on first compile entry if we only viewing recent events
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
internal static List<AlertEntry> Suggestions = new List<AlertEntry>();
|
||||
internal static int UnsupportedChangesCount => EventsTimeline.Count(alert => alert.alertType == AlertType.UnsupportedChange && alert.entryType != EntryType.Child);
|
||||
internal static int PartiallySupportedChangesCount => EventsTimeline.Count(alert => alert.alertType == AlertType.PartiallySupportedChange && alert.entryType != EntryType.Child);
|
||||
internal static int UndetectedChangesCount => EventsTimeline.Count(alert => alert.alertType == AlertType.UndetectedChange && alert.entryType != EntryType.Child);
|
||||
internal static int CompileErrorsCount => EventsTimeline.Count(alert => alert.alertType == AlertType.CompileError);
|
||||
internal static int AppliedChangesCount => EventsTimeline.Count(alert => alert.alertType == AlertType.AppliedChange);
|
||||
internal static int UnsupportedChangesCount => CountTimelineEnties(alert => alert.alertType == AlertType.UnsupportedChange && alert.entryType != EntryType.Child);
|
||||
internal static int PartiallySupportedChangesCount => CountTimelineEnties(alert => alert.alertType == AlertType.PartiallySupportedChange && alert.entryType != EntryType.Child);
|
||||
internal static int UndetectedChangesCount => CountTimelineEnties(alert => alert.alertType == AlertType.UndetectedChange && alert.entryType != EntryType.Child);
|
||||
internal static int CompileErrorsCount => CountTimelineEnties(alert => alert.alertType == AlertType.CompileError);
|
||||
internal static int AppliedChangesCount => CountTimelineEnties(alert => alert.alertType == AlertType.AppliedChange);
|
||||
|
||||
static Regex shortDescriptionRegex = new Regex(PackageConst.DefaultLocale == Locale.SimplifiedChinese ? @"^([\p{L}\p{N}_]+)\s([\p{L}\p{N}_]+)(?=:)" : @"^(\w+)\s(\w+)(?=:)", RegexOptions.Compiled);
|
||||
|
||||
@@ -248,6 +265,12 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RenderReportBugButton(string title, string detail = null) {
|
||||
if (GUILayout.Button(Translations.Common.ButtonBugReport.Trim(), GUILayout.Width(80))) {
|
||||
ReportWindowAPI.OpenBugReport(title?.Replace($", {Translations.UI.TapHereToSeeMore}", ""), detail);
|
||||
}
|
||||
}
|
||||
|
||||
private static float maxScrollPos;
|
||||
internal static void RenderErrorEventActions(string description, ErrorData errorData) {
|
||||
int maxLen = 2400;
|
||||
@@ -266,6 +289,8 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
if (!errorData.stacktrace.Contains("error CS")) {
|
||||
RenderCompileButton();
|
||||
}
|
||||
|
||||
RenderReportBugButton(errorData.error, errorData.stacktrace);
|
||||
|
||||
// Link
|
||||
if (errorData.file) {
|
||||
@@ -363,16 +388,18 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
}
|
||||
var patchesList = patchedMethodsDisplayNames?.Length > 0 ? string.Join("\n• ", patchedMethodsDisplayNames) : "";
|
||||
var timestamp = createdAt ?? DateTime.Now;
|
||||
var title = Translations.Timeline.EventTitleFailedApplyingPatch;
|
||||
var entry = new AlertEntry(
|
||||
timestamp: timestamp,
|
||||
alertType : AlertType.UnsupportedChange,
|
||||
title: Translations.Timeline.EventTitleFailedApplyingPatch,
|
||||
title: title,
|
||||
description: $"{Translations.Timeline.EventDescriptionInlinedMethods}\n\n• {(truncated ? patchesList + "\n..." : patchesList)}",
|
||||
entryType: EntryType.Parent,
|
||||
actionData: () => {
|
||||
GUILayout.Space(10f);
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
RenderCompileButton();
|
||||
RenderReportBugButton(title);
|
||||
var suggestion = HotReloadSuggestionsHelper.suggestionMap[HotReloadSuggestionKind.SwitchToDebugModeForInlinedMethods];
|
||||
if (suggestion?.actionData != null) {
|
||||
suggestion.actionData();
|
||||
@@ -419,7 +446,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
return truncatedList;
|
||||
}
|
||||
|
||||
internal static void CreateReloadFinishedEventEntry(DateTime? createdAt = null, string[] patchedMethodsDisplayNames = null) {
|
||||
internal static void CreateReloadFinishedEventEntry(DateTime? createdAt = null, string[] patchedMethodsDisplayNames = null, bool isCompile = false) {
|
||||
var truncated = false;
|
||||
if (patchedMethodsDisplayNames?.Length > 25) {
|
||||
patchedMethodsDisplayNames = TruncateList(patchedMethodsDisplayNames, 25);
|
||||
@@ -439,6 +466,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
AlertEntryType.PatchApplied,
|
||||
createdAt: timestamp,
|
||||
entryType: EntryType.Standalone,
|
||||
isCompile: isCompile,
|
||||
patchedMembersDisplayNames: patchedMethodsDisplayNames)
|
||||
);
|
||||
|
||||
@@ -494,15 +522,17 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
|
||||
internal static void CreateReloadUndetectedChangeEventEntry(DateTime? createdAt = null) {
|
||||
var timestamp = createdAt ?? DateTime.Now;
|
||||
var title = EditorIndicationState.IndicationText[EditorIndicationState.IndicationStatus.Undetected];
|
||||
InsertEntry(new AlertEntry(
|
||||
timestamp: timestamp,
|
||||
alertType : AlertType.UndetectedChange,
|
||||
title: EditorIndicationState.IndicationText[EditorIndicationState.IndicationStatus.Undetected],
|
||||
title: title,
|
||||
description: Translations.Timeline.EventDescriptionUndetectedChange,
|
||||
actionData: () => {
|
||||
GUILayout.Space(10f);
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
RenderCompileButton();
|
||||
RenderReportBugButton(title);
|
||||
GUILayout.FlexibleSpace();
|
||||
OpenURLButton.Render(Translations.Suggestions.ButtonDocs, Constants.UndetectedChangesURL);
|
||||
GUILayout.Space(10f);
|
||||
@@ -519,16 +549,18 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
if (!partiallySupportedChangeDescriptions.TryGetValue(partiallySupportedChange, out description)) {
|
||||
return;
|
||||
}
|
||||
var title = detailed ? Translations.Timeline.EventTitleChangePartiallyApplied : ToString(partiallySupportedChange);
|
||||
InsertEntry(new AlertEntry(
|
||||
timestamp: timestamp,
|
||||
alertType : AlertType.PartiallySupportedChange,
|
||||
title : detailed ? Translations.Timeline.EventTitleChangePartiallyApplied : ToString(partiallySupportedChange),
|
||||
title : title,
|
||||
description : description,
|
||||
shortDescription: detailed ? ToString(partiallySupportedChange) : null,
|
||||
actionData: () => {
|
||||
GUILayout.Space(10f);
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
RenderCompileButton();
|
||||
RenderReportBugButton(title);
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GetPartiallySupportedChangePref(partiallySupportedChange)) {
|
||||
if (GUILayout.Button(Translations.Timeline.ButtonIgnoreEventType, HotReloadWindowStyles.LinkStyle)) {
|
||||
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffb65be71b8b4d14800f8b28bf68d0ab
|
||||
timeCreated: 1695210350
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/HotReloadTimelineHelper.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1695210350
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace SingularityGroup.HotReload.Editor {
|
||||
internal class Spinner {
|
||||
internal static string SpinnerIconPath => "icon_loading_star_light_mode_96";
|
||||
internal static string SpinnerIconPath => "Hot_Reload_icon_loading_star_light_mode_96";
|
||||
internal static Texture2D spinnerTexture => GUIHelper.GetInvertibleIcon(InvertibleIcon.Spinner);
|
||||
private Texture2D _rotatedTextureLight;
|
||||
private Texture2D _rotatedTextureDark;
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bd77f0465824c5da3e1454f75c6e93c
|
||||
timeCreated: 1685871830
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/Spinner.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1685871830
|
||||
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34fb1222dc00466ab4e3db7383bd00ee
|
||||
timeCreated: 1694279476
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/Helpers/UnitySettingsHelper.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1694279476
|
||||
Reference in New Issue
Block a user