Upload from upload_mods.ps1
This commit is contained in:
225
Scripts/GameEvent/ActionOpenWindowRebirth.cs
Normal file
225
Scripts/GameEvent/ActionOpenWindowRebirth.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace GameEvent.SequenceActions
|
||||
{
|
||||
[Preserve]
|
||||
public class ActionOpenWindowRebirth : ActionBaseClientAction
|
||||
{
|
||||
public override void OnClientPerform(Entity target)
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform START");
|
||||
EntityPlayer entityPlayer = target as EntityPlayer;
|
||||
if (entityPlayer != null)
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform 1");
|
||||
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayer as EntityPlayerLocal);
|
||||
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform this.windowName: " + this.windowName);
|
||||
uiforPlayer.windowManager.Open(this.windowName, true, false, true);
|
||||
|
||||
XUiWindowGroup xuiWindowGroup = (XUiWindowGroup)uiforPlayer.windowManager.GetWindow(this.windowName);
|
||||
|
||||
if (xuiWindowGroup != null && this.windowName == "InformationPreview")
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform 2");
|
||||
XUiC_PreviewInformationWindowRebirth childByType = xuiWindowGroup.Controller.GetChildByType<XUiC_PreviewInformationWindowRebirth>();
|
||||
if (childByType != null)
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform 3");
|
||||
childByType.description.Text = Localization.Get(this.description);
|
||||
childByType.description.FontSize = this.descriptionfontsize;
|
||||
childByType.title.Text = Localization.Get(this.title);
|
||||
childByType.quest = this.quest;
|
||||
childByType.gameevent = this.gameevent;
|
||||
childByType.items = this.items;
|
||||
childByType.windowX = this.posX;
|
||||
childByType.windowY = this.posY;
|
||||
childByType.imageWidth = this.imageWidth;
|
||||
childByType.imageHeight = this.imageHeight;
|
||||
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform childByType.description.Text: " + childByType.description.Text);
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform childByType.title.Text: " + childByType.title.Text);
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform childByType.windowX: " + childByType.windowX);
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform childByType.windowY: " + childByType.windowY);
|
||||
|
||||
if (this.previewIndex != -1)
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform this.previewIndex: " + this.previewIndex);
|
||||
childByType.previewIndex = this.previewIndex;
|
||||
|
||||
if (childByType.previewIndex == 999)
|
||||
{
|
||||
//childByType.gameevent = "meet_purge";
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform 4");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform 5");
|
||||
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(entityPlayer.position); // entityPlayer.world.GetPOIAtPosition(entityPlayer.position, false);
|
||||
|
||||
//Log.Out("ActionOpenWindowRebirth-OnClientPerform poiatPosition.name: " + poiatPosition.name);
|
||||
|
||||
if (poiatPosition != null)
|
||||
{
|
||||
string[] parts = poiatPosition.name.Split('.');
|
||||
|
||||
string strPrefabName = parts[0].ToLower();
|
||||
int previewIndex = this.previewIndex;
|
||||
|
||||
if (strPrefabName == "trader_joel")
|
||||
{
|
||||
if (previewIndex == 0 || previewIndex == 4)
|
||||
{
|
||||
childByType.description.Text = childByType.description.Text + "\n\n - [b789f0]Joel[-]";
|
||||
childByType.trader = "joel";
|
||||
}
|
||||
else if (previewIndex == 1)
|
||||
{
|
||||
childByType.title.Text = Localization.Get("meet_isaac_title");
|
||||
image = "isaac";
|
||||
childByType.description.Text = childByType.description.Text.Replace("{0}", "[8bd984]Isaac[-]");
|
||||
childByType.description.Text = childByType.description.Text.Replace("{1}", "He");
|
||||
}
|
||||
}
|
||||
else if (strPrefabName == "trader_rekt")
|
||||
{
|
||||
if (previewIndex == 0 || previewIndex == 4)
|
||||
{
|
||||
childByType.description.Text = childByType.description.Text + "\n\n - [b789f0]Rekt[-]";
|
||||
childByType.trader = "rekt";
|
||||
}
|
||||
else if (previewIndex == 1)
|
||||
{
|
||||
childByType.title.Text = Localization.Get("meet_elias_title");
|
||||
image = "elias";
|
||||
childByType.description.Text = childByType.description.Text.Replace("{0}", "[8bd984]Elias[-]");
|
||||
childByType.description.Text = childByType.description.Text.Replace("{1}", "He");
|
||||
}
|
||||
}
|
||||
else if (strPrefabName == "trader_jen")
|
||||
{
|
||||
if (previewIndex == 0 || previewIndex == 4)
|
||||
{
|
||||
childByType.description.Text = childByType.description.Text + "\n\n - [b789f0]Jen[-]";
|
||||
childByType.trader = "jen";
|
||||
}
|
||||
else if (previewIndex == 1)
|
||||
{
|
||||
childByType.title.Text = Localization.Get("meet_scarlett_title");
|
||||
image = "scarlett";
|
||||
childByType.description.Text = childByType.description.Text.Replace("{0}", "[8bd984]Scarlett[-]");
|
||||
childByType.description.Text = childByType.description.Text.Replace("{1}", "She");
|
||||
}
|
||||
}
|
||||
else if (strPrefabName == "trader_hugh")
|
||||
{
|
||||
if (previewIndex == 0 || previewIndex == 4)
|
||||
{
|
||||
childByType.description.Text = childByType.description.Text + "\n\n - [b789f0]Hugh[-]";
|
||||
childByType.trader = "hugh";
|
||||
}
|
||||
else if (previewIndex == 1)
|
||||
{
|
||||
childByType.title.Text = Localization.Get("meet_helen_title");
|
||||
image = "helen";
|
||||
childByType.description.Text = childByType.description.Text.Replace("{0}", "[8bd984]Helen[-]");
|
||||
childByType.description.Text = childByType.description.Text.Replace("{1}", "She");
|
||||
}
|
||||
}
|
||||
else if (strPrefabName == "trader_bob")
|
||||
{
|
||||
if (previewIndex == 0 || previewIndex == 4)
|
||||
{
|
||||
childByType.description.Text = childByType.description.Text + "\n\n - [b789f0]Bob[-]";
|
||||
childByType.trader = "bob";
|
||||
}
|
||||
else if (previewIndex == 1)
|
||||
{
|
||||
childByType.title.Text = Localization.Get("meet_liam_title");
|
||||
image = "liam";
|
||||
childByType.description.Text = childByType.description.Text.Replace("{0}", "[8bd984]Liam[-]");
|
||||
childByType.description.Text = childByType.description.Text.Replace("{1}", "He");
|
||||
}
|
||||
}
|
||||
if (previewIndex == 4)
|
||||
{
|
||||
childByType.gameevent = "meet_" + childByType.trader;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
childByType.imagePreview.SpriteName = this.image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ParseProperties(DynamicProperties properties)
|
||||
{
|
||||
base.ParseProperties(properties);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropWindowName, ref this.windowName);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropDescription, ref this.description);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropDescriptionFontSize, ref this.descriptionfontsize);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropPosX, ref this.posX);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropPosY, ref this.posY);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropImageWidth, ref this.imageWidth);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropImageHeight, ref this.imageHeight);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropImage, ref this.image);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropTitle, ref this.title);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropQuest, ref this.quest);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropGameEvent, ref this.gameevent);
|
||||
properties.ParseString(ActionOpenWindowRebirth.PropItems, ref this.items);
|
||||
properties.ParseInt(ActionOpenWindowRebirth.PropPreviewIndex, ref this.previewIndex);
|
||||
}
|
||||
|
||||
public override BaseAction CloneChildSettings()
|
||||
{
|
||||
return new ActionOpenWindowRebirth
|
||||
{
|
||||
targetGroup = this.targetGroup,
|
||||
windowName = this.windowName,
|
||||
description = this.description,
|
||||
descriptionfontsize = this.descriptionfontsize,
|
||||
posX = this.posX,
|
||||
posY = this.posY,
|
||||
imageWidth = this.imageWidth,
|
||||
imageHeight = this.imageHeight,
|
||||
image = this.image,
|
||||
title = this.title,
|
||||
items = this.items,
|
||||
previewIndex = this.previewIndex,
|
||||
gameevent = this.gameevent,
|
||||
quest = this.quest
|
||||
};
|
||||
}
|
||||
|
||||
protected string windowName = "";
|
||||
protected string description = "";
|
||||
protected int descriptionfontsize = 30;
|
||||
protected int descriptionPosY = 0;
|
||||
protected string image = "";
|
||||
protected string title = "";
|
||||
protected string quest = "";
|
||||
protected string gameevent = "";
|
||||
protected string items = "";
|
||||
protected int previewIndex = -1;
|
||||
protected int posX = 0;
|
||||
protected int posY = 0;
|
||||
protected int imageWidth = 0;
|
||||
protected int imageHeight = 0;
|
||||
protected static string PropWindowName = "window_name";
|
||||
protected static string PropDescription = "description";
|
||||
protected static string PropDescriptionFontSize = "description_font_size";
|
||||
protected static string PropPosX = "posX";
|
||||
protected static string PropPosY = "posY";
|
||||
protected static string PropImageWidth = "imageWidth";
|
||||
protected static string PropImageHeight = "imageHeight";
|
||||
protected static string PropImage = "image";
|
||||
protected static string PropTitle = "title";
|
||||
protected static string PropQuest = "quest";
|
||||
protected static string PropGameEvent = "gameevent";
|
||||
protected static string PropItems = "items";
|
||||
protected static string PropPreviewIndex = "previewIndex";
|
||||
}
|
||||
}
|
||||
88
Scripts/GameEvent/ActionTeleportToSpecialRebirth.cs
Normal file
88
Scripts/GameEvent/ActionTeleportToSpecialRebirth.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
namespace GameEvent.SequenceActions
|
||||
{
|
||||
public class ActionTeleportToSpecialRebirth : ActionBaseClientAction
|
||||
{
|
||||
public override void OnClientPerform(Entity target)
|
||||
{
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform START");
|
||||
EntityPlayer entityPlayer = target as EntityPlayer;
|
||||
if (entityPlayer != null)
|
||||
{
|
||||
World world = GameManager.Instance.World;
|
||||
Vector3 vector = Vector3.zero;
|
||||
switch (this.pointType)
|
||||
{
|
||||
case ActionTeleportToSpecialRebirth.SpecialPointTypes.Bedroll:
|
||||
if (entityPlayer.SpawnPoints.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
vector = entityPlayer.SpawnPoints[0];
|
||||
break;
|
||||
case ActionTeleportToSpecialRebirth.SpecialPointTypes.Landclaim:
|
||||
{
|
||||
PersistentPlayerData playerDataFromEntityID = GameManager.Instance.persistentPlayers.GetPlayerDataFromEntityID(target.entityId);
|
||||
if (playerDataFromEntityID.LPBlocks == null || playerDataFromEntityID.LPBlocks.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
vector = playerDataFromEntityID.LPBlocks[0];
|
||||
break;
|
||||
}
|
||||
case ActionTeleportToSpecialRebirth.SpecialPointTypes.Backpack:
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform BACKPACK 0");
|
||||
Vector3i lastDroppedBackpackPosition = entityPlayer.GetLastDroppedBackpackPosition();
|
||||
if (lastDroppedBackpackPosition == Vector3i.zero)
|
||||
{
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform BACKPACK 1");
|
||||
return;
|
||||
}
|
||||
vector = lastDroppedBackpackPosition;
|
||||
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform BACKPACK 2, vector: " + vector);
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.GetBackPackContent(1.5f, (EntityPlayerLocal)target, vector));
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform BACKPACK 3");
|
||||
|
||||
break;
|
||||
}
|
||||
if (vector.y > 0f)
|
||||
{
|
||||
//Log.Out("ActionTeleportToSpecialRebirth-OnClientPerform 1");
|
||||
vector += Vector3.up * 2f;
|
||||
if (entityPlayer.isEntityRemote)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.Clients.ForEntityId(entityPlayer.entityId).SendPackage(NetPackageManager.GetPackage<NetPackageTeleportPlayer>().Setup(vector, null, false));
|
||||
return;
|
||||
}
|
||||
((EntityPlayerLocal)entityPlayer).PlayerUI.windowManager.CloseAllOpenWindows(null, false);
|
||||
((EntityPlayerLocal)entityPlayer).TeleportToPosition(vector, false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ParseProperties(DynamicProperties properties)
|
||||
{
|
||||
base.ParseProperties(properties);
|
||||
properties.ParseEnum<ActionTeleportToSpecialRebirth.SpecialPointTypes>(ActionTeleportToSpecialRebirth.PropSpecialType, ref this.pointType);
|
||||
}
|
||||
|
||||
public override BaseAction CloneChildSettings()
|
||||
{
|
||||
return new ActionTeleportToSpecialRebirth
|
||||
{
|
||||
targetGroup = this.targetGroup,
|
||||
pointType = this.pointType
|
||||
};
|
||||
}
|
||||
|
||||
protected ActionTeleportToSpecialRebirth.SpecialPointTypes pointType;
|
||||
protected static string PropSpecialType = "special_type";
|
||||
|
||||
protected enum SpecialPointTypes
|
||||
{
|
||||
Bedroll,
|
||||
Landclaim,
|
||||
Backpack
|
||||
}
|
||||
}
|
||||
}
|
||||
82
Scripts/GameEvent/RequirementIsOptionValid.cs
Normal file
82
Scripts/GameEvent/RequirementIsOptionValid.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
#nullable disable
|
||||
namespace GameEvent.SequenceRequirements
|
||||
{
|
||||
[Preserve]
|
||||
public class RequirementIsOptionValid : BaseRequirement
|
||||
{
|
||||
[PublicizedFrom(EAccessModifier.Protected)]
|
||||
public string optionType = "";
|
||||
[PublicizedFrom(EAccessModifier.Protected)]
|
||||
public string optionName;
|
||||
[PublicizedFrom(EAccessModifier.Protected)]
|
||||
public string optionValue;
|
||||
|
||||
public static string PropOptionType = "option_type";
|
||||
public static string PropOptionName = "option_name";
|
||||
public static string PropOptionValue = "option_value";
|
||||
|
||||
[PublicizedFrom(EAccessModifier.Protected)]
|
||||
public override void OnInit()
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-OnInit START");
|
||||
}
|
||||
|
||||
public override bool CanPerform(Entity target)
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-CanPerform optionType: " + this.optionType);
|
||||
//Log.Out("RequirementIsOptionValid-CanPerform optionName: " + this.optionName);
|
||||
//Log.Out("RequirementIsOptionValid-CanPerform optionValue: " + this.optionValue);
|
||||
|
||||
bool result = RebirthUtilities.IsOptionAvailable(this.optionType, this.optionName, this.optionValue);
|
||||
|
||||
if (this.Invert)
|
||||
{
|
||||
result = !result;
|
||||
}
|
||||
|
||||
//Log.Out("RequirementIsOptionValid-CanPerform result: " + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void ParseProperties(DynamicProperties properties)
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-ParseProperties START");
|
||||
base.ParseProperties(properties);
|
||||
if (properties.Values.ContainsKey(RequirementIsOptionValid.PropOptionType))
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-ParseProperties 1");
|
||||
this.optionType = properties.Values[RequirementIsOptionValid.PropOptionType];
|
||||
}
|
||||
if (properties.Values.ContainsKey(RequirementIsOptionValid.PropOptionName))
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-ParseProperties 2");
|
||||
this.optionName = properties.Values[RequirementIsOptionValid.PropOptionName];
|
||||
}
|
||||
if (properties.Values.ContainsKey(RequirementIsOptionValid.PropOptionValue))
|
||||
{
|
||||
//Log.Out("RequirementIsOptionValid-ParseProperties 3");
|
||||
this.optionValue = properties.Values[RequirementIsOptionValid.PropOptionValue];
|
||||
}
|
||||
}
|
||||
|
||||
[PublicizedFrom(EAccessModifier.Protected)]
|
||||
public override BaseRequirement CloneChildSettings()
|
||||
{
|
||||
RequirementIsOptionValid RequirementIsOptionValid = new RequirementIsOptionValid();
|
||||
RequirementIsOptionValid.optionType = this.optionType;
|
||||
RequirementIsOptionValid.optionName = this.optionName;
|
||||
RequirementIsOptionValid.optionValue = this.optionValue;
|
||||
RequirementIsOptionValid.Invert = this.Invert;
|
||||
|
||||
return (BaseRequirement)RequirementIsOptionValid;
|
||||
}
|
||||
|
||||
[PublicizedFrom(EAccessModifier.Private)]
|
||||
static RequirementIsOptionValid()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user