Upload from upload_mods.ps1
This commit is contained in:
78
Scripts/XUIC/NPCs/XUiC_GoRepairRebirth.cs
Normal file
78
Scripts/XUIC/NPCs/XUiC_GoRepairRebirth.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
internal class XUiC_GoRepairRebirth : XUiController
|
||||
{
|
||||
public XUiV_Label Label;
|
||||
public XUiV_Panel Panel;
|
||||
public float flSubLevels = 0.1f;
|
||||
public bool bDifferentBiome = false;
|
||||
public string strDuration = "25";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
|
||||
((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)
|
||||
{
|
||||
Label.Text = string.Format(Localization.Get("ttRepairBlocks"), myEntity.EntityName);
|
||||
}
|
||||
|
||||
base.OnOpen();
|
||||
}
|
||||
|
||||
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed START");
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
|
||||
var entityID = 0;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
|
||||
if (entityID == 0)
|
||||
{
|
||||
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 1");
|
||||
return;
|
||||
}
|
||||
|
||||
var myEntity = player.world.GetEntity(entityID) as EntityNPCRebirth;
|
||||
if (myEntity == null)
|
||||
{
|
||||
//Log.Out("XUiC_AddSecondClassPopupRebirth-BtnConfirm_OnPressed 2");
|
||||
return;
|
||||
}
|
||||
|
||||
myEntity.Buffs.AddBuff("FuriousRamsayHelpRepair");
|
||||
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
}
|
||||
|
||||
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
Panel.IsVisible = false;
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user