70 lines
2.4 KiB
C#
70 lines
2.4 KiB
C#
using Assets.Framework.Tool;
|
|
using Assets.MyGame.Scripts.Net;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public enum LevelGiftType
|
|
{
|
|
MianFei=1,
|
|
JingYing=2,
|
|
ZhiZun=4
|
|
}
|
|
public class LevelGiftitem : MonoBehaviour
|
|
{
|
|
public Image img_MianFei;
|
|
public Image img_MianFeiDuiGou;
|
|
public TextMeshProUGUI tmp_MianFeiPropCount;
|
|
|
|
public Image img_JingYing;
|
|
public Image img_JingYingDuiGou;
|
|
public Image img_JingYingLocal;
|
|
public TextMeshProUGUI tmp_JingYingPropCount;
|
|
|
|
|
|
public Image img_ZhiZun;
|
|
public Image img_ZhiZunDuiGou;
|
|
public Image img_ZhiZunLocal;
|
|
public TextMeshProUGUI tmp_ZhiZunPropCount;
|
|
|
|
public TextMeshProUGUI tmp_currLevel;
|
|
public void Init(string urlMianFei,int mianFeiPropCount, string urlJingYing,int jingYingPropCount, string urlZhiZun,int zhiZunPropCount,int currLevel, LevelGiftType giftType,bool showDuiGou)
|
|
{
|
|
WebTool.DownImage(APIManager.baseURL+ urlMianFei, (texture) =>
|
|
{
|
|
img_MianFei.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
|
|
});
|
|
WebTool.DownImage(APIManager.baseURL + urlJingYing, (texture) =>
|
|
{
|
|
img_JingYing.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
|
|
});
|
|
WebTool.DownImage(APIManager.baseURL + urlZhiZun, (texture) =>
|
|
{
|
|
img_ZhiZun.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
|
|
});
|
|
tmp_MianFeiPropCount.text = mianFeiPropCount.ToString();
|
|
tmp_JingYingPropCount.text = jingYingPropCount.ToString();
|
|
tmp_ZhiZunPropCount.text = zhiZunPropCount.ToString();
|
|
if ((giftType & LevelGiftType.MianFei) != 0)
|
|
{
|
|
if (showDuiGou)
|
|
img_MianFeiDuiGou.gameObject.SetActive(true);
|
|
}
|
|
if ((giftType & LevelGiftType.JingYing) != 0)
|
|
{
|
|
img_JingYingLocal.gameObject.SetActive(false);
|
|
if (showDuiGou)
|
|
img_JingYingDuiGou.gameObject.SetActive(true);
|
|
}
|
|
if ((giftType & LevelGiftType.ZhiZun) != 0)
|
|
{
|
|
img_ZhiZunLocal.gameObject.SetActive(false);
|
|
if (showDuiGou)
|
|
img_ZhiZunDuiGou.gameObject.SetActive(true);
|
|
}
|
|
tmp_currLevel.text = currLevel.ToString();
|
|
}
|
|
}
|