修改toolTips显示逻辑
This commit is contained in:
parent
921d5b659e
commit
0965c83a64
|
@ -168,11 +168,11 @@ RectTransform:
|
|||
m_Father: {fileID: 7369265064053445044}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 52, y: -4}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: -17.4}
|
||||
m_SizeDelta: {x: 16, y: 16}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!222 &5272243258143008175
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -223,7 +223,7 @@ GameObject:
|
|||
- component: {fileID: 9083784722124570545}
|
||||
- component: {fileID: 2296507059249110610}
|
||||
m_Layer: 5
|
||||
m_Name: ItemTips
|
||||
m_Name: ToolInfoTips
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -249,7 +249,7 @@ RectTransform:
|
|||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 0.5, y: 0.5068044}
|
||||
--- !u!222 &9083784722124570545
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -270,6 +270,8 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 7fd7002edeffb3a408cfac227a769d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
itemText: {fileID: 66389531985156297}
|
||||
bg: {fileID: 7369265064053445044}
|
||||
--- !u!1 &7894709409026262177
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -305,11 +307,11 @@ RectTransform:
|
|||
m_Father: {fileID: 3282513741013345151}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 66.74}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 588.74}
|
||||
m_SizeDelta: {x: 120, y: 36}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!222 &1055551684720532243
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
|
@ -32,12 +32,12 @@ public class OfficeManager : SingletonMono<OfficeManager>
|
|||
{
|
||||
GameManager.UIMgr.ShowPanel<UI_TopTipPanel>(E_UI_Layer.Mid, (panel) =>
|
||||
{
|
||||
panel.Init($"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.processName}:<color=blue>{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.subProcessName}</color>", $"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.tips}", false);
|
||||
panel.Init($"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.processName}:<color=#00EEE6>{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.subProcessName}</color>", $"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.tips}", false);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GameManager.UIMgr.GetPanel<UI_TopTipPanel>().Init($"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.processName}:<color=blue>{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.subProcessName}</color>", $"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.tips}", false);
|
||||
GameManager.UIMgr.GetPanel<UI_TopTipPanel>().Init($"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.processName}:<color=#00EEE6>{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.subProcessName}</color>", $"{GameManager.ProcessMgr.d_Scheme.CurrentProcess.CurrentSubProcess.tips}", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,7 @@ public class Tool_SelectComponent : BaseToolOrDevice
|
|||
{
|
||||
base.OnEnter();
|
||||
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
|
||||
//GameManager.UIMgr.ShowPanel<ItemTips>(E_UI_Layer.System, (panel) =>
|
||||
//{
|
||||
// panel.Init(gameObject.name, pos);
|
||||
//});
|
||||
GameManager.UIMgr.toolTips.ShowTips(gameObject.name, pos);
|
||||
///¸ßÁÁ
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
{
|
||||
|
@ -25,17 +22,14 @@ public class Tool_SelectComponent : BaseToolOrDevice
|
|||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(itemInfo.toolName, true) == 0)
|
||||
{
|
||||
GameManager.PacksackBagMgr.AddOneToolOrMater(itemInfo);
|
||||
GameManager.UIMgr.HidePanel<ItemTips>();//提示面板
|
||||
|
||||
GameManager.UIMgr.toolTips.HideTips();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
///关闭高亮
|
||||
//if (GameManager.UIMgr.GetPanel<ItemTips>())
|
||||
// GameManager.UIMgr.HidePanel<ItemTips>();//提示面板
|
||||
GameManager.UIMgr.toolTips.HideTips();
|
||||
base.OnExit();
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
_highlight.SetHighlighted(false);
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ItemTips : BasePanel
|
||||
{
|
||||
public void Init(string Item, Vector3 pos)
|
||||
{
|
||||
GetControl<TextMeshProUGUI>("ItemText").text = Item;
|
||||
GetComponent<RectTransform>().position = pos;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ToolInfoTips : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI itemText;
|
||||
public RectTransform bg;
|
||||
public void ShowTips(string Item, Vector3 pos)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
itemText.text = Item;
|
||||
GetComponent<RectTransform>().position = pos;
|
||||
AdjustImageWidth(itemText);
|
||||
}
|
||||
|
||||
public void HideTips()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据文字数量改变 背景 大小
|
||||
/// </summary>
|
||||
/// <param name="contentText"></param>
|
||||
private void AdjustImageWidth(TextMeshProUGUI contentText)
|
||||
{
|
||||
float preferredWidth = contentText.preferredWidth;
|
||||
bg.sizeDelta = new Vector2(preferredWidth + (contentText.text == "" ? 0 : 30), bg.sizeDelta.y);
|
||||
contentText.GetComponent<RectTransform>().sizeDelta = new Vector2(preferredWidth + (contentText.text == "" ? 0 : 30), 52);
|
||||
}
|
||||
}
|
|
@ -57,6 +57,11 @@ public class UIManager : BaseManager<UIManager>
|
|||
/// </summary>
|
||||
public ImageTips imageTipsPrefab;
|
||||
public ImageTips imageTips;
|
||||
/// <summary>
|
||||
/// 工具提示预制体和实列化
|
||||
/// </summary>
|
||||
public ToolInfoTips toolTipsPrefab;
|
||||
public ToolInfoTips toolTips;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
|
@ -72,6 +77,9 @@ public class UIManager : BaseManager<UIManager>
|
|||
imageTipsPrefab = ResourcesManager.Instance.Load<ImageTips>("UI/UI_Tip/ImageTips");
|
||||
imageTips = GameObject.Instantiate(imageTipsPrefab, canvas);
|
||||
imageTips.HideTips();
|
||||
toolTipsPrefab = ResourcesManager.Instance.Load<ToolInfoTips>("UI/UI_Tip/ToolInfoTips");
|
||||
toolTips = GameObject.Instantiate(toolTipsPrefab, canvas);
|
||||
toolTips.HideTips();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue