156 lines
4.5 KiB
C#
156 lines
4.5 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class LowerPanel : BasePanel
|
|||
|
{
|
|||
|
//<2F><>ť<EFBFBD><C5A5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ɫ
|
|||
|
private string imgColor1 = "#FF9F00";
|
|||
|
//<2F><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ,<2C><>ɫ
|
|||
|
private string txtColor1 = "#A89500";
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
private string txtColor2 = "#255746";
|
|||
|
|
|||
|
public Button btnFight;
|
|||
|
public Button btnPerson;
|
|||
|
public Button btnBag;
|
|||
|
public Button btnWorld;
|
|||
|
|
|||
|
public TextMeshProUGUI txtFight;
|
|||
|
public TextMeshProUGUI txtPerson;
|
|||
|
public TextMeshProUGUI txtBag;
|
|||
|
public TextMeshProUGUI txtWorld;
|
|||
|
|
|||
|
//ѡ<><D1A1><EFBFBD>İ<EFBFBD>ť
|
|||
|
private Button btnChoose;
|
|||
|
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private TextMeshProUGUI txtChoose;
|
|||
|
|
|||
|
//<2F><>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
|||
|
private BasePanel choosePanel;
|
|||
|
|
|||
|
public override void Init()
|
|||
|
{
|
|||
|
//<2F>ս<EFBFBD><D5BD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>Ϊս<CEAA><D5BD>
|
|||
|
btnChoose = btnFight;
|
|||
|
txtChoose = txtFight;
|
|||
|
|
|||
|
//ս<><D5BD><EFBFBD><EFBFBD>ť
|
|||
|
btnFight.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
HidePanel(choosePanel);
|
|||
|
SetColor(btnFight, txtFight);
|
|||
|
UIManager.Instance.ShowPanel<BattlePanel>(E_UILayer.Bottom);
|
|||
|
if (UIManager.Instance.GetPanel<TopPanel>() == null)
|
|||
|
{
|
|||
|
UIManager.Instance.ShowPanel<TopPanel>(E_UILayer.System);
|
|||
|
}
|
|||
|
choosePanel = null;
|
|||
|
});
|
|||
|
//<2F><><EFBFBD>ﰴť
|
|||
|
btnPerson.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (UIManager.Instance.GetPanel<UserPanel>() == null)
|
|||
|
{
|
|||
|
HidePanel(choosePanel);
|
|||
|
SetColor(btnPerson, txtPerson);
|
|||
|
UIManager.Instance.ShowPanel<UserPanel>(E_UILayer.Middle);
|
|||
|
|
|||
|
if (UIManager.Instance.GetPanel<TopPanel>() == null)
|
|||
|
{
|
|||
|
UIManager.Instance.ShowPanel<TopPanel>(E_UILayer.System);
|
|||
|
}
|
|||
|
choosePanel = UIManager.Instance.GetPanel<UserPanel>();
|
|||
|
}
|
|||
|
});
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|||
|
btnBag.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (UIManager.Instance.GetPanel<BagPanel>() == null)
|
|||
|
{
|
|||
|
HidePanel(choosePanel);
|
|||
|
SetColor(btnBag, txtBag);
|
|||
|
UIManager.Instance.ShowPanel<BagPanel>(E_UILayer.Middle);
|
|||
|
if (UIManager.Instance.GetPanel<TopPanel>()!=null)
|
|||
|
{
|
|||
|
UIManager.Instance.HidePanel<TopPanel>();
|
|||
|
}
|
|||
|
choosePanel = UIManager.Instance.GetPanel<BagPanel>();
|
|||
|
}
|
|||
|
});
|
|||
|
//<2F><><EFBFBD>簴ť
|
|||
|
btnWorld.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (UIManager.Instance.GetPanel<WorldPanel>() == null)
|
|||
|
{
|
|||
|
HidePanel(choosePanel);
|
|||
|
SetColor(btnWorld, txtWorld);
|
|||
|
UIManager.Instance.ShowPanel<WorldPanel>(E_UILayer.Middle);
|
|||
|
if (UIManager.Instance.GetPanel<TopPanel>() != null)
|
|||
|
{
|
|||
|
UIManager.Instance.HidePanel<TopPanel>();
|
|||
|
}
|
|||
|
choosePanel = UIManager.Instance.GetPanel<WorldPanel>();
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>ı䰴ť<E4B0B4><C5A5><EFBFBD><EFBFBD>ɫ
|
|||
|
/// </summary>
|
|||
|
/// <param name="btn"></param>
|
|||
|
/// <param name="txt"></param>
|
|||
|
public void SetColor(Button btn, TextMeshProUGUI txt)
|
|||
|
{
|
|||
|
Color imgColor, txtColor;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫǰ<C9AB>Ȱ<EFBFBD><C8B0><EFBFBD>һ<EFBFBD>εİ<CEB5>ť<EFBFBD><C5A5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|||
|
if (btnChoose!=null&&txtChoose!=null)
|
|||
|
{
|
|||
|
btnChoose.image.color = Color.white;
|
|||
|
if (ColorUtility.TryParseHtmlString(txtColor2, out txtColor))
|
|||
|
{
|
|||
|
txtChoose.color = txtColor;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD>ô˴ε<CBB4><CEB5><EFBFBD><EFBFBD>İ<EFBFBD>ť<EFBFBD><C5A5>ɫ
|
|||
|
if (ColorUtility.TryParseHtmlString(imgColor1, out imgColor))
|
|||
|
{
|
|||
|
btn.image.color = imgColor;
|
|||
|
if (ColorUtility.TryParseHtmlString(txtColor1, out txtColor))
|
|||
|
{
|
|||
|
txt.color = txtColor;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD>µİ<C2B5>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|||
|
btnChoose = btn;
|
|||
|
txtChoose = txt;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private void HidePanel(BasePanel choosePanel)
|
|||
|
{
|
|||
|
//<2F><>ѡ<EFBFBD><D1A1>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (choosePanel == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
switch (choosePanel)
|
|||
|
{
|
|||
|
case UserPanel:
|
|||
|
UIManager.Instance.HidePanel<UserPanel>();
|
|||
|
break;
|
|||
|
case BagPanel:
|
|||
|
UIManager.Instance.HidePanel<BagPanel>();
|
|||
|
break;
|
|||
|
case WorldPanel:
|
|||
|
UIManager.Instance.HidePanel<WorldPanel>();
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|