Пример #1
0
        private void OnDraw()
        {
            ImGui.PushID(this.namespaceName);

            if (this.hasErrorWindow && ImGui.Begin(string.Format("{0} Error", this.namespaceName), ref this.hasErrorWindow,
                                                   ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize))
            {
                ImGui.Text(string.Format("The plugin {0} ran into an error.\nContact the plugin developer for support.\n\nPlease try restarting your game.", this.namespaceName));
                ImGui.Spacing();

                if (ImGui.Button("OK"))
                {
                    this.hasErrorWindow = false;
                }

                ImGui.End();
            }

            try {
                OnBuildUi?.Invoke();
            } catch (Exception ex) {
                Log.Error(ex, "[{0}] UiBuilder OnBuildUi caught exception", this.namespaceName);
                OnBuildUi      = null;
                OnOpenConfigUi = null;

                this.hasErrorWindow = true;
            }

            ImGui.PopID();
        }
Пример #2
0
        private void OnDraw()
        {
            if (this.dalamud.Framework.Gui.GameUiHidden && this.dalamud.Configuration.ToggleUiHide && !(DisableUserUiHide || DisableAutomaticUiHide) ||
                CutsceneActive && this.dalamud.Configuration.ToggleUiHideDuringCutscenes && !(DisableCutsceneUiHide || DisableAutomaticUiHide) ||
                GposeActive && this.dalamud.Configuration.ToggleUiHideDuringGpose && !(DisableGposeUiHide || DisableAutomaticUiHide))
            {
                return;
            }

            ImGui.PushID(this.namespaceName);
            if (DoStats)
            {
                this.stopwatch.Restart();
            }

            if (this.hasErrorWindow && ImGui.Begin(string.Format("{0} Error", this.namespaceName), ref this.hasErrorWindow,
                                                   ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize))
            {
                ImGui.Text(string.Format("The plugin {0} ran into an error.\nContact the plugin developer for support.\n\nPlease try restarting your game.", this.namespaceName));
                ImGui.Spacing();

                if (ImGui.Button("OK"))
                {
                    this.hasErrorWindow = false;
                }

                ImGui.End();
            }

            try {
                OnBuildUi?.Invoke();
            } catch (Exception ex) {
                Log.Error(ex, "[{0}] UiBuilder OnBuildUi caught exception", this.namespaceName);
                OnBuildUi      = null;
                OnOpenConfigUi = null;

                this.hasErrorWindow = true;
            }

            if (DoStats)
            {
                this.stopwatch.Stop();
                this.lastDrawTime = this.stopwatch.ElapsedTicks;
                this.maxDrawTime  = Math.Max(this.lastDrawTime, this.maxDrawTime);
                this.drawTimeHistory.Add(lastDrawTime);
                while (drawTimeHistory.Count > 100)
                {
                    drawTimeHistory.RemoveAt(0);
                }
            }
            ImGui.PopID();
        }
Пример #3
0
        private void OnDraw()
        {
            ImGui.PushID(this.namespaceName);
            if (DoStats)
            {
                this.stopwatch.Restart();
            }

            if (this.hasErrorWindow && ImGui.Begin(string.Format("{0} Error", this.namespaceName), ref this.hasErrorWindow,
                                                   ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize))
            {
                ImGui.Text(string.Format("The plugin {0} ran into an error.\nContact the plugin developer for support.\n\nPlease try restarting your game.", this.namespaceName));
                ImGui.Spacing();

                if (ImGui.Button("OK"))
                {
                    this.hasErrorWindow = false;
                }

                ImGui.End();
            }

            try {
                OnBuildUi?.Invoke();
            } catch (Exception ex) {
                Log.Error(ex, "[{0}] UiBuilder OnBuildUi caught exception", this.namespaceName);
                OnBuildUi      = null;
                OnOpenConfigUi = null;

                this.hasErrorWindow = true;
            }

            if (DoStats)
            {
                this.stopwatch.Stop();
                this.lastDrawTime = this.stopwatch.ElapsedTicks;
                this.maxDrawTime  = Math.Max(this.lastDrawTime, this.maxDrawTime);
                this.drawTimeHistory.Add(lastDrawTime);
                while (drawTimeHistory.Count > 100)
                {
                    drawTimeHistory.RemoveAt(0);
                }
            }
            ImGui.PopID();
        }
Пример #4
0
 private void OnDraw()
 {
     ImGui.PushID(this.namespaceName);
     OnBuildUi?.Invoke();
     ImGui.PopID();
 }