81 lines
1.3 KiB
C#
81 lines
1.3 KiB
C#
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class BugReporter : MonoBehaviour
|
|
{
|
|
private static BugReporter instance;
|
|
|
|
[ReadOnly]
|
|
public bool isVisible;
|
|
|
|
[ReadOnly]
|
|
public float prevTimeScale = 1f;
|
|
|
|
[ReadOnly]
|
|
public bool prevCursorVisible = true;
|
|
|
|
[ReadOnly]
|
|
public CursorLockMode prevCursorLockMode;
|
|
|
|
public static BugReporter Instance
|
|
{
|
|
get
|
|
{
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
private BugReporter()
|
|
{
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = this;
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F5) && !isVisible)
|
|
{
|
|
OnShowReportWidow(true);
|
|
ReportBug();
|
|
}
|
|
}
|
|
|
|
public void ReportBug()
|
|
{
|
|
SRDebug.Instance.ShowBugReportSheet(delegate(bool success)
|
|
{
|
|
Debug.Log("ReportBug " + success);
|
|
OnShowReportWidow(false);
|
|
}, true, string.Empty);
|
|
}
|
|
|
|
public void OnShowReportWidow(bool show)
|
|
{
|
|
isVisible = show;
|
|
if (show)
|
|
{
|
|
prevTimeScale = Time.timeScale;
|
|
Time.timeScale = 0f;
|
|
prevCursorVisible = Cursor.visible;
|
|
Cursor.visible = true;
|
|
prevCursorLockMode = Cursor.lockState;
|
|
Cursor.lockState = CursorLockMode.None;
|
|
}
|
|
else
|
|
{
|
|
Time.timeScale = prevTimeScale;
|
|
Cursor.visible = prevCursorVisible;
|
|
Cursor.lockState = prevCursorLockMode;
|
|
}
|
|
if (!GameController.Instance)
|
|
{
|
|
}
|
|
}
|
|
}
|