최종프로젝트 진행상황
오늘의 작업 :
연휴의 후유증..
짜릿하다 !
업그레이드 UI
업그레이드 방식은
우선, unit, room, item 모두 같은 레벨이 3개 있으면, 다음 레벨로 업그레이드 가능하게끔 구현해보려고 한다.
그리고 drag 방식이 아닌 click 방식으로 업그레이드를 진행해볼 예정이다.
새로운 도전의 작업이 찾아왔는데
일단 츄라이🔥 실패해도 못해도 일단 츄라이🔥
파이탱 !
차근차근
unit 업그레이드부터 하나씩 시작해보자 !
InventUpgrade_PopupUI.cs (~ing)
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class InventUpgrade_PopupUI : BaseUI
{
private Button _closeButton;
private Button[] _upgradeSlots = new Button[3];
private Button _upgradeButton;
private Image _itemImg;
private Image[] _upgradeSlotsImgs = new Image[3];
private Image[] _upgradeCancelImgs = new Image[3];
protected override void Init()
{
SetUI<Button>();
SetUI<Image>();
_closeButton = GetUI<Button>("InventUpgradeCloseBtn");
for (int i = 0; i < _upgradeSlots.Length; i++)
{
_upgradeSlots[i] = GetUI<Button>($"UpgradeSlotBtn{i + 1}");
_upgradeSlotsImgs[i] = GetUI<Image>($"UpgradeSlotBtn{i + 1}");
_upgradeCancelImgs[i] = GetUI<Image>($"UpgradeCancelImg{i + 1}");
}
_upgradeButton = GetUI<Button>("UpgradeBtn");
SetUICallback(_closeButton.gameObject, EUIEventState.Click, ClickCloseBtn);
SetUICallback(_upgradeButton.gameObject, EUIEventState.Click, ClickUpgradeBtn);
SetUICallback(_upgradeSlots[0].gameObject, EUIEventState.Click, ClickFirstSlot);
SetUICallback(_upgradeSlots[1].gameObject, EUIEventState.Click, ClickSecondSlot);
SetUICallback(_upgradeSlots[2].gameObject, EUIEventState.Click, ClickThirdSlot);
SetUICallback(_upgradeSlots[0].gameObject, EUIEventState.Hovered, HoveredFirstSlot);
SetUICallback(_upgradeSlots[0].gameObject, EUIEventState.Exit, ExitFirstSlot);
SetUICallback(_upgradeSlots[1].gameObject, EUIEventState.Hovered, HoveredSecondSlot);
SetUICallback(_upgradeSlots[1].gameObject, EUIEventState.Exit, ExitSecondSlot);
SetUICallback(_upgradeSlots[2].gameObject, EUIEventState.Hovered, HoveredThirdSlot);
SetUICallback(_upgradeSlots[2].gameObject, EUIEventState.Exit, ExitThirdSlot);
}
private void ClickCloseBtn(PointerEventData data)
{
Main.Get<UIManager>().ClosePopup();
}
private void ClickUpgradeBtn(PointerEventData data)
{
}
private void ClickFirstSlot(PointerEventData data)
{
}
private void ClickSecondSlot(PointerEventData data)
{
}
private void ClickThirdSlot(PointerEventData data)
{
}
private void HoveredFirstSlot(PointerEventData data)
{
_upgradeCancelImgs[0].gameObject.SetActive(true);
}
private void ExitFirstSlot(PointerEventData data)
{
_upgradeCancelImgs[0].gameObject.SetActive(false);
}
private void HoveredSecondSlot(PointerEventData data)
{
_upgradeCancelImgs[1].gameObject.SetActive(true);
}
private void ExitSecondSlot(PointerEventData data)
{
_upgradeCancelImgs[1].gameObject.SetActive(false);
}
private void HoveredThirdSlot(PointerEventData data)
{
_upgradeCancelImgs[2].gameObject.SetActive(true);
}
private void ExitThirdSlot(PointerEventData data)
{
_upgradeCancelImgs[2].gameObject.SetActive(false);
}
}