43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
namespace Harmony.XUiC_CompanionEntryListPatches
|
|
{
|
|
[HarmonyPatch(typeof(XUiC_CompanionEntryList))]
|
|
[HarmonyPatch("RefreshPartyList")]
|
|
public class RefreshPartyListPatch
|
|
{
|
|
public static bool Prefix(XUiC_CompanionEntryList __instance)
|
|
{
|
|
int index1 = 0;
|
|
EntityPlayer entityPlayer = (EntityPlayer)__instance.xui.playerUI.entityPlayer;
|
|
int num = 0;
|
|
|
|
if (entityPlayer.Party != null)
|
|
{
|
|
num = (entityPlayer.Party.MemberList.Count - 1) * 40;
|
|
}
|
|
|
|
__instance.viewComponent.Position = new Vector2i(__instance.viewComponent.Position.x, (int)__instance.yOffset - num);
|
|
__instance.viewComponent.UiTransform.localPosition = new Vector3((float)__instance.viewComponent.Position.x, (float)__instance.viewComponent.Position.y);
|
|
if (entityPlayer.Companions != null)
|
|
{
|
|
for (int index2 = 0; index2 < entityPlayer.Companions.Count; ++index2)
|
|
{
|
|
EntityAlive companion = entityPlayer.Companions[index2];
|
|
if (index1 < __instance.entryList.Count)
|
|
__instance.entryList[index1++].SetCompanion(companion);
|
|
else
|
|
break;
|
|
}
|
|
for (; index1 < __instance.entryList.Count; ++index1)
|
|
__instance.entryList[index1].SetCompanion((EntityAlive)null);
|
|
}
|
|
else
|
|
{
|
|
for (int index3 = 0; index3 < __instance.entryList.Count; ++index3)
|
|
__instance.entryList[index3].SetCompanion((EntityAlive)null);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|