mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +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:
|
||||
return ceil(costCounts[index] * multipiler())
|
||||
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():
|
||||
avatarRect.texture = avatarTexture
|
||||
nameLabel.displayName = displayName
|
||||
@@ -83,7 +86,8 @@ func rebuildInfo():
|
||||
var fieldShow: FieldShow = ComponentManager.getUIComponent("FieldShow").instantiate()
|
||||
fieldShow.field = field
|
||||
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)
|
||||
if noField:
|
||||
fieldsBox.add_child(QuickUI.smallText("无词条"))
|
||||
|
||||
Reference in New Issue
Block a user