This commit is contained in:
JA
2026-06-27 03:35:50 +08:00
parent 0bcb488b13
commit 2ab982a4e0
1044 changed files with 66627 additions and 112414 deletions

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3363aa678bc5a3947aeca6018e775f7f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c480308bc5b87dd4193ea0174eb6d6b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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;
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0af01c0f76595044aa27ad201f2d08b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,91 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CharacterHp : MonoBehaviour
{
public GameObject EndUI;
//UI
public Image headImage;
private float maxHp;
public Slider hpBar;
public Text bossName;
public Text hpText;
public Text atk;
private Animator _animator;
private BossAI bossAI;
private CharacterCombat charComba;
private void Awake()
{
hpBar.value = 1;
}
public void Init(BossAI ai)
{
_animator = ai._animator;
headImage.overrideSprite = ai._info.bossHead;
maxHp = ai.maxHp;
hpText.text = maxHp + "/" + maxHp;
bossAI = ai;
bossName.text = ai._info.bossName;
ai.OnHit += OnUpdate;
}
public void Init(CharacterCombat ch)
{
_animator = ch._animator;
maxHp = ch.maxHp;
hpText.text = ch.currentHp + "/" + maxHp;
charComba = ch;
atk.text = ch.attack.ToString();
bossName.text = PlayerInfo.Instance.info.playerName;
ch.OnHit += OnUpdate;
}
private void OnUpdate(float hp)
{
if(bossAI==null)
{
maxHp = charComba.maxHp;
atk.text = charComba.attack.ToString();
}
hpBar.value = hp/maxHp;
hpText.text = hp + "/" + maxHp;
if (hp<=0)
{
_animator.Play("die");
hpText.text = "0/" + maxHp;
if (charComba==null)//¹ÖÎչʾÖÕ½áUI
{
EndUI.SetActive(true);
StartCoroutine(StartTimer(1f));
}
else
{
UIManager.Instance.Show<UIGameOver>();
}
}
}
IEnumerator StartTimer(float t)
{
yield return new WaitForSeconds(t);
EndUI.SetActive(false);
yield return new WaitForSeconds(t);
//½±Àø
UIManager.Instance.Show<UILottery>();
PlayerInfo.Instance.BagMgr.AddItem(1, 2);
PlayerInfo.Instance.BagMgr.AddItem(0, 2);
PlayerInfo.Instance.info.exp += 2000;
PlayerInfo.Instance.LevelUp();
PlayerInfo.Instance.OnUpdateLevel?.Invoke();
//
this.gameObject.SetActive(false);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 25181661743cceb4dbeb94494e7f83e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: