1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class Price : MonoBehaviour {
- public GameObject[] gameObjArr;
- public Text[] textArr;
- public void SetPrice(BuyUtil.Currency currency, int price, BuyUtil.ItemState state = BuyUtil.ItemState.Sell)
- {
- for(int i=0; i<gameObjArr.Length; i++)
- {
- if(state == BuyUtil.ItemState.Bought)
- {
- if(i == BuyUtil.Currency.Money.GetHashCode())
- {
- gameObjArr[i].SetActive(true);
- textArr[i].text = Language.GetStr("Shop", "bought");
- }
- else
- {
- gameObjArr[i].SetActive(false);
- }
- }
- else if(state == BuyUtil.ItemState.Equiped)
- {
- if(i == BuyUtil.Currency.Money.GetHashCode())
- {
- gameObjArr[i].SetActive(true);
- textArr[i].text = Language.GetStr("Shop", "equiped");
- }
- else
- {
- gameObjArr[i].SetActive(false);
- }
- }
- else
- {
- if(i == currency.GetHashCode())
- {
- gameObjArr[i].SetActive(true);
- if(currency == BuyUtil.Currency.Money)
- textArr[i].text = Language.GetStr("Shop", "RMB") + ((float)price/100f).ToString();
- else
- textArr[i].text = NumberUtil.AddThousandSplit(price);
- }
- else
- {
- gameObjArr[i].SetActive(false);
- }
- }
- }
- }
- }
|