Upload from upload_mods.ps1
This commit is contained in:
263
Scripts/XUIC/XUiC_ImmunityModsRebirth.cs
Normal file
263
Scripts/XUIC/XUiC_ImmunityModsRebirth.cs
Normal file
@@ -0,0 +1,263 @@
|
||||
|
||||
internal class XUiC_ImmunityModsRebirth : XUiController
|
||||
{
|
||||
private static float uiCheck = 0f;
|
||||
public float uiTick = 0.5f;
|
||||
public float barterPerc = 0f;
|
||||
|
||||
private XUiC_ComboBoxList<string> cbxTargetAuraType;
|
||||
|
||||
public XUiC_ComboBoxInt combo9mm;
|
||||
public XUiC_ComboBoxInt combo762;
|
||||
public XUiC_ComboBoxInt combo44;
|
||||
public XUiC_ComboBoxInt comboShell;
|
||||
public XUiV_Label Resource;
|
||||
public XUiV_Label ResourceMultiplier;
|
||||
public XUiV_Label GatherType;
|
||||
public XUiV_Label LabelDescription;
|
||||
public XUiV_Label LabelTotalCash;
|
||||
public XUiV_Label LabelTotalRemains;
|
||||
public XUiV_Panel Panel;
|
||||
|
||||
public XUiV_Sprite spriteAuraImage;
|
||||
public XUiV_Sprite spriteRemainsImage;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-Init START");
|
||||
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;
|
||||
|
||||
spriteAuraImage = (XUiV_Sprite)GetChildById("AuraImage").ViewComponent;
|
||||
spriteRemainsImage = (XUiV_Sprite)GetChildById("RemainsImage").ViewComponent;
|
||||
|
||||
LabelDescription = (XUiV_Label)Panel.Controller.GetChildById("lblDescription").ViewComponent;
|
||||
LabelTotalCash = (XUiV_Label)Panel.Controller.GetChildById("lblTotalCash").ViewComponent;
|
||||
LabelTotalRemains = (XUiV_Label)Panel.Controller.GetChildById("lblTotalRemains").ViewComponent;
|
||||
|
||||
this.cbxTargetAuraType = (base.GetChildById("cbxAuraType") as XUiC_ComboBoxList<string>);
|
||||
if (this.cbxTargetAuraType != null)
|
||||
{
|
||||
this.cbxTargetAuraType.Elements.Add(Localization.Get("ttFire"));
|
||||
this.cbxTargetAuraType.Elements.Add(Localization.Get("ttShock"));
|
||||
this.cbxTargetAuraType.Elements.Add(Localization.Get("ttExplosion"));
|
||||
this.cbxTargetAuraType.Elements.Add(Localization.Get("ttFireShock"));
|
||||
this.cbxTargetAuraType.Elements.Add(Localization.Get("ttFireShockExplosion"));
|
||||
this.cbxTargetAuraType.OnValueChanged += this.cbxTargetAuraType_OnValueChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void changeValue(EntityPlayer player, int index)
|
||||
{
|
||||
string iconAuraName = "";
|
||||
string iconRemainsName = "";
|
||||
string remainsName = "";
|
||||
string costCash = "0";
|
||||
string costRemains = "0";
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
iconAuraName = "FireResistAura";
|
||||
iconRemainsName = "ZombieRemainsFire";
|
||||
remainsName = "FuriousRamsayZombieRemainsFire";
|
||||
costCash = "10000";
|
||||
costRemains = "150";
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
iconAuraName = "ShockResistAura";
|
||||
iconRemainsName = "ZombieRemainsShock";
|
||||
remainsName = "FuriousRamsayZombieRemainsShock";
|
||||
costCash = "12500";
|
||||
costRemains = "200";
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
iconAuraName = "SmokeResistAura";
|
||||
iconRemainsName = "ZombieRemainsSmoke";
|
||||
remainsName = "FuriousRamsayZombieRemainsSmoke";
|
||||
costCash = "15000";
|
||||
costRemains = "250";
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
iconAuraName = "FireShockResistAura";
|
||||
iconRemainsName = "ZombieRemainsFireShock";
|
||||
remainsName = "FuriousRamsayZombieRemainsFireShock";
|
||||
costCash = "20000";
|
||||
costRemains = "150";
|
||||
}
|
||||
else if (index == 4)
|
||||
{
|
||||
iconAuraName = "FireShockSmokeResistAura";
|
||||
iconRemainsName = "ZombieRemainsFireShockSmoke";
|
||||
remainsName = "FuriousRamsayZombieRemainsFireShockSmoke";
|
||||
costCash = "30000";
|
||||
costRemains = "200";
|
||||
}
|
||||
|
||||
int totalCash = RebirthUtilities.numItems(ItemClass.GetItem("casinoCoin"), player);
|
||||
int totalRemains = RebirthUtilities.numItems(ItemClass.GetItem(remainsName), player);
|
||||
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue costCash: " + costCash);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue totalCash: " + totalCash);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue costRemains: " + costRemains);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue totalRemains: " + totalRemains);
|
||||
|
||||
string cashColor = "ffffff";
|
||||
|
||||
bool cannotTrade = false;
|
||||
|
||||
if (totalCash < int.Parse(costCash))
|
||||
{
|
||||
cashColor = "c79595";
|
||||
cannotTrade = true;
|
||||
}
|
||||
|
||||
string remainsColor = "ffffff";
|
||||
|
||||
if (totalRemains < int.Parse(costRemains))
|
||||
{
|
||||
remainsColor = "c79595";
|
||||
cannotTrade |= true;
|
||||
}
|
||||
|
||||
spriteAuraImage.SpriteName = "ui_game_symbol_" + iconAuraName;
|
||||
spriteRemainsImage.SpriteName = "ui_game_symbol_" + iconRemainsName;
|
||||
|
||||
string cashText = "[" + cashColor + "]" + costCash + "[-]";
|
||||
string remainsText = "[" + remainsColor + "]" + costRemains + "[-]";
|
||||
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue cashText: " + cashText);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue remainsText: " + remainsText);
|
||||
|
||||
LabelTotalCash.Text = cashText;
|
||||
LabelTotalRemains.Text = remainsText;
|
||||
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue cbxTargetAuraType.Value: " + cbxTargetAuraType.Value);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-changeValue cbxTargetAuraType.currentIndex: " + cbxTargetAuraType.currentIndex);
|
||||
|
||||
if (cannotTrade)
|
||||
{
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void cbxTargetAuraType_OnValueChanged(XUiController _sender, string _oldValue, string _newValue)
|
||||
{
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
|
||||
int index = cbxTargetAuraType.currentIndex;
|
||||
|
||||
changeValue(player, index);
|
||||
}
|
||||
|
||||
public override void Update(float _dt)
|
||||
{
|
||||
base.Update(_dt);
|
||||
|
||||
if ((Time.time - uiCheck) > uiTick)
|
||||
{
|
||||
uiCheck = Time.time;
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-Update 1");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-OnOpen START");
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
|
||||
var entityID = 0;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
{
|
||||
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-OnOpen 1, entityID: " + entityID);
|
||||
}
|
||||
|
||||
if (entityID == 0)
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-OnOpen 2");
|
||||
return;
|
||||
}
|
||||
|
||||
cbxTargetAuraType.SelectedIndex = 0;
|
||||
changeValue(player, 0);
|
||||
|
||||
base.OnOpen();
|
||||
}
|
||||
|
||||
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-BtnConfirm_OnPressed START");
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
int index = cbxTargetAuraType.currentIndex;
|
||||
|
||||
string auraName = "";
|
||||
string remainsName = "";
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
auraName = "FuriousRamsayModFireResist";
|
||||
remainsName = "FuriousRamsayZombieRemainsFire";
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
auraName = "FuriousRamsayModShockResist";
|
||||
remainsName = "FuriousRamsayZombieRemainsShock";
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
auraName = "FuriousRamsayModSmokeResist";
|
||||
remainsName = "FuriousRamsayZombieRemainsSmoke";
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
auraName = "FuriousRamsayModFireShockResist";
|
||||
remainsName = "FuriousRamsayZombieRemainsFireShock";
|
||||
}
|
||||
else if (index == 4)
|
||||
{
|
||||
auraName = "FuriousRamsayModFireShockSmokeResist";
|
||||
remainsName = "FuriousRamsayZombieRemainsFireShockSmoke";
|
||||
}
|
||||
|
||||
string cashText = LabelTotalCash.Text.Replace("[-]", "").Replace("[ffffff]", "").Replace("[]", "c79595"); ;
|
||||
string remainsText = LabelTotalRemains.Text.Replace("[-]", "").Replace("[ffffff]", "").Replace("[]", "c79595"); ;
|
||||
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-BtnConfirm_OnPressed AuraType: " + AuraType);
|
||||
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-BtnConfirm_OnPressed cashText: " + cashText);
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-BtnConfirm_OnPressed remainsText: " + remainsText);
|
||||
|
||||
RebirthUtilities.useInventoryBagItem(player, "casinoCoin", int.Parse(cashText));
|
||||
RebirthUtilities.useInventoryBagItem(player, remainsName, int.Parse(remainsText));
|
||||
|
||||
ItemValue itemReceived = ItemClass.GetItem(auraName, false);
|
||||
|
||||
RebirthUtilities.addToPlayerBag(itemReceived, player, 1);
|
||||
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
}
|
||||
|
||||
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-BtnCancel_OnPressed START");
|
||||
Panel.IsVisible = false;
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
//Log.Out("XUiC_ImmunityModsRebirth-OnClose START");
|
||||
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