chore: move a method

This commit is contained in:
Anna 2022-02-06 03:49:11 -05:00
parent 368b0a8832
commit 6966f935ee
1 changed files with 29 additions and 29 deletions

View File

@ -116,6 +116,35 @@ internal sealed class PluginUi : IDisposable {
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() {
FontData? fontData = null;
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() {
this.RegularFont = null;
this.ItalicFont = null;