feat: ui transparency when not hovered
This commit is contained in:
parent
88a97164ea
commit
12304c6bb4
366 changed files with 27618 additions and 28 deletions
|
@ -1,6 +1,5 @@
|
|||
using Domain;
|
||||
using Presenter;
|
||||
using SatorImaging.AppWindowUtility;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -10,9 +9,6 @@ namespace View {
|
|||
private CTrencadaClick _click;
|
||||
|
||||
private void Start() {
|
||||
AppWindowUtility.AlwaysOnTop = true;
|
||||
AppWindowUtility.FrameVisibility = false;
|
||||
|
||||
_click = FindObjectOfType<Dependencies>().CTrencadaClick;
|
||||
}
|
||||
|
||||
|
|
18
Assets/Scripts/View/DisplaySetup.cs
Normal file
18
Assets/Scripts/View/DisplaySetup.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
#if !UNITY_EDITOR
|
||||
using SatorImaging.AppWindowUtility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace View {
|
||||
internal static class DisplaySetup {
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Setup() {
|
||||
AppWindowUtility.AlwaysOnTop = true;
|
||||
AppWindowUtility.FrameVisibility = false;
|
||||
|
||||
Vector2Int resolution = new(Screen.currentResolution.width, Screen.currentResolution.height);
|
||||
Vector2Int newPosition = new(resolution.x - Screen.width, 0);
|
||||
Screen.MoveMainWindowTo(Screen.mainWindowDisplayInfo, newPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
3
Assets/Scripts/View/DisplaySetup.cs.meta
Normal file
3
Assets/Scripts/View/DisplaySetup.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf60e69915aa4e2c9bd0cdbdccee8fc7
|
||||
timeCreated: 1712944769
|
|
@ -5,7 +5,8 @@
|
|||
"GUID:23c7c01f8c5436c429399011615ce636",
|
||||
"GUID:d9011953b32919841a6c357880a50fb3",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:1220ccfff01d26041a9bb8cd7ae584af"
|
||||
"GUID:1220ccfff01d26041a9bb8cd7ae584af",
|
||||
"GUID:58f2f98b0cec4e74998cb65ad59190b4"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
28
Assets/Scripts/View/UIVisibility.cs
Normal file
28
Assets/Scripts/View/UIVisibility.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace View {
|
||||
public class UIVisibility : MonoBehaviour {
|
||||
[SerializeField] private CanvasGroup ui;
|
||||
[SerializeField] private float fadeDuration = .5f;
|
||||
|
||||
private bool _wasVisible = true;
|
||||
|
||||
private void Update() {
|
||||
bool isPointerOver = EventSystem.current.IsPointerOverGameObject();
|
||||
if (_wasVisible && !isPointerOver) {
|
||||
ui.DOFade(0, fadeDuration);
|
||||
_wasVisible = false;
|
||||
return;
|
||||
}
|
||||
if (!_wasVisible && isPointerOver) {
|
||||
ui.DOFade(1, fadeDuration);
|
||||
_wasVisible = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/View/UIVisibility.cs.meta
Normal file
11
Assets/Scripts/View/UIVisibility.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20b23959801b4fd40967d39ed926e9f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/View/UnfocusableEventSystem.cs
Normal file
8
Assets/Scripts/View/UnfocusableEventSystem.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace View {
|
||||
public class UnfocusableEventSystem : EventSystem {
|
||||
//Dummy method to prevent calling base method
|
||||
protected override void OnApplicationFocus(bool hasFocus) { }
|
||||
}
|
||||
}
|
11
Assets/Scripts/View/UnfocusableEventSystem.cs.meta
Normal file
11
Assets/Scripts/View/UnfocusableEventSystem.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f88b65679ed919a4196a1cbeb4a47809
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue