修复web平台兼容性问题
This commit is contained in:
parent
b7c053dd0c
commit
41c68a734a
@ -44,14 +44,14 @@ public class DeviceController : MonoSingleton<DeviceController>
|
||||
}
|
||||
if (uitip != null)
|
||||
{
|
||||
uitip.Set(deviceItem.tipItem.label);
|
||||
uitip.Active(true);
|
||||
uitip.Open(new UIDeviceTipData() { txt = deviceItem.tipItem.label });
|
||||
uitip.Show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uitip?.Active(false);
|
||||
uitip?.Hide();
|
||||
}
|
||||
|
||||
}
|
||||
@ -100,10 +100,6 @@ public class DeviceController : MonoSingleton<DeviceController>
|
||||
{
|
||||
#if !VR
|
||||
var uitip = UIKit.GetPanel<UIDeviceTip>();
|
||||
if (uitip != null)
|
||||
{
|
||||
uitip = UIKit.OpenPanel<UIDeviceTip>(UILevel.PopUI);
|
||||
}
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
@ -112,12 +108,12 @@ public class DeviceController : MonoSingleton<DeviceController>
|
||||
|
||||
if (uitip != null && deviceItem != null && deviceItem.tipItem != null && EventSystem.current.IsPointerOverGameObject() == false)
|
||||
{
|
||||
uitip.Set(deviceItem.tipItem.label);
|
||||
uitip.Active(true);
|
||||
uitip.Open(new UIDeviceTipData() { txt = deviceItem.tipItem.label });
|
||||
uitip.Show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
uitip?.Active(false);
|
||||
uitip?.Hide();
|
||||
#endif
|
||||
}
|
||||
public DeviceItem GetDeviceItem(string name)
|
||||
|
||||
@ -28,7 +28,7 @@ public class TipItem : MonoBehaviour
|
||||
{
|
||||
if (tip != null)
|
||||
{
|
||||
tip.Active(false);
|
||||
tip.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,22 +59,25 @@ public class TipItem : MonoBehaviour
|
||||
tip = UIKit.GetPanel<UIDeviceTip>();
|
||||
if (tip == null)
|
||||
{
|
||||
tip = UIKit.OpenPanel<UIDeviceTip>(UILevel.PopUI);
|
||||
|
||||
tip.Set(label);
|
||||
tip.Active(true);
|
||||
Debug.LogError($"{gameObject}:Tip");
|
||||
UIKit.OpenPanelAsync<UIDeviceTip>(UILevel.PopUI).ToAction().StartGlobal(() =>
|
||||
{
|
||||
tip = UIKit.GetPanel<UIDeviceTip>();
|
||||
tip.Open(new UIDeviceTipData() { txt = label });
|
||||
tip.Show();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
tip.Set(label);
|
||||
tip.Active(true);
|
||||
tip.Open(new UIDeviceTipData() { txt = label});
|
||||
tip.Show();
|
||||
}
|
||||
}
|
||||
public void OnExit()
|
||||
{
|
||||
if (tip != null)
|
||||
{
|
||||
tip.Active(false);
|
||||
tip.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +90,7 @@ public class TipItem : MonoBehaviour
|
||||
{
|
||||
if (tip != null)
|
||||
{
|
||||
tip.Active(false);
|
||||
tip.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,8 @@ public class Launch : MonoBehaviour
|
||||
});
|
||||
|
||||
yield return UIKit.OpenPanelAsync<UILoading>();
|
||||
yield return UIKit.OpenPanelAsync<UIDeviceTip>(canvasLevel: UILevel.PopUI);
|
||||
UIKit.GetPanel<UIDeviceTip>().Hide();
|
||||
yield return new WaitUntil(() => isLoadFinished == true);
|
||||
if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null)
|
||||
{
|
||||
|
||||
@ -8,6 +8,7 @@ namespace QFramework.Example
|
||||
{
|
||||
public class UIDeviceTipData : UIPanelData
|
||||
{
|
||||
public string txt;
|
||||
}
|
||||
public partial class UIDeviceTip : UIPanel
|
||||
{
|
||||
@ -20,6 +21,11 @@ namespace QFramework.Example
|
||||
|
||||
protected override void OnOpen(IUIData uiData = null)
|
||||
{
|
||||
if (uiData != null)
|
||||
{
|
||||
mData = uiData as UIDeviceTipData ?? new UIDeviceTipData();
|
||||
Label.text = Regex.Replace(mData.txt, @"\\n", "\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if !VR
|
||||
@ -33,21 +39,19 @@ namespace QFramework.Example
|
||||
}
|
||||
#endif
|
||||
|
||||
public void Set(string txt)
|
||||
{
|
||||
Label.text = Regex.Replace(txt, @"\\n", "\n");
|
||||
}
|
||||
public void Active(bool active)
|
||||
{
|
||||
Point.gameObject.SetActive(active);
|
||||
}
|
||||
//public void Active(bool active)
|
||||
//{
|
||||
// Point.gameObject.SetActive(active);
|
||||
//}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
//Active(true);
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
//Active(false);
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user