chore: move a method
This commit is contained in:
parent
368b0a8832
commit
6966f935ee
|
@ -116,6 +116,35 @@ internal sealed class PluginUi : IDisposable {
|
||||||
this._fontCfgMerge.Destroy();
|
this._fontCfgMerge.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Draw() {
|
||||||
|
this.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
||||||
|
|
||||||
|
var font = this.RegularFont.HasValue;
|
||||||
|
|
||||||
|
if (font) {
|
||||||
|
ImGui.PushFont(this.RegularFont!.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var component in this.Components) {
|
||||||
|
try {
|
||||||
|
component.Draw();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
PluginLog.LogError(ex, "Error drawing component");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (font) {
|
||||||
|
ImGui.PopFont();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] GetResource(string name) {
|
||||||
|
var stream = this.GetType().Assembly.GetManifestResourceStream(name)!;
|
||||||
|
var memory = new MemoryStream();
|
||||||
|
stream.CopyTo(memory);
|
||||||
|
return memory.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
private void SetUpUserFonts() {
|
private void SetUpUserFonts() {
|
||||||
FontData? fontData = null;
|
FontData? fontData = null;
|
||||||
if (this.Plugin.Config.GlobalFont.StartsWith(Fonts.IncludedIndicator)) {
|
if (this.Plugin.Config.GlobalFont.StartsWith(Fonts.IncludedIndicator)) {
|
||||||
|
@ -194,35 +223,6 @@ internal sealed class PluginUi : IDisposable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Draw() {
|
|
||||||
this.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
|
||||||
|
|
||||||
var font = this.RegularFont.HasValue;
|
|
||||||
|
|
||||||
if (font) {
|
|
||||||
ImGui.PushFont(this.RegularFont!.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var component in this.Components) {
|
|
||||||
try {
|
|
||||||
component.Draw();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
PluginLog.LogError(ex, "Error drawing component");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (font) {
|
|
||||||
ImGui.PopFont();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] GetResource(string name) {
|
|
||||||
var stream = this.GetType().Assembly.GetManifestResourceStream(name)!;
|
|
||||||
var memory = new MemoryStream();
|
|
||||||
stream.CopyTo(memory);
|
|
||||||
return memory.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BuildFonts() {
|
private void BuildFonts() {
|
||||||
this.RegularFont = null;
|
this.RegularFont = null;
|
||||||
this.ItalicFont = null;
|
this.ItalicFont = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user