Files
zzz_REBIRTH__Utils/Scripts/XUIC/NPCs/XUiC_RepairReportRebirth.cs
2025-06-04 16:44:53 +09:30

86 lines
2.9 KiB
C#

internal class XUiC_RepairReportRebirth : XUiController
{
public XUiV_Label Label;
public XUiV_Panel Panel;
public float flSubLevels = 0.1f;
public bool bDifferentBiome = false;
public override void Init()
{
base.Init();
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
Label = (XUiV_Label)Panel.Controller.GetChildById("Label").ViewComponent;
}
public override void OnOpen()
{
EntityPlayer player = xui.playerUI.entityPlayer;
var entityID = 0;
if (player.Buffs.HasCustomVar("CurrentNPC"))
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
if (entityID == 0)
return;
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
if (myEntity != null)
{
string strSerialize = myEntity.strSerialize;
Label.Text = Localization.Get("ttRepairReport");
if (strSerialize != null)
{
if (strSerialize.Length > 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerialize.Length: " + strSerialize.Length);
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp LOAD: " + strSerialize);
string[] array = strSerialize.Split(new char[]
{
'<'
});
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[]
{
'|'
});
for (int i2 = 0; i2 < array2.Length; i2++)
{
if (i2 == 0)
{
Label.Text = Label.Text + " • " + Localization.Get(array2[i2]);
}
else
{
Label.Text = Label.Text + " ([88d188]" + array2[i2] + "[-])";
}
}
Label.Text = Label.Text + "\n";
}
}
}
}
}
base.OnOpen();
}
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
{
xui.playerUI.windowManager.Close(windowGroup.ID);
}
public override void OnClose()
{
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
xui.playerUI.windowManager.Close("dialog");
base.OnClose();
}
}