138 lines
4.3 KiB
C#
138 lines
4.3 KiB
C#
using Quartz.Settings;
|
|
|
|
|
|
internal class XUiC_VehicleHUD : XUiController
|
|
{
|
|
private EntityPlayerLocal LocalPlayer;
|
|
|
|
public override bool GetBindingValue(ref string value, string bindingName)
|
|
{
|
|
bool hasVehicle = false;
|
|
|
|
if (this.LocalPlayer != null)
|
|
{
|
|
bool isAttached = this.LocalPlayer.AttachedToEntity;
|
|
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue isAttached: " + isAttached);
|
|
|
|
if (isAttached)
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue Attached to Entity Class: " + __instance.LocalPlayer.AttachedToEntity.EntityClass.entityClassName);
|
|
if (this.LocalPlayer.AttachedToEntity is EntityVehicle)
|
|
{
|
|
hasVehicle = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
switch (bindingName)
|
|
{
|
|
case "autoRunText":
|
|
value = "";
|
|
|
|
if (hasVehicle)
|
|
{
|
|
if (RebirthVariables.autoRun == 1)
|
|
{
|
|
value = Localization.Get("ttCruiseNormal");
|
|
}
|
|
else if (RebirthVariables.autoRun == 2f)
|
|
{
|
|
value = Localization.Get("ttCruiseFast");
|
|
}
|
|
}
|
|
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue autoRunText value: " + value);
|
|
|
|
return true;
|
|
case "autoRunColor":
|
|
value = "242, 236, 167, 128";
|
|
|
|
if (hasVehicle)
|
|
{
|
|
if (RebirthVariables.autoRun == 1)
|
|
{
|
|
value = "242, 236, 167, 128";
|
|
}
|
|
else if (RebirthVariables.autoRun == 2f)
|
|
{
|
|
value = "86, 145, 78, 128";
|
|
}
|
|
}
|
|
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue autoRunText value: " + value);
|
|
|
|
return true;
|
|
case "autoRunPosition":
|
|
value = "0,-10000";
|
|
|
|
if (hasVehicle)
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue B VEHICLE EXISTS");
|
|
if (RebirthVariables.autoRun > 0)
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue AUTORUN > 0");
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue entityClassName: " + this.LocalPlayer.AttachedToEntity.EntityClass.entityClassName);
|
|
if (this.LocalPlayer.AttachedToEntity.EntityClass.entityClassName.ToLower() == "vehiclebicycle")
|
|
{
|
|
value = "0,250";
|
|
}
|
|
else
|
|
{
|
|
if (MinimapSettings.Enabled)
|
|
{
|
|
value = "0,300";
|
|
}
|
|
else
|
|
{
|
|
value = "0,50";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue AUTORUN == 0");
|
|
value = "0,-10000";
|
|
}
|
|
|
|
//Log.Out("XUiC_VehicleHUD-GetBindingValue showAutoRun value: " + value);
|
|
}
|
|
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-OnOpen START");
|
|
base.OnOpen();
|
|
if (this.LocalPlayer == null && XUi.IsGameRunning())
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-OnOpen 1");
|
|
this.LocalPlayer = this.xui.playerUI.entityPlayer;
|
|
}
|
|
this.IsDirty = true;
|
|
this.RefreshBindings(true);
|
|
}
|
|
|
|
private float currentTime;
|
|
public override void Update(float _dt)
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-Update START");
|
|
this.currentTime -= _dt;
|
|
base.Update(_dt);
|
|
if (this.LocalPlayer == null)
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-Update 1");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("XUiC_VehicleHUD-Update 2");
|
|
this.RefreshBindings(true);
|
|
}
|
|
}
|
|
}
|