Enderal SE https://mod.pub/enderal-se/38-enderal-se
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
241 lines
4.8 KiB
241 lines
4.8 KiB
Scriptname _00E_GUI_ActorHealthBar extends ski_widgetbase
|
|
|
|
float _scale = 1.0
|
|
int _maxEntries = 5
|
|
float _fadeInDuration = 250.0
|
|
float _fadeOutDuration = 750.0
|
|
float _moveDuration = 1000.0
|
|
float _removeDuration = 15000.0
|
|
Form[] _currentlyDisplayedActors
|
|
|
|
string function GetWidgetSource()
|
|
return "skyui/followerpanel.swf"
|
|
endFunction
|
|
|
|
string function GetWidgetType()
|
|
return "EFFPanel"
|
|
endFunction
|
|
|
|
int function GetVersion()
|
|
return 1
|
|
endFunction
|
|
|
|
float property Scale
|
|
float function get()
|
|
return _scale
|
|
endFunction
|
|
|
|
function set(float a_val)
|
|
_scale = a_val
|
|
if (Ready)
|
|
UpdateWidgetScale()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
int Property MaxEntries
|
|
int function get()
|
|
return _maxEntries
|
|
endFunction
|
|
|
|
function set(int a_val)
|
|
_maxEntries = a_val
|
|
if (Ready)
|
|
UpdateMaxEntries()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
float property FadeInDuration
|
|
float function get()
|
|
return _fadeInDuration
|
|
endFunction
|
|
|
|
function set(float a_val)
|
|
_fadeInDuration = a_val
|
|
if (Ready)
|
|
UpdateFadeInDuration()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
float property FadeOutDuration
|
|
float function get()
|
|
return _fadeOutDuration
|
|
endFunction
|
|
|
|
function set(float a_val)
|
|
_fadeOutDuration = a_val
|
|
if (Ready)
|
|
UpdateFadeOutDuration()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
float property MoveDuration
|
|
float function get()
|
|
return _moveDuration
|
|
endFunction
|
|
|
|
function set(float a_val)
|
|
_moveDuration = a_val
|
|
if (Ready)
|
|
UpdateMoveDuration()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
float property RemoveDuration
|
|
float function get()
|
|
return _removeDuration
|
|
endFunction
|
|
|
|
function set(float a_val)
|
|
_removeDuration = a_val
|
|
if (Ready)
|
|
UpdateRemoveDuration()
|
|
endIf
|
|
endFunction
|
|
endProperty
|
|
|
|
; @override SKI_WidgetBase
|
|
event OnWidgetReset()
|
|
parent.OnWidgetReset()
|
|
UpdateWidgetScale()
|
|
UpdateMaxEntries()
|
|
UpdateFadeInDuration()
|
|
UpdateFadeOutDuration()
|
|
UpdateMoveDuration()
|
|
UpdateRemoveDuration()
|
|
|
|
endEvent
|
|
|
|
event OnGameReload()
|
|
parent.OnGameReload()
|
|
|
|
if _currentlyDisplayedActors.length == 0
|
|
_currentlyDisplayedActors = new Form[4]
|
|
else
|
|
_ResetActors()
|
|
Endif
|
|
Endevent
|
|
|
|
Function _ResetActors()
|
|
_LockActors()
|
|
|
|
Form[] tempActors = new Form[4]
|
|
Int nTempActors = 0
|
|
Int i
|
|
|
|
i = _currentlyDisplayedActors.Length
|
|
While i > 0
|
|
i = i - 1
|
|
Form akForm = _currentlyDisplayedActors[i]
|
|
If akForm != None
|
|
tempActors[nTempActors] = akForm
|
|
nTempActors += 1
|
|
RemoveActorRaw(akForm)
|
|
_currentlyDisplayedActors[i] = None
|
|
EndIf
|
|
EndWhile
|
|
|
|
If nTempActors > 0
|
|
Utility.Wait(FadeOutDuration / 1000.0 + 0.05)
|
|
|
|
i = 0
|
|
Int ireg = _currentlyDisplayedActors.Length
|
|
While i < nTempActors
|
|
Actor akActor = tempActors[i] as Actor
|
|
; Make sure the actor is valid, not deleted and not disabled
|
|
If akActor && akActor.GetFormID() != 0
|
|
If akActor.IsDeleted() == False && akActor.IsDisabled() == False && (_currentlyDisplayedActors.Find(akActor) < 0)
|
|
AddActorRaw(akActor)
|
|
ireg -= 1
|
|
_currentlyDisplayedActors[ireg] = akActor
|
|
EndIf
|
|
EndIf
|
|
i += 1
|
|
EndWhile
|
|
EndIf
|
|
|
|
_UnlockActors()
|
|
EndFunction
|
|
|
|
Function UpdateWidgetScale()
|
|
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setScale", _scale * 100.0)
|
|
EndFunction
|
|
|
|
Function UpdateMaxEntries()
|
|
UI.InvokeInt(HUD_MENU, WidgetRoot + ".setEntryCount", _maxEntries)
|
|
EndFunction
|
|
|
|
Function UpdateFadeInDuration()
|
|
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setFadeInDuration", _fadeInDuration / 1000.0)
|
|
EndFunction
|
|
|
|
Function UpdateFadeOutDuration()
|
|
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setFadeOutDuration", _fadeOutDuration / 1000.0)
|
|
EndFunction
|
|
|
|
Function UpdateMoveDuration()
|
|
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setMoveDuration", _moveDuration / 1000.0)
|
|
EndFunction
|
|
|
|
Function UpdateRemoveDuration()
|
|
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setRemoveDuration", _removeDuration)
|
|
EndFunction
|
|
|
|
Function AddActors(Form aForm)
|
|
_LockActors()
|
|
|
|
if _currentlyDisplayedActors.Find(aForm) < 0
|
|
AddActorRaw(aForm)
|
|
|
|
int i = _currentlyDisplayedActors.length
|
|
while i > 0
|
|
i = i - 1
|
|
if _currentlyDisplayedActors[i] == None
|
|
_currentlyDisplayedActors[i] = aForm
|
|
i = 0 ; Break
|
|
Endif
|
|
Endwhile
|
|
;we do not have enough place in the array - the added actor will not be save game persistent
|
|
EndIf
|
|
|
|
_UnlockActors()
|
|
EndFunction
|
|
|
|
Function RemoveActors(Form aForm)
|
|
_LockActors()
|
|
|
|
RemoveActorRaw(aForm)
|
|
|
|
int i = _currentlyDisplayedActors.find(aForm)
|
|
if i >= 0
|
|
_currentlyDisplayedActors[i] = None
|
|
Endif
|
|
|
|
_UnlockActors()
|
|
EndFunction
|
|
|
|
Function AddActorRaw(Form aActor)
|
|
UI.InvokeForm(HUD_MENU, WidgetRoot + ".addPanelActors", aActor)
|
|
EndFunction
|
|
|
|
Function RemoveActorRaw(Form aActor)
|
|
UI.InvokeForm(HUD_MENU, WidgetRoot + ".removePanelActors", aActor)
|
|
EndFunction
|
|
|
|
|
|
Bool _bActorsLocked = False
|
|
|
|
Function _LockActors()
|
|
While _bActorsLocked
|
|
Utility.WaitMenuMode(0.05)
|
|
EndWhile
|
|
_bActorsLocked = True
|
|
EndFunction
|
|
|
|
Function _UnlockActors()
|
|
_bActorsLocked = False
|
|
EndFunction |