1280 lines
33 KiB
C#
1280 lines
33 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x020000A7 RID: 167
|
|
public class Formation : MonoBehaviour
|
|
{
|
|
// Token: 0x06000F6C RID: 3948 RVA: 0x0012AB8C File Offset: 0x00128D8C
|
|
private void Awake()
|
|
{
|
|
this.contents1.SetActive(false);
|
|
this.anim.enabled = false;
|
|
this.defaultText = "Drag companions to change formation positions. Select a companion to update their support behavior.";
|
|
this.normalTextColor1 = this.support.color;
|
|
this.normalTextColor2 = this.evade.color;
|
|
}
|
|
|
|
// Token: 0x06000F6D RID: 3949 RVA: 0x0012ABDE File Offset: 0x00128DDE
|
|
private void Start()
|
|
{
|
|
Links.x.formation = this;
|
|
}
|
|
|
|
// Token: 0x06000F6E RID: 3950 RVA: 0x0012ABEC File Offset: 0x00128DEC
|
|
public void UpdateSlider()
|
|
{
|
|
GameObject currentEventObject = Links.x.gameplay.currentEventObject;
|
|
if (currentEventObject)
|
|
{
|
|
float x = Links.x.fellowship.direction.x;
|
|
Slider slider = null;
|
|
if (currentEventObject == this.items.gameObject)
|
|
{
|
|
slider = this.items;
|
|
}
|
|
if (currentEventObject == this.buffs.gameObject)
|
|
{
|
|
slider = this.buffs;
|
|
}
|
|
if (currentEventObject == this.criticals.gameObject)
|
|
{
|
|
slider = this.criticals;
|
|
}
|
|
float num = 1f;
|
|
if (slider)
|
|
{
|
|
float num2 = 0.05f;
|
|
if (slider == this.buffs)
|
|
{
|
|
num2 = 0.3f;
|
|
}
|
|
if (Time.realtimeSinceStartup > this.lastSliderTime + num2 || this.lastSliderTime == 0f)
|
|
{
|
|
if (x > 0f)
|
|
{
|
|
slider.value += num;
|
|
}
|
|
else if (x < 0f)
|
|
{
|
|
slider.value -= num;
|
|
}
|
|
this.lastSliderTime = Time.realtimeSinceStartup;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F6F RID: 3951 RVA: 0x0012ACFC File Offset: 0x00128EFC
|
|
public void StartMenu()
|
|
{
|
|
this.anim.enabled = true;
|
|
this.canvas.enabled = true;
|
|
bool flag = false;
|
|
if (Links.x.joy && (Links.x.gameplay.dockStart || Links.x.gameplay.itemsStart))
|
|
{
|
|
flag = true;
|
|
}
|
|
if (!flag)
|
|
{
|
|
this.anim.Play("RestOpen");
|
|
}
|
|
else
|
|
{
|
|
this.anim.Play("RestOpen", 0, 1f);
|
|
}
|
|
this.party = Links.x.portraitOrder;
|
|
Links.x.gameplay.openingAnotherMenu = true;
|
|
Links.x.gameplay.CloseAllMenus();
|
|
if (!Records.x.inMenus && Links.x.gaia.sceneLoaded)
|
|
{
|
|
Links.x.gameplay.OpenDock();
|
|
}
|
|
this.open = true;
|
|
this.contents1.SetActive(true);
|
|
this.party1.SetActive(false);
|
|
this.party2.SetActive(false);
|
|
this.party3.SetActive(false);
|
|
this.party4.SetActive(false);
|
|
this.dragging = false;
|
|
for (int i = 0; i < this.companionIcons.Count; i++)
|
|
{
|
|
if (this.companionIcons[i])
|
|
{
|
|
this.companionIcons[i].TurnOff();
|
|
}
|
|
}
|
|
for (int j = 0; j < this.party.Count; j++)
|
|
{
|
|
if (this.party[j])
|
|
{
|
|
if (j == 0)
|
|
{
|
|
this.party1.SetActive(true);
|
|
}
|
|
if (j == 1)
|
|
{
|
|
this.party2.SetActive(true);
|
|
}
|
|
if (j == 2)
|
|
{
|
|
this.party3.SetActive(true);
|
|
}
|
|
if (j == 3)
|
|
{
|
|
this.party4.SetActive(true);
|
|
}
|
|
if (this.companionIcons[j].character != this.party[j])
|
|
{
|
|
this.companionIcons[j].Setup(this.party[j]);
|
|
this.companionIcons[j].btn.interactable = true;
|
|
}
|
|
}
|
|
}
|
|
Records.x.AddMenu(base.gameObject);
|
|
if (Links.x.mk)
|
|
{
|
|
this.controllerMessage.enabled = false;
|
|
this.controllerMessage.gameObject.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
this.controllerMessage.enabled = true;
|
|
this.controllerMessage.gameObject.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
this.str.Clear();
|
|
this.str.Append("<voffset=.4em><size=40><sprite=");
|
|
this.str.Append(Links.x.gameplay.GetControllerSprite("Action", Links.x.gameplay.controllerName));
|
|
this.str.Append("></size></voffset>");
|
|
this.str.Append("Start Drag");
|
|
this.str.Append(" <voffset=.4em><size=40><sprite=");
|
|
this.str.Append(Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName));
|
|
this.str.Append("></size></voffset>");
|
|
this.str.Append("Support Behavior");
|
|
this.controllerMessageHover = this.str.ToString();
|
|
this.controllerMessage.text = this.controllerMessageHover;
|
|
this.controllerMessage.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
this.str.Clear();
|
|
this.str.Append("<voffset=.4em><size=40><sprite=");
|
|
int num = Links.x.gameplay.GetControllerSprite("Joystick", Links.x.gameplay.controllerName);
|
|
this.str.Append(num);
|
|
this.str.Append("></size></voffset>Drag ");
|
|
this.str.Append("<voffset=.4em><size=40><sprite=");
|
|
num = Links.x.gameplay.GetControllerSprite("Action", Links.x.gameplay.controllerName);
|
|
this.str.Append(num);
|
|
this.str.Append("></size></voffset>End Drag");
|
|
this.controllerMessageDrag = this.str.ToString();
|
|
this.str.Clear();
|
|
this.str.Append("<voffset=.4em><size=40><sprite=");
|
|
this.str.Append(Links.x.gameplay.GetControllerSprite("Cancel", Links.x.gameplay.controllerName));
|
|
this.str.Append("></size></voffset>");
|
|
this.str.Append("Return to portraits");
|
|
this.controllerMessageSliders = this.str.ToString();
|
|
this.dragMessage.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
this.dragMessage.enabled = true;
|
|
if (Links.x.joy)
|
|
{
|
|
this.items.interactable = false;
|
|
this.buffs.interactable = false;
|
|
this.criticals.interactable = false;
|
|
}
|
|
else
|
|
{
|
|
this.items.interactable = true;
|
|
this.buffs.interactable = true;
|
|
this.criticals.interactable = true;
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
this.formationDescription = Links.x.formation.defaultText;
|
|
this.dragMessage.text = this.formationDescription;
|
|
}
|
|
if (Links.x.mk)
|
|
{
|
|
foreach (TextMeshProUGUI textMeshProUGUI in this.autoCastIcons)
|
|
{
|
|
textMeshProUGUI.text = "";
|
|
textMeshProUGUI.enabled = false;
|
|
}
|
|
using (List<TextMeshProUGUI>.Enumerator enumerator = this.leaderIcons.GetEnumerator())
|
|
{
|
|
while (enumerator.MoveNext())
|
|
{
|
|
TextMeshProUGUI textMeshProUGUI2 = enumerator.Current;
|
|
textMeshProUGUI2.text = "";
|
|
textMeshProUGUI2.enabled = false;
|
|
}
|
|
goto IL_06F8;
|
|
}
|
|
}
|
|
num = Links.x.gameplay.GetControllerSprite("BtnNorth", Links.x.gameplay.controllerName);
|
|
this.str.Clear();
|
|
this.str.Append("<voffset=-.9em>Toggle Group Leader <voffset=-.6em><size=20><sprite=");
|
|
this.str.Append(num);
|
|
this.str.Append("></size></voffset></voffset>");
|
|
foreach (TextMeshProUGUI textMeshProUGUI3 in this.leaderIcons)
|
|
{
|
|
textMeshProUGUI3.text = this.str.ToString();
|
|
textMeshProUGUI3.enabled = true;
|
|
textMeshProUGUI3.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
}
|
|
IL_06F8:
|
|
this.EmptySliders();
|
|
this.StartCompanions();
|
|
if (Links.x.joy)
|
|
{
|
|
Links.x.hudControl.UpdateMenuSwitcher("Formation");
|
|
}
|
|
this.updateTime = Time.realtimeSinceStartup;
|
|
}
|
|
|
|
// Token: 0x06000F70 RID: 3952 RVA: 0x0012B460 File Offset: 0x00129660
|
|
public void StartEndMenu(bool fromCloseButton)
|
|
{
|
|
foreach (CompanionIcon companionIcon in this.companionIcons)
|
|
{
|
|
if (companionIcon.character)
|
|
{
|
|
companionIcon.character.stats.isLeader = companionIcon.leader.isOn;
|
|
}
|
|
}
|
|
if (fromCloseButton && Links.x.gaia.sceneLoaded)
|
|
{
|
|
Links.x.gameplay.CloseDock();
|
|
}
|
|
bool flag = false;
|
|
if (Links.x.joy && (Links.x.gameplay.dockStart || Links.x.gameplay.itemsStart))
|
|
{
|
|
flag = true;
|
|
}
|
|
if (!flag)
|
|
{
|
|
this.anim.Play("RestClose");
|
|
}
|
|
else
|
|
{
|
|
this.anim.Play("RestClose", 0, 1f);
|
|
}
|
|
if (this.dragging && this.draggingIcon)
|
|
{
|
|
this.draggingIcon.EndDrag();
|
|
}
|
|
Links.x.SetFormationOrder();
|
|
this.dragging = false;
|
|
Links.x.hudControl.JoyBox(false);
|
|
}
|
|
|
|
// Token: 0x06000F71 RID: 3953 RVA: 0x0012B598 File Offset: 0x00129798
|
|
public void EndMenu()
|
|
{
|
|
this.open = false;
|
|
this.contents1.SetActive(false);
|
|
Links.x.SetFormationParty();
|
|
if (this.selectedCharacter)
|
|
{
|
|
this.GetSelectedIcon().selected.enabled = false;
|
|
}
|
|
this.selectedCharacter = null;
|
|
Records.x.RemoveMenu(base.gameObject);
|
|
this.anim.enabled = false;
|
|
this.canvas.enabled = false;
|
|
Links.x.OrderPortraitList();
|
|
Links.x.hudControl.SetPortraitPositions();
|
|
Links.x.characterSheet.OrderPortraits();
|
|
Links.x.hudControl.SetPortraitBacks();
|
|
Links.x.fellowship.SetFirstAsSelected(true);
|
|
}
|
|
|
|
// Token: 0x06000F72 RID: 3954 RVA: 0x0012B656 File Offset: 0x00129856
|
|
public void Save()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000F73 RID: 3955 RVA: 0x0012B658 File Offset: 0x00129858
|
|
public void Load()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000F74 RID: 3956 RVA: 0x0012B65A File Offset: 0x0012985A
|
|
public void StartCompanions()
|
|
{
|
|
this.AddPortraits();
|
|
}
|
|
|
|
// Token: 0x06000F75 RID: 3957 RVA: 0x0012B664 File Offset: 0x00129864
|
|
public void AddPortraits()
|
|
{
|
|
for (int i = 0; i < this.companionIcons.Count; i++)
|
|
{
|
|
if (this.companionIcons[i].character)
|
|
{
|
|
this.SetPortraitParent(i, false);
|
|
this.companionIcons[i].btn.interactable = true;
|
|
}
|
|
}
|
|
this.open = true;
|
|
this.SetLeaders();
|
|
if (Links.x.joy && this.open)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.companionIcons[0].gameObject);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F76 RID: 3958 RVA: 0x0012B6FC File Offset: 0x001298FC
|
|
public void SetPortraitParent(int i, bool fromDrag)
|
|
{
|
|
this.companionIcons[i].enabled = true;
|
|
Transform transform = this.companionIcons[i].gameObject.transform;
|
|
RectTransform rt = this.companionIcons[i].rt;
|
|
if (this.companionIcons[i].character.stats.formationGroup == 1)
|
|
{
|
|
transform.SetParent(this.group1);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 2)
|
|
{
|
|
transform.SetParent(this.group2);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 3)
|
|
{
|
|
transform.SetParent(this.group3);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 4)
|
|
{
|
|
transform.SetParent(this.group4);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 5)
|
|
{
|
|
transform.SetParent(this.group5);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 6)
|
|
{
|
|
transform.SetParent(this.group6);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 7)
|
|
{
|
|
transform.SetParent(this.group7);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 8)
|
|
{
|
|
transform.SetParent(this.group8);
|
|
}
|
|
if (this.companionIcons[i].character.stats.formationGroup == 9)
|
|
{
|
|
transform.SetParent(this.group9);
|
|
}
|
|
float num = Random.Range(-10f, 10f);
|
|
float num2 = Random.Range(-10f, 10f);
|
|
int num3 = 0;
|
|
int formationGroup = this.companionIcons[i].character.stats.formationGroup;
|
|
for (int j = 0; j < this.companionIcons.Count; j++)
|
|
{
|
|
Character character = this.companionIcons[j].character;
|
|
if (character && character.stats.formationGroup == formationGroup)
|
|
{
|
|
num3++;
|
|
}
|
|
}
|
|
if (num3 <= 1)
|
|
{
|
|
num = 0f;
|
|
num2 = 0f;
|
|
rt.anchoredPosition3D = new Vector3(num, num2, 0f);
|
|
}
|
|
if (num3 >= 2)
|
|
{
|
|
num3 = 0;
|
|
float num4 = 35f;
|
|
for (int k = 0; k < this.companionIcons.Count; k++)
|
|
{
|
|
Character character2 = this.companionIcons[k].character;
|
|
if (character2 && character2.stats.formationGroup == formationGroup)
|
|
{
|
|
if (num3 == 0)
|
|
{
|
|
num = num4 * -1f;
|
|
num2 = num4;
|
|
}
|
|
if (num3 == 1)
|
|
{
|
|
num = num4 * -1f;
|
|
num2 = num4 * -1f;
|
|
}
|
|
if (num3 == 2)
|
|
{
|
|
num = num4 * 1f;
|
|
num2 = num4;
|
|
}
|
|
if (num3 == 3)
|
|
{
|
|
num = num4 * 1f;
|
|
num2 = num4 * -1f;
|
|
}
|
|
num3++;
|
|
this.companionIcons[k].rt.anchoredPosition3D = new Vector3(num + 5f, num2, 0f);
|
|
}
|
|
}
|
|
}
|
|
transform.localScale = new Vector3(1f, 1f, 1f);
|
|
Links.x.formationTooltip.transform.SetAsLastSibling();
|
|
if (Links.x.joy)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(transform.gameObject);
|
|
}
|
|
if (fromDrag)
|
|
{
|
|
for (int l = 0; l < this.companionIcons.Count; l++)
|
|
{
|
|
if (l != i && this.companionIcons[l].character)
|
|
{
|
|
this.SetPortraitParent(l, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F77 RID: 3959 RVA: 0x0012BAE0 File Offset: 0x00129CE0
|
|
public void EndCompanions()
|
|
{
|
|
for (int i = 0; i < this.companionIcons.Count; i++)
|
|
{
|
|
Character character = this.companionIcons[i].character;
|
|
if (character)
|
|
{
|
|
character.stats.FormationTactics();
|
|
this.companionIcons[i].enabled = false;
|
|
Transform transform = this.companionIcons[i].gameObject.transform;
|
|
transform.localPosition = Vector3.zero;
|
|
transform.localScale = new Vector3(1f, 1f, 1f);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F78 RID: 3960 RVA: 0x0012BB77 File Offset: 0x00129D77
|
|
public void UpdateItemUse(GameObject obj)
|
|
{
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
Character character = obj.GetComponent<CompanionIcon>().character;
|
|
}
|
|
|
|
// Token: 0x06000F79 RID: 3961 RVA: 0x0012BB9C File Offset: 0x00129D9C
|
|
public void UpdateAutoCast(GameObject obj)
|
|
{
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
Character character = obj.GetComponent<CompanionIcon>().character;
|
|
}
|
|
|
|
// Token: 0x06000F7A RID: 3962 RVA: 0x0012BBC4 File Offset: 0x00129DC4
|
|
public bool SharingFormationGroup(Character c)
|
|
{
|
|
foreach (CompanionIcon companionIcon in this.companionIcons)
|
|
{
|
|
if (companionIcon.character != c && companionIcon.character && companionIcon.character.stats.formationGroup == c.stats.formationGroup)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000F7B RID: 3963 RVA: 0x0012BC50 File Offset: 0x00129E50
|
|
public void UpdateLeader(GameObject obj)
|
|
{
|
|
if (!obj)
|
|
{
|
|
return;
|
|
}
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
CompanionIcon component = obj.GetComponent<CompanionIcon>();
|
|
Character character = component.character;
|
|
if (character && component.leader)
|
|
{
|
|
character.stats.isLeader = component.leader.isOn;
|
|
if (character.stats.isLeader)
|
|
{
|
|
using (List<CompanionIcon>.Enumerator enumerator = this.companionIcons.GetEnumerator())
|
|
{
|
|
while (enumerator.MoveNext())
|
|
{
|
|
CompanionIcon companionIcon = enumerator.Current;
|
|
if (companionIcon != component && component.character && companionIcon.character && companionIcon.character.stats.formationGroup == component.character.stats.formationGroup)
|
|
{
|
|
companionIcon.character.stats.isLeader = false;
|
|
companionIcon.CheckLeader();
|
|
companionIcon.character.stats.FormationTactics();
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
this.SetLeaders();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F7C RID: 3964 RVA: 0x0012BD80 File Offset: 0x00129F80
|
|
public void UpdateSelectedCharacter(Character c)
|
|
{
|
|
this.selectedCharacter = c;
|
|
this.UpdateSliderValues(c);
|
|
}
|
|
|
|
// Token: 0x06000F7D RID: 3965 RVA: 0x0012BD90 File Offset: 0x00129F90
|
|
public void EmptySliders()
|
|
{
|
|
this.items.interactable = false;
|
|
this.buffs.interactable = false;
|
|
this.criticals.interactable = false;
|
|
this.updateTime = Time.realtimeSinceStartup;
|
|
this.items.value = 0f;
|
|
this.buffs.value = 0f;
|
|
this.criticals.value = 0f;
|
|
this.outputBuffs.text = "";
|
|
this.outputCriticals.text = "";
|
|
this.outputItems.text = "";
|
|
}
|
|
|
|
// Token: 0x06000F7E RID: 3966 RVA: 0x0012BE2C File Offset: 0x0012A02C
|
|
public void UpdateSliderValues(Character c)
|
|
{
|
|
if (Links.x.mk)
|
|
{
|
|
this.items.interactable = true;
|
|
this.buffs.interactable = true;
|
|
this.criticals.interactable = true;
|
|
}
|
|
this.updateTime = Time.realtimeSinceStartup;
|
|
this.items.value = (float)c.stats.useItemsAI;
|
|
this.buffs.value = (float)c.stats.autoBuffsAI;
|
|
this.criticals.value = (float)c.stats.autoCritsAI;
|
|
this.SetOutputs();
|
|
}
|
|
|
|
// Token: 0x06000F7F RID: 3967 RVA: 0x0012BEC0 File Offset: 0x0012A0C0
|
|
public void SetOutputs()
|
|
{
|
|
int num = (int)this.items.value;
|
|
this.outputItems.text = num.ToString() + "%";
|
|
num = (int)this.buffs.value;
|
|
if (num == 0)
|
|
{
|
|
this.outputBuffs.text = "Low";
|
|
}
|
|
else if (num == 1)
|
|
{
|
|
this.outputBuffs.text = "Medium";
|
|
}
|
|
else if (num == 2)
|
|
{
|
|
this.outputBuffs.text = "High";
|
|
}
|
|
else
|
|
{
|
|
this.outputBuffs.text = "Never";
|
|
}
|
|
num = (int)this.criticals.value;
|
|
this.outputCriticals.text = num.ToString() + "%";
|
|
}
|
|
|
|
// Token: 0x06000F80 RID: 3968 RVA: 0x0012BF80 File Offset: 0x0012A180
|
|
public void UpdateSlider(string type)
|
|
{
|
|
if (this.selectedCharacter && this.open && Time.realtimeSinceStartup > this.updateTime + 0.1f)
|
|
{
|
|
if (type == "Items")
|
|
{
|
|
this.selectedCharacter.stats.useItemsAI = (int)this.items.value;
|
|
}
|
|
if (type == "Buffs")
|
|
{
|
|
this.selectedCharacter.stats.autoBuffsAI = (int)this.buffs.value;
|
|
}
|
|
if (type == "Criticals")
|
|
{
|
|
this.selectedCharacter.stats.autoCritsAI = (int)this.criticals.value;
|
|
}
|
|
this.SetOutputs();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F81 RID: 3969 RVA: 0x0012C040 File Offset: 0x0012A240
|
|
private void Update()
|
|
{
|
|
if (this.open)
|
|
{
|
|
this.dragMessage.text = this.formationDescription;
|
|
if (Links.x.joy)
|
|
{
|
|
GameObject currentEventObject = Links.x.gameplay.currentEventObject;
|
|
CompanionIcon companionIcon = null;
|
|
if (currentEventObject)
|
|
{
|
|
companionIcon = currentEventObject.GetComponent<CompanionIcon>();
|
|
if (companionIcon && Links.x.gameplay.targetDodgeStart)
|
|
{
|
|
bool flag = false;
|
|
if (companionIcon.leaderJoy.gameObject.activeSelf)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
if (companionIcon.leaderJoy.isOn)
|
|
{
|
|
companionIcon.leaderJoy.isOn = false;
|
|
companionIcon.leader.isOn = false;
|
|
}
|
|
else
|
|
{
|
|
companionIcon.leaderJoy.isOn = true;
|
|
companionIcon.leader.isOn = true;
|
|
}
|
|
this.UpdateLeader(companionIcon.gameObject);
|
|
}
|
|
}
|
|
}
|
|
if (currentEventObject)
|
|
{
|
|
companionIcon = currentEventObject.GetComponent<CompanionIcon>();
|
|
}
|
|
if (!this.dragging && (this.selectedCharacter || companionIcon) && this.open)
|
|
{
|
|
if (Links.x.gameplay.interactStart)
|
|
{
|
|
if (companionIcon)
|
|
{
|
|
if (this.selectedCharacter)
|
|
{
|
|
this.GetSelectedIcon().selected.enabled = false;
|
|
}
|
|
this.selectedCharacter = companionIcon.character;
|
|
this.UpdateSelectedCharacter(companionIcon.character);
|
|
this.GetSelectedIcon().selected.enabled = true;
|
|
}
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
this.companionIcons[i].btn.interactable = false;
|
|
}
|
|
this.items.interactable = true;
|
|
this.buffs.interactable = true;
|
|
this.criticals.interactable = true;
|
|
EventSystem.current.SetSelectedGameObject(this.items.gameObject);
|
|
this.cancelButton.SetActive(false);
|
|
}
|
|
if (Links.x.gameplay.cancelStart && !this.cancelButton.activeSelf)
|
|
{
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
this.companionIcons[j].btn.interactable = true;
|
|
}
|
|
EventSystem.current.SetSelectedGameObject(this.GetSelectedIcon().gameObject);
|
|
this.cancelButton.SetActive(true);
|
|
this.items.interactable = false;
|
|
this.buffs.interactable = false;
|
|
this.criticals.interactable = false;
|
|
}
|
|
}
|
|
if (this.dragging)
|
|
{
|
|
this.controllerMessage.text = this.controllerMessageDrag;
|
|
return;
|
|
}
|
|
if (this.items.interactable)
|
|
{
|
|
this.controllerMessage.text = this.controllerMessageSliders;
|
|
return;
|
|
}
|
|
this.controllerMessage.text = this.controllerMessageHover;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F82 RID: 3970 RVA: 0x0012C2F8 File Offset: 0x0012A4F8
|
|
public void SetLeaders()
|
|
{
|
|
foreach (CompanionIcon companionIcon in this.companionIcons)
|
|
{
|
|
companionIcon.CheckLeader();
|
|
if (companionIcon.character && !companionIcon.character.stats.isLeader)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
if (companionIcon.character.stats.defendMainInCombat)
|
|
{
|
|
foreach (CompanionIcon companionIcon2 in this.companionIcons)
|
|
{
|
|
if (companionIcon2 != companionIcon && companionIcon2.character && companionIcon2.character.stats.formationGroup == companionIcon.character.stats.formationGroup)
|
|
{
|
|
num2++;
|
|
if (companionIcon2.character.stats.isLeader)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
}
|
|
if (num == 0 && num2 > 0)
|
|
{
|
|
companionIcon.character.stats.isLeader = true;
|
|
companionIcon.CheckLeader();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F83 RID: 3971 RVA: 0x0012C458 File Offset: 0x0012A658
|
|
public void StartDrag(CompanionIcon icon, CompanionDrop startBox)
|
|
{
|
|
this.dragging = true;
|
|
this.draggingIcon = icon;
|
|
if (Links.x.joy)
|
|
{
|
|
for (int i = 0; i < this.companionIcons.Count; i++)
|
|
{
|
|
if (this.companionIcons[i] != this.draggingIcon)
|
|
{
|
|
this.companionIcons[i].btn.interactable = false;
|
|
}
|
|
else
|
|
{
|
|
Navigation navigation = this.companionIcons[i].btn.navigation;
|
|
navigation.selectOnLeft = null;
|
|
navigation.selectOnRight = null;
|
|
navigation.selectOnDown = null;
|
|
navigation.selectOnUp = null;
|
|
this.companionIcons[i].btn.navigation = navigation;
|
|
this.companionIcons[i].btn.interactable = true;
|
|
}
|
|
}
|
|
this.dragMessage.enabled = true;
|
|
}
|
|
if (startBox.label1 != "Utility" && startBox.label2 != "Utility")
|
|
{
|
|
this.ToggleHighlight("Utility", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Utility", true);
|
|
}
|
|
if (startBox.label1 != "Offense" && startBox.label2 != "Offense")
|
|
{
|
|
this.ToggleHighlight("Offense", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Offense", true);
|
|
}
|
|
if (startBox.label1 != "Support" && startBox.label2 != "Support")
|
|
{
|
|
this.ToggleHighlight("Support", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Support", true);
|
|
}
|
|
if (startBox.label1 != "Avoid" && startBox.label2 != "Avoid")
|
|
{
|
|
this.ToggleHighlight("Avoid", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Avoid", true);
|
|
}
|
|
if (startBox.label1 != "Evade" && startBox.label2 != "Evade")
|
|
{
|
|
this.ToggleHighlight("Evade", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Evade", true);
|
|
}
|
|
if (startBox.label1 != "Persevere" && startBox.label2 != "Persevere")
|
|
{
|
|
this.ToggleHighlight("Persevere", false);
|
|
return;
|
|
}
|
|
this.ToggleHighlight("Persevere", true);
|
|
}
|
|
|
|
// Token: 0x06000F84 RID: 3972 RVA: 0x0012C6B4 File Offset: 0x0012A8B4
|
|
public void EndDrag(CompanionDrop endBox)
|
|
{
|
|
this.dragging = false;
|
|
if (Links.x.joy && Links.x.joy)
|
|
{
|
|
int count = this.companionIcons.Count;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
this.companionIcons[i].btn.interactable = true;
|
|
this.companionIcons[i].btn.navigation = Navigation.defaultNavigation;
|
|
}
|
|
}
|
|
this.draggingIcon = null;
|
|
if (endBox)
|
|
{
|
|
if (endBox.label1 != "Utility" && endBox.label2 != "Utility")
|
|
{
|
|
this.ToggleHighlight("Utility", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Utility", true);
|
|
}
|
|
if (endBox.label1 != "Offense" && endBox.label2 != "Offense")
|
|
{
|
|
this.ToggleHighlight("Offense", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Offense", true);
|
|
}
|
|
if (endBox.label1 != "Support" && endBox.label2 != "Support")
|
|
{
|
|
this.ToggleHighlight("Support", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Support", true);
|
|
}
|
|
if (endBox.label1 != "Avoid" && endBox.label2 != "Avoid")
|
|
{
|
|
this.ToggleHighlight("Avoid", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Avoid", true);
|
|
}
|
|
if (endBox.label1 != "Evade" && endBox.label2 != "Evade")
|
|
{
|
|
this.ToggleHighlight("Evade", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Evade", true);
|
|
}
|
|
if (endBox.label1 != "Persevere" && endBox.label2 != "Persevere")
|
|
{
|
|
this.ToggleHighlight("Persevere", false);
|
|
}
|
|
else
|
|
{
|
|
this.ToggleHighlight("Persevere", true);
|
|
}
|
|
Links.x.OrderPortraitList();
|
|
this.SetLeaders();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F85 RID: 3973 RVA: 0x0012C8C0 File Offset: 0x0012AAC0
|
|
public CompanionDrop GetClosestBox(Vector3 iconPosition)
|
|
{
|
|
float num = float.PositiveInfinity;
|
|
int num2 = -1;
|
|
for (int i = 0; i < this.companionDrops.Count; i++)
|
|
{
|
|
float sqrMagnitude = (iconPosition - this.companionDrops[i].transform.position).sqrMagnitude;
|
|
if (sqrMagnitude < num)
|
|
{
|
|
num = sqrMagnitude;
|
|
num2 = i;
|
|
}
|
|
}
|
|
return this.companionDrops[num2];
|
|
}
|
|
|
|
// Token: 0x06000F86 RID: 3974 RVA: 0x0012C928 File Offset: 0x0012AB28
|
|
public void ToggleHighlight(string label, bool state)
|
|
{
|
|
if (label == "Utility")
|
|
{
|
|
if (state)
|
|
{
|
|
this.utility.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.utility.color = this.normalTextColor1;
|
|
}
|
|
}
|
|
if (label == "Offense")
|
|
{
|
|
if (state)
|
|
{
|
|
this.offense.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.offense.color = this.normalTextColor1;
|
|
}
|
|
}
|
|
if (label == "Support")
|
|
{
|
|
if (state)
|
|
{
|
|
this.support.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.support.color = this.normalTextColor1;
|
|
}
|
|
}
|
|
if (label == "Evade")
|
|
{
|
|
if (state)
|
|
{
|
|
this.evade.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.evade.color = this.normalTextColor2;
|
|
}
|
|
}
|
|
if (label == "Avoid")
|
|
{
|
|
if (state)
|
|
{
|
|
this.avoid.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.avoid.color = this.normalTextColor2;
|
|
}
|
|
}
|
|
if (label == "Persevere")
|
|
{
|
|
if (state)
|
|
{
|
|
this.persevere.color = this.highlightTextColor;
|
|
}
|
|
if (!state)
|
|
{
|
|
this.persevere.color = this.normalTextColor2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F87 RID: 3975 RVA: 0x0012CA74 File Offset: 0x0012AC74
|
|
public CompanionIcon GetSelectedIcon()
|
|
{
|
|
foreach (CompanionIcon companionIcon in this.companionIcons)
|
|
{
|
|
if (companionIcon.character == this.selectedCharacter)
|
|
{
|
|
return companionIcon;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06000F88 RID: 3976 RVA: 0x0012CADC File Offset: 0x0012ACDC
|
|
public void GetDescription(CompanionIcon icon, CompanionDrop drop)
|
|
{
|
|
if (!icon && this.selectedCharacter && !this.dragging)
|
|
{
|
|
icon = this.GetSelectedIcon();
|
|
drop = icon.GetDrop();
|
|
}
|
|
if (this.dragging && drop)
|
|
{
|
|
icon = null;
|
|
}
|
|
if (icon && drop)
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase><color=#8E5C1A>" + icon.character.stats.GetName() + "</color></uppercase></font>";
|
|
if (drop.dropNum == 1 || drop.dropNum == 2 || drop.dropNum == 3)
|
|
{
|
|
this.formationDescription += " Holds ground regardless of health. ";
|
|
}
|
|
if (drop.dropNum == 4 || drop.dropNum == 5 || drop.dropNum == 6)
|
|
{
|
|
this.formationDescription += " Moves around often to evade enemies and projectiles. ";
|
|
}
|
|
if (drop.dropNum == 7 || drop.dropNum == 8 || drop.dropNum == 9)
|
|
{
|
|
this.formationDescription += " Stays on the outskirts of a fight to keep out of range of frontline attacks. ";
|
|
}
|
|
if (!icon.character.stats.isLeader && icon.character.stats.defendMainInCombat && icon.character.stats.defendingCharacter && icon.character.stats.defendingCharacter.stats.formationGroup == icon.character.stats.formationGroup)
|
|
{
|
|
this.formationDescription = this.formationDescription + "Will try to stay near " + icon.character.stats.defendingCharacter.stats.GetName() + ".";
|
|
}
|
|
icon.SetControllerIcons(true);
|
|
for (int i = 0; i < this.companionIcons.Count; i++)
|
|
{
|
|
if (this.companionIcons[i] != icon)
|
|
{
|
|
this.companionIcons[i].SetControllerIcons(false);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (drop)
|
|
{
|
|
if (drop.dropNum == 1 || drop.dropNum == 2 || drop.dropNum == 3)
|
|
{
|
|
this.SetDescriptionFromLabel("Persevere");
|
|
}
|
|
if (drop.dropNum == 4 || drop.dropNum == 5 || drop.dropNum == 6)
|
|
{
|
|
this.SetDescriptionFromLabel("Evade");
|
|
}
|
|
if (drop.dropNum == 7 || drop.dropNum == 8 || drop.dropNum == 9)
|
|
{
|
|
this.SetDescriptionFromLabel("Avoid");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F89 RID: 3977 RVA: 0x0012CD58 File Offset: 0x0012AF58
|
|
public void SetDescriptionFromLabel(string label)
|
|
{
|
|
if (label == "Persevere")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>" + label + "</uppercase></font> Holds ground on the frontline regardless of health or fatigue.";
|
|
}
|
|
if (label == "Evade")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>" + label + "</uppercase></font> Moves around often to evade enemies and projectiles.";
|
|
}
|
|
if (label == "Avoid")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>" + label + "</uppercase></font> tays on the outskirts of a fight to keep out of range of frontline attacks.";
|
|
}
|
|
if (label == "Auto Cast")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>Auto-Cast Spells</uppercase></font> Companion will automatically cast spells when spirit becomes available.";
|
|
}
|
|
if (label == "Items")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>Use Items</uppercase></font> Companion will consume items in belt slots when health is low.";
|
|
}
|
|
if (label == "Star")
|
|
{
|
|
this.formationDescription = "<font=Bold><uppercase>Leader</uppercase></font> Companions in same square will stay near this companion.";
|
|
}
|
|
}
|
|
|
|
// Token: 0x04001959 RID: 6489
|
|
public GameObject contents1;
|
|
|
|
// Token: 0x0400195A RID: 6490
|
|
public Canvas canvas;
|
|
|
|
// Token: 0x0400195B RID: 6491
|
|
public Animator anim;
|
|
|
|
// Token: 0x0400195C RID: 6492
|
|
public bool open;
|
|
|
|
// Token: 0x0400195D RID: 6493
|
|
public GameObject party1;
|
|
|
|
// Token: 0x0400195E RID: 6494
|
|
public GameObject party2;
|
|
|
|
// Token: 0x0400195F RID: 6495
|
|
public GameObject party3;
|
|
|
|
// Token: 0x04001960 RID: 6496
|
|
public GameObject party4;
|
|
|
|
// Token: 0x04001961 RID: 6497
|
|
private List<Character> party;
|
|
|
|
// Token: 0x04001962 RID: 6498
|
|
public Character selectedCharacter;
|
|
|
|
// Token: 0x04001963 RID: 6499
|
|
public RectTransform group1;
|
|
|
|
// Token: 0x04001964 RID: 6500
|
|
public RectTransform group2;
|
|
|
|
// Token: 0x04001965 RID: 6501
|
|
public RectTransform group3;
|
|
|
|
// Token: 0x04001966 RID: 6502
|
|
public RectTransform group4;
|
|
|
|
// Token: 0x04001967 RID: 6503
|
|
public RectTransform group5;
|
|
|
|
// Token: 0x04001968 RID: 6504
|
|
public RectTransform group6;
|
|
|
|
// Token: 0x04001969 RID: 6505
|
|
public RectTransform group7;
|
|
|
|
// Token: 0x0400196A RID: 6506
|
|
public RectTransform group8;
|
|
|
|
// Token: 0x0400196B RID: 6507
|
|
public RectTransform group9;
|
|
|
|
// Token: 0x0400196C RID: 6508
|
|
public CompanionDrop hoverBox;
|
|
|
|
// Token: 0x0400196D RID: 6509
|
|
public CompanionDrop group1box;
|
|
|
|
// Token: 0x0400196E RID: 6510
|
|
public CompanionDrop group2box;
|
|
|
|
// Token: 0x0400196F RID: 6511
|
|
public CompanionDrop group3box;
|
|
|
|
// Token: 0x04001970 RID: 6512
|
|
public CompanionDrop group4box;
|
|
|
|
// Token: 0x04001971 RID: 6513
|
|
public CompanionDrop group5box;
|
|
|
|
// Token: 0x04001972 RID: 6514
|
|
public CompanionDrop group6box;
|
|
|
|
// Token: 0x04001973 RID: 6515
|
|
public CompanionDrop group7box;
|
|
|
|
// Token: 0x04001974 RID: 6516
|
|
public CompanionDrop group8box;
|
|
|
|
// Token: 0x04001975 RID: 6517
|
|
public CompanionDrop group9box;
|
|
|
|
// Token: 0x04001976 RID: 6518
|
|
public TextMeshProUGUI utility;
|
|
|
|
// Token: 0x04001977 RID: 6519
|
|
public TextMeshProUGUI offense;
|
|
|
|
// Token: 0x04001978 RID: 6520
|
|
public TextMeshProUGUI support;
|
|
|
|
// Token: 0x04001979 RID: 6521
|
|
public TextMeshProUGUI persevere;
|
|
|
|
// Token: 0x0400197A RID: 6522
|
|
public TextMeshProUGUI evade;
|
|
|
|
// Token: 0x0400197B RID: 6523
|
|
public TextMeshProUGUI avoid;
|
|
|
|
// Token: 0x0400197C RID: 6524
|
|
public bool canDrop;
|
|
|
|
// Token: 0x0400197D RID: 6525
|
|
public List<CompanionIcon> companionIcons = new List<CompanionIcon>();
|
|
|
|
// Token: 0x0400197E RID: 6526
|
|
public List<CompanionDrop> companionDrops = new List<CompanionDrop>();
|
|
|
|
// Token: 0x0400197F RID: 6527
|
|
public CompanionDrop currBox;
|
|
|
|
// Token: 0x04001980 RID: 6528
|
|
public CompanionIcon draggingIcon;
|
|
|
|
// Token: 0x04001981 RID: 6529
|
|
public bool dragging;
|
|
|
|
// Token: 0x04001982 RID: 6530
|
|
private List<CompanionIcon> formationOrder = new List<CompanionIcon>();
|
|
|
|
// Token: 0x04001983 RID: 6531
|
|
public Image currImage;
|
|
|
|
// Token: 0x04001984 RID: 6532
|
|
public Color highlight;
|
|
|
|
// Token: 0x04001985 RID: 6533
|
|
public Color highlightTextColor;
|
|
|
|
// Token: 0x04001986 RID: 6534
|
|
public Color normalTextColor1;
|
|
|
|
// Token: 0x04001987 RID: 6535
|
|
public Color normalTextColor2;
|
|
|
|
// Token: 0x04001988 RID: 6536
|
|
public RectTransform bottomLeft;
|
|
|
|
// Token: 0x04001989 RID: 6537
|
|
public RectTransform topRight;
|
|
|
|
// Token: 0x0400198A RID: 6538
|
|
public RectTransform bottomRight;
|
|
|
|
// Token: 0x0400198B RID: 6539
|
|
public RectTransform topLeft;
|
|
|
|
// Token: 0x0400198C RID: 6540
|
|
public TextMeshProUGUI dragMessage;
|
|
|
|
// Token: 0x0400198D RID: 6541
|
|
public TextMeshProUGUI controllerMessage;
|
|
|
|
// Token: 0x0400198E RID: 6542
|
|
public string formationDescription;
|
|
|
|
// Token: 0x0400198F RID: 6543
|
|
public string defaultText;
|
|
|
|
// Token: 0x04001990 RID: 6544
|
|
public string controllerMessageHover;
|
|
|
|
// Token: 0x04001991 RID: 6545
|
|
public string controllerMessageDrag;
|
|
|
|
// Token: 0x04001992 RID: 6546
|
|
public string controllerMessageSliders;
|
|
|
|
// Token: 0x04001993 RID: 6547
|
|
public Transform dragHolder;
|
|
|
|
// Token: 0x04001994 RID: 6548
|
|
public List<TextMeshProUGUI> autoCastIcons = new List<TextMeshProUGUI>();
|
|
|
|
// Token: 0x04001995 RID: 6549
|
|
public List<TextMeshProUGUI> leaderIcons = new List<TextMeshProUGUI>();
|
|
|
|
// Token: 0x04001996 RID: 6550
|
|
private StringFast str = new StringFast(32);
|
|
|
|
// Token: 0x04001997 RID: 6551
|
|
public float dragThreshold = 0.1f;
|
|
|
|
// Token: 0x04001998 RID: 6552
|
|
public Slider items;
|
|
|
|
// Token: 0x04001999 RID: 6553
|
|
public Slider buffs;
|
|
|
|
// Token: 0x0400199A RID: 6554
|
|
public Slider criticals;
|
|
|
|
// Token: 0x0400199B RID: 6555
|
|
public TextMeshProUGUI outputItems;
|
|
|
|
// Token: 0x0400199C RID: 6556
|
|
public TextMeshProUGUI outputBuffs;
|
|
|
|
// Token: 0x0400199D RID: 6557
|
|
public TextMeshProUGUI outputCriticals;
|
|
|
|
// Token: 0x0400199E RID: 6558
|
|
public GameObject cancelButton;
|
|
|
|
// Token: 0x0400199F RID: 6559
|
|
private float updateTime;
|
|
|
|
// Token: 0x040019A0 RID: 6560
|
|
private float lastSliderTime;
|
|
}
|