1032 lines
29 KiB
C#
1032 lines
29 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
// Token: 0x020000BA RID: 186
|
|
public class ItemLabelGrid : MonoBehaviour
|
|
{
|
|
// Token: 0x060011B4 RID: 4532 RVA: 0x0015A7E6 File Offset: 0x001589E6
|
|
private void Awake()
|
|
{
|
|
this.targetAlpha = -1f;
|
|
}
|
|
|
|
// Token: 0x060011B5 RID: 4533 RVA: 0x0015A7F3 File Offset: 0x001589F3
|
|
private void Start()
|
|
{
|
|
this.tr = base.transform;
|
|
this.farPos = new Vector3(-100000f, -1000000f, 0f);
|
|
}
|
|
|
|
// Token: 0x060011B6 RID: 4534 RVA: 0x0015A81C File Offset: 0x00158A1C
|
|
public Vector3 WorldToUISpace(Vector3 screenPos)
|
|
{
|
|
Vector2 vector;
|
|
RectTransformUtility.ScreenPointToLocalPointInRectangle(this.canvas.transform as RectTransform, screenPos, this.canvas.worldCamera, out vector);
|
|
return this.canvas.transform.TransformPoint(vector);
|
|
}
|
|
|
|
// Token: 0x060011B7 RID: 4535 RVA: 0x0015A868 File Offset: 0x00158A68
|
|
public Vector3 WorldToUISpaceAnchor(Vector3 screenPos)
|
|
{
|
|
Vector3 vector = screenPos;
|
|
vector.z = 0f;
|
|
vector.x = vector.x * (Links.x.canvasRT.sizeDelta.x / (float)Screen.width) - Links.x.canvasRT.sizeDelta.x / 2f;
|
|
vector.y = vector.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x060011B8 RID: 4536 RVA: 0x0015A90C File Offset: 0x00158B0C
|
|
public void Close()
|
|
{
|
|
this.targetAlpha = -1f;
|
|
}
|
|
|
|
// Token: 0x060011B9 RID: 4537 RVA: 0x0015A91C File Offset: 0x00158B1C
|
|
public void Controller(bool joy)
|
|
{
|
|
if (joy)
|
|
{
|
|
int controllerSprite = Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName);
|
|
this.controllerIcon.text = "<sprite=" + controllerSprite.ToString() + ">";
|
|
this.controllerIcon.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
this.controllerIcon.enabled = true;
|
|
return;
|
|
}
|
|
this.controllerIcon.text = "";
|
|
this.controllerIcon.enabled = false;
|
|
}
|
|
|
|
// Token: 0x060011BA RID: 4538 RVA: 0x0015A9C0 File Offset: 0x00158BC0
|
|
public void ItemLabels()
|
|
{
|
|
if (Links.x.main)
|
|
{
|
|
this.items = Links.x.inventory.groundBag.inRangeItems;
|
|
float num = this.ySize;
|
|
float num2 = this.rowThreshhold;
|
|
float num3 = this.closeThreshhold;
|
|
if (!Links.x.worldCamera.orthographic)
|
|
{
|
|
num = this.ySizePerspective;
|
|
num3 = this.closeThreshholdPerspective * ((float)Screen.width / 3200f);
|
|
num2 = this.rowThreshholdPerspective * ((float)Screen.width / 3200f);
|
|
}
|
|
Item item5 = null;
|
|
Vector3 vector = Vector3.zero;
|
|
Vector3 vector2 = vector;
|
|
Vector3 vector3 = vector;
|
|
Vector3 vector4 = vector;
|
|
Vector3 vector5 = new Vector3(0f, 0.5f, 0f);
|
|
this.screenY.Clear();
|
|
this.worldVector.Clear();
|
|
Vector3 vector6 = vector5;
|
|
bool flag = false;
|
|
if (flag)
|
|
{
|
|
Debug.Log("-----------------------------");
|
|
}
|
|
int count = this.items.Count;
|
|
if (count > 0 && Links.x.inventory.groundBag.canOpen && !Records.x.removeControls)
|
|
{
|
|
this.targetAlpha = 1f;
|
|
if (this.currentAlpha < 0f && Links.x.inventory.groundBag.toggle)
|
|
{
|
|
this.currentAlpha = 0f;
|
|
}
|
|
}
|
|
if (count == 0 || Records.x.removeControls)
|
|
{
|
|
this.targetAlpha = -1f;
|
|
}
|
|
if (Records.x.inMenus)
|
|
{
|
|
this.targetAlpha = -1f;
|
|
}
|
|
if (Links.x.inventory.groundBag.collectorUpdate)
|
|
{
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
if (this.items[i].label)
|
|
{
|
|
this.items[i].label.worldPosition = Vector3.zero;
|
|
}
|
|
}
|
|
}
|
|
Links.x.inventory.groundBag.collectorUpdate = false;
|
|
if (Links.x.inventory.groundBag.collectorUpdateFromTrigger && this.triggerTimer == 0f)
|
|
{
|
|
this.triggerTimer = 0f;
|
|
}
|
|
Links.x.inventory.groundBag.collectorUpdateFromTrigger = false;
|
|
if (Time.timeSinceLevelLoad > this.triggerTimer + 0.5f && this.triggerTimer != 0f)
|
|
{
|
|
this.triggerTimer = 0f;
|
|
}
|
|
bool flag2 = false;
|
|
float num4 = 1f;
|
|
float num5 = 1f;
|
|
bool flag3 = false;
|
|
Vector3 zero = Vector3.zero;
|
|
if (Links.x.diorama && Links.x.diorama.cameraDirection)
|
|
{
|
|
Links.x.diorama.cameraDirection.rotation * Vector3.forward;
|
|
}
|
|
if (count > 0 && this.items[0].dropNode != null)
|
|
{
|
|
Vector3 vector7 = (Vector3)this.items[0].dropNode.position;
|
|
Vector3 vector8 = vector7 + new Vector3(0f, 0f, -1f) * Records.x.nodeSize;
|
|
num4 = Links.x.worldCamera.WorldToScreenPoint(vector8).x - Links.x.worldCamera.WorldToScreenPoint(vector7).x;
|
|
num5 = Links.x.worldCamera.WorldToScreenPoint(vector8).y - Links.x.worldCamera.WorldToScreenPoint(vector7).y;
|
|
}
|
|
this.checkScreenEdges = true;
|
|
float num6 = 0f;
|
|
float num7 = 0f;
|
|
if (Links.x.worldCamera.orthographic)
|
|
{
|
|
this.checkScreenEdges = false;
|
|
}
|
|
else
|
|
{
|
|
this.screenMinX = 0f - this.canvasRT.sizeDelta.x / 2f;
|
|
this.screenMaxX = this.canvasRT.sizeDelta.x / 2f;
|
|
this.screenMinY = 0f - this.canvasRT.sizeDelta.y / 2f;
|
|
this.screenMaxY = this.canvasRT.sizeDelta.y / 2f;
|
|
num6 = Links.x.worldCamera.transform.rotation.eulerAngles.x;
|
|
}
|
|
if (this.checkScreenEdges && num6 > 45f)
|
|
{
|
|
num7 = 20f * ((float)Screen.width / 1920f);
|
|
}
|
|
if (!Links.x.main)
|
|
{
|
|
return;
|
|
}
|
|
for (int j = 0; j < count; j++)
|
|
{
|
|
item5 = this.items[j];
|
|
if (item5 && item5.label)
|
|
{
|
|
if (Links.x.joy)
|
|
{
|
|
if (!Links.x.partyColliderAdventure.InRange(item5))
|
|
{
|
|
item5.label.txt.color = this.outOfRange;
|
|
}
|
|
else
|
|
{
|
|
item5.label.txt.color = item5.label.textColor;
|
|
}
|
|
}
|
|
if (Links.x.mk)
|
|
{
|
|
if (Links.x.gameplay.item && Links.x.gameplay.hitItem && !Links.x.gameplay.uiHover && count > 1)
|
|
{
|
|
if (item5 == Links.x.gameplay.item)
|
|
{
|
|
item5.label.txt.color = this.highlightColor;
|
|
}
|
|
else
|
|
{
|
|
item5.label.txt.color = item5.label.textColor;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item5.label.txt.color = item5.label.textColor;
|
|
}
|
|
}
|
|
if (item5.label.active && item5.label.gameObject.activeSelf)
|
|
{
|
|
if (flag2)
|
|
{
|
|
if (item5.label.worldPosition == Vector3.zero)
|
|
{
|
|
vector = this.farPos;
|
|
item5.label.screenPosition = this.farPos;
|
|
item5.label.rt.localPosition = this.WorldToUISpaceAnchor(this.farPos);
|
|
}
|
|
else
|
|
{
|
|
vector = Links.x.worldCamera.WorldToScreenPoint(item5.label.worldPosition);
|
|
item5.label.screenPosition = vector;
|
|
item5.label.rt.localPosition = this.WorldToUISpaceAnchor(vector);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Vector3 position = item5.tr.position;
|
|
vector6 = position;
|
|
vector6.y = (vector6.y + vector5.y).ToNearestMultiple(num, 0);
|
|
vector6.x = vector6.x.ToNearestMultiple(num, 0);
|
|
vector6.z = vector6.z.ToNearestMultiple(num, 0);
|
|
vector = Links.x.worldCamera.WorldToScreenPoint(vector6);
|
|
vector.y += num7;
|
|
this.worldVector.Add(vector6);
|
|
bool flag4 = false;
|
|
this.rowItems.Clear();
|
|
this.spotTried.Clear();
|
|
int num8 = 0;
|
|
int num9 = 0;
|
|
int num10 = 5;
|
|
int num11 = 1;
|
|
int num12 = this.screenY.Count;
|
|
for (int k = 0; k < num12; k++)
|
|
{
|
|
float num13 = this.screenY[k] - vector.y;
|
|
if (num13 < 0f)
|
|
{
|
|
num13 *= -1f;
|
|
}
|
|
if (num13 < num2)
|
|
{
|
|
num8++;
|
|
}
|
|
if (num8 > num10)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
int num14 = 0;
|
|
while (num14 < count && num9 < 5)
|
|
{
|
|
if (this.items[num14] && this.SubtractVectors(this.items[num14].tr.position, position).sqrMagnitude < num3 * num3)
|
|
{
|
|
num9++;
|
|
}
|
|
num14++;
|
|
}
|
|
if (num8 > num10 && num9 >= num11)
|
|
{
|
|
bool flag5 = false;
|
|
num12 = this.screenY.Count;
|
|
for (int l = 2; l < 8; l++)
|
|
{
|
|
if (!flag5)
|
|
{
|
|
vector6 = this.AddVectors(position, vector5);
|
|
if (!flag3)
|
|
{
|
|
Vector3 vector9 = vector6;
|
|
vector9.x = vector9.x.ToNearestMultiple(num * (float)l, 0);
|
|
vector9.z = vector9.z.ToNearestMultiple(num * (float)l, 0);
|
|
vector9.y = (vector9.y + vector5.y).ToNearestMultiple(num, 0);
|
|
vector = Links.x.worldCamera.WorldToScreenPoint(vector9);
|
|
vector.y += num7;
|
|
}
|
|
else
|
|
{
|
|
vector.x += num4;
|
|
vector.y += num5;
|
|
}
|
|
num8 = 0;
|
|
for (int m = 0; m < num12; m++)
|
|
{
|
|
float num13 = this.screenY[m] - vector.y;
|
|
if (num13 < 0f)
|
|
{
|
|
num13 *= -1f;
|
|
}
|
|
if (num13 < num2)
|
|
{
|
|
num8++;
|
|
}
|
|
if (num8 > num10 + 1)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
if (num8 <= num10)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
num12 = this.screenY.Count;
|
|
for (int n = 0; n < num12; n++)
|
|
{
|
|
float num13 = this.screenY[n] - vector.y;
|
|
if (num13 < 0f)
|
|
{
|
|
num13 *= -1f;
|
|
}
|
|
if (num13 < num2)
|
|
{
|
|
flag4 = true;
|
|
this.rowItems.Add(this.items[n]);
|
|
this.spotTried.Add(false);
|
|
}
|
|
}
|
|
this.screenY.Add(vector.y);
|
|
item5.label.screenPosition = vector;
|
|
if (!flag4 && this.checkScreenEdges && !this.InScreenSpace(item5.label.rt.localPosition, item5.label.rt.sizeDelta))
|
|
{
|
|
flag4 = false;
|
|
}
|
|
if (!flag4)
|
|
{
|
|
if (count == 1)
|
|
{
|
|
vector = Links.x.worldCamera.WorldToScreenPoint(item5.tr.position + new Vector3(0f, 1.5f, 0f));
|
|
vector.y += num7;
|
|
}
|
|
item5.label.rt.localPosition = this.WorldToUISpaceAnchor(vector);
|
|
item5.label.uiPosition = item5.label.rt.localPosition;
|
|
item5.label.worldPosition = Links.x.worldCamera.ScreenToWorldPoint(vector);
|
|
if (flag)
|
|
{
|
|
string text = "NO PROBLEMS ";
|
|
Item item2 = item5;
|
|
Debug.Log(text + ((item2 != null) ? item2.ToString() : null) + " " + vector.z.ToString());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Vector3 vector10 = this.WorldToUISpaceAnchor(vector);
|
|
item5.label.rt.localPosition = vector10;
|
|
bool flag6 = false;
|
|
float x = item5.label.rt.sizeDelta.x;
|
|
bool flag7 = true;
|
|
num12 = this.rowItems.Count;
|
|
if (num9 <= 4)
|
|
{
|
|
for (int num15 = 0; num15 < num12; num15++)
|
|
{
|
|
Item item3 = this.rowItems[num15];
|
|
if (item3 && item3 != item5 && item3.label)
|
|
{
|
|
vector2 = item5.label.rt.anchoredPosition;
|
|
if (this.IsPointInBounds(vector2, x, item3.label.uiPosition, item3.label.rt.sizeDelta.x))
|
|
{
|
|
flag7 = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (flag7 && this.checkScreenEdges)
|
|
{
|
|
if (this.rowItems.Count == 0)
|
|
{
|
|
if (!this.InScreenSpace(item5.label.rt.localPosition, item5.label.rt.sizeDelta))
|
|
{
|
|
flag7 = false;
|
|
}
|
|
}
|
|
else if (!this.InScreenSpace(item5.label.rt.localPosition, item5.label.rt.sizeDelta))
|
|
{
|
|
flag7 = false;
|
|
}
|
|
}
|
|
if (flag7)
|
|
{
|
|
flag6 = true;
|
|
item5.label.uiPosition = this.WorldToUISpaceAnchor(vector);
|
|
item5.label.screenPosition = vector;
|
|
item5.label.worldPosition = Links.x.worldCamera.ScreenToWorldPoint(vector);
|
|
}
|
|
}
|
|
for (int num16 = 0; num16 < num12; num16++)
|
|
{
|
|
if (!flag6)
|
|
{
|
|
int num17 = -1;
|
|
float num18 = float.PositiveInfinity;
|
|
bool flag8 = false;
|
|
for (int num19 = 0; num19 < num12; num19++)
|
|
{
|
|
Item item3 = this.rowItems[num19];
|
|
if (item3 != item5 && !this.spotTried[num19] && item3.label)
|
|
{
|
|
float num20 = item3.label.screenPosition.x - vector.x;
|
|
if (num20 < 0f)
|
|
{
|
|
num20 *= -1f;
|
|
}
|
|
if (num20 < num18)
|
|
{
|
|
num17 = num19;
|
|
num18 = num20;
|
|
flag8 = item3.label.screenPosition.x >= vector.x;
|
|
}
|
|
}
|
|
}
|
|
if (num17 != -1)
|
|
{
|
|
this.spotTried[num17] = true;
|
|
Item item4 = this.rowItems[num17];
|
|
bool flag9 = true;
|
|
bool flag10 = true;
|
|
float num21 = item4.label.rt.sizeDelta.x;
|
|
for (int num22 = 0; num22 < 2; num22++)
|
|
{
|
|
flag7 = true;
|
|
if (num22 == 0)
|
|
{
|
|
vector4 = item4.label.uiPosition;
|
|
float num23 = num21;
|
|
vector4.x += num23 / 2f;
|
|
vector4.x += x / 2f;
|
|
vector4.x += this.padding;
|
|
vector3 = vector4;
|
|
}
|
|
else
|
|
{
|
|
vector4 = item4.label.uiPosition;
|
|
float num23 = num21;
|
|
vector4.x -= num23 / 2f;
|
|
vector4.x -= x / 2f;
|
|
vector4.x -= this.padding;
|
|
vector2 = vector4;
|
|
}
|
|
for (int num24 = 0; num24 < num12; num24++)
|
|
{
|
|
if (flag7)
|
|
{
|
|
Item item3 = this.rowItems[num24];
|
|
if (item3 && item3 != item5 && item3.label)
|
|
{
|
|
num21 = item3.label.rt.sizeDelta.x;
|
|
if (this.IsPointInBounds(vector4, x, item3.label.uiPosition, num21))
|
|
{
|
|
flag7 = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (num22 == 0)
|
|
{
|
|
flag10 = flag7;
|
|
if (flag10 && this.checkScreenEdges && !this.InScreenSpace(vector3, item5.label.rt.sizeDelta))
|
|
{
|
|
flag10 = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
flag9 = flag7;
|
|
if (flag9 && this.checkScreenEdges && !this.InScreenSpace(vector2, item5.label.rt.sizeDelta))
|
|
{
|
|
flag9 = false;
|
|
}
|
|
}
|
|
}
|
|
Vector3 vector11 = vector2;
|
|
if (flag10 && flag9)
|
|
{
|
|
if (flag8)
|
|
{
|
|
vector11 = vector2;
|
|
}
|
|
else
|
|
{
|
|
vector11 = vector3;
|
|
}
|
|
flag7 = true;
|
|
}
|
|
else if (flag9 && !flag10)
|
|
{
|
|
vector11 = vector2;
|
|
flag7 = true;
|
|
}
|
|
else if (flag10 && !flag9)
|
|
{
|
|
vector11 = vector3;
|
|
flag7 = true;
|
|
}
|
|
else
|
|
{
|
|
flag7 = false;
|
|
}
|
|
if (flag7)
|
|
{
|
|
flag6 = true;
|
|
item5.label.rt.localPosition = vector11;
|
|
item5.label.screenPosition = Links.x.menuCamera.WorldToScreenPoint(vector11);
|
|
item5.label.uiPosition = vector11;
|
|
item5.label.worldPosition = Links.x.worldCamera.ScreenToWorldPoint(item5.label.screenPosition);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!flag6)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item5.label.screenPosition = this.farPos;
|
|
item5.label.worldPosition = Vector3.zero;
|
|
}
|
|
}
|
|
}
|
|
if (Links.x.inventory.groundBag.toggle)
|
|
{
|
|
this.GetCloseLabel(item5, false);
|
|
if ((Links.x.gameplay.interactStart || Links.x.gameplay.actionStart) && this.closeLabel && Links.x.inventory.groundBag.toggle)
|
|
{
|
|
this.closeLabel.Clicked(Links.x.main);
|
|
this.GetCloseLabel(item5, true);
|
|
if (this.closeLabel)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.closeLabel.gameObject);
|
|
}
|
|
}
|
|
}
|
|
if (Links.x.joy)
|
|
{
|
|
if (Links.x.partyColliderAdventure.closestItem)
|
|
{
|
|
int num25 = this.items.IndexOf(Links.x.partyColliderAdventure.closestItem);
|
|
if (num25 > -1 && this.items[num25].label)
|
|
{
|
|
this.controllerRT.anchoredPosition3D = this.items[num25].label.rt.anchoredPosition3D + new Vector3(0f, this.items[num25].label.rt.sizeDelta.y / 2f, 0f) + new Vector3(this.items[num25].label.rt.sizeDelta.x / 2f * -1f, 0f, 0f);
|
|
this.controllerIcon.enabled = true;
|
|
int childCount = this.controllerRT.transform.parent.childCount;
|
|
if (this.controllerRT.transform.GetSiblingIndex() < childCount - 1)
|
|
{
|
|
this.controllerRT.gameObject.transform.SetAsLastSibling();
|
|
}
|
|
}
|
|
}
|
|
else if (this.controllerIcon.enabled)
|
|
{
|
|
this.controllerIcon.enabled = false;
|
|
}
|
|
}
|
|
Links.x.inventory.groundBag.firstOpen = false;
|
|
if (Links.x.joy)
|
|
{
|
|
bool flag11 = true;
|
|
if (Links.x.gameplay.dockDown && Links.x.gaia.sceneLoaded && !Links.x.gameplay.gameFeedScrolling && flag11)
|
|
{
|
|
this.characters = Links.x.diorama.characters;
|
|
Vector3 currentPosition = Links.x.main.currentPosition;
|
|
float num26 = Links.x.main.stats.SightRadius(false, false, true);
|
|
float num27 = num26 * num26;
|
|
float num28 = 0f;
|
|
if (!Links.x.worldCamera.orthographic)
|
|
{
|
|
num28 = 1f;
|
|
}
|
|
bool flag12 = false;
|
|
for (int num29 = 0; num29 < this.characters.Count; num29++)
|
|
{
|
|
Character character = this.characters[num29];
|
|
if (character)
|
|
{
|
|
bool flag13 = true;
|
|
if (!character.dead && character.visible == 1 && !character.party && (character.currentPosition - currentPosition).sqrMagnitude < num27)
|
|
{
|
|
RectTransform rectTransform = null;
|
|
if (!character.hasInfoCard)
|
|
{
|
|
character.hasInfoCard = true;
|
|
this.characterInfoObj.Add(character);
|
|
GameObject gameObject;
|
|
if (this.openCharacterInfo.Count > 0)
|
|
{
|
|
rectTransform = this.openCharacterInfo[0];
|
|
gameObject = rectTransform.gameObject;
|
|
this.openCharacterInfo.RemoveAt(0);
|
|
}
|
|
else
|
|
{
|
|
gameObject = Object.Instantiate<GameObject>(this.characterInfoPrefab, Vector3.zero, Quaternion.Euler(Vector3.zero), this.characterDetailsParent);
|
|
rectTransform = gameObject.GetComponent<RectTransform>();
|
|
}
|
|
gameObject.SetActive(true);
|
|
this.characterInfo.Add(rectTransform);
|
|
this.str.Clear();
|
|
this.str.Append(character.stats.GetDisplayName());
|
|
if (Records.x.InCombat(false) && (character.hostility >= 2 || character.attackingUntilBribe))
|
|
{
|
|
this.str.Append(" (");
|
|
this.str.Append(character.stats.HealthCurrent());
|
|
this.str.Append("/");
|
|
this.str.Append(character.stats.HealthMax());
|
|
this.str.Append(")");
|
|
}
|
|
gameObject.GetComponent<TextMeshProUGUI>().text = this.str.ToString();
|
|
}
|
|
else
|
|
{
|
|
int num30 = this.characterInfoObj.IndexOf(character);
|
|
if (num30 > -1)
|
|
{
|
|
rectTransform = this.characterInfo[num30];
|
|
}
|
|
}
|
|
if (rectTransform)
|
|
{
|
|
flag13 = false;
|
|
Vector3 vector12 = Links.x.worldCamera.WorldToScreenPoint(character.body.GetNeck().position + new Vector3(0f, 1f - num28, 0f));
|
|
vector12.z = 0f;
|
|
vector12.x = vector12.x * (1920f / (float)Screen.width) - 960f;
|
|
vector12.y = vector12.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
|
|
rectTransform.localPosition = vector12;
|
|
}
|
|
}
|
|
if (character.hasInfoCard && flag13)
|
|
{
|
|
character.hasInfoCard = false;
|
|
int num31 = this.characterInfoObj.IndexOf(character);
|
|
if (num31 > -1)
|
|
{
|
|
this.characterInfo[num31].gameObject.SetActive(false);
|
|
this.openCharacterInfo.Add(this.characterInfo[num31]);
|
|
this.characterInfoObj[num31] = null;
|
|
this.characterInfo[num31] = null;
|
|
flag12 = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int num32 = 0; num32 < this.characterInfoObj.Count; num32++)
|
|
{
|
|
if (!this.characterInfoObj[num32])
|
|
{
|
|
if (this.characterInfo[num32])
|
|
{
|
|
this.characterInfo[num32].gameObject.SetActive(false);
|
|
this.openCharacterInfo.Add(this.characterInfo[num32]);
|
|
this.characterInfo[num32] = null;
|
|
}
|
|
flag12 = true;
|
|
}
|
|
}
|
|
for (int num33 = 0; num33 < this.characterInfo.Count; num33++)
|
|
{
|
|
if (!this.characterInfoObj[num33])
|
|
{
|
|
this.characterInfoObj[num33] = null;
|
|
flag12 = true;
|
|
}
|
|
}
|
|
if (flag12)
|
|
{
|
|
this.characterInfo.RemoveAll((RectTransform item) => item == null);
|
|
this.characterInfoObj.RemoveAll((Character item) => item == null);
|
|
}
|
|
}
|
|
if (Links.x.gameplay.dockUp)
|
|
{
|
|
for (int num34 = 0; num34 < this.characterInfoObj.Count; num34++)
|
|
{
|
|
if (!this.characterInfoObj[num34])
|
|
{
|
|
this.characterInfoObj[num34].hasInfoCard = false;
|
|
}
|
|
}
|
|
for (int num35 = 0; num35 < this.characterInfo.Count; num35++)
|
|
{
|
|
if (this.characterInfo[num35])
|
|
{
|
|
this.openCharacterInfo.Add(this.characterInfo[num35]);
|
|
this.characterInfo[num35].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
this.characterInfo.Clear();
|
|
this.characterInfoObj.Clear();
|
|
}
|
|
}
|
|
if ((Links.x.mk || !Links.x.gaia.sceneLoaded || Records.x.removeControls || Records.x.dialogue || Records.x.inMenus || Records.x.typing || Links.x.gameplay.gameFeedScrolling) && this.characterInfo.Count > 0)
|
|
{
|
|
for (int num36 = 0; num36 < this.characterInfo.Count; num36++)
|
|
{
|
|
this.openCharacterInfo.Add(this.characterInfo[num36]);
|
|
this.characterInfo[num36].gameObject.SetActive(false);
|
|
}
|
|
this.characterInfo.Clear();
|
|
this.characterInfoObj.Clear();
|
|
}
|
|
}
|
|
if (this.targetAlpha == 1f)
|
|
{
|
|
this.currentAlpha = Mathf.Lerp(this.currentAlpha, this.targetAlpha, Time.unscaledDeltaTime * 5f);
|
|
if (this.currentAlpha >= 0f)
|
|
{
|
|
this.canvasGroup.alpha = this.currentAlpha;
|
|
}
|
|
else
|
|
{
|
|
this.canvasGroup.alpha = 0f;
|
|
}
|
|
if (this.currentAlpha > 0.5f && !this.canvasGroup.interactable)
|
|
{
|
|
this.canvasGroup.interactable = true;
|
|
this.canvasGroup.blocksRaycasts = true;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.currentAlpha = Mathf.Lerp(this.currentAlpha, this.targetAlpha, Time.unscaledDeltaTime * 5f);
|
|
if (Records.x.inMenus)
|
|
{
|
|
this.currentAlpha = -1f;
|
|
}
|
|
if (this.currentAlpha >= 0f)
|
|
{
|
|
this.canvasGroup.alpha = this.currentAlpha;
|
|
}
|
|
else
|
|
{
|
|
this.canvasGroup.alpha = 0f;
|
|
}
|
|
if (this.currentAlpha <= 0.5f && this.canvasGroup.interactable)
|
|
{
|
|
this.canvasGroup.interactable = false;
|
|
this.canvasGroup.blocksRaycasts = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060011BB RID: 4539 RVA: 0x0015C40C File Offset: 0x0015A60C
|
|
private void GetCloseLabel(Item item, bool clicked)
|
|
{
|
|
Vector2 zero = Vector2.zero;
|
|
Links.x.fellowship.direction;
|
|
if (Links.x.inventory.groundBag.firstOpen)
|
|
{
|
|
this.closeLabel = null;
|
|
}
|
|
else if (this.closeLabel)
|
|
{
|
|
if (this.closeLabel.label)
|
|
{
|
|
Vector2 anchoredPosition = this.closeLabel.label.rt.anchoredPosition;
|
|
}
|
|
else
|
|
{
|
|
this.closeLabel = null;
|
|
}
|
|
}
|
|
float num = float.PositiveInfinity;
|
|
Vector3 position = Links.x.main.tr.position;
|
|
Item item2 = this.closeLabel;
|
|
float magnitude = Links.x.fellowship.direction.magnitude;
|
|
if (Links.x.inventory.groundBag.firstOpen || clicked)
|
|
{
|
|
this.procTime = Time.timeSinceLevelLoad;
|
|
for (int i = 0; i < this.items.Count; i++)
|
|
{
|
|
item = this.items[i];
|
|
if (item && item.label)
|
|
{
|
|
float sqrMagnitude = (position - item.tr.position).sqrMagnitude;
|
|
if (sqrMagnitude < num)
|
|
{
|
|
num = sqrMagnitude;
|
|
this.closeLabel = item;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!Links.x.inventory.groundBag.firstOpen && this.closeLabel && Time.timeSinceLevelLoad > this.procTime + 0.8f * (1f - magnitude) && magnitude > 0.3f)
|
|
{
|
|
bool flag = false;
|
|
if (Links.x.fellowship.direction.y > 0f)
|
|
{
|
|
flag = true;
|
|
}
|
|
float y = this.closeLabel.label.uiPosition.y;
|
|
float num2 = y;
|
|
float num3 = float.PositiveInfinity;
|
|
if (Mathf.Abs(Links.x.fellowship.direction.y) > 0.5f)
|
|
{
|
|
for (int j = 0; j < this.items.Count; j++)
|
|
{
|
|
if (this.items[j].label)
|
|
{
|
|
float y2 = this.items[j].label.uiPosition.y;
|
|
if ((y2 > y && flag) || (y2 < y && !flag))
|
|
{
|
|
float num4 = Mathf.Abs(y2 - y);
|
|
if (num4 < num3 && num4 > 0f)
|
|
{
|
|
num3 = num4;
|
|
num2 = y2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
bool flag2 = false;
|
|
bool flag3 = false;
|
|
if (Mathf.Abs(Links.x.fellowship.direction.x) < 0.5f)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (Links.x.fellowship.direction.x > 0f)
|
|
{
|
|
flag2 = true;
|
|
}
|
|
float x = this.closeLabel.label.uiPosition.x;
|
|
num3 = float.PositiveInfinity;
|
|
int num5 = this.items.IndexOf(this.closeLabel);
|
|
for (int k = 0; k < this.items.Count; k++)
|
|
{
|
|
if (this.items[k].label && Mathf.Abs(this.items[k].label.uiPosition.y - num2) < 1f)
|
|
{
|
|
float num6 = this.items[k].label.uiPosition.x - x;
|
|
if (Mathf.Abs(num6) < num3 && (flag3 || (flag2 && num6 > 0f) || (!flag2 && num6 < 0f)))
|
|
{
|
|
num3 = Mathf.Abs(num6);
|
|
num5 = k;
|
|
}
|
|
}
|
|
}
|
|
if (num5 > -1)
|
|
{
|
|
this.closeLabel = this.items[num5];
|
|
}
|
|
this.procTime = Time.timeSinceLevelLoad;
|
|
}
|
|
if (Links.x.joy)
|
|
{
|
|
this.closeLabel = Links.x.partyColliderAdventure.closestItem;
|
|
}
|
|
if (this.closeLabel && Links.x.joy && this.closeLabel.label)
|
|
{
|
|
this.closeLabel.label.txt.color = this.highlightColor;
|
|
}
|
|
if (item2 && item2 != this.closeLabel && item)
|
|
{
|
|
item2.label.txt.color = item.label.textColor;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060011BC RID: 4540 RVA: 0x0015C894 File Offset: 0x0015AA94
|
|
private bool InScreenSpace(Vector2 point, Vector2 sizeDelta)
|
|
{
|
|
return point.x - sizeDelta.x >= this.screenMinX && point.x + sizeDelta.x <= this.screenMaxX && point.y - sizeDelta.y >= this.screenMinY && point.y + sizeDelta.y <= this.screenMaxY;
|
|
}
|
|
|
|
// Token: 0x060011BD RID: 4541 RVA: 0x0015C8F8 File Offset: 0x0015AAF8
|
|
private bool IsPointInBounds(Vector2 pointBox1, float widthBox1, Vector2 otherPoint, float otherPointWidth)
|
|
{
|
|
float num = -1f;
|
|
float num2 = 10000f;
|
|
float num3 = otherPoint.x - otherPointWidth / 2f - num + num2;
|
|
float num4 = otherPoint.x + otherPointWidth / 2f + num + num2;
|
|
float num5 = pointBox1.x - widthBox1 / 2f - num + num2;
|
|
float num6 = pointBox1.x + widthBox1 / 2f + num + num2;
|
|
return (num5 >= num3 && num5 <= num4) || (num6 >= num3 && num6 <= num4);
|
|
}
|
|
|
|
// Token: 0x060011BE RID: 4542 RVA: 0x0015C97C File Offset: 0x0015AB7C
|
|
public Vector3 SubtractVectors(Vector3 a, Vector3 b)
|
|
{
|
|
Vector3 vector;
|
|
vector.x = a.x - b.x;
|
|
vector.y = a.y - b.y;
|
|
vector.z = a.z - b.z;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x060011BF RID: 4543 RVA: 0x0015C9C8 File Offset: 0x0015ABC8
|
|
public Vector3 AddVectors(Vector3 a, Vector3 b)
|
|
{
|
|
Vector3 vector;
|
|
vector.x = a.x + b.x;
|
|
vector.y = a.y + b.y;
|
|
vector.z = a.z + b.z;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x04001D31 RID: 7473
|
|
public Canvas canvas;
|
|
|
|
// Token: 0x04001D32 RID: 7474
|
|
public CanvasGroup canvasGroup;
|
|
|
|
// Token: 0x04001D33 RID: 7475
|
|
public RectTransform canvasRT;
|
|
|
|
// Token: 0x04001D34 RID: 7476
|
|
private List<Item> items;
|
|
|
|
// Token: 0x04001D35 RID: 7477
|
|
private Transform tr;
|
|
|
|
// Token: 0x04001D36 RID: 7478
|
|
public float ySize = 20f;
|
|
|
|
// Token: 0x04001D37 RID: 7479
|
|
public float rowThreshhold = 0.1f;
|
|
|
|
// Token: 0x04001D38 RID: 7480
|
|
public float closeThreshhold = 3.5f;
|
|
|
|
// Token: 0x04001D39 RID: 7481
|
|
public float ySizePerspective = 0.1f;
|
|
|
|
// Token: 0x04001D3A RID: 7482
|
|
public float rowThreshholdPerspective = 0.001f;
|
|
|
|
// Token: 0x04001D3B RID: 7483
|
|
public float closeThreshholdPerspective = 1f;
|
|
|
|
// Token: 0x04001D3C RID: 7484
|
|
public List<float> screenY = new List<float>();
|
|
|
|
// Token: 0x04001D3D RID: 7485
|
|
public List<Vector3> worldVector = new List<Vector3>();
|
|
|
|
// Token: 0x04001D3E RID: 7486
|
|
public List<Item> rowItems = new List<Item>();
|
|
|
|
// Token: 0x04001D3F RID: 7487
|
|
public List<bool> spotTried = new List<bool>();
|
|
|
|
// Token: 0x04001D40 RID: 7488
|
|
public float padding;
|
|
|
|
// Token: 0x04001D41 RID: 7489
|
|
private float triggerTimer;
|
|
|
|
// Token: 0x04001D42 RID: 7490
|
|
private Vector3 farPos;
|
|
|
|
// Token: 0x04001D43 RID: 7491
|
|
private bool checkScreenEdges;
|
|
|
|
// Token: 0x04001D44 RID: 7492
|
|
public float roundNumberX = 100f;
|
|
|
|
// Token: 0x04001D45 RID: 7493
|
|
public float roundNumberY = 50f;
|
|
|
|
// Token: 0x04001D46 RID: 7494
|
|
public float roundNumberXPerspective = 100f;
|
|
|
|
// Token: 0x04001D47 RID: 7495
|
|
public float roundNumberYPerspective = 50f;
|
|
|
|
// Token: 0x04001D48 RID: 7496
|
|
private float screenMinX;
|
|
|
|
// Token: 0x04001D49 RID: 7497
|
|
private float screenMaxX;
|
|
|
|
// Token: 0x04001D4A RID: 7498
|
|
private float screenMinY;
|
|
|
|
// Token: 0x04001D4B RID: 7499
|
|
private float screenMaxY;
|
|
|
|
// Token: 0x04001D4C RID: 7500
|
|
private float procTime;
|
|
|
|
// Token: 0x04001D4D RID: 7501
|
|
public Item closeLabel;
|
|
|
|
// Token: 0x04001D4E RID: 7502
|
|
public float targetAlpha;
|
|
|
|
// Token: 0x04001D4F RID: 7503
|
|
public float currentAlpha;
|
|
|
|
// Token: 0x04001D50 RID: 7504
|
|
public TextMeshProUGUI controllerIcon;
|
|
|
|
// Token: 0x04001D51 RID: 7505
|
|
public RectTransform controllerRT;
|
|
|
|
// Token: 0x04001D52 RID: 7506
|
|
public Color inRange = Color.white;
|
|
|
|
// Token: 0x04001D53 RID: 7507
|
|
public Color highlightColor = Color.red;
|
|
|
|
// Token: 0x04001D54 RID: 7508
|
|
public Color outOfRange = Color.red;
|
|
|
|
// Token: 0x04001D55 RID: 7509
|
|
private List<Character> characters;
|
|
|
|
// Token: 0x04001D56 RID: 7510
|
|
private List<Character> characterInfoObj = new List<Character>();
|
|
|
|
// Token: 0x04001D57 RID: 7511
|
|
private List<RectTransform> characterInfo = new List<RectTransform>();
|
|
|
|
// Token: 0x04001D58 RID: 7512
|
|
private List<RectTransform> openCharacterInfo = new List<RectTransform>();
|
|
|
|
// Token: 0x04001D59 RID: 7513
|
|
public GameObject characterInfoPrefab;
|
|
|
|
// Token: 0x04001D5A RID: 7514
|
|
public Transform characterDetailsParent;
|
|
|
|
// Token: 0x04001D5B RID: 7515
|
|
private StringFast str = new StringFast(32);
|
|
}
|