92 lines
3.7 KiB
C#
92 lines
3.7 KiB
C#
internal class XUiC_ShowDismemberRebirth : XUiController
|
|
{
|
|
private EntityPlayerLocal LocalPlayer;
|
|
private readonly CachedStringFormatterXuiRgbaColor stealthColorFormatter = new CachedStringFormatterXuiRgbaColor();
|
|
private readonly CachedStringFormatter<float> statfillFormatter = new CachedStringFormatter<float>((Func<float, string>)(_i => _i.ToCultureInvariantString()));
|
|
private readonly CachedStringFormatter<int, int> statcurrentWMaxFormatterAOfB = new CachedStringFormatter<int, int>((Func<int, int, string>)((_i, _i1) => string.Format("{0}/{1}", (object)_i, (object)_i1)));
|
|
private readonly CachedStringFormatter<float, float> statmodifiedmaxFormatter = new CachedStringFormatter<float, float>((Func<float, float, string>)((_f1, _f2) => (_f1 / _f2).ToCultureInvariantString()));
|
|
|
|
public override bool GetBindingValue(ref string value, string bindingName)
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-GetBindingValue START");
|
|
float flDismemberCountdown = 0;
|
|
float flDismemberTotalCounter = 0;
|
|
float flDismemberHUD = 0;
|
|
|
|
if (this.LocalPlayer != null)
|
|
{
|
|
flDismemberCountdown = this.LocalPlayer.Buffs.GetCustomVar(".FuriousRamsayDismemberedHeadTotalCountdown");
|
|
flDismemberTotalCounter = this.LocalPlayer.Buffs.GetCustomVar(".FuriousRamsayDismemberedHeadTotalCounter");
|
|
flDismemberHUD = this.LocalPlayer.Buffs.GetCustomVar("$varFuriousRamsayDismemberHUD");
|
|
}
|
|
|
|
switch (bindingName)
|
|
{
|
|
case "dismemberCount":
|
|
value = flDismemberTotalCounter.ToString();
|
|
return true;
|
|
case "statDismemberFill":
|
|
if (this.LocalPlayer == null)
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-GetBindingValue 2");
|
|
value = "0";
|
|
return true;
|
|
}
|
|
value = (flDismemberCountdown / 8).ToString();
|
|
return true;
|
|
case "statDismemberVisible":
|
|
if (this.xui.dragAndDrop.InMenu || flDismemberHUD == 0)
|
|
{
|
|
value = "false";
|
|
//Log.Out("XUiC_ShowDismemberRebirth-GetBindingValue 4 statDismemberVisible: " + value);
|
|
return true;
|
|
}
|
|
if (flDismemberCountdown <= 0 || flDismemberTotalCounter <= 0)
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-GetBindingValue 5 statDismemberVisible: " + value);
|
|
value = "false";
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-GetBindingValue 6 statDismemberVisible: " + value);
|
|
value = "true";
|
|
}
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-OnOpen START");
|
|
base.OnOpen();
|
|
if (this.LocalPlayer == null && XUi.IsGameRunning())
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-OnOpen 1");
|
|
this.LocalPlayer = this.xui.playerUI.entityPlayer;
|
|
}
|
|
this.IsDirty = true;
|
|
this.RefreshBindings(true);
|
|
}
|
|
|
|
private float currentTime;
|
|
public override void Update(float _dt)
|
|
{
|
|
this.currentTime -= _dt;
|
|
base.Update(_dt);
|
|
if (this.LocalPlayer == null)
|
|
{
|
|
//Log.Out("XUiC_ShowDismemberRebirth-Update 1");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (this.LocalPlayer.Buffs.HasBuff("FuriousRamsayDismemberedHeadCounter"))
|
|
{
|
|
this.RefreshBindings(true);
|
|
}
|
|
}
|
|
}
|
|
}
|