83 lines
2.0 KiB
C#
83 lines
2.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
using Unity.VisualScripting;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.U2D;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>ؿ<EFBFBD><D8BF><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ؿ<EFBFBD>״̬
|
|||
|
/// </summary>
|
|||
|
public class LevItem2 : MonoBehaviour
|
|||
|
{
|
|||
|
//<2F><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
|||
|
public Button btnSelf;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
public Text txtName;
|
|||
|
//<2F>ؿ<EFBFBD>id
|
|||
|
private int levId;
|
|||
|
|
|||
|
//<2F><>ť<EFBFBD><C5A5>
|
|||
|
public Image imgLock;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ͨ<EFBFBD><CDA8>
|
|||
|
private bool isLock=false;
|
|||
|
|
|||
|
void Start()
|
|||
|
{
|
|||
|
btnSelf.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (isLock)
|
|||
|
{
|
|||
|
GameDataMgr.Instance.levRankMsg.openId = GameDataMgr.Instance.player.openId;
|
|||
|
GameDataMgr.Instance.levRankMsg.id = levId;
|
|||
|
StartCoroutine(NetMgr.Instance.LevPetInfoPost(GameDataMgr.Instance.levRankMsg));
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
UIManager.Instance.GetPanel<GamePanel>().UpdatePanel(levId);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>°<EFBFBD>ť<EFBFBD><C5A5>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="lev"><3E>ؿ<EFBFBD>״̬<D7B4><CCAC>Ϣ</param>
|
|||
|
public void InitInfo(AllLevData lev)
|
|||
|
{
|
|||
|
//<2F><>¼<EFBFBD><C2BC>ǰ<EFBFBD>ؿ<EFBFBD>id
|
|||
|
levId = lev.levId;
|
|||
|
if (levId==1)
|
|||
|
{
|
|||
|
isLock=true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (levId<=GameDataMgr.Instance.player.customLev+1)
|
|||
|
{
|
|||
|
isLock = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
isLock = false;
|
|||
|
}
|
|||
|
}
|
|||
|
//<2F><><EFBFBD>°<EFBFBD>ť<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>Ϣ
|
|||
|
txtName.text = levId.ToString();
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|||
|
SpriteAtlas sa = Resources.Load<SpriteAtlas>("Atlas/AllLevPanel");
|
|||
|
if (!isLock)
|
|||
|
{
|
|||
|
btnSelf.image.sprite = sa.GetSprite("icn_taxoff");
|
|||
|
imgLock.gameObject.SetActive(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
btnSelf.image.sprite = sa.GetSprite("icn_taxon");
|
|||
|
imgLock.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|