_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/lianghaoLL/OrderObj.cs

58 lines
1.6 KiB
C#
Raw Normal View History

using UnityEngine;
using UnityEngine.UI;
using static OrderPanel;
public class OrderObj : MonoBehaviour
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>ͼ
public Sprite imgBk1;
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
public Sprite imgBk2;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
private string colorZong = "574436";
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
private string colorFen = "B67687";
//֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
private string colorLv = "63B900";
//<2F><><EFBFBD><EFBFBD>
public Image imgBk;
//<2F><>ƷId
public Text txtId;
//֧<><D6A7>״̬
public Text txtFinish;
public void UpdatePanel(OrderList order)
{
txtId.text = order.productId + "\n" + order.createTime;
switch (order.payStatus)
{
case 0:
txtFinish.text = <><D6A7><EFBFBD><EFBFBD>";
txtFinish.color = HexToColor(colorLv);
imgBk.sprite = imgBk1;
break;
case 1:
txtFinish.text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
txtFinish.color = HexToColor(colorZong);
imgBk.sprite = imgBk1;
break;
case 2:
txtFinish.text = "<22><>ȡ<EFBFBD><C8A1>";
txtFinish.color = HexToColor(colorFen);
imgBk.sprite = imgBk2;
break;
}
}
// <20><>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫת<C9AB><D7AA>Ϊ Color
private Color HexToColor(string hex)
{
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
return new Color32(r, g, b, 255);
}
}