467 lines
14 KiB
C#
467 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x020000A6 RID: 166
|
|
public class Forfeits : MonoBehaviour
|
|
{
|
|
// Token: 0x06000F5E RID: 3934 RVA: 0x00129CB0 File Offset: 0x00127EB0
|
|
private void Start()
|
|
{
|
|
this.anim.enabled = false;
|
|
this.exiles = Records.x.exiles;
|
|
this.exilesPurseState = Records.x.exilesPurseState;
|
|
if (!Records.x.windows && this.scrollRect1)
|
|
{
|
|
this.scrollRect1.scrollSensitivity = 9f;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F5F RID: 3935 RVA: 0x00129D14 File Offset: 0x00127F14
|
|
public void DoUpdate()
|
|
{
|
|
if (Links.x.joy && this.on)
|
|
{
|
|
RectTransform viewport = this.scrollRect1.viewport;
|
|
for (int i = 0; i < this.usedButtons.Count; i++)
|
|
{
|
|
if (this.usedButtons[i])
|
|
{
|
|
Vector2 vector = RectTransformUtility.WorldToScreenPoint(Links.x.hudCanvas.worldCamera, this.usedButtons[i].gameObject.transform.position);
|
|
bool flag = RectTransformUtility.RectangleContainsScreenPoint(viewport, vector, Links.x.hudCanvas.worldCamera);
|
|
this.usedButtons[i].GetComponent<Button>().interactable = flag;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F60 RID: 3936 RVA: 0x00129DD4 File Offset: 0x00127FD4
|
|
public void ResetExiles()
|
|
{
|
|
for (int i = 0; i < this.usedButtons.Count; i++)
|
|
{
|
|
if (this.usedButtons[i])
|
|
{
|
|
this.openButtons.Add(this.usedButtons[i]);
|
|
this.usedButtons[i].SetActive(false);
|
|
this.usedButtons[i].transform.SetParent(this.lineParent, true);
|
|
this.usedButtons[i] = null;
|
|
}
|
|
}
|
|
this.usedButtons.Clear();
|
|
for (int j = 0; j < this.usedButtonsUnavailable.Count; j++)
|
|
{
|
|
if (this.usedButtonsUnavailable[j])
|
|
{
|
|
this.openButtonsUnavailable.Add(this.usedButtonsUnavailable[j]);
|
|
this.usedButtonsUnavailable[j].SetActive(false);
|
|
this.usedButtonsUnavailable[j].transform.SetParent(this.lineParent, true);
|
|
this.usedButtonsUnavailable[j] = null;
|
|
}
|
|
}
|
|
this.usedButtonsUnavailable.Clear();
|
|
for (int k = 0; k < this.usedLines.Count; k++)
|
|
{
|
|
if (this.usedLines[k])
|
|
{
|
|
this.openLines.Add(this.usedLines[k]);
|
|
this.usedLines[k].SetActive(false);
|
|
this.usedLines[k] = null;
|
|
}
|
|
}
|
|
this.usedLines.RemoveAll((GameObject item) => item == null);
|
|
}
|
|
|
|
// Token: 0x06000F61 RID: 3937 RVA: 0x00129F7C File Offset: 0x0012817C
|
|
public void SetupFromGameLoad()
|
|
{
|
|
this.ResetExiles();
|
|
this.exiles = Records.x.exiles;
|
|
this.exilesPurseState = Records.x.exilesPurseState;
|
|
for (int i = 0; i < this.exiles.Count; i++)
|
|
{
|
|
this.AddLine(this.exiles[i], this.exilesPurseState[i]);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F62 RID: 3938 RVA: 0x00129FE4 File Offset: 0x001281E4
|
|
public void StartMenu()
|
|
{
|
|
if (!base.gameObject.activeSelf)
|
|
{
|
|
base.gameObject.SetActive(true);
|
|
}
|
|
if (this.contents1.activeSelf)
|
|
{
|
|
return;
|
|
}
|
|
Links.x.gameplay.lastMenu = "Forfeits";
|
|
Links.x.gameplay.openingAnotherMenu = true;
|
|
Links.x.gameplay.CloseAllMenus();
|
|
if (!Records.x.inMenus && Links.x.gaia.sceneLoaded)
|
|
{
|
|
Links.x.gameplay.OpenDock();
|
|
}
|
|
this.on = true;
|
|
Records.x.AddMenu(base.gameObject);
|
|
this.anim.enabled = true;
|
|
this.anim.Play("RestOpen");
|
|
this.contents1.SetActive(true);
|
|
this.exiles = Records.x.exiles;
|
|
this.exilesPurseState = Records.x.exilesPurseState;
|
|
Links.x.hudControl.ChangeHudVisibility(false, true);
|
|
this.CheckButtons();
|
|
this.SetFirstButtonAsSelected(true);
|
|
if (Links.x.joy)
|
|
{
|
|
this.controller.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
this.str.Clear();
|
|
this.str.Append("<voffset=.4em><size=40><sprite=");
|
|
int controllerSprite = Links.x.gameplay.GetControllerSprite("Joystick", Links.x.gameplay.controllerName);
|
|
this.str.Append(controllerSprite);
|
|
this.str.Append("></size></voffset> Navigate ");
|
|
this.controller.text = this.str.ToString();
|
|
return;
|
|
}
|
|
this.controller.text = "";
|
|
}
|
|
|
|
// Token: 0x06000F63 RID: 3939 RVA: 0x0012A1B0 File Offset: 0x001283B0
|
|
public bool InForfeitsBoard(string characterName)
|
|
{
|
|
for (int i = 0; i < this.exiles.Count; i++)
|
|
{
|
|
if (this.exiles[i] != "" && this.exiles[i] == characterName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000F64 RID: 3940 RVA: 0x0012A204 File Offset: 0x00128404
|
|
public void AddLine(string characterName, float state)
|
|
{
|
|
Library.Characters pcrowFromName = Links.x.library.GetPCRowFromName(characterName);
|
|
if (pcrowFromName != null)
|
|
{
|
|
GameObject gameObject;
|
|
if (this.openLines.Count == 0)
|
|
{
|
|
gameObject = Object.Instantiate<GameObject>(this.line, new Vector3(0f, 0f, 0f), Quaternion.identity, this.lineParent);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
gameObject = this.openLines[0];
|
|
if (!gameObject)
|
|
{
|
|
gameObject = Object.Instantiate<GameObject>(this.line, new Vector3(0f, 0f, 0f), Quaternion.identity, this.lineParent);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
this.openLines.RemoveAt(0);
|
|
gameObject.SetActive(true);
|
|
}
|
|
}
|
|
gameObject.name = characterName;
|
|
string text = pcrowFromName._GenericName;
|
|
if (text == "Journeier")
|
|
{
|
|
text = "Grave Robber";
|
|
}
|
|
string text2 = pcrowFromName._DisplayName + ", " + text;
|
|
gameObject.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = text2;
|
|
if (Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= state && state != 0f)
|
|
{
|
|
GameObject gameObject2;
|
|
if (this.openButtons.Count == 0)
|
|
{
|
|
gameObject2 = Object.Instantiate<GameObject>(this.purseButton, new Vector3(0f, 0f, 0f), Quaternion.identity, gameObject.transform);
|
|
gameObject2.transform.localPosition = Vector3.zero;
|
|
gameObject2.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
gameObject2.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
gameObject2 = this.openButtons[0];
|
|
if (gameObject2)
|
|
{
|
|
this.openButtons.RemoveAt(0);
|
|
gameObject2.SetActive(true);
|
|
gameObject2.transform.SetParent(gameObject.transform, false);
|
|
gameObject2.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject2 = Object.Instantiate<GameObject>(this.purseButton, new Vector3(0f, 0f, 0f), Quaternion.identity, gameObject.transform);
|
|
gameObject2.transform.localPosition = Vector3.zero;
|
|
gameObject2.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
gameObject2.SetActive(true);
|
|
}
|
|
}
|
|
this.usedButtons.Add(gameObject2);
|
|
gameObject2.GetComponent<Button>().interactable = true;
|
|
}
|
|
if (Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) < state && state != 0f)
|
|
{
|
|
GameObject gameObject3;
|
|
if (this.openButtonsUnavailable.Count == 0)
|
|
{
|
|
gameObject3 = Object.Instantiate<GameObject>(this.purseButtonUnavailable, new Vector3(0f, 0f, 0f), Quaternion.identity, gameObject.transform);
|
|
gameObject3.transform.localPosition = Vector3.zero;
|
|
gameObject3.SetActive(true);
|
|
gameObject3.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject3 = this.openButtonsUnavailable[0];
|
|
if (gameObject3)
|
|
{
|
|
this.openButtonsUnavailable.RemoveAt(0);
|
|
gameObject3.SetActive(true);
|
|
gameObject3.transform.SetParent(gameObject.transform, false);
|
|
gameObject3.transform.localPosition = Vector3.zero;
|
|
gameObject3.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject3 = Object.Instantiate<GameObject>(this.purseButtonUnavailable, new Vector3(0f, 0f, 0f), Quaternion.identity, gameObject.transform);
|
|
gameObject3.transform.localPosition = Vector3.zero;
|
|
gameObject3.SetActive(true);
|
|
gameObject3.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
}
|
|
this.usedButtonsUnavailable.Add(gameObject3);
|
|
}
|
|
this.usedLines.Add(gameObject);
|
|
this.originals.SetAsLastSibling();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F65 RID: 3941 RVA: 0x0012A614 File Offset: 0x00128814
|
|
private void CheckButtons()
|
|
{
|
|
for (int i = 0; i < this.exiles.Count; i++)
|
|
{
|
|
if (this.usedLines[i].transform.childCount > 1)
|
|
{
|
|
float num = this.exilesPurseState[i];
|
|
Debug.Log(string.Concat(new string[]
|
|
{
|
|
this.exiles[i],
|
|
" ",
|
|
num.ToString(),
|
|
" ",
|
|
Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()).ToString()
|
|
}));
|
|
if (Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= num && num != 0f)
|
|
{
|
|
GameObject gameObject = this.usedLines[i].transform.GetChild(1).gameObject;
|
|
int num2 = this.usedButtonsUnavailable.IndexOf(gameObject);
|
|
if (num2 > -1)
|
|
{
|
|
this.openButtonsUnavailable.Add(gameObject);
|
|
gameObject.SetActive(false);
|
|
gameObject.transform.SetParent(this.lineParent, true);
|
|
this.usedButtonsUnavailable[num2] = null;
|
|
if (this.openButtons.Count == 0)
|
|
{
|
|
gameObject = Object.Instantiate<GameObject>(this.purseButton, new Vector3(0f, 0f, 0f), Quaternion.identity, this.usedLines[i].transform);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.SetActive(true);
|
|
gameObject.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject = this.openButtons[0];
|
|
if (gameObject)
|
|
{
|
|
this.openButtons.RemoveAt(0);
|
|
gameObject.SetActive(true);
|
|
gameObject.transform.SetParent(this.usedLines[i].transform, false);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject = Object.Instantiate<GameObject>(this.purseButton, new Vector3(0f, 0f, 0f), Quaternion.identity, this.usedLines[i].transform);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.SetActive(true);
|
|
gameObject.GetComponent<RectTransform>().anchoredPosition = Vector3.zero;
|
|
}
|
|
}
|
|
this.usedButtons.Add(gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F66 RID: 3942 RVA: 0x0012A89C File Offset: 0x00128A9C
|
|
public void ClickedReward(GameObject go)
|
|
{
|
|
string name = go.gameObject.transform.parent.gameObject.name;
|
|
Debug.Log(name);
|
|
go.gameObject.SetActive(false);
|
|
this.openButtons.Add(go);
|
|
Links.x.itemPickupFX.gameObject.SetActive(true);
|
|
Links.x.itemPickupFX.gameObject.GetComponent<HannahAnimator>().Play("Idle");
|
|
Links.x.itemPickupFX.position = go.transform.GetChild(0).position;
|
|
int num = this.emeraldsPerReward;
|
|
if (name.Contains("RobberBaron"))
|
|
{
|
|
num = 100;
|
|
}
|
|
Links.x.inventory.emeralds += num;
|
|
Links.x.gameFeed.AddFeed("Party received " + num.ToString() + " emeralds");
|
|
MasterAudio.PlaySoundAndForget("Inventory", 0.6f, new float?(1f), 0f, "Coins", null);
|
|
Links.x.inventory.peddlerFX.gameObject.SetActive(true);
|
|
Links.x.inventory.peddlerFX.Play("Peddler", -1, 0f);
|
|
Links.x.inventory.peddlerSellAmount.text = num.ToString();
|
|
Links.x.inventory.peddlerSellAmount.color = Color.white;
|
|
Links.x.inventory.peddlerFX.GetComponent<RectTransform>().position = go.transform.GetChild(0).gameObject.transform.position;
|
|
int num2 = this.exiles.IndexOf(name);
|
|
if (num2 > -1)
|
|
{
|
|
this.exilesPurseState[num2] = 0f;
|
|
}
|
|
this.SetFirstButtonAsSelected(false);
|
|
}
|
|
|
|
// Token: 0x06000F67 RID: 3943 RVA: 0x0012AA7F File Offset: 0x00128C7F
|
|
private void SetFirstButtonAsSelected(bool first)
|
|
{
|
|
base.StartCoroutine(this.SetFirstButton(first));
|
|
}
|
|
|
|
// Token: 0x06000F68 RID: 3944 RVA: 0x0012AA8F File Offset: 0x00128C8F
|
|
private IEnumerator SetFirstButton(bool first)
|
|
{
|
|
yield return new WaitForSecondsRealtime(0.2f);
|
|
if (Links.x.joy)
|
|
{
|
|
Debug.Log(this.usedButtons.Count);
|
|
if (this.usedButtons.Count > 0)
|
|
{
|
|
bool flag = false;
|
|
for (int i = 0; i < this.usedButtons.Count; i++)
|
|
{
|
|
if (this.usedButtons[i].gameObject.activeSelf && !flag)
|
|
{
|
|
flag = true;
|
|
if (first)
|
|
{
|
|
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.usedButtons[i].gameObject);
|
|
}
|
|
else
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.usedButtons[i].gameObject);
|
|
}
|
|
}
|
|
}
|
|
if (!flag)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.scrollbar.gameObject);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.scrollbar.gameObject);
|
|
}
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06000F69 RID: 3945 RVA: 0x0012AAA8 File Offset: 0x00128CA8
|
|
public void CloseMenu(bool fromCloseButton)
|
|
{
|
|
Links.x.hudControl.JoyBox(false);
|
|
this.on = false;
|
|
Records.x.RemoveMenu(base.gameObject);
|
|
this.anim.Play("RestClose");
|
|
if (fromCloseButton)
|
|
{
|
|
Links.x.gameplay.CloseDock();
|
|
}
|
|
Links.x.hudControl.ChangeHudVisibility(true, true);
|
|
}
|
|
|
|
// Token: 0x06000F6A RID: 3946 RVA: 0x0012AB0F File Offset: 0x00128D0F
|
|
public void EndMenu()
|
|
{
|
|
this.contents1.SetActive(false);
|
|
}
|
|
|
|
// Token: 0x04001944 RID: 6468
|
|
public Animator anim;
|
|
|
|
// Token: 0x04001945 RID: 6469
|
|
public GameObject contents1;
|
|
|
|
// Token: 0x04001946 RID: 6470
|
|
public bool on;
|
|
|
|
// Token: 0x04001947 RID: 6471
|
|
public int emeraldsPerReward = 50;
|
|
|
|
// Token: 0x04001948 RID: 6472
|
|
public GameObject line;
|
|
|
|
// Token: 0x04001949 RID: 6473
|
|
public GameObject purseButton;
|
|
|
|
// Token: 0x0400194A RID: 6474
|
|
public GameObject purseButtonUnavailable;
|
|
|
|
// Token: 0x0400194B RID: 6475
|
|
public Transform lineParent;
|
|
|
|
// Token: 0x0400194C RID: 6476
|
|
public List<GameObject> usedLines = new List<GameObject>();
|
|
|
|
// Token: 0x0400194D RID: 6477
|
|
public List<GameObject> openLines = new List<GameObject>();
|
|
|
|
// Token: 0x0400194E RID: 6478
|
|
public List<GameObject> usedButtons = new List<GameObject>();
|
|
|
|
// Token: 0x0400194F RID: 6479
|
|
public List<GameObject> openButtons = new List<GameObject>();
|
|
|
|
// Token: 0x04001950 RID: 6480
|
|
public List<GameObject> usedButtonsUnavailable = new List<GameObject>();
|
|
|
|
// Token: 0x04001951 RID: 6481
|
|
public List<GameObject> openButtonsUnavailable = new List<GameObject>();
|
|
|
|
// Token: 0x04001952 RID: 6482
|
|
private List<string> exiles;
|
|
|
|
// Token: 0x04001953 RID: 6483
|
|
private List<float> exilesPurseState;
|
|
|
|
// Token: 0x04001954 RID: 6484
|
|
public ScrollRectNoDragging scrollRect1;
|
|
|
|
// Token: 0x04001955 RID: 6485
|
|
public Transform originals;
|
|
|
|
// Token: 0x04001956 RID: 6486
|
|
public TextMeshProUGUI controller;
|
|
|
|
// Token: 0x04001957 RID: 6487
|
|
private StringFast str = new StringFast(32);
|
|
|
|
// Token: 0x04001958 RID: 6488
|
|
public GameObject scrollbar;
|
|
}
|