mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-28 22:42:31 +08:00
fix(Feed): 添加对UIState.player无效实例的检查
在multiplier()和rebuildInfo()方法中添加对UIState.player实例有效性的检查,防止当player无效时出现运行时错误
This commit is contained in:
@@ -67,7 +67,10 @@ func apply(entity: EntityBase):
|
|||||||
func countOf(index: int) -> int:
|
func countOf(index: int) -> int:
|
||||||
return ceil(costCounts[index] * multipiler())
|
return ceil(costCounts[index] * multipiler())
|
||||||
func multipiler() -> float:
|
func multipiler() -> float:
|
||||||
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)
|
if is_instance_valid(UIState.player):
|
||||||
|
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
func rebuildInfo():
|
func rebuildInfo():
|
||||||
avatarRect.texture = avatarTexture
|
avatarRect.texture = avatarTexture
|
||||||
nameLabel.displayName = displayName
|
nameLabel.displayName = displayName
|
||||||
@@ -83,7 +86,8 @@ func rebuildInfo():
|
|||||||
var fieldShow: FieldShow = ComponentManager.getUIComponent("FieldShow").instantiate()
|
var fieldShow: FieldShow = ComponentManager.getUIComponent("FieldShow").instantiate()
|
||||||
fieldShow.field = field
|
fieldShow.field = field
|
||||||
fieldShow.value = value
|
fieldShow.value = value
|
||||||
fieldShow.maxed = value + UIState.player.fields[field] > FieldStore.entityMaxValueMap.get(field, INF)
|
if is_instance_valid(UIState.player):
|
||||||
|
fieldShow.maxed = value + UIState.player.fields[field] > FieldStore.entityMaxValueMap.get(field, INF)
|
||||||
fieldsBox.add_child(fieldShow)
|
fieldsBox.add_child(fieldShow)
|
||||||
if noField:
|
if noField:
|
||||||
fieldsBox.add_child(QuickUI.smallText("无词条"))
|
fieldsBox.add_child(QuickUI.smallText("无词条"))
|
||||||
|
|||||||
Reference in New Issue
Block a user