Skip to content

Commit 1227538

Browse files
committed
Fix issue with trashing item when pressing "A" button on gamepad
Fix confirm dialog
1 parent f92f31f commit 1227538

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

TrashItems/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ To install the mod just move the downloaded TrashItems.dll to the `<valheim-fold
2020

2121
## Change Log
2222

23+
- 1.2.8
24+
- Fix issue with trashing item when pressing "A" button on gamepad
25+
- Fix confirm dialog
26+
2327
- 1.2.7
2428
- Fix issue with TMP Component
2529

TrashItems/TrashItems.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,22 +330,22 @@ public static void ShowConfirmDialog(ItemDrop.ItemData item, int itemAmount)
330330
var okButton = dialog.transform.Find("win_bkg/Button_ok").GetComponent<Button>();
331331
okButton.onClick.RemoveAllListeners();
332332
okButton.onClick.AddListener(new UnityAction(OnConfirm));
333-
okButton.GetComponentInChildren<Text>().text = "Trash";
334-
okButton.GetComponentInChildren<Text>().color = new Color(1, 0.2f, 0.1f);
333+
okButton.GetComponentInChildren<TextMeshProUGUI>().text = "Trash";
334+
okButton.GetComponentInChildren<TextMeshProUGUI>().color = new Color(1, 0.2f, 0.1f);
335335

336336
var cancelButton = dialog.transform.Find("win_bkg/Button_cancel").GetComponent<Button>();
337337
cancelButton.onClick.RemoveAllListeners();
338338
cancelButton.onClick.AddListener(new UnityAction(OnCancel));
339339

340340
dialog.transform.Find("win_bkg/Slider").gameObject.SetActive(false);
341341

342-
var text = dialog.transform.Find("win_bkg/Text").GetComponent<Text>();
342+
var text = dialog.transform.Find("win_bkg/Text").GetComponent<TextMeshProUGUI>();
343343
text.text = Localization.instance.Localize(item.m_shared.m_name);
344344

345345
var icon = dialog.transform.Find("win_bkg/Icon_bkg/Icon").GetComponent<Image>();
346346
icon.sprite = item.GetIcon();
347347

348-
var amount = dialog.transform.Find("win_bkg/amount").GetComponent<Text>();
348+
var amount = dialog.transform.Find("win_bkg/amount").GetComponent<TextMeshProUGUI>();
349349

350350
amount.text = itemAmount + "/" + item.m_shared.m_maxStackSize;
351351

@@ -396,6 +396,7 @@ public class TrashHandler : MonoBehaviour
396396
private void Awake()
397397
{
398398
handler = this.GetComponent<UIGroupHandler>();
399+
handler.SetActive(false);
399400
}
400401

401402
private void Update()
@@ -404,7 +405,7 @@ private void Update()
404405
{
405406
TrashItems.TrashItem();
406407
// Switch back to inventory iab
407-
typeof(InventoryGui).GetMethod("SetActiveGroup", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(InventoryGui.instance, new object[] { 1 });
408+
typeof(InventoryGui).GetMethod("SetActiveGroup", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(InventoryGui.instance, new object[] { 1, false });
408409
}
409410
}
410411
}

0 commit comments

Comments
 (0)