From b35506e39f6e678fe563abefdcb74657c329f2ee Mon Sep 17 00:00:00 2001 From: p21380769 <18963570599@qq.com> Date: Thu, 8 Jul 2021 11:57:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E6=AD=A6=E5=99=A8=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8F=8A=E6=93=8D=E4=BD=9C=EF=BC=88=E4=B8=8E=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=B1=BB=E4=BC=BC=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SingleWeapon.cs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 SingleWeapon.cs diff --git a/SingleWeapon.cs b/SingleWeapon.cs new file mode 100644 index 0000000..a9a1af2 --- /dev/null +++ b/SingleWeapon.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; + +public class SingleWeapon : MonoBehaviour +{ + public string WeaponName; + public Sprite weaponSprite; + public int UpgradePrice; + public Weapon weapon; + + public Text WeaponNameText; + //public GoodsDatabase goodsDatabase; + // Start is called before the first frame update + void Start() + { + WeaponNameText.color = Color.white; + WeaponNameText.text = WeaponName + ""; + weaponSprite = weapon.weaponSprite; + UpgradePrice = (weapon.level + 1) * 10; + } + /*public void UpdataInfo() + { + WeaponNameText.text = WeaponName+""; + weapon = transform.Find(WeaponName).GetComponent(); + }*/ + // Update is called once per frame + void Update() + { + UpgradePrice = (weapon.level + 1) * 10; + } + public void IPointerClick() + { + //Debug.Log("Down"); + WeaponNameText.color = Color.green; + if (WeaponUpgradePandle.instance.singleWeapon != null && WeaponUpgradePandle.instance.singleWeapon != this) + { + WeaponUpgradePandle.instance.singleWeapon.WeaponNameText.color = Color.white; + } + WeaponUpgradePandle.instance.singleWeapon = this; + WeaponUpgradePandle.instance.UpdateUI(); + } +}