修复锁屏及发包问题

This commit is contained in:
shenjianxing 2025-03-25 13:23:47 +08:00
parent 0179fcff00
commit 292e1f0a3d
6 changed files with 31 additions and 2 deletions

View File

@ -1329,7 +1329,7 @@ MonoBehaviour:
rotateSpeed: 10 rotateSpeed: 10
moveSpeed: 0.1 moveSpeed: 0.1
distance: 2 distance: 2
distanceMin: 1 distanceMin: 0.5
distanceMax: 15 distanceMax: 15
pitchMinMax: {x: -80, y: 80} pitchMinMax: {x: -80, y: 80}
texture: {fileID: 8400000, guid: 187fba8368491cb428c8cbd324fa9bb4, type: 2} texture: {fileID: 8400000, guid: 187fba8368491cb428c8cbd324fa9bb4, type: 2}

View File

@ -15,3 +15,7 @@ struct EndScreenShot
{ {
} }
struct OnLock
{
public bool isLock;
}

View File

@ -1,3 +1,4 @@
using QFramework;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -11,8 +12,23 @@ public class ObjectToggle : MonoBehaviour
public UnityEvent<bool> OnValueChanged = new UnityEvent<bool>(); public UnityEvent<bool> OnValueChanged = new UnityEvent<bool>();
private float mouseDownTime; private float mouseDownTime;
private bool isMouseDown; private bool isMouseDown;
bool isLock = false;
private void Awake()
{
TypeEventSystem.Global.Register<OnLock>(OnLockEvent).UnRegisterWhenDisabled(this);
}
private void OnLockEvent(OnLock islock)
{
this.isLock = islock.isLock;
}
private void OnMouseDown() private void OnMouseDown()
{ {
if (isLock == true)
{
return;
}
// 记录鼠标按下的时间 // 记录鼠标按下的时间
mouseDownTime = Time.time; mouseDownTime = Time.time;
isMouseDown = true; isMouseDown = true;
@ -44,4 +60,5 @@ public class ObjectToggle : MonoBehaviour
this.isOn = isOn; this.isOn = isOn;
OnValueChanged?.Invoke(isOn); OnValueChanged?.Invoke(isOn);
} }
} }

View File

@ -1,4 +1,6 @@
using DG.Tweening; using DG.Tweening;
using QFramework;
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
@ -47,8 +49,13 @@ public class Show3DCamera : MonoBehaviour
self = transform.GetComponent<Camera>(); self = transform.GetComponent<Camera>();
DontDestroyOnLoad(this); DontDestroyOnLoad(this);
gameObject.SetActive(false); gameObject.SetActive(false);
TypeEventSystem.Global.Register<OnLock>(OnLockEvent).UnRegisterWhenDisabled(this);
} }
private void OnLockEvent(OnLock islock)
{
this.lockMove = islock.isLock;
}
public void Set(Transform target, float rotateSpeed = 10, float moveSpeed = 0.1f, float distance = 0.1f, float pitchMin = -20, float pitchMax = 80, float distanceMin = 0.2f, float distanceMax = 20f, RectTransform inputRect = null, bool isRenderTexture = true, float moveTime = -1) public void Set(Transform target, float rotateSpeed = 10, float moveSpeed = 0.1f, float distance = 0.1f, float pitchMin = -20, float pitchMax = 80, float distanceMin = 0.2f, float distanceMax = 20f, RectTransform inputRect = null, bool isRenderTexture = true, float moveTime = -1)
{ {

View File

@ -233,7 +233,7 @@ namespace QFramework.Example
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "Ëø¶¨ÆÁÄ»"; LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "Ëø¶¨ÆÁÄ»";
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f); LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
} }
Show3DCamera.instance.lockMove = isOn; TypeEventSystem.Global.Send<OnLock>(new OnLock() { isLock = isOn });
}); });

View File

@ -37,6 +37,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 4800000, guid: c8b5bc66eaa9c574cb2bfefd127c88b9, type: 3}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_PreloadShadersBatchTimeLimit: -1 m_PreloadShadersBatchTimeLimit: -1
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}