/// <summary>Show the lookup UI for the current target.</summary> /// <param name="lookupMode">The lookup target mode.</param> private void ShowLookup(LookupMode lookupMode) { // disable lookups if metadata is invalid if (!this.IsDataValid) { GameHelper.ShowErrorMessage("The mod doesn't seem to be installed correctly: its data.json file is missing or corrupt."); return; } // show menu StringBuilder logMessage = new StringBuilder("Received a lookup request..."); this.Monitor.InterceptErrors("looking that up", () => { try { // get target ISubject subject = this.GetSubject(logMessage, lookupMode); if (subject == null) { this.Monitor.Log($"{logMessage} no target found.", LogLevel.Trace); return; } // show lookup UI this.Monitor.Log(logMessage.ToString(), LogLevel.Trace); this.ShowLookupFor(subject); } catch { this.Monitor.Log($"{logMessage} an error occurred.", LogLevel.Trace); throw; } }); }
/// <summary>Show the lookup UI for the current target.</summary> /// <param name="lookupMode">The lookup target mode.</param> private void ShowLookup(LookupMode lookupMode) { // disable lookups if metadata is invalid if (!this.IsDataValid) { GameHelper.ShowErrorMessage("The mod doesn't seem to be installed correctly: its data.json file is missing or corrupt."); return; } // show menu StringBuilder logMessage = new StringBuilder("Received a lookup request..."); this.Monitor.InterceptErrors("looking that up", () => { try { // get target ISubject subject = this.GetSubject(logMessage, lookupMode); if (subject == null) { this.Monitor.Log($"{logMessage} no target found.", LogLevel.Trace); return; } // show lookup UI this.Monitor.Log($"{logMessage} showing {subject.GetType().Name}::{subject.Type}::{subject.Name}.", LogLevel.Trace); this.PreviousMenu = Game1.activeClickableMenu; Game1.activeClickableMenu = new LookupMenu(subject, this.Metadata, this.Monitor, this.Helper.Reflection, this.Config.ScrollAmount, showDebugFields: this.Config.ShowDataMiningFields); } catch { this.Monitor.Log($"{logMessage} an error occurred.", LogLevel.Trace); throw; } }); }