97 lines
2.5 KiB
C#
97 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIHome_BY_VIPPanel : SubUIBase
|
|
{
|
|
|
|
[Header("下一页上一页")]
|
|
public Button btn_Next;
|
|
public Button btn_Last;
|
|
[Header("VIP等级-名字-介绍-奖励")]
|
|
public TextMeshProUGUI txt_VIPLevel;
|
|
public TextMeshProUGUI txt_VIPName;
|
|
public TextMeshProUGUI txt_VIPDescription;
|
|
public TextMeshProUGUI txt_VIPEXP;
|
|
public Button btn_AwardPrefab;
|
|
public Button btn_AwardParent;
|
|
|
|
public Button btn_Award_A;
|
|
public Button btn_Award_B;
|
|
public Button btn_Award_C;
|
|
[Header("炮台")]
|
|
public Image img_Turret;
|
|
|
|
public Slider EXP;
|
|
|
|
int vipLevel = 0;
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
|
|
|
|
}
|
|
protected override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
var vipDatas = GameManager.Instance.gameConfig.vipLevelConfigs;
|
|
btn_Last.onClick.AddListener(() =>
|
|
{
|
|
if (vipLevel>0)
|
|
{
|
|
vipLevel--;
|
|
UpdateVIPPanel(vipLevel);
|
|
}
|
|
});
|
|
btn_Next.onClick.AddListener(() =>
|
|
{
|
|
if (vipLevel<vipDatas.Count-1)
|
|
{
|
|
vipLevel++;
|
|
UpdateVIPPanel(vipLevel);
|
|
}
|
|
});
|
|
}
|
|
public void UpdateVIPPanel(int level)
|
|
{
|
|
var vipDatas = GameManager.Instance.gameConfig.vipLevelConfigs;
|
|
foreach (var item in vipDatas)
|
|
{
|
|
if (level == item.level)
|
|
{
|
|
txt_VIPName.text = $"VIP等级{item.level}特权 ";
|
|
txt_VIPDescription.text = item.remark;
|
|
}
|
|
}
|
|
}
|
|
public void Start()
|
|
{
|
|
|
|
}
|
|
private void OnClose()
|
|
{
|
|
}
|
|
protected override void OnShow(object args = null)
|
|
{
|
|
var vip = GameManager.Instance.user.assets;
|
|
var vipEX = GameManager.Instance.user.@static;
|
|
var vipDatas = GameManager.Instance.gameConfig.vipLevelConfigs;
|
|
vipLevel = vip.vipLevel;
|
|
foreach (var item in vipDatas)
|
|
{
|
|
if (vipLevel == item.level)
|
|
{
|
|
EXP.maxValue = item.expMax;
|
|
EXP.minValue = item.expMin;
|
|
EXP.value = (float)vipEX.totalRecharge;
|
|
txt_VIPEXP.text = $"{vipEX.totalRecharge*10}/{item.expMax*10}";
|
|
txt_VIPLevel.text = $"{vip.vipLevel}";
|
|
UpdateVIPPanel(item.level);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|