fix UI DlgInstall.prefab
This commit is contained in:
@@ -33,6 +33,7 @@ namespace BrewMonster
|
||||
[SerializeField] private Button m_BtnCancel;
|
||||
|
||||
[SerializeField] private Sprite khung_item;
|
||||
[SerializeField] private Transform itemInventoryRoot;
|
||||
|
||||
private EC_IvtrItem m_SelectedEquip;
|
||||
private EC_IvtrItem m_SelectedMaterial;
|
||||
@@ -50,6 +51,21 @@ namespace BrewMonster
|
||||
RegisterClick(m_SlotSecondlParent, OnClickMaterialSlot);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
CheckHidePanel(Input.mousePosition);
|
||||
}
|
||||
#else
|
||||
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
|
||||
{
|
||||
CheckHidePanel(Input.GetTouch(0).position);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
@@ -214,6 +230,12 @@ namespace BrewMonster
|
||||
else
|
||||
detailedItem.GetDetailDataFromLocal();
|
||||
|
||||
if (m_FirstInvSlot >= 0)
|
||||
{
|
||||
var previosBtn = FindInventoryButtonBySlot(m_FirstInvSlot);
|
||||
SetInventorySlotGray(previosBtn, false);
|
||||
}
|
||||
|
||||
m_SelectedEquip?.Freeze(false);
|
||||
m_SelectedEquip = detailedItem;
|
||||
m_FirstInvSlot = slotIndex;
|
||||
@@ -247,6 +269,12 @@ namespace BrewMonster
|
||||
else
|
||||
detailedItem.GetDetailDataFromLocal();
|
||||
|
||||
if (m_SecondInvSlot >= 0)
|
||||
{
|
||||
var previosBtn = FindInventoryButtonBySlot(m_SecondInvSlot);
|
||||
SetInventorySlotGray(previosBtn, false);
|
||||
}
|
||||
|
||||
m_SelectedMaterial?.Freeze(false);
|
||||
m_SelectedMaterial = detailedItem;
|
||||
m_SelectedMaterial?.Freeze(true);
|
||||
@@ -336,7 +364,6 @@ namespace BrewMonster
|
||||
private void ClearEquipSlot()
|
||||
{
|
||||
m_SelectedEquip?.Freeze(false);
|
||||
m_SelectedMaterial?.Freeze(false);
|
||||
m_SelectedEquip = null;
|
||||
m_FirstInvSlot = -1;
|
||||
m_TxtFirstName.text = "___";
|
||||
@@ -345,6 +372,7 @@ namespace BrewMonster
|
||||
|
||||
private void ClearMaterialSlot()
|
||||
{
|
||||
m_SelectedMaterial?.Freeze(false);
|
||||
m_SelectedMaterial = null;
|
||||
m_SecondInvSlot = -1;
|
||||
m_TxtSecondName.text = "___";
|
||||
@@ -477,5 +505,37 @@ namespace BrewMonster
|
||||
{
|
||||
Show(false);
|
||||
}
|
||||
|
||||
public void ResetInstallUI()
|
||||
{
|
||||
RestoreInventoryColors();
|
||||
|
||||
m_SelectedEquip = null;
|
||||
m_SelectedMaterial = null;
|
||||
|
||||
m_FirstInvSlot = -1;
|
||||
m_SecondInvSlot = -1;
|
||||
|
||||
m_TxtFirstName.text = "___";
|
||||
m_TxtSecondName.text = "___";
|
||||
m_TxtMoney.text = "0";
|
||||
m_install_price = -1;
|
||||
|
||||
ClearSlotIcon(m_SlotFirstParent);
|
||||
ClearSlotIcon(m_SlotSecondlParent);
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void CheckHidePanel(Vector2 screenPos)
|
||||
{
|
||||
if (!RectTransformUtility.RectangleContainsScreenPoint(
|
||||
itemInventoryRoot as RectTransform, screenPos,
|
||||
Camera.main))
|
||||
{
|
||||
if(itemInventoryRoot!=null)
|
||||
itemInventoryRoot.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10577,6 +10577,7 @@ MonoBehaviour:
|
||||
m_BtnMerge: {fileID: 8208092408021918524}
|
||||
m_BtnCancel: {fileID: 4503836757578509720}
|
||||
khung_item: {fileID: 21300000, guid: a5366f3bce011c046902e39b6bd3a077, type: 3}
|
||||
itemInventoryRoot: {fileID: 7750009739432212686}
|
||||
--- !u!1 &5641506892578507279
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -14989,7 +14990,7 @@ MonoBehaviour:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 2206910701173095729}
|
||||
m_TargetAssemblyTypeName: BrewMonster.DlgInstall, Assembly-CSharp
|
||||
m_MethodName: CloseInstall
|
||||
m_MethodName: ResetInstallUI
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
||||
@@ -8038,14 +8038,12 @@ namespace BrewMonster
|
||||
EC_Inventory pPack = GetPack(pCmd.byPackage);
|
||||
if (pPack == null)
|
||||
{
|
||||
Debug.LogError("[OnMsgHstUseItem] Pack not found");
|
||||
return;
|
||||
}
|
||||
|
||||
EC_IvtrItem pItem = pPack.GetItem(pCmd.bySlot, false);
|
||||
if (pItem == null || pItem.GetTemplateID() != pCmd.item_id)
|
||||
{
|
||||
Debug.LogError($"[OnMsgHstUseItem] Item mismatch at slot {pCmd.bySlot}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8058,12 +8056,12 @@ namespace BrewMonster
|
||||
{
|
||||
if (pPack.GetItem(pCmd.bySlot, false) == null)
|
||||
{
|
||||
Debug.Log($"[OnMsgHstUseItem] Item {pCmd.item_id} removed from slot {pCmd.bySlot}");
|
||||
//Debug.Log($"[OnMsgHstUseItem] Item {pCmd.item_id} removed from slot {pCmd.bySlot}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[OnMsgHstUseItem] Failed to remove item {pCmd.item_id} from slot {pCmd.bySlot}");
|
||||
//Debug.LogError($"[OnMsgHstUseItem] Failed to remove item {pCmd.item_id} from slot {pCmd.bySlot}");
|
||||
}
|
||||
|
||||
var ui = GameObject.FindFirstObjectByType<EC_InventoryUI>();
|
||||
@@ -8074,7 +8072,7 @@ namespace BrewMonster
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[OnMsgHstUseItem] EC_InventoryUI not found, UI may not update");
|
||||
//Debug.LogError("[OnMsgHstUseItem] EC_InventoryUI not found, UI may not update");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user