mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-12-31 11:08:09 +00:00
提交Unity 联机Pro
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
|
||||
public class BugReportPopoverRoot : SRMonoBehaviourEx
|
||||
{
|
||||
[RequiredField] public CanvasGroup CanvasGroup;
|
||||
|
||||
[RequiredField] public RectTransform Container;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c9a194ca4d3911419f82b2f06d5ef2e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,195 @@
|
||||
|
||||
#if NETFX_CORE
|
||||
using UnityEngine.Windows;
|
||||
#endif
|
||||
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Internal;
|
||||
using Services;
|
||||
using SRF;
|
||||
using SRF.Service;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BugReportSheetController : SRMonoBehaviourEx
|
||||
{
|
||||
[RequiredField] public GameObject ButtonContainer;
|
||||
|
||||
[RequiredField] public Text ButtonText;
|
||||
|
||||
[RequiredField] public UnityEngine.UI.Button CancelButton;
|
||||
|
||||
public Action CancelPressed;
|
||||
|
||||
[RequiredField] public InputField DescriptionField;
|
||||
|
||||
[RequiredField] public InputField EmailField;
|
||||
|
||||
[RequiredField] public Slider ProgressBar;
|
||||
|
||||
[RequiredField] public Text ResultMessageText;
|
||||
|
||||
public Action ScreenshotComplete;
|
||||
|
||||
[RequiredField] public UnityEngine.UI.Button SubmitButton;
|
||||
|
||||
public Action<bool, string> SubmitComplete;
|
||||
public Action TakingScreenshot;
|
||||
|
||||
public bool IsCancelButtonEnabled
|
||||
{
|
||||
get { return CancelButton.gameObject.activeSelf; }
|
||||
set { CancelButton.gameObject.SetActive(value); }
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
SetLoadingSpinnerVisible(false);
|
||||
ClearErrorMessage();
|
||||
ClearForm();
|
||||
}
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(null);
|
||||
|
||||
ProgressBar.value = 0;
|
||||
ClearErrorMessage();
|
||||
SetLoadingSpinnerVisible(true);
|
||||
SetFormEnabled(false);
|
||||
|
||||
if (!string.IsNullOrEmpty(EmailField.text))
|
||||
{
|
||||
SetDefaultEmailFieldContents(EmailField.text);
|
||||
}
|
||||
|
||||
StartCoroutine(SubmitCo());
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
if (CancelPressed != null)
|
||||
{
|
||||
CancelPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator SubmitCo()
|
||||
{
|
||||
if (BugReportScreenshotUtil.ScreenshotData == null && Settings.Instance.EnableBugReportScreenshot)
|
||||
{
|
||||
if (TakingScreenshot != null)
|
||||
{
|
||||
TakingScreenshot();
|
||||
}
|
||||
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
yield return StartCoroutine(BugReportScreenshotUtil.ScreenshotCaptureCo());
|
||||
|
||||
if (ScreenshotComplete != null)
|
||||
{
|
||||
ScreenshotComplete();
|
||||
}
|
||||
}
|
||||
|
||||
var s = SRServiceManager.GetService<IBugReportService>();
|
||||
|
||||
var r = new BugReport();
|
||||
|
||||
r.Email = EmailField.text;
|
||||
r.UserDescription = DescriptionField.text;
|
||||
|
||||
r.ConsoleLog = Service.Console.AllEntries.ToList();
|
||||
r.SystemInformation = SRServiceManager.GetService<ISystemInformationService>().CreateReport();
|
||||
r.ScreenshotData = BugReportScreenshotUtil.ScreenshotData;
|
||||
|
||||
BugReportScreenshotUtil.ScreenshotData = null;
|
||||
|
||||
s.SendBugReport(r, OnBugReportComplete, new Progress<float>(OnBugReportProgress));
|
||||
}
|
||||
|
||||
private void OnBugReportProgress(float progress)
|
||||
{
|
||||
ProgressBar.value = progress;
|
||||
}
|
||||
|
||||
private void OnBugReportComplete(bool didSucceed, string errorMessage)
|
||||
{
|
||||
if (!didSucceed)
|
||||
{
|
||||
ShowErrorMessage("Error sending bug report", errorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearForm();
|
||||
ShowErrorMessage("Bug report submitted successfully");
|
||||
}
|
||||
|
||||
SetLoadingSpinnerVisible(false);
|
||||
SetFormEnabled(true);
|
||||
|
||||
if (SubmitComplete != null)
|
||||
{
|
||||
SubmitComplete(didSucceed, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetLoadingSpinnerVisible(bool visible)
|
||||
{
|
||||
ProgressBar.gameObject.SetActive(visible);
|
||||
ButtonContainer.SetActive(!visible);
|
||||
}
|
||||
|
||||
protected void ClearForm()
|
||||
{
|
||||
EmailField.text = GetDefaultEmailFieldContents();
|
||||
DescriptionField.text = "";
|
||||
}
|
||||
|
||||
protected void ShowErrorMessage(string userMessage, string serverMessage = null)
|
||||
{
|
||||
var txt = userMessage;
|
||||
|
||||
if (!string.IsNullOrEmpty(serverMessage))
|
||||
{
|
||||
txt += " (<b>{0}</b>)".Fmt(serverMessage);
|
||||
}
|
||||
|
||||
ResultMessageText.text = txt;
|
||||
ResultMessageText.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
protected void ClearErrorMessage()
|
||||
{
|
||||
ResultMessageText.text = "";
|
||||
ResultMessageText.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
protected void SetFormEnabled(bool e)
|
||||
{
|
||||
SubmitButton.interactable = e;
|
||||
CancelButton.interactable = e;
|
||||
EmailField.interactable = e;
|
||||
DescriptionField.interactable = e;
|
||||
}
|
||||
|
||||
private string GetDefaultEmailFieldContents()
|
||||
{
|
||||
return PlayerPrefs.GetString("SRDEBUGGER_BUG_REPORT_LAST_EMAIL", "");
|
||||
}
|
||||
|
||||
private void SetDefaultEmailFieldContents(string value)
|
||||
{
|
||||
PlayerPrefs.SetString("SRDEBUGGER_BUG_REPORT_LAST_EMAIL", value);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63d76b94b1c670b4cbafd57dd8dcd2ff
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,56 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CategoryGroup : SRMonoBehaviourEx
|
||||
{
|
||||
[RequiredField] public RectTransform Container;
|
||||
[RequiredField] public Text Header;
|
||||
[RequiredField] public GameObject Background;
|
||||
[RequiredField] public Toggle SelectionToggle;
|
||||
|
||||
public GameObject[] EnabledDuringSelectionMode = new GameObject[0];
|
||||
|
||||
private bool _selectionModeEnabled = true;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectionToggle.isOn;
|
||||
}
|
||||
set
|
||||
{
|
||||
SelectionToggle.isOn = value;
|
||||
|
||||
if (SelectionToggle.graphic != null)
|
||||
{
|
||||
SelectionToggle.graphic.CrossFadeAlpha(value ? _selectionModeEnabled ? 1.0f : 0.2f : 0f, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool SelectionModeEnabled
|
||||
{
|
||||
get { return _selectionModeEnabled; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == _selectionModeEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_selectionModeEnabled = value;
|
||||
|
||||
for (var i = 0; i < EnabledDuringSelectionMode.Length; i++)
|
||||
{
|
||||
EnabledDuringSelectionMode[i].SetActive(_selectionModeEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 176c1a8b99c762143a65fa14f47b5d93
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using Internal;
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof (Canvas))]
|
||||
public class ConfigureCanvasFromSettings : SRMonoBehaviour
|
||||
{
|
||||
private Canvas _canvas;
|
||||
private CanvasScaler _canvasScaler;
|
||||
|
||||
private float _originalScale;
|
||||
private float _lastSetScale;
|
||||
private Settings _settings;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_canvas = GetComponent<Canvas>();
|
||||
_canvasScaler = GetComponent<CanvasScaler>();
|
||||
|
||||
SRDebuggerUtil.ConfigureCanvas(_canvas);
|
||||
|
||||
_settings = SRDebug.Instance.Settings;
|
||||
_originalScale = _canvasScaler.scaleFactor;
|
||||
_canvasScaler.scaleFactor = _originalScale * _settings.UIScale;
|
||||
|
||||
// Track the last set scale in case it is modified by the retina scaler.
|
||||
_lastSetScale = _canvasScaler.scaleFactor;
|
||||
|
||||
_settings.PropertyChanged += SettingsOnPropertyChanged;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_settings != null)
|
||||
{
|
||||
_settings.PropertyChanged -= SettingsOnPropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingsOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
|
||||
{
|
||||
// If the last set scale does not match the current scale factor, then it is likely the retina scaler has applied a change.
|
||||
// Treat the new value as the original scale.
|
||||
if (_canvasScaler.scaleFactor != _lastSetScale) _originalScale = _canvasScaler.scaleFactor;
|
||||
|
||||
_canvasScaler.scaleFactor = _originalScale * _settings.UIScale;
|
||||
_lastSetScale = _canvasScaler.scaleFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0ad3d8afa9fd64429a249b5bbb19557
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using Services;
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ConsoleTabQuickViewControl : SRMonoBehaviourEx
|
||||
{
|
||||
private const int Max = 1000;
|
||||
private static readonly string MaxString = (Max - 1) + "+";
|
||||
private int _prevErrorCount = -1;
|
||||
private int _prevInfoCount = -1;
|
||||
private int _prevWarningCount = -1;
|
||||
|
||||
[Import] public IConsoleService ConsoleService;
|
||||
|
||||
[RequiredField] public Text ErrorCountText;
|
||||
|
||||
[RequiredField] public Text InfoCountText;
|
||||
|
||||
[RequiredField] public Text WarningCountText;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
ErrorCountText.text = "0";
|
||||
WarningCountText.text = "0";
|
||||
InfoCountText.text = "0";
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (ConsoleService == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasChanged(ConsoleService.ErrorCount, ref _prevErrorCount, Max))
|
||||
{
|
||||
ErrorCountText.text = Internal.SRDebuggerUtil.GetNumberString(ConsoleService.ErrorCount, Max, MaxString);
|
||||
}
|
||||
|
||||
if (HasChanged(ConsoleService.WarningCount, ref _prevWarningCount, Max))
|
||||
{
|
||||
WarningCountText.text = Internal.SRDebuggerUtil.GetNumberString(ConsoleService.WarningCount, Max,
|
||||
MaxString);
|
||||
}
|
||||
|
||||
if (HasChanged(ConsoleService.InfoCount, ref _prevInfoCount, Max))
|
||||
{
|
||||
InfoCountText.text = Internal.SRDebuggerUtil.GetNumberString(ConsoleService.InfoCount, Max, MaxString);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool HasChanged(int newCount, ref int oldCount, int max)
|
||||
{
|
||||
var newCountClamped = Mathf.Clamp(newCount, 0, max);
|
||||
var oldCountClamped = Mathf.Clamp(oldCount, 0, max);
|
||||
|
||||
var hasChanged = newCountClamped != oldCountClamped;
|
||||
|
||||
oldCount = newCount;
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9e7555976318b846887116c61e2ecf6
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using SRF.UI;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof (StyleComponent))]
|
||||
public class DebugPanelBackgroundBehaviour : SRMonoBehaviour
|
||||
{
|
||||
private StyleComponent _styleComponent;
|
||||
public string TransparentStyleKey = "";
|
||||
|
||||
[SerializeField]
|
||||
private StyleSheet _styleSheet;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_styleComponent = GetComponent<StyleComponent>();
|
||||
|
||||
if (Settings.Instance.EnableBackgroundTransparency)
|
||||
{
|
||||
// Update transparent style to have the transparency set in the settings menu.
|
||||
Style style = _styleSheet.GetStyle(TransparentStyleKey);
|
||||
Color c = style.NormalColor;
|
||||
c.a = Settings.Instance.BackgroundTransparency;
|
||||
style.NormalColor = c;
|
||||
|
||||
_styleComponent.StyleKey = TransparentStyleKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a819a08c122d6474a848377ee7ba3192
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,266 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using Controls;
|
||||
using Internal;
|
||||
using Services;
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DockConsoleController : SRMonoBehaviourEx, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public const float NonFocusOpacity = 0.65f;
|
||||
private bool _isDirty;
|
||||
private bool _isDragging;
|
||||
private int _pointersOver;
|
||||
|
||||
[Import]
|
||||
public IConsoleFilterState FilterState;
|
||||
|
||||
[RequiredField] public GameObject BottomHandle;
|
||||
|
||||
[RequiredField] public CanvasGroup CanvasGroup;
|
||||
|
||||
[RequiredField] public ConsoleLogControl Console;
|
||||
|
||||
[RequiredField] public GameObject Dropdown;
|
||||
|
||||
[RequiredField] public Image DropdownToggleSprite;
|
||||
|
||||
[RequiredField] public Text TextErrors;
|
||||
|
||||
[RequiredField] public Text TextInfo;
|
||||
|
||||
[RequiredField] public Text TextWarnings;
|
||||
|
||||
[RequiredField] public Toggle ToggleErrors;
|
||||
|
||||
[RequiredField] public Toggle ToggleInfo;
|
||||
|
||||
[RequiredField] public Toggle ToggleWarnings;
|
||||
|
||||
[RequiredField] public GameObject TopBar;
|
||||
|
||||
[RequiredField] public GameObject TopHandle;
|
||||
|
||||
[RequiredField] public GameObject TopSafeAreaSpacer;
|
||||
[RequiredField] public GameObject BottomSafeAreaSpacer;
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get { return CachedGameObject.activeSelf; }
|
||||
set { CachedGameObject.SetActive(value); }
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
//_canvasScaler = Canvas.GetComponent<CanvasScaler>();
|
||||
Service.Console.Updated += ConsoleOnUpdated;
|
||||
|
||||
ToggleErrors.isOn = FilterState.GetConsoleFilterState(LogType.Error);
|
||||
ToggleWarnings.isOn = FilterState.GetConsoleFilterState(LogType.Warning);
|
||||
ToggleInfo.isOn = FilterState.GetConsoleFilterState(LogType.Log);
|
||||
|
||||
ToggleErrors.onValueChanged.AddListener(isOn =>
|
||||
{
|
||||
FilterState.SetConsoleFilterState(LogType.Error, isOn);
|
||||
_isDirty = true;
|
||||
});
|
||||
|
||||
ToggleWarnings.onValueChanged.AddListener(isOn =>
|
||||
{
|
||||
FilterState.SetConsoleFilterState(LogType.Warning, isOn);
|
||||
_isDirty = true;
|
||||
});
|
||||
|
||||
ToggleInfo.onValueChanged.AddListener(isOn =>
|
||||
{
|
||||
FilterState.SetConsoleFilterState(LogType.Log, isOn);
|
||||
_isDirty = true;
|
||||
});
|
||||
|
||||
FilterState.FilterStateChange += OnFilterStateChange;
|
||||
|
||||
Refresh();
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
if (Service.Console != null)
|
||||
{
|
||||
Service.Console.Updated -= ConsoleOnUpdated;
|
||||
}
|
||||
|
||||
FilterState.FilterStateChange -= OnFilterStateChange;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
_pointersOver = 0;
|
||||
_isDragging = false;
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
_pointersOver = 0;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (_isDirty)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFilterStateChange(LogType logType, bool newState)
|
||||
{
|
||||
switch (logType)
|
||||
{
|
||||
case LogType.Error:
|
||||
ToggleErrors.isOn = newState;
|
||||
break;
|
||||
case LogType.Warning:
|
||||
ToggleWarnings.isOn = newState;
|
||||
break;
|
||||
case LogType.Log:
|
||||
ToggleInfo.isOn = newState;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConsoleOnUpdated(IConsoleService console)
|
||||
{
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
public void SetDropdownVisibility(bool visible)
|
||||
{
|
||||
Dropdown.SetActive(visible);
|
||||
DropdownToggleSprite.rectTransform.localRotation = Quaternion.Euler(0, 0, visible ? 0f : 180f);
|
||||
}
|
||||
|
||||
public void SetAlignmentMode(ConsoleAlignment alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case ConsoleAlignment.Top:
|
||||
{
|
||||
TopBar.transform.SetSiblingIndex(0);
|
||||
Dropdown.transform.SetSiblingIndex(2);
|
||||
TopHandle.SetActive(false);
|
||||
BottomHandle.SetActive(true);
|
||||
transform.SetSiblingIndex(0);
|
||||
DropdownToggleSprite.rectTransform.parent.localRotation = Quaternion.Euler(0, 0, 0f);
|
||||
TopSafeAreaSpacer.SetActive(true);
|
||||
BottomSafeAreaSpacer.SetActive(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case ConsoleAlignment.Bottom:
|
||||
{
|
||||
Dropdown.transform.SetSiblingIndex(0);
|
||||
TopBar.transform.SetSiblingIndex(2);
|
||||
TopHandle.SetActive(true);
|
||||
BottomHandle.SetActive(false);
|
||||
transform.SetSiblingIndex(1);
|
||||
DropdownToggleSprite.rectTransform.parent.localRotation = Quaternion.Euler(0, 0, 180f);
|
||||
TopSafeAreaSpacer.SetActive(false);
|
||||
BottomSafeAreaSpacer.SetActive(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
// Update total counts labels
|
||||
TextInfo.text = SRDebuggerUtil.GetNumberString(Service.Console.InfoCount, 999, "999+");
|
||||
TextWarnings.text = SRDebuggerUtil.GetNumberString(Service.Console.WarningCount, 999, "999+");
|
||||
TextErrors.text = SRDebuggerUtil.GetNumberString(Service.Console.ErrorCount, 999, "999+");
|
||||
|
||||
ToggleErrors.isOn = FilterState.GetConsoleFilterState(LogType.Error);
|
||||
ToggleWarnings.isOn = FilterState.GetConsoleFilterState(LogType.Warning);
|
||||
ToggleInfo.isOn = FilterState.GetConsoleFilterState(LogType.Log);
|
||||
|
||||
_isDirty = false;
|
||||
}
|
||||
|
||||
private void RefreshAlpha()
|
||||
{
|
||||
if (_isDragging || _pointersOver > 0)
|
||||
{
|
||||
CanvasGroup.alpha = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
CanvasGroup.alpha = NonFocusOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
#region Event Callbacks
|
||||
|
||||
public void ToggleDropdownVisible()
|
||||
{
|
||||
SetDropdownVisibility(!Dropdown.activeSelf);
|
||||
}
|
||||
|
||||
public void MenuButtonPressed()
|
||||
{
|
||||
SRDebug.Instance.ShowDebugPanel(DefaultTabs.Console);
|
||||
}
|
||||
|
||||
public void ClearButtonPressed()
|
||||
{
|
||||
Service.Console.Clear();
|
||||
}
|
||||
|
||||
public void TogglesUpdated()
|
||||
{
|
||||
Console.ShowErrors = ToggleErrors.isOn;
|
||||
Console.ShowWarnings = ToggleWarnings.isOn;
|
||||
Console.ShowInfo = ToggleInfo.isOn;
|
||||
|
||||
SetDropdownVisibility(true);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData e)
|
||||
{
|
||||
_pointersOver = 1;
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData e)
|
||||
{
|
||||
_pointersOver = 0; //Mathf.Max(0, _pointersOver - 1);
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
public void OnBeginDrag()
|
||||
{
|
||||
_isDragging = true;
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
public void OnEndDrag()
|
||||
{
|
||||
_isDragging = false;
|
||||
_pointersOver = 0;
|
||||
RefreshAlpha();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8181ba76f89dd64a96c1e8c2beccb26
|
||||
timeCreated: 1441833066
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
// Deprecated file. Included to prevent conflicts when upgrading from a previous version of SRDebugger
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e502669a31931b74ea762540a783f1ff
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
public class ErrorNotifier : MonoBehaviour
|
||||
{
|
||||
public bool IsVisible
|
||||
{
|
||||
get { return _isShowing; }
|
||||
}
|
||||
|
||||
private const float DisplayTime = 6;
|
||||
|
||||
[SerializeField]
|
||||
private Animator _animator = null;
|
||||
|
||||
private int _triggerHash;
|
||||
|
||||
private float _hideTime;
|
||||
private bool _isShowing;
|
||||
|
||||
private bool _queueWarning;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_triggerHash = Animator.StringToHash("Display");
|
||||
}
|
||||
|
||||
public void ShowErrorWarning()
|
||||
{
|
||||
_queueWarning = true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_queueWarning)
|
||||
{
|
||||
_hideTime = Time.realtimeSinceStartup + DisplayTime;
|
||||
|
||||
if (!_isShowing)
|
||||
{
|
||||
_isShowing = true;
|
||||
_animator.SetBool(_triggerHash, true);
|
||||
}
|
||||
|
||||
_queueWarning = false;
|
||||
}
|
||||
|
||||
if (_isShowing && Time.realtimeSinceStartup > _hideTime)
|
||||
{
|
||||
_animator.SetBool(_triggerHash, false);
|
||||
_isShowing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc845b8723c64841aa76e259d4a0b6c4
|
||||
timeCreated: 1582392762
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform)), ExecuteAlways]
|
||||
public class FloatOverElement : UIBehaviour, ILayoutSelfController
|
||||
{
|
||||
public RectTransform CopyFrom;
|
||||
|
||||
private DrivenRectTransformTracker _tracker;
|
||||
|
||||
void Copy()
|
||||
{
|
||||
if (CopyFrom == null) return;
|
||||
|
||||
_tracker.Clear();
|
||||
|
||||
var r = GetComponent<RectTransform>();
|
||||
r.anchorMin = CopyFrom.anchorMin;
|
||||
r.anchorMax = CopyFrom.anchorMax;
|
||||
r.anchoredPosition = CopyFrom.anchoredPosition;
|
||||
r.offsetMin = CopyFrom.offsetMin;
|
||||
r.offsetMax = CopyFrom.offsetMax;
|
||||
r.sizeDelta = CopyFrom.sizeDelta;
|
||||
r.localScale = CopyFrom.localScale;
|
||||
r.pivot = CopyFrom.pivot;
|
||||
|
||||
_tracker.Add(this, r, DrivenTransformProperties.All);
|
||||
}
|
||||
|
||||
public void SetLayoutHorizontal()
|
||||
{
|
||||
Copy();
|
||||
}
|
||||
|
||||
public void SetLayoutVertical()
|
||||
{
|
||||
Copy();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb581f748e6cd6d43805081fbb5242f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,106 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Handles enabling/disabling handle objects for different anchoring modes
|
||||
/// </summary>
|
||||
public class HandleManager : SRMonoBehaviour
|
||||
{
|
||||
private bool _hasSet;
|
||||
public GameObject BottomHandle;
|
||||
public GameObject BottomLeftHandle;
|
||||
public GameObject BottomRightHandle;
|
||||
public PinAlignment DefaultAlignment;
|
||||
public GameObject LeftHandle;
|
||||
public GameObject RightHandle;
|
||||
public GameObject TopHandle;
|
||||
public GameObject TopLeftHandle;
|
||||
public GameObject TopRightHandle;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (!_hasSet)
|
||||
{
|
||||
SetAlignment(DefaultAlignment);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAlignment(PinAlignment alignment)
|
||||
{
|
||||
_hasSet = true;
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case PinAlignment.TopLeft:
|
||||
case PinAlignment.TopRight:
|
||||
SetActive(BottomHandle, true);
|
||||
SetActive(TopHandle, false);
|
||||
SetActive(TopLeftHandle, false);
|
||||
SetActive(TopRightHandle, false);
|
||||
break;
|
||||
|
||||
case PinAlignment.BottomLeft:
|
||||
case PinAlignment.BottomRight:
|
||||
SetActive(BottomHandle, false);
|
||||
SetActive(TopHandle, true);
|
||||
SetActive(BottomLeftHandle, false);
|
||||
SetActive(BottomRightHandle, false);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case PinAlignment.TopLeft:
|
||||
case PinAlignment.BottomLeft:
|
||||
SetActive(LeftHandle, false);
|
||||
SetActive(RightHandle, true);
|
||||
SetActive(TopLeftHandle, false);
|
||||
SetActive(BottomLeftHandle, false);
|
||||
break;
|
||||
|
||||
case PinAlignment.TopRight:
|
||||
case PinAlignment.BottomRight:
|
||||
SetActive(LeftHandle, true);
|
||||
SetActive(RightHandle, false);
|
||||
SetActive(TopRightHandle, false);
|
||||
SetActive(BottomRightHandle, false);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case PinAlignment.TopLeft:
|
||||
SetActive(BottomLeftHandle, false);
|
||||
SetActive(BottomRightHandle, true);
|
||||
break;
|
||||
|
||||
case PinAlignment.TopRight:
|
||||
SetActive(BottomLeftHandle, true);
|
||||
SetActive(BottomRightHandle, false);
|
||||
break;
|
||||
|
||||
case PinAlignment.BottomLeft:
|
||||
SetActive(TopLeftHandle, false);
|
||||
SetActive(TopRightHandle, true);
|
||||
break;
|
||||
|
||||
case PinAlignment.BottomRight:
|
||||
SetActive(TopLeftHandle, true);
|
||||
SetActive(TopRightHandle, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetActive(GameObject obj, bool active)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
obj.SetActive(active);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4292e93ad30fda64b96c60d4d68b3c0d
|
||||
timeCreated: 1441815277
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
public interface IEnableTab
|
||||
{
|
||||
bool IsEnabled { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0522b3ec2155a4468bea956e3ea2fd5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
|
||||
public class LoadingSpinnerBehaviour : SRMonoBehaviour
|
||||
{
|
||||
private float _dt;
|
||||
public int FrameCount = 12;
|
||||
public float SpinDuration = 0.8f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_dt += Time.unscaledDeltaTime;
|
||||
|
||||
var localRotation = CachedTransform.localRotation.eulerAngles;
|
||||
var r = localRotation.z;
|
||||
|
||||
var fTime = SpinDuration/FrameCount;
|
||||
var hasChanged = false;
|
||||
|
||||
while (_dt > fTime)
|
||||
{
|
||||
r -= 360f/FrameCount;
|
||||
_dt -= fTime;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (hasChanged)
|
||||
{
|
||||
CachedTransform.localRotation = Quaternion.Euler(localRotation.x, localRotation.y, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d058d954e809c4fa87cfab328237d7
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using SRF.UI.Layout;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PinnedUIRoot : SRMonoBehaviourEx
|
||||
{
|
||||
[RequiredField] public Canvas Canvas;
|
||||
|
||||
[RequiredField] public RectTransform Container;
|
||||
|
||||
[RequiredField] public DockConsoleController DockConsoleController;
|
||||
|
||||
[RequiredField] public GameObject Options;
|
||||
|
||||
[RequiredField] public FlowLayoutGroup OptionsLayoutGroup;
|
||||
|
||||
[RequiredField] public GameObject Profiler;
|
||||
|
||||
[RequiredField] public HandleManager ProfilerHandleManager;
|
||||
|
||||
[RequiredField] public VerticalLayoutGroup ProfilerVerticalLayoutGroup;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d5f8248a0899ee48adc84c3fb98627a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
52
JNFrame2/Assets/Plugins/SRDebugger/Scripts/UI/Other/SRTab.cs
Normal file
52
JNFrame2/Assets/Plugins/SRDebugger/Scripts/UI/Other/SRTab.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using System;
|
||||
using Controls;
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class SRTab : SRMonoBehaviourEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Content that will be added to the content area of the header
|
||||
/// </summary>
|
||||
public RectTransform HeaderExtraContent;
|
||||
|
||||
[Obsolete] [HideInInspector] public Sprite Icon;
|
||||
|
||||
/// <summary>
|
||||
/// Content that will be added to the content area of the tab button
|
||||
/// </summary>
|
||||
public RectTransform IconExtraContent;
|
||||
|
||||
public string IconStyleKey = "Icon_Stompy";
|
||||
public int SortIndex;
|
||||
|
||||
[HideInInspector] public SRTabButton TabButton;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get { return _title; }
|
||||
}
|
||||
|
||||
public string LongTitle
|
||||
{
|
||||
get { return !string.IsNullOrEmpty(_longTitle) ? _longTitle : _title; }
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
#pragma warning disable 649
|
||||
|
||||
[SerializeField] [FormerlySerializedAs("Title")] private string _title;
|
||||
|
||||
[SerializeField] private string _longTitle;
|
||||
|
||||
[SerializeField] private string _key;
|
||||
|
||||
#pragma warning restore 649
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94b1f24ed4379dd4fab14add56e520a5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,133 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Controls;
|
||||
using SRF;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SRTabController : SRMonoBehaviourEx
|
||||
{
|
||||
private readonly SRList<SRTab> _tabs = new SRList<SRTab>();
|
||||
private SRTab _activeTab;
|
||||
|
||||
[RequiredField] public RectTransform TabButtonContainer;
|
||||
|
||||
[RequiredField] public SRTabButton TabButtonPrefab;
|
||||
|
||||
[RequiredField] public RectTransform TabContentsContainer;
|
||||
|
||||
[RequiredField] public RectTransform TabHeaderContentContainer;
|
||||
|
||||
[RequiredField] public Text TabHeaderText;
|
||||
|
||||
public SRTab ActiveTab
|
||||
{
|
||||
get { return _activeTab; }
|
||||
set { MakeActive(value); }
|
||||
}
|
||||
|
||||
public IList<SRTab> Tabs
|
||||
{
|
||||
get { return _tabs.AsReadOnly(); }
|
||||
}
|
||||
|
||||
public event Action<SRTabController, SRTab> ActiveTabChanged;
|
||||
|
||||
public void AddTab(SRTab tab, bool visibleInSidebar = true)
|
||||
{
|
||||
tab.CachedTransform.SetParent(TabContentsContainer, false);
|
||||
tab.CachedGameObject.SetActive(false);
|
||||
|
||||
if (visibleInSidebar)
|
||||
{
|
||||
// Create a tab button for this tab
|
||||
var button = SRInstantiate.Instantiate(TabButtonPrefab);
|
||||
button.CachedTransform.SetParent(TabButtonContainer, false);
|
||||
button.TitleText.text = tab.Title.ToUpper();
|
||||
|
||||
if (tab.IconExtraContent != null)
|
||||
{
|
||||
var extraContent = SRInstantiate.Instantiate(tab.IconExtraContent);
|
||||
extraContent.SetParent(button.ExtraContentContainer, false);
|
||||
}
|
||||
|
||||
button.IconStyleComponent.StyleKey = tab.IconStyleKey;
|
||||
button.IsActive = false;
|
||||
|
||||
button.Button.onClick.AddListener(() => MakeActive(tab));
|
||||
|
||||
tab.TabButton = button;
|
||||
}
|
||||
|
||||
_tabs.Add(tab);
|
||||
SortTabs();
|
||||
|
||||
if (_tabs.Count == 1)
|
||||
{
|
||||
ActiveTab = tab;
|
||||
}
|
||||
}
|
||||
|
||||
private void MakeActive(SRTab tab)
|
||||
{
|
||||
if (!_tabs.Contains(tab))
|
||||
{
|
||||
throw new ArgumentException("tab is not a member of this tab controller", "tab");
|
||||
}
|
||||
|
||||
if (_activeTab != null)
|
||||
{
|
||||
_activeTab.CachedGameObject.SetActive(false);
|
||||
|
||||
if (_activeTab.TabButton != null)
|
||||
{
|
||||
_activeTab.TabButton.IsActive = false;
|
||||
}
|
||||
|
||||
if (_activeTab.HeaderExtraContent != null)
|
||||
{
|
||||
_activeTab.HeaderExtraContent.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
_activeTab = tab;
|
||||
|
||||
if (_activeTab != null)
|
||||
{
|
||||
_activeTab.CachedGameObject.SetActive(true);
|
||||
TabHeaderText.text = _activeTab.LongTitle;
|
||||
|
||||
if (_activeTab.TabButton != null)
|
||||
{
|
||||
_activeTab.TabButton.IsActive = true;
|
||||
}
|
||||
|
||||
if (_activeTab.HeaderExtraContent != null)
|
||||
{
|
||||
_activeTab.HeaderExtraContent.SetParent(TabHeaderContentContainer, false);
|
||||
_activeTab.HeaderExtraContent.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ActiveTabChanged != null)
|
||||
{
|
||||
ActiveTabChanged(this, _activeTab);
|
||||
}
|
||||
}
|
||||
|
||||
private void SortTabs()
|
||||
{
|
||||
_tabs.Sort((t1, t2) => t1.SortIndex.CompareTo(t2.SortIndex));
|
||||
|
||||
for (var i = 0; i < _tabs.Count; i++)
|
||||
{
|
||||
if (_tabs[i].TabButton != null)
|
||||
{
|
||||
_tabs[i].TabButton.CachedTransform.SetSiblingIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 035be48566f8a3a4285521c6480d83ce
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[ExecuteInEditMode]
|
||||
public class SafeAreaSizer : UIBehaviour, ILayoutElement
|
||||
{
|
||||
public RectTransform.Edge Edge
|
||||
{
|
||||
get { return _edge; }
|
||||
set
|
||||
{
|
||||
if (_edge != value)
|
||||
{
|
||||
_edge = value;
|
||||
LayoutRebuilder.MarkLayoutForRebuild(transform as RectTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField, FormerlySerializedAs("Edge")]
|
||||
private RectTransform.Edge _edge;
|
||||
public float Scale = 1f;
|
||||
|
||||
private float _height;
|
||||
private float _width;
|
||||
|
||||
|
||||
public float preferredWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
}
|
||||
|
||||
public float preferredHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
}
|
||||
|
||||
public float minWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
}
|
||||
|
||||
public float minHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
}
|
||||
|
||||
public int layoutPriority
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public float flexibleHeight
|
||||
{
|
||||
get { return -1; }
|
||||
}
|
||||
|
||||
public float flexibleWidth
|
||||
{
|
||||
get { return -1; }
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
_width = _height = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
// Determine the distance in local coords
|
||||
Rect safeArea = Screen.safeArea;
|
||||
Canvas myCanvas = GetComponentInParent<Canvas>();
|
||||
if (myCanvas == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RectTransform canvasRect = myCanvas.GetComponent<RectTransform>();
|
||||
|
||||
// RectTransformUtility.PixelAdjustRect()
|
||||
_width = _height = 0;
|
||||
|
||||
switch (_edge)
|
||||
{
|
||||
case RectTransform.Edge.Left:
|
||||
_width = (safeArea.x / myCanvas.pixelRect.width) * canvasRect.rect.width;
|
||||
break;
|
||||
case RectTransform.Edge.Right:
|
||||
_width = (Screen.width - safeArea.width - safeArea.x) / myCanvas.pixelRect.width * canvasRect.rect.width;
|
||||
break;
|
||||
case RectTransform.Edge.Top:
|
||||
_height = (Screen.height - safeArea.height - safeArea.y) / myCanvas.pixelRect.height * canvasRect.rect.height;
|
||||
break;
|
||||
case RectTransform.Edge.Bottom:
|
||||
_height = (safeArea.y / myCanvas.pixelRect.height) * canvasRect.rect.height;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
_width *= Scale;
|
||||
_height *= Scale;
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputVertical()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00b72250a6a48194fbecb6ed8b983720
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
* This file has been deleted.
|
||||
* This empty file is left here to ensure it is properly overwritten when importing a new version of the package over an old version.
|
||||
*/
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec8340b6e7293114da3d567338dc8e9f
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof (ScrollRect))]
|
||||
public class ScrollSettingsBehaviour : MonoBehaviour
|
||||
{
|
||||
public const float ScrollSensitivity = 40f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var scrollRect = GetComponent<ScrollRect>();
|
||||
scrollRect.scrollSensitivity = ScrollSensitivity;
|
||||
|
||||
if (!Internal.SRDebuggerUtil.IsMobilePlatform)
|
||||
{
|
||||
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||
scrollRect.inertia = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f0ff44b792ef2042856036000e22450
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
|
||||
public class SetLayerFromSettings : SRMonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
gameObject.SetLayerRecursive(Settings.Instance.DebugLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40436e7c301de034f916ee1e7ddabeeb
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using Controls;
|
||||
using SRF;
|
||||
using SRF.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class TriggerRoot : SRMonoBehaviourEx
|
||||
{
|
||||
[RequiredField] public Canvas Canvas;
|
||||
|
||||
[RequiredField] public LongPressButton TapHoldButton;
|
||||
|
||||
[RequiredField] public RectTransform TriggerTransform;
|
||||
|
||||
[RequiredField] public ErrorNotifier ErrorNotifier;
|
||||
|
||||
[RequiredField] [FormerlySerializedAs("TriggerButton")] public MultiTapButton TripleTapButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e511950015658d545aa9d10a45550b11
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace SRDebugger.UI.Other
|
||||
{
|
||||
using SRF;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class VersionTextBehaviour : SRMonoBehaviourEx
|
||||
{
|
||||
public string Format = "SRDebugger {0}";
|
||||
|
||||
[RequiredField] public Text Text;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
Text.text = string.Format(Format, SRDebug.Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc11b0e922d02a54fa6197856eee3976
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Reference in New Issue
Block a user