1
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CanUseItem : MonoBehaviour
|
||||
{
|
||||
public Transform rectTransfrom;
|
||||
|
||||
public Text UpItemNum;
|
||||
private void OnEnable()
|
||||
{
|
||||
PlayerInfo.Instance.OnUpdateMainUI += UpdateUI;
|
||||
UpdateUI();
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
PlayerInfo.Instance.OnUpdateMainUI -= UpdateUI;
|
||||
}
|
||||
public void UpdateUI()
|
||||
{
|
||||
foreach (Transform item in rectTransfrom)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
if(PlayerInfo.Instance.info.BagInfo.Count==0|| !PlayerInfo.Instance.info.BagInfo.ContainsKey(0))//背包中没有道具
|
||||
{
|
||||
UpItemNum.text = "0";
|
||||
}
|
||||
foreach (var item in PlayerInfo.Instance.info.BagInfo)
|
||||
{
|
||||
if(item.Key==Date.Instance.ItemDate[0].Id)//背包中道具Id等于道具表中的升级道具
|
||||
{
|
||||
UpItemNum.text = item.Value.ToString();
|
||||
}
|
||||
|
||||
if(Date.Instance.ItemDate[item.Key].type==ItemClass.User)//能够使用的道具
|
||||
{
|
||||
string path = "UI/Perfab/Item";
|
||||
UnityEngine.Object go = Resloader.Load<GameObject>(path);
|
||||
if (go != null)//预制体不为空
|
||||
{
|
||||
GameObject m = (GameObject)Instantiate(go, rectTransfrom);
|
||||
UIItemInfo ui = m.GetComponent<UIItemInfo>();
|
||||
ui.gameObject.SetActive(true);
|
||||
|
||||
ui.SetInfo(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c480308bc5b87dd4193ea0174eb6d6b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Date:Singleton<Date>
|
||||
{
|
||||
public List<Item> ItemDate = new List<Item>();
|
||||
|
||||
public List<LevelUpDefine> UpDate = new List<LevelUpDefine>();
|
||||
|
||||
}
|
||||
|
||||
public enum ItemClass
|
||||
{
|
||||
User,
|
||||
Up,
|
||||
}
|
||||
[Serializable]
|
||||
public class CharInfo
|
||||
{
|
||||
public string DatePath;
|
||||
|
||||
public string playerName;
|
||||
public int Level;
|
||||
public int exp;
|
||||
|
||||
public float maxHp;
|
||||
public float attack;
|
||||
|
||||
//局内属性
|
||||
public int currentMap;
|
||||
public float currentHp;
|
||||
public float testAttack;
|
||||
|
||||
//背包数据
|
||||
public Dictionary<int, int> BagInfo;//背包字典
|
||||
public List<int> BagKey;
|
||||
public List<int> BagValue;
|
||||
|
||||
//升级数据
|
||||
|
||||
public Dictionary<int, bool> UpInfo;//升级字典
|
||||
public List<int> UpKey;
|
||||
public List<bool> UpValue;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0af01c0f76595044aa27ad201f2d08b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user