1094 lines
30 KiB
C#
1094 lines
30 KiB
C#
using System;
|
|
using System.Collections;
|
|
using DarkTonic.MasterAudio;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x020000E4 RID: 228
|
|
public class Windows : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
|
|
{
|
|
// Token: 0x060014ED RID: 5357 RVA: 0x00193D22 File Offset: 0x00191F22
|
|
private void Awake()
|
|
{
|
|
this.prevY = this.minimumY;
|
|
this.prevX = this.minimumX;
|
|
this.tr = base.transform;
|
|
this.GetStartPositions();
|
|
this.SetResizeButtonColors();
|
|
}
|
|
|
|
// Token: 0x060014EE RID: 5358 RVA: 0x00193D54 File Offset: 0x00191F54
|
|
public void GetStartPositions()
|
|
{
|
|
this.startPosition = this.rt.anchoredPosition3D;
|
|
this.startAnchorMin = this.rt.anchorMin;
|
|
this.startAnchorMax = this.rt.anchorMax;
|
|
this.startPivot = this.rt.pivot;
|
|
}
|
|
|
|
// Token: 0x060014EF RID: 5359 RVA: 0x00193DB4 File Offset: 0x00191FB4
|
|
private void Start()
|
|
{
|
|
this.OnPointerExit(null);
|
|
}
|
|
|
|
// Token: 0x060014F0 RID: 5360 RVA: 0x00193DC0 File Offset: 0x00191FC0
|
|
public void SetPivotLeft()
|
|
{
|
|
if (this.rt.anchorMin.x != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(0f, 1f);
|
|
this.rt.anchorMax = new Vector2(0f, 1f);
|
|
this.rt.pivot = new Vector2(0f, 1f);
|
|
float num = this.rt.anchoredPosition3D.x + this.ScreenXModifier() - this.rt.sizeDelta.x;
|
|
float y = this.rt.anchoredPosition3D.y;
|
|
this.rt.anchoredPosition3D = new Vector3(num, y, 0f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014F1 RID: 5361 RVA: 0x00193E88 File Offset: 0x00192088
|
|
public void Load(Vector3 size, Vector3 position, bool mini, float fullW, float fullH)
|
|
{
|
|
if (!this.tr)
|
|
{
|
|
this.tr = base.transform;
|
|
}
|
|
if (this.rt.anchorMin.x != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(0f, 1f);
|
|
this.rt.anchorMax = new Vector2(0f, 1f);
|
|
this.rt.pivot = new Vector2(0f, 1f);
|
|
float num = this.rt.anchoredPosition3D.x + this.ScreenXModifier() - this.rt.sizeDelta.x;
|
|
float y = this.rt.anchoredPosition3D.y;
|
|
this.rt.anchoredPosition3D = new Vector3(num, y, 0f);
|
|
}
|
|
float z = size.z;
|
|
this.rt.sizeDelta = size;
|
|
this.tr.position = position;
|
|
this.tr.localPosition = new Vector3(this.tr.localPosition.x, this.tr.localPosition.y, 0f);
|
|
this.minimized = false;
|
|
if (this.contentRT)
|
|
{
|
|
this.contentRT.anchoredPosition3D = new Vector3(this.contentRT.anchoredPosition3D.x, z, 0f);
|
|
}
|
|
this.GridLayout(false, true);
|
|
this.ChangeScreenSize();
|
|
}
|
|
|
|
// Token: 0x060014F2 RID: 5362 RVA: 0x00194008 File Offset: 0x00192208
|
|
public void Save(out Vector3 size, out Vector3 position, out bool mini, out float fullW, out float fullH)
|
|
{
|
|
if (!this.tr)
|
|
{
|
|
this.tr = base.transform;
|
|
}
|
|
if (this.rt.anchorMin.x != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(0f, 1f);
|
|
this.rt.anchorMax = new Vector2(0f, 1f);
|
|
this.rt.pivot = new Vector2(0f, 1f);
|
|
float num = this.rt.anchoredPosition3D.x + this.ScreenXModifier() - this.rt.sizeDelta.x;
|
|
float y = this.rt.anchoredPosition3D.y;
|
|
this.rt.anchoredPosition3D = new Vector3(num, y, 0f);
|
|
}
|
|
size = this.rt.sizeDelta;
|
|
position = this.tr.position;
|
|
mini = this.minimized;
|
|
fullW = this.fullWidth;
|
|
fullH = this.fullHeight;
|
|
if (this.contentRT)
|
|
{
|
|
size.z = this.contentRT.anchoredPosition3D.y;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014F3 RID: 5363 RVA: 0x0019414B File Offset: 0x0019234B
|
|
public void ToggleController()
|
|
{
|
|
if (!this.edgesBtn)
|
|
{
|
|
return;
|
|
}
|
|
this.edgesBtn.interactable = Links.x.mk;
|
|
}
|
|
|
|
// Token: 0x060014F4 RID: 5364 RVA: 0x00194170 File Offset: 0x00192370
|
|
public void ToggleResizeDrag()
|
|
{
|
|
Links.x.hudControl.ToggleWindowInteractables(true);
|
|
}
|
|
|
|
// Token: 0x060014F5 RID: 5365 RVA: 0x00194184 File Offset: 0x00192384
|
|
public void ToggleWindowVisual(bool state)
|
|
{
|
|
if (this.windowBg)
|
|
{
|
|
if (this.linkedPortrait)
|
|
{
|
|
if (!this.linkedPortrait.character)
|
|
{
|
|
state = false;
|
|
}
|
|
if (Links.x)
|
|
{
|
|
if (!Links.x.hudControl.AnyWindowDraggingResizing())
|
|
{
|
|
this.windowBg.enabled = state;
|
|
if (this.windowResizeR)
|
|
{
|
|
this.windowResizeR.enabled = state;
|
|
this.windowResizeL.enabled = state;
|
|
this.windowResizeU.enabled = state;
|
|
this.windowResizeUR.enabled = state;
|
|
this.windowResizeUL.enabled = state;
|
|
this.windowResizeD.enabled = state;
|
|
this.windowResizeDR.enabled = state;
|
|
this.windowResizeDL.enabled = state;
|
|
}
|
|
this.linkedPortrait.skillBag.SetResizeDrag();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.windowBg.enabled = state;
|
|
if (this.windowResizeR)
|
|
{
|
|
this.windowResizeR.enabled = state;
|
|
this.windowResizeL.enabled = state;
|
|
this.windowResizeU.enabled = state;
|
|
this.windowResizeUR.enabled = state;
|
|
this.windowResizeUL.enabled = state;
|
|
this.windowResizeD.enabled = state;
|
|
this.windowResizeDR.enabled = state;
|
|
this.windowResizeDL.enabled = state;
|
|
}
|
|
}
|
|
if (Links.x && !Links.x.hudControl.AnyWindowDraggingResizing() && !this.dragging && !this.resizing && !Records.x.movingWindows)
|
|
{
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Color color = this.windowResizeR.color;
|
|
bool flag = false;
|
|
if (Records.x && Records.x.movingWindows)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag || this.dragging || this.resizing)
|
|
{
|
|
color.a = 1f;
|
|
}
|
|
else
|
|
{
|
|
color.a = 0f;
|
|
}
|
|
if (this.windowResizeR)
|
|
{
|
|
this.windowResizeR.color = color;
|
|
this.windowResizeL.color = color;
|
|
this.windowResizeU.color = color;
|
|
this.windowResizeUR.color = color;
|
|
this.windowResizeUL.color = color;
|
|
this.windowResizeD.color = color;
|
|
this.windowResizeDR.color = color;
|
|
this.windowResizeDL.color = color;
|
|
}
|
|
}
|
|
}
|
|
this.GridLayout(false, false);
|
|
}
|
|
|
|
// Token: 0x060014F6 RID: 5366 RVA: 0x00194404 File Offset: 0x00192604
|
|
public void ToggleWindowInteractables(bool state)
|
|
{
|
|
if (this.windowBg && this.linkedPortrait)
|
|
{
|
|
if (!this.linkedPortrait.character)
|
|
{
|
|
}
|
|
if (Links.x && this.linkedPortrait && !Links.x.hudControl.AnyWindowDraggingResizing() && !this.dragging && !this.resizing)
|
|
{
|
|
bool movingWindows = Records.x.movingWindows;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014F7 RID: 5367 RVA: 0x00194488 File Offset: 0x00192688
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
if (!this.handle)
|
|
{
|
|
return;
|
|
}
|
|
this.handle.color.a = 1f;
|
|
}
|
|
|
|
// Token: 0x060014F8 RID: 5368 RVA: 0x001944BC File Offset: 0x001926BC
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
if (!this.handle)
|
|
{
|
|
return;
|
|
}
|
|
if (!Input.GetMouseButton(0))
|
|
{
|
|
this.handle.color.a = 0f;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014F9 RID: 5369 RVA: 0x001944F7 File Offset: 0x001926F7
|
|
public void ResetGridLayout()
|
|
{
|
|
this.grid.constraint = GridLayoutGroup.Constraint.Flexible;
|
|
this.rt.sizeDelta = new Vector2(229f, 91f);
|
|
}
|
|
|
|
// Token: 0x060014FA RID: 5370 RVA: 0x00194520 File Offset: 0x00192720
|
|
public void GridLayout(bool setToSize, bool fromLoad)
|
|
{
|
|
if (!this.grid)
|
|
{
|
|
return;
|
|
}
|
|
float num = 44.5f;
|
|
this.cellWidth = 45f;
|
|
this.rowsWanted = this.rt.sizeDelta.y / num;
|
|
this.rowsWanted = Mathf.Round(this.rowsWanted);
|
|
if (this.linkedPortrait && this.linkedPortrait.character && this.linkedPortrait.character.stats.HealthCurrent() <= 0)
|
|
{
|
|
return;
|
|
}
|
|
if ((Links.x.creation || (Records.x.dialogue && Records.x.banquetIsle)) && this.linkedPortrait)
|
|
{
|
|
this.rowsWanted = 2f;
|
|
setToSize = true;
|
|
}
|
|
if (Links.x.joy && this.rowsWanted > 3f)
|
|
{
|
|
this.rowsWanted = 3f;
|
|
}
|
|
if (this.rowsWanted <= 1f)
|
|
{
|
|
this.grid.constraint = GridLayoutGroup.Constraint.Flexible;
|
|
}
|
|
else
|
|
{
|
|
this.grid.constraint = GridLayoutGroup.Constraint.Flexible;
|
|
}
|
|
int num2 = 0;
|
|
using (IEnumerator enumerator = this.listGrid.GetEnumerator())
|
|
{
|
|
while (enumerator.MoveNext())
|
|
{
|
|
if (((Transform)enumerator.Current).gameObject.activeSelf)
|
|
{
|
|
num2++;
|
|
}
|
|
}
|
|
}
|
|
this.columnsWanted = (int)Mathf.Round(this.rt.sizeDelta.x / this.cellWidth);
|
|
if (Links.x.joy && this.columnsWanted < 2)
|
|
{
|
|
this.columnsWanted = 2;
|
|
}
|
|
if (this.rowsWanted < 1f)
|
|
{
|
|
this.rowsWanted = 1f;
|
|
}
|
|
int num3 = (int)Mathf.Ceil((float)num2 / this.rowsWanted);
|
|
if (Links.x.joy && !this.linkedPortrait && num3 > 6 && this.rowsWanted < 3f)
|
|
{
|
|
num3 = 6;
|
|
this.columnsWanted = 6;
|
|
this.rowsWanted = (float)((int)Mathf.Ceil((float)num2 / (float)this.columnsWanted));
|
|
this.grid.constraint = GridLayoutGroup.Constraint.Flexible;
|
|
}
|
|
int num4 = (int)Mathf.Ceil((float)num2 / (float)this.columnsWanted);
|
|
if (!this.dragging && !this.resizing && !fromLoad)
|
|
{
|
|
setToSize = true;
|
|
}
|
|
if (Links.x.joy || setToSize)
|
|
{
|
|
if (Links.x.joy)
|
|
{
|
|
this.columnsWanted = num3;
|
|
}
|
|
else
|
|
{
|
|
if (this.rowsWanted == 1f)
|
|
{
|
|
this.columnsWanted = num3;
|
|
}
|
|
else if (num2 <= this.columnsWanted)
|
|
{
|
|
this.rowsWanted = 1f;
|
|
}
|
|
else if (this.rowsWanted > (float)num2 / (float)this.columnsWanted)
|
|
{
|
|
this.rowsWanted = Mathf.Ceil((float)num2 / (float)this.columnsWanted);
|
|
}
|
|
if (!this.linkedPortrait && setToSize)
|
|
{
|
|
this.rowsWanted = (float)num4;
|
|
}
|
|
}
|
|
if (this.linkedPortrait && !this.first)
|
|
{
|
|
if (num2 < 4)
|
|
{
|
|
this.rowsWanted = 1f;
|
|
this.columnsWanted = num2;
|
|
num3 = this.columnsWanted;
|
|
}
|
|
else
|
|
{
|
|
this.rowsWanted = 2f;
|
|
this.columnsWanted = (int)Mathf.Ceil((float)num2 / this.rowsWanted);
|
|
if (this.columnsWanted < 4)
|
|
{
|
|
this.columnsWanted = 4;
|
|
}
|
|
num3 = this.columnsWanted;
|
|
}
|
|
this.first = true;
|
|
}
|
|
}
|
|
float num5 = (float)this.columnsWanted * this.cellWidth + 6f;
|
|
float num6 = this.rowsWanted * num + 6f;
|
|
if (!this.resizing)
|
|
{
|
|
this.rt.sizeDelta = new Vector2(num5, num6);
|
|
}
|
|
if ((this.book || this.linkedPortrait) && !this.resizing)
|
|
{
|
|
this.updateGridNextFrame = true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014FB RID: 5371 RVA: 0x001948EC File Offset: 0x00192AEC
|
|
private void Update()
|
|
{
|
|
if (this.resizing)
|
|
{
|
|
this.OnResize();
|
|
this.GridLayout(false, false);
|
|
}
|
|
if (this.dragging)
|
|
{
|
|
this.OnDrag();
|
|
this.GridLayout(false, false);
|
|
}
|
|
if (this.updateGridNextFrame && !Links.x.pocketWheel.spellbook.activeSelf && this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.skillBag.UpdateButtonsFromGrid((float)this.columnsWanted, this.rowsWanted, this.cellWidth);
|
|
}
|
|
this.updateGridNextFrame = false;
|
|
if (this.checkForDrag && this.portraitHandle)
|
|
{
|
|
this.portraitHandle.CheckForDrag();
|
|
}
|
|
if (Input.GetMouseButtonDown(0) && Links.x.mk)
|
|
{
|
|
GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
|
|
bool flag = false;
|
|
if (currentSelectedGameObject && this.listGrid && currentSelectedGameObject.transform.parent && this.listGrid == currentSelectedGameObject.transform.parent)
|
|
{
|
|
flag = true;
|
|
}
|
|
GameObject gameObject = null;
|
|
if (this.handle)
|
|
{
|
|
gameObject = this.handle.gameObject;
|
|
}
|
|
if (currentSelectedGameObject == base.gameObject || currentSelectedGameObject == gameObject || currentSelectedGameObject == this.topBorder || flag)
|
|
{
|
|
this.down = true;
|
|
this.OnPointerEnter(null);
|
|
}
|
|
}
|
|
if (Input.GetMouseButtonUp(0) && Links.x.mk)
|
|
{
|
|
GameObject currentSelectedGameObject2 = EventSystem.current.currentSelectedGameObject;
|
|
this.down = false;
|
|
bool flag2 = false;
|
|
if (currentSelectedGameObject2 && this.listGrid && currentSelectedGameObject2.transform.parent && this.listGrid == currentSelectedGameObject2.transform.parent)
|
|
{
|
|
flag2 = true;
|
|
}
|
|
GameObject gameObject2 = null;
|
|
if (this.handle)
|
|
{
|
|
gameObject2 = this.handle.gameObject;
|
|
}
|
|
if (currentSelectedGameObject2 != base.gameObject && currentSelectedGameObject2 != gameObject2 && currentSelectedGameObject2 != this.topBorder && !flag2)
|
|
{
|
|
this.OnPointerExit(null);
|
|
}
|
|
}
|
|
if ((this.resizing || this.dragging) && Links.x.mk && Input.GetMouseButtonUp(0))
|
|
{
|
|
if (this.currentHandle)
|
|
{
|
|
this.currentHandle.OnPointerUp(null);
|
|
}
|
|
if (this.dragging)
|
|
{
|
|
this.OnDragEnds();
|
|
}
|
|
if (this.resizing)
|
|
{
|
|
this.OnResizeEnds();
|
|
}
|
|
}
|
|
if (this.changingHeight)
|
|
{
|
|
if (Records.x.filming)
|
|
{
|
|
this.t += Time.unscaledDeltaTime * Records.x.filmingAnimatorSpeed;
|
|
}
|
|
else
|
|
{
|
|
this.t += Time.unscaledDeltaTime * 10f;
|
|
}
|
|
this.rt.sizeDelta = Vector2.Lerp(this.minimizeStartSize, new Vector2(this.widthTarget, this.heightTarget), this.t);
|
|
if (this.rt.sizeDelta.y == this.heightTarget && this.rt.sizeDelta.x == this.widthTarget)
|
|
{
|
|
this.t = 0f;
|
|
this.changingHeight = false;
|
|
if (this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.skillBag.MinimizeWindow();
|
|
}
|
|
}
|
|
}
|
|
if (this.waitingToStartDrag)
|
|
{
|
|
if ((Vector3.Distance(Input.mousePosition, this.startDragInputPosition) > 0.01f || Time.realtimeSinceStartup > this.dragStartTime + 0.5f) && Input.GetMouseButton(0))
|
|
{
|
|
this.OnDragBegins();
|
|
this.tr.SetAsLastSibling();
|
|
this.waitingToStartDrag = false;
|
|
}
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
this.waitingToStartDrag = false;
|
|
}
|
|
}
|
|
if (this.waitingForMinimizeMove)
|
|
{
|
|
if ((Vector3.Distance(Input.mousePosition, this.savedPosition) > 0.3f || Time.realtimeSinceStartup > this.minimizeTime + 0.5f) && Input.GetMouseButton(0))
|
|
{
|
|
this.OnDragBegins();
|
|
this.tr.SetAsLastSibling();
|
|
this.waitingForMinimizeMove = false;
|
|
}
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
this.waitingForMinimizeMove = false;
|
|
this.FinishToggleMinimize();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014FC RID: 5372 RVA: 0x00194D10 File Offset: 0x00192F10
|
|
public void StartDrag()
|
|
{
|
|
Links.x.gameplay.StoneSoundQuieter();
|
|
this.startDragInputPosition = Input.mousePosition;
|
|
this.dragStartTime = Time.realtimeSinceStartup;
|
|
if (this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.PortraitHover(false);
|
|
}
|
|
this.waitingToStartDrag = true;
|
|
}
|
|
|
|
// Token: 0x060014FD RID: 5373 RVA: 0x00194D64 File Offset: 0x00192F64
|
|
public void ToggleMinimize()
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Clicks Stone B", Random.Range(0.7f, 1f), new float?(Random.Range(0.97f, 1f)), 0f, "", null);
|
|
this.minimizeTime = Time.realtimeSinceStartup;
|
|
this.waitingForMinimizeMove = true;
|
|
this.savedPosition = Input.mousePosition;
|
|
}
|
|
|
|
// Token: 0x060014FE RID: 5374 RVA: 0x00194DD0 File Offset: 0x00192FD0
|
|
public void FinishToggleMinimize()
|
|
{
|
|
if (this.minimized)
|
|
{
|
|
this.minimized = false;
|
|
this.minimizeStartSize = this.rt.sizeDelta;
|
|
this.heightTarget = this.fullHeight;
|
|
this.t = 0f;
|
|
this.changingHeight = true;
|
|
this.widthTarget = this.fullWidth;
|
|
if (this.rt.anchorMin.x != 1f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(1f, 1f);
|
|
this.rt.anchorMax = new Vector2(1f, 1f);
|
|
this.rt.pivot = new Vector2(1f, 1f);
|
|
float num = -1f * this.ScreenXModifier() + this.rt.anchoredPosition3D.x + this.rt.sizeDelta.x;
|
|
this.rt.anchoredPosition3D = new Vector3(num, this.rt.anchoredPosition3D.y, 0f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.minimized = true;
|
|
this.fullHeight = this.rt.sizeDelta.y;
|
|
this.fullWidth = this.rt.sizeDelta.x;
|
|
this.minimizeStartSize = this.rt.sizeDelta;
|
|
this.heightTarget = 2f;
|
|
this.widthTarget = 0f;
|
|
this.t = 0f;
|
|
this.changingHeight = true;
|
|
if (this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.skillBag.TooltipOff();
|
|
}
|
|
if (this.rt.anchorMin.x != 1f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(1f, 1f);
|
|
this.rt.anchorMax = new Vector2(1f, 1f);
|
|
this.rt.pivot = new Vector2(1f, 1f);
|
|
float num2 = -1f * this.ScreenXModifier() + this.rt.anchoredPosition3D.x + this.rt.sizeDelta.x;
|
|
this.rt.anchoredPosition3D = new Vector3(num2, this.rt.anchoredPosition3D.y, 0f);
|
|
}
|
|
}
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014FF RID: 5375 RVA: 0x0019504C File Offset: 0x0019324C
|
|
private float ScreenXModifier()
|
|
{
|
|
float num = (float)Screen.width / (float)Screen.height / 1.7777778f;
|
|
if (num > 1f)
|
|
{
|
|
return num * 1920f;
|
|
}
|
|
return 1920f;
|
|
}
|
|
|
|
// Token: 0x06001500 RID: 5376 RVA: 0x00195084 File Offset: 0x00193284
|
|
private float ScreenYModifier()
|
|
{
|
|
if ((float)Screen.width / (float)Screen.height / 1.7777778f > 1f)
|
|
{
|
|
float num = (float)Screen.width / (float)Screen.height;
|
|
float num2 = (float)Screen.height / (float)Screen.width;
|
|
float num3 = (float)Screen.width * 1080f / 1920f;
|
|
float num4 = 1080f / num3 * 1080f / (num2 * (float)Screen.width);
|
|
return 1080f / (num2 * (float)Screen.width);
|
|
}
|
|
return 1080f / this.GetScreenHeight();
|
|
}
|
|
|
|
// Token: 0x06001501 RID: 5377 RVA: 0x00195110 File Offset: 0x00193310
|
|
private float ScreenYModifier2()
|
|
{
|
|
float num = (float)Screen.width / (float)Screen.height / 1.7777778f;
|
|
if (num > 1f)
|
|
{
|
|
float num2 = (float)Screen.height / (float)Screen.width;
|
|
return 1080f + 1080f / ((float)Screen.width * 1080f / 1920f);
|
|
}
|
|
if (num == 1f)
|
|
{
|
|
return 1080f;
|
|
}
|
|
float num3 = (float)Screen.height / (float)Screen.width;
|
|
return 1080f * ((float)Screen.height / ((float)Screen.width * 0.5625f));
|
|
}
|
|
|
|
// Token: 0x06001502 RID: 5378 RVA: 0x0019519C File Offset: 0x0019339C
|
|
public void SetResizeButtonColors()
|
|
{
|
|
if (!this.edgesBtn)
|
|
{
|
|
return;
|
|
}
|
|
ColorBlock colors = this.edgesBtn.colors;
|
|
Color normalColor = colors.normalColor;
|
|
if (this.resizing || this.dragging)
|
|
{
|
|
normalColor.a = 1f;
|
|
}
|
|
else
|
|
{
|
|
normalColor.a = 0f;
|
|
}
|
|
colors.normalColor = normalColor;
|
|
this.edgesBtn.colors = colors;
|
|
}
|
|
|
|
// Token: 0x06001503 RID: 5379 RVA: 0x0019520C File Offset: 0x0019340C
|
|
public void OnResizeBegins(bool left, bool right, bool up, bool down)
|
|
{
|
|
if (this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.PortraitHover(false);
|
|
this.linkedPortrait.skillBag.Dragging();
|
|
}
|
|
if (this.book)
|
|
{
|
|
Links.x.main.portrait.skillBag.Dragging();
|
|
}
|
|
this.resizing = true;
|
|
this.SetResizeButtonColors();
|
|
this.resizeLeft = left;
|
|
this.resizeRight = right;
|
|
this.resizeUp = up;
|
|
this.resizeDown = down;
|
|
if (this.resizeRight && this.rt.anchorMin.x != 1f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(1f, this.rt.anchorMin.y);
|
|
this.rt.anchorMax = new Vector2(1f, this.rt.anchorMax.y);
|
|
this.rt.pivot = new Vector2(1f, this.rt.pivot.y);
|
|
float num = -1f * this.ScreenXModifier() + this.rt.anchoredPosition3D.x + this.rt.sizeDelta.x;
|
|
this.rt.anchoredPosition3D = new Vector3(num, this.rt.anchoredPosition3D.y, 0f);
|
|
}
|
|
if (this.resizeLeft && this.rt.anchorMin.x != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(0f, this.rt.anchorMin.y);
|
|
this.rt.anchorMax = new Vector2(0f, this.rt.anchorMax.y);
|
|
this.rt.pivot = new Vector2(0f, this.rt.pivot.y);
|
|
float num2 = this.rt.anchoredPosition3D.x + this.ScreenXModifier() - this.rt.sizeDelta.x;
|
|
this.rt.anchoredPosition3D = new Vector3(num2, this.rt.anchoredPosition3D.y, 0f);
|
|
}
|
|
if (!this.resizeDown && this.rt.anchorMin.y == 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(this.rt.anchorMin.x, 1f);
|
|
this.rt.anchorMax = new Vector2(this.rt.anchorMax.x, 1f);
|
|
this.rt.pivot = new Vector2(this.rt.pivot.x, 1f);
|
|
float num3 = this.rt.anchoredPosition3D.y - this.ScreenYModifier2() + this.rt.sizeDelta.y;
|
|
this.rt.anchoredPosition3D = new Vector3(this.rt.anchoredPosition3D.x, num3, 0f);
|
|
}
|
|
if (this.resizeDown && this.rt.anchorMin.y != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(this.rt.anchorMin.x, 0f);
|
|
this.rt.anchorMax = new Vector2(this.rt.anchorMax.x, 0f);
|
|
this.rt.pivot = new Vector2(this.rt.pivot.x, 0f);
|
|
float num4 = this.rt.anchoredPosition3D.y + this.ScreenYModifier2() - this.rt.sizeDelta.y;
|
|
this.rt.anchoredPosition3D = new Vector3(this.rt.anchoredPosition3D.x, num4, 0f);
|
|
}
|
|
this.startPos = Input.mousePosition;
|
|
this.canvasWidth = this.canvasRT.sizeDelta.x;
|
|
this.resolutionMultiplierX = this.canvasWidth / (float)Screen.width;
|
|
this.startPos.x = this.startPos.x * this.resolutionMultiplierX;
|
|
this.resolutionMultiplierY = this.ScreenYModifier();
|
|
this.startPos.y = this.startPos.y * this.resolutionMultiplierY;
|
|
this.startSize = this.rt.sizeDelta;
|
|
Links.x.hudControl.ToggleWindowInteractables(false);
|
|
}
|
|
|
|
// Token: 0x06001504 RID: 5380 RVA: 0x001956B0 File Offset: 0x001938B0
|
|
public void OnResizeEnds()
|
|
{
|
|
this.resizing = false;
|
|
this.SetResizeButtonColors();
|
|
Links.x.hudControl.ToggleWindowInteractables(true);
|
|
Links.x.gameplay.resizing = false;
|
|
if (this.rt.anchorMin.y == 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(this.rt.anchorMin.x, 1f);
|
|
this.rt.anchorMax = new Vector2(this.rt.anchorMax.x, 1f);
|
|
this.rt.pivot = new Vector2(this.rt.pivot.x, 1f);
|
|
float num = this.rt.anchoredPosition3D.y - this.ScreenYModifier2() + this.rt.sizeDelta.y;
|
|
this.rt.anchoredPosition3D = new Vector3(this.rt.anchoredPosition3D.x, num, 0f);
|
|
}
|
|
if (this.rt.anchorMin.x != 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(0f, 1f);
|
|
this.rt.anchorMax = new Vector2(0f, 1f);
|
|
this.rt.pivot = new Vector2(0f, 1f);
|
|
float num2 = this.rt.anchoredPosition3D.x + this.ScreenXModifier() - this.rt.sizeDelta.x;
|
|
float y = this.rt.anchoredPosition3D.y;
|
|
this.rt.anchoredPosition3D = new Vector3(num2, y, 0f);
|
|
}
|
|
this.GridLayout(true, false);
|
|
}
|
|
|
|
// Token: 0x06001505 RID: 5381 RVA: 0x00195884 File Offset: 0x00193A84
|
|
public void OnResize()
|
|
{
|
|
Vector2 vector = Input.mousePosition;
|
|
float num = vector.x / (float)Screen.width;
|
|
float num2 = vector.y / (float)Screen.height;
|
|
if (num > 0f && num < 1f && num2 > 0f && num2 < 1f)
|
|
{
|
|
this.canvasWidth = this.canvasRT.sizeDelta.x;
|
|
this.resolutionMultiplierX = this.canvasWidth / (float)Screen.width;
|
|
vector.x *= this.resolutionMultiplierX;
|
|
this.canvasHeight = this.canvasRT.sizeDelta.y;
|
|
this.resolutionMultiplierY = this.ScreenYModifier();
|
|
vector.y *= this.resolutionMultiplierY;
|
|
Vector2 vector2 = this.startPos - vector;
|
|
Vector2 vector3 = new Vector2(0f, 0f);
|
|
if (this.resizeRight)
|
|
{
|
|
vector3 = new Vector2(vector2.x, 0f);
|
|
}
|
|
if (this.resizeLeft)
|
|
{
|
|
vector3 = new Vector2(-vector2.x, 0f);
|
|
}
|
|
if (this.resizeUp)
|
|
{
|
|
vector3 += new Vector2(0f, vector2.y);
|
|
}
|
|
if (this.resizeDown)
|
|
{
|
|
vector3 -= new Vector2(0f, vector2.y);
|
|
}
|
|
vector3 += this.startSize;
|
|
if (this.resizeRight && vector3.x < 0f)
|
|
{
|
|
vector3.x = this.prevX;
|
|
}
|
|
if (this.resizeLeft && vector3.x < 0f)
|
|
{
|
|
vector3.x = this.prevX;
|
|
}
|
|
if (this.resizeUp && vector3.y < 0f)
|
|
{
|
|
vector3.y = this.prevY;
|
|
}
|
|
if (this.resizeDown && vector3.y < 0f)
|
|
{
|
|
vector3.y = this.prevY;
|
|
}
|
|
if (Mathf.Abs(vector3.x) < this.minimumX)
|
|
{
|
|
vector3.x = this.minimumX;
|
|
}
|
|
if (Mathf.Abs(vector3.y) < this.minimumY)
|
|
{
|
|
vector3.y = this.minimumY;
|
|
}
|
|
this.prevX = vector3.x;
|
|
this.prevY = vector3.y;
|
|
this.rt.sizeDelta = vector3;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001506 RID: 5382 RVA: 0x00195AEC File Offset: 0x00193CEC
|
|
public void ChangeScreenSize()
|
|
{
|
|
if (!this.tr)
|
|
{
|
|
this.tr = base.transform;
|
|
}
|
|
Vector3 vector = Links.x.menuCamera.WorldToScreenPoint(this.tr.position);
|
|
float num = vector.x / (float)Screen.width;
|
|
float num2 = vector.y / (float)Screen.height;
|
|
if (num <= 0f || num >= 1f || num2 <= 0f || num2 >= 1f)
|
|
{
|
|
this.rt.anchoredPosition3D = this.startPosition;
|
|
this.rt.anchorMin = this.startAnchorMin;
|
|
this.rt.anchorMax = this.startAnchorMax;
|
|
this.rt.pivot = this.startPivot;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001507 RID: 5383 RVA: 0x00195BBC File Offset: 0x00193DBC
|
|
public void SetAtStartPosition()
|
|
{
|
|
this.rt.anchorMin = this.startAnchorMin;
|
|
this.rt.anchorMax = this.startAnchorMax;
|
|
this.rt.pivot = this.startPivot;
|
|
this.rt.anchoredPosition3D = this.startPosition;
|
|
}
|
|
|
|
// Token: 0x06001508 RID: 5384 RVA: 0x00195C1C File Offset: 0x00193E1C
|
|
public void OnDragBegins()
|
|
{
|
|
if (this.rt.anchorMin.y == 0f)
|
|
{
|
|
this.rt.anchorMin = new Vector2(this.rt.anchorMin.x, 1f);
|
|
this.rt.anchorMax = new Vector2(this.rt.anchorMax.x, 1f);
|
|
this.rt.pivot = new Vector2(this.rt.pivot.x, 1f);
|
|
float num = this.rt.anchoredPosition3D.y - this.ScreenYModifier2() + this.rt.sizeDelta.y;
|
|
this.rt.anchoredPosition3D = new Vector3(this.rt.anchoredPosition3D.x, num, 0f);
|
|
}
|
|
this.dragging = true;
|
|
this.SetResizeButtonColors();
|
|
this.offset = this.tr.position - Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition);
|
|
if (this.linkedPortrait)
|
|
{
|
|
this.linkedPortrait.skillBag.TooltipOff();
|
|
}
|
|
Links.x.hudControl.ToggleWindowInteractables(false);
|
|
}
|
|
|
|
// Token: 0x06001509 RID: 5385 RVA: 0x00195D65 File Offset: 0x00193F65
|
|
public void OnDragEnds()
|
|
{
|
|
this.dragging = false;
|
|
this.SetResizeButtonColors();
|
|
Links.x.hudControl.ToggleWindowInteractables(true);
|
|
Links.x.gameplay.resizing = false;
|
|
this.SetResizeButtonColors();
|
|
this.GridLayout(true, false);
|
|
}
|
|
|
|
// Token: 0x0600150A RID: 5386 RVA: 0x00195DA4 File Offset: 0x00193FA4
|
|
public void OnDrag()
|
|
{
|
|
float num = Links.x.fellowship.box.canvasRt.sizeDelta.x / (float)Screen.width;
|
|
float num2 = Links.x.fellowship.box.canvasRt.sizeDelta.y / (float)Screen.height;
|
|
this.tr.position = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition) + this.offset;
|
|
Vector2 anchoredPosition = this.rt.anchoredPosition;
|
|
float num3 = anchoredPosition.x;
|
|
if (this.rt.anchorMin.x != 1f)
|
|
{
|
|
num3 = Mathf.Clamp(num3, -2f, (float)Screen.width * num - this.rt.sizeDelta.x);
|
|
anchoredPosition.x = num3;
|
|
}
|
|
else
|
|
{
|
|
num3 *= -1f;
|
|
num3 = Mathf.Clamp(num3, -2f, (float)Screen.width * num - this.rt.sizeDelta.x);
|
|
anchoredPosition.x = num3 * -1f;
|
|
}
|
|
float num4 = anchoredPosition.y * -1f;
|
|
num4 = Mathf.Clamp(num4, this.maximumY, (float)Screen.height * num2 - this.rt.sizeDelta.y);
|
|
anchoredPosition.y = num4 * -1f;
|
|
this.rt.anchoredPosition = anchoredPosition;
|
|
this.tr.localPosition = new Vector3(this.tr.localPosition.x, this.tr.localPosition.y, 0f);
|
|
}
|
|
|
|
// Token: 0x0600150B RID: 5387 RVA: 0x00195F41 File Offset: 0x00194141
|
|
private float GetScreenHeight()
|
|
{
|
|
return (float)Mathf.RoundToInt((float)Screen.width * 0.5625f);
|
|
}
|
|
|
|
// Token: 0x04002461 RID: 9313
|
|
public RectTransform rt;
|
|
|
|
// Token: 0x04002462 RID: 9314
|
|
public RectTransform topBorderRT;
|
|
|
|
// Token: 0x04002463 RID: 9315
|
|
public RectTransform canvasRT;
|
|
|
|
// Token: 0x04002464 RID: 9316
|
|
public bool dragging;
|
|
|
|
// Token: 0x04002465 RID: 9317
|
|
public bool resizing;
|
|
|
|
// Token: 0x04002466 RID: 9318
|
|
public bool resizeLeft;
|
|
|
|
// Token: 0x04002467 RID: 9319
|
|
public bool resizeRight;
|
|
|
|
// Token: 0x04002468 RID: 9320
|
|
public bool resizeUp;
|
|
|
|
// Token: 0x04002469 RID: 9321
|
|
public bool resizeDown;
|
|
|
|
// Token: 0x0400246A RID: 9322
|
|
public bool minimized;
|
|
|
|
// Token: 0x0400246B RID: 9323
|
|
public Image windowBg;
|
|
|
|
// Token: 0x0400246C RID: 9324
|
|
public Image windowResizeR;
|
|
|
|
// Token: 0x0400246D RID: 9325
|
|
public Image windowResizeL;
|
|
|
|
// Token: 0x0400246E RID: 9326
|
|
public Image windowResizeU;
|
|
|
|
// Token: 0x0400246F RID: 9327
|
|
public Image windowResizeUR;
|
|
|
|
// Token: 0x04002470 RID: 9328
|
|
public Image windowResizeUL;
|
|
|
|
// Token: 0x04002471 RID: 9329
|
|
public Image windowResizeD;
|
|
|
|
// Token: 0x04002472 RID: 9330
|
|
public Image windowResizeDR;
|
|
|
|
// Token: 0x04002473 RID: 9331
|
|
public Image windowResizeDL;
|
|
|
|
// Token: 0x04002474 RID: 9332
|
|
public int index;
|
|
|
|
// Token: 0x04002475 RID: 9333
|
|
public WindowHandles currentHandle;
|
|
|
|
// Token: 0x04002476 RID: 9334
|
|
public WindowHandles portraitHandle;
|
|
|
|
// Token: 0x04002477 RID: 9335
|
|
public Portrait linkedPortrait;
|
|
|
|
// Token: 0x04002478 RID: 9336
|
|
public Transform tr;
|
|
|
|
// Token: 0x04002479 RID: 9337
|
|
private Vector3 offset;
|
|
|
|
// Token: 0x0400247A RID: 9338
|
|
private Vector2 startPos;
|
|
|
|
// Token: 0x0400247B RID: 9339
|
|
private Vector2 startSize;
|
|
|
|
// Token: 0x0400247C RID: 9340
|
|
private Vector2 minimizeStartSize;
|
|
|
|
// Token: 0x0400247D RID: 9341
|
|
private Vector3 mousePos;
|
|
|
|
// Token: 0x0400247E RID: 9342
|
|
private Vector3 savedPosition;
|
|
|
|
// Token: 0x0400247F RID: 9343
|
|
private float resolutionMultiplierX;
|
|
|
|
// Token: 0x04002480 RID: 9344
|
|
private float resolutionMultiplierY;
|
|
|
|
// Token: 0x04002481 RID: 9345
|
|
private float canvasWidth;
|
|
|
|
// Token: 0x04002482 RID: 9346
|
|
private float canvasHeight;
|
|
|
|
// Token: 0x04002483 RID: 9347
|
|
public float fullHeight;
|
|
|
|
// Token: 0x04002484 RID: 9348
|
|
public float fullWidth;
|
|
|
|
// Token: 0x04002485 RID: 9349
|
|
public bool changingHeight;
|
|
|
|
// Token: 0x04002486 RID: 9350
|
|
public bool checkForDrag;
|
|
|
|
// Token: 0x04002487 RID: 9351
|
|
private float t;
|
|
|
|
// Token: 0x04002488 RID: 9352
|
|
private float heightTarget;
|
|
|
|
// Token: 0x04002489 RID: 9353
|
|
private float widthTarget;
|
|
|
|
// Token: 0x0400248A RID: 9354
|
|
public Image handle;
|
|
|
|
// Token: 0x0400248B RID: 9355
|
|
public Transform listGrid;
|
|
|
|
// Token: 0x0400248C RID: 9356
|
|
public GameObject minimizeButton;
|
|
|
|
// Token: 0x0400248D RID: 9357
|
|
public GameObject topBorder;
|
|
|
|
// Token: 0x0400248E RID: 9358
|
|
public bool down;
|
|
|
|
// Token: 0x0400248F RID: 9359
|
|
public bool waitingForMinimizeMove;
|
|
|
|
// Token: 0x04002490 RID: 9360
|
|
public bool waitingToStartDrag;
|
|
|
|
// Token: 0x04002491 RID: 9361
|
|
public float minimumX = 110f;
|
|
|
|
// Token: 0x04002492 RID: 9362
|
|
public float minimumY = 55f;
|
|
|
|
// Token: 0x04002493 RID: 9363
|
|
public float maximumY = 44f;
|
|
|
|
// Token: 0x04002494 RID: 9364
|
|
private float prevX;
|
|
|
|
// Token: 0x04002495 RID: 9365
|
|
private float prevY;
|
|
|
|
// Token: 0x04002496 RID: 9366
|
|
private float minimizeTime;
|
|
|
|
// Token: 0x04002497 RID: 9367
|
|
private float dragStartTime;
|
|
|
|
// Token: 0x04002498 RID: 9368
|
|
private Vector3 startDragInputPosition;
|
|
|
|
// Token: 0x04002499 RID: 9369
|
|
public RectTransform contentRT;
|
|
|
|
// Token: 0x0400249A RID: 9370
|
|
private Vector3 startPosition;
|
|
|
|
// Token: 0x0400249B RID: 9371
|
|
private Vector3 startAnchorMin;
|
|
|
|
// Token: 0x0400249C RID: 9372
|
|
private Vector3 startAnchorMax;
|
|
|
|
// Token: 0x0400249D RID: 9373
|
|
private Vector3 startPivot;
|
|
|
|
// Token: 0x0400249E RID: 9374
|
|
public Color utilityColor = new Color(0.44313726f, 0.38039216f, 0.42745098f, 1f);
|
|
|
|
// Token: 0x0400249F RID: 9375
|
|
public Color beltColor = new Color(0.5019608f, 0.23529412f, 0.13725491f, 1f);
|
|
|
|
// Token: 0x040024A0 RID: 9376
|
|
public Color wpnColor = new Color(0.50980395f, 0.30980393f, 0.03137255f, 1f);
|
|
|
|
// Token: 0x040024A1 RID: 9377
|
|
public Color ammoColor = new Color(0.5176471f, 0.4117647f, 0.08627451f, 1f);
|
|
|
|
// Token: 0x040024A2 RID: 9378
|
|
public GridLayoutGroup grid;
|
|
|
|
// Token: 0x040024A3 RID: 9379
|
|
public ButtonMultiTargets edgesBtn;
|
|
|
|
// Token: 0x040024A4 RID: 9380
|
|
private float cellWidth;
|
|
|
|
// Token: 0x040024A5 RID: 9381
|
|
private float rowsWanted;
|
|
|
|
// Token: 0x040024A6 RID: 9382
|
|
private int columnsWanted;
|
|
|
|
// Token: 0x040024A7 RID: 9383
|
|
private bool updateGridNextFrame;
|
|
|
|
// Token: 0x040024A8 RID: 9384
|
|
public bool book;
|
|
|
|
// Token: 0x040024A9 RID: 9385
|
|
public bool first;
|
|
|
|
// Token: 0x040024AA RID: 9386
|
|
private Transform[] allChildren;
|
|
}
|