小兵添加多血条显示

tcx_xiyou_solider
PC-202302260912\Administrator 2024-04-02 18:47:44 +08:00
parent 2e8610795a
commit 360d8c71e1
2 changed files with 213 additions and 8 deletions

View File

@ -90039,6 +90039,85 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2835493833500473932
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3746179055486948903}
- component: {fileID: 5902335177164408761}
- component: {fileID: 530152787681044996}
m_Layer: 5
m_Name: numTxt
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3746179055486948903
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835493833500473932}
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_Children: []
m_Father: {fileID: 4594492938401723161}
m_RootOrder: 2
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: 293, y: 0}
m_SizeDelta: {x: 75.3, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5902335177164408761
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835493833500473932}
m_CullTransparentMesh: 0
--- !u!114 &530152787681044996
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835493833500473932}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9811321, g: 0.9579922, b: 0.9579922, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: x1
--- !u!1 &2855914043935716432
GameObject:
m_ObjectHideFlags: 0
@ -126625,6 +126704,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 345522315851906538}
- {fileID: 8690405924968769168}
- {fileID: 3746179055486948903}
m_Father: {fileID: 6461990839478086415}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -197158,6 +197239,80 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &7482131513766683548
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8690405924968769168}
- component: {fileID: 6223299035589840276}
- component: {fileID: 4024541812502997305}
m_Layer: 5
m_Name: Image1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8690405924968769168
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7482131513766683548}
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_Children: []
m_Father: {fileID: 4594492938401723161}
m_RootOrder: 1
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: 500, y: 38}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6223299035589840276
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7482131513766683548}
m_CullTransparentMesh: 0
--- !u!114 &4024541812502997305
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7482131513766683548}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.6320754, g: 0.068574235, b: 0.068574235, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: a107a73ff774dc94ea4ccaaeb6a6f90e, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!1 &7523040840964448925
GameObject:
m_ObjectHideFlags: 0
@ -235975,8 +236130,8 @@ RectTransform:
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: -228, y: 780}
m_SizeDelta: {x: 160, y: 30}
m_AnchoredPosition: {x: -289, y: 780}
m_SizeDelta: {x: 42.9, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3664324840418874399
CanvasRenderer:
@ -236013,7 +236168,7 @@ MonoBehaviour:
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 3
m_Alignment: 5
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1

View File

@ -281,6 +281,8 @@ function FightPointPassMainPanel:InitComponent()
this.bossImg=Util.GetGameObject(self.gameObject, "battlePanel/bossObj/icon"):GetComponent("Image")
this.bossNum=Util.GetGameObject(self.gameObject, "battlePanel/bossObj/num"):GetComponent("Text")
this.hpBar=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/Image"):GetComponent("Image")
this.hpBar2=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/Image1"):GetComponent("Image")
this.numTxt=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/numTxt"):GetComponent("Text")
this.onHookObj= Util.GetGameObject(self.gameObject, "Bg/getBoxReward/Button")
this.btn_hookReward=Util.GetGameObject(self.gameObject, "Bg/getBoxReward/Button")
@ -671,7 +673,8 @@ function this.BattleLogic()
battleTime=curSoliderStageConfig.Time
bossHp=curSoliderStageConfig.Hp
end
this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
this.timeTxt.text=battleTime
this.hpTxt.text=bossHp
LogError("curSoliderStageConfig.Time===="..curSoliderStageConfig.Time.." curSoliderStageConfig.Hp=="..curSoliderStageConfig.Hp)
@ -733,11 +736,11 @@ function this.BattleLogic()
--end
end
curAttack=allAttacck
this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
cd=0
end
bossSpine.AnimationState:SetAnimation(0, "idle", true)
battleTime=battleTime-1
this.timeTxt.text=battleTime
if bossHp<0 then
bossHp=0
@ -750,7 +753,8 @@ function this.BattleLogic()
cd=0
battleTime=curSoliderStageConfig.Time
bossHp=curSoliderStageConfig.Hp
this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
this.battleTimer:Start()
end
if bossHp<=0 then
@ -788,15 +792,61 @@ function this.BattleLogic()
cd=0
battleTime=curSoliderStageConfig.Time
bossHp=curSoliderStageConfig.Hp
this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
this.RefreshBossInfo()
end)
end
battleTime=battleTime-1
end, 1, -1, true)
this.battleTimer:Start()
end
local maxHp=0
local everyHp=0
function this.SetHp(_maxHp,_curHp,_Num)
if _maxHp==_curHp then
maxHp=_maxHp
everyHp=maxHp/_Num
this.numTxt.text="x".._Num
this.hpBar2.fillAmount=1
this.hpBar.fillAmount=1
if _Num==1 then
this.hpBar2.fillAmount=0
end
else
this.UpdateHp(_curHp)
end
end
function this.UpdateHp(_curHp)
if _curHp==maxHp then
return
end
if _curHp<=0 then
this.hpBar2.fillAmount=0
this.hpBar0.fillAmount=0
end
this.numTxt.text="x"..math.floor(_curHp/everyHp)+1
if math.floor(_curHp/everyHp)==0 then
this.hpBar2.fillAmount=0
this.hpBar.fillAmount=_curHp/everyHp
return
end
if math.floor(_curHp/everyHp)%2==0 then
this.hpBar2.transform:SetAsFirstSibling()
this.hpBar2.fillAmount=1
this.hpBar.fillAmount=_curHp % everyHp/everyHp
else
this.hpBar.transform:SetAsFirstSibling()
this.hpBar.fillAmount=1
this.hpBar2.fillAmount=_curHp % everyHp/everyHp
end
end
function this.SetInitAnim()