体力
This commit is contained in:
parent
bb19707237
commit
54469fff53
@ -732,10 +732,10 @@ RectTransform:
|
||||
m_Father: {fileID: 8646173537342263721}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 628.68, y: -174.5}
|
||||
m_SizeDelta: {x: 264, y: 349}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &514399549474802177
|
||||
CanvasRenderer:
|
||||
@ -1165,10 +1165,10 @@ RectTransform:
|
||||
m_Father: {fileID: 8646173537342263721}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 132, y: -174.5}
|
||||
m_SizeDelta: {x: 264, y: 349}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1106133910927903845
|
||||
CanvasRenderer:
|
||||
@ -1470,10 +1470,10 @@ RectTransform:
|
||||
m_Father: {fileID: 8646173537342263721}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 380.34, y: -174.5}
|
||||
m_SizeDelta: {x: 264, y: 349}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6130671505914922423
|
||||
CanvasRenderer:
|
||||
@ -5291,10 +5291,10 @@ RectTransform:
|
||||
m_Father: {fileID: 8646173537015180660}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 132, y: -174.5}
|
||||
m_SizeDelta: {x: 264, y: 349}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8646173537325353418
|
||||
CanvasRenderer:
|
||||
|
@ -921,7 +921,6 @@ RectTransform:
|
||||
- {fileID: 3011360593165223875}
|
||||
- {fileID: 3011360594467670305}
|
||||
- {fileID: 3011360593094855125}
|
||||
- {fileID: 3011360594285297421}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -3586,6 +3585,12 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: a3a6b8473145fbb45ab7cbeccf28286d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
btn1: {fileID: 2130962702}
|
||||
btn2: {fileID: 1703562762}
|
||||
obj: {fileID: 3011360593039830508}
|
||||
speed: 8
|
||||
textColor1: {r: 0, g: 0, b: 0, a: 1}
|
||||
textColor2: {r: 1, g: 1, b: 1, a: 1}
|
||||
--- !u!1 &3011360593023613002
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5011,8 +5016,9 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3011360593323557530}
|
||||
- component: {fileID: 366819988}
|
||||
m_Layer: 5
|
||||
m_Name: Strength
|
||||
m_Name: StaminaBar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -5042,6 +5048,24 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 120}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &366819988
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360593323557531}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f2d69f2aa3f6373469eb2b4585d59920, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
filled: {fileID: 0}
|
||||
MaxNumberInt: 0
|
||||
numberInt: 0
|
||||
TextFilled: {fileID: 0}
|
||||
Timer: 0
|
||||
TextTime: {fileID: 0}
|
||||
--- !u!1 &3011360593356703323
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -6388,10 +6412,10 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 63977b6fd70c29d4387087bc3f19c1ed, type: 3}
|
||||
m_Type: 0
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillMethod: 1
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
@ -7129,86 +7153,6 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3011360593755663291
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3011360593755663290}
|
||||
- component: {fileID: 3011360593755663288}
|
||||
- component: {fileID: 3011360593755663289}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3011360593755663290
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360593755663291}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3011360594285297421}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3011360593755663288
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360593755663291}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3011360593755663289
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360593755663291}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Button
|
||||
--- !u!1 &3011360593756524122
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -10024,128 +9968,6 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3011360594285297422
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3011360594285297421}
|
||||
- component: {fileID: 3011360594285297410}
|
||||
- component: {fileID: 3011360594285297411}
|
||||
- component: {fileID: 3011360594285297420}
|
||||
m_Layer: 5
|
||||
m_Name: Button (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &3011360594285297421
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360594285297422}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3011360593755663290}
|
||||
m_Father: {fileID: 3011360592396996928}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3011360594285297410
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360594285297422}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3011360594285297411
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360594285297422}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &3011360594285297420
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3011360594285297422}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 3011360594285297411}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &3011360594291280544
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -35,6 +35,8 @@ public class Battle_Selection : BaseUI
|
||||
|
||||
public List<Button> Btns;
|
||||
|
||||
public StaminaBar _staminaBar;
|
||||
|
||||
// Start is called before the first frame update
|
||||
async void Start()
|
||||
{
|
||||
@ -66,18 +68,16 @@ public class Battle_Selection : BaseUI
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogError("++++Ìø++++ת++++³¡++++¾°++++");
|
||||
|
||||
Base.GlobalObj.GetComponent<gameGlobal>().CarryCardId.Clear();
|
||||
|
||||
foreach (Button go in CarryCard)
|
||||
{
|
||||
Debug.Log(go.gameObject.GetComponent<CardInfo>().mengyaoid);
|
||||
|
||||
|
||||
Base.GlobalObj.GetComponent<gameGlobal>().CarryCardId.Add(go.gameObject.GetComponent<CardInfo>().mengyaoid);
|
||||
}
|
||||
SceneManager.LoadScene(2);
|
||||
|
||||
_staminaBar.NumberInt -= 5;
|
||||
// SceneManager.LoadScene(2);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,15 @@ public class DownPanel : Base
|
||||
public List<GameObject> PanelList=new List<GameObject>();
|
||||
|
||||
public GameObject canvse;
|
||||
|
||||
public StaminaBar _staminaBar;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
btns[0].onClick.AddListener(async() => {
|
||||
|
||||
await ButtonClickAnimationAsync(btns[0].gameObject);
|
||||
GameObject.Instantiate(PanelList[0], canvse.transform);
|
||||
GameObject.Instantiate(PanelList[0], canvse.transform).GetComponent<Battle_Selection>()._staminaBar=this._staminaBar;
|
||||
});
|
||||
}
|
||||
|
||||
|
69
meng_yao/Assets/script/scene_Main/ui/StaminaBar.cs
Normal file
69
meng_yao/Assets/script/scene_Main/ui/StaminaBar.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
public class StaminaBar : MonoBehaviour
|
||||
{
|
||||
[Header("填充条")] public Image filled;
|
||||
|
||||
[Header("最大数")] public int MaxNumberInt;
|
||||
[Header("当前数")] public int numberInt;//当前数
|
||||
|
||||
public int NumberInt
|
||||
{
|
||||
get => numberInt;
|
||||
set
|
||||
{
|
||||
numberInt = value;
|
||||
|
||||
// 使用 DOTween 使 fillAmount 平滑过渡
|
||||
float targetFillAmount = (float)numberInt / MaxNumberInt; // 目标值
|
||||
filled.DOFillAmount(targetFillAmount, 0.5f); // 0.5f 为过渡时间,你可以根据需要调整
|
||||
TextFilled.text = numberInt.ToString() + "/" + MaxNumberInt.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
[Header("填充显示")] public Text TextFilled;
|
||||
|
||||
[Header("恢复时间,秒")] public float Timer;
|
||||
[Header("恢复时间显示")] public Text TextTime;
|
||||
private float timer;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
timer = Timer; // 初始化恢复计时器
|
||||
|
||||
filled.fillAmount = (float)numberInt / MaxNumberInt;
|
||||
TextFilled.text = numberInt.ToString() + "/" + MaxNumberInt.ToString();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (numberInt < MaxNumberInt) // 如果体力小于最大值
|
||||
{
|
||||
timer -= Time.deltaTime; // 计时器减少
|
||||
|
||||
// 计算剩余的分钟和秒数
|
||||
int minutes = Mathf.FloorToInt(timer / 60);
|
||||
int seconds = Mathf.FloorToInt(timer % 60);
|
||||
|
||||
// 格式化为 "分钟:秒" 的格式,显示剩余恢复时间
|
||||
TextTime.text = string.Format("恢复时间: {0}:{1:D2}", minutes, seconds);
|
||||
|
||||
if (timer <= 0) // 如果恢复时间到达
|
||||
{
|
||||
NumberInt += 1; // 恢复体力
|
||||
timer = Timer; // 重置计时器
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 恢复完毕后显示为 0:00
|
||||
TextTime.text = "恢复时间: 0:00";
|
||||
}
|
||||
}
|
||||
}
|
11
meng_yao/Assets/script/scene_Main/ui/StaminaBar.cs.meta
Normal file
11
meng_yao/Assets/script/scene_Main/ui/StaminaBar.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d69f2aa3f6373469eb2b4585d59920
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user