182 lines
4.5 KiB
C#
182 lines
4.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x020000DB RID: 219
|
|
public class StackSplit : MonoBehaviour
|
|
{
|
|
// Token: 0x06001493 RID: 5267 RVA: 0x0018F8F8 File Offset: 0x0018DAF8
|
|
public void OpenMenu(Item useItem)
|
|
{
|
|
this.item = useItem;
|
|
this.closing = false;
|
|
this.open = true;
|
|
this.slider.minValue = 1f;
|
|
this.max.text = (this.item.stackSize - 1).ToString();
|
|
this.slider.maxValue = (float)(this.item.stackSize - 1);
|
|
base.gameObject.SetActive(true);
|
|
this.img.sprite = Links.x.archives.GetItemFull(this.item.invRow._UIModelFull);
|
|
this.img.SetNativeSize();
|
|
this.SliderChange();
|
|
Links.x.inventory.CloseTooltip();
|
|
}
|
|
|
|
// Token: 0x06001494 RID: 5268 RVA: 0x0018F9BC File Offset: 0x0018DBBC
|
|
public void SliderChange()
|
|
{
|
|
string text = this.slider.value.ToString();
|
|
this.btnText.text = "Create new stack of " + text;
|
|
}
|
|
|
|
// Token: 0x06001495 RID: 5269 RVA: 0x0018F9F3 File Offset: 0x0018DBF3
|
|
private void OnDisable()
|
|
{
|
|
this.open = false;
|
|
}
|
|
|
|
// Token: 0x06001496 RID: 5270 RVA: 0x0018F9FC File Offset: 0x0018DBFC
|
|
public void SetSlider()
|
|
{
|
|
float x = Links.x.fellowship.direction.x;
|
|
Object currentEventObject = Links.x.gameplay.currentEventObject;
|
|
Slider slider = null;
|
|
if (currentEventObject == this.slider.gameObject)
|
|
{
|
|
slider = this.slider;
|
|
}
|
|
float num = 1f;
|
|
if (slider)
|
|
{
|
|
Links.x.inventory.inSlider = true;
|
|
if (Time.realtimeSinceStartup > this.lastSliderTime + 0.12f || this.lastSliderTime == 0f)
|
|
{
|
|
if (x > 0f)
|
|
{
|
|
slider.value += num;
|
|
}
|
|
else if (x < 0f)
|
|
{
|
|
slider.value -= num;
|
|
}
|
|
this.lastSliderTime = Time.realtimeSinceStartup;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Links.x.inventory.inSlider = false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001497 RID: 5271 RVA: 0x0018FAD0 File Offset: 0x0018DCD0
|
|
public void Confirm()
|
|
{
|
|
if (!this.closing)
|
|
{
|
|
this.item.stackSize = Mathf.RoundToInt((float)this.item.stackSize - this.slider.value);
|
|
Links.x.inventory.SetBagAmt(this.item, this.item.stackSize, Links.x.inventory.selectedPlayer);
|
|
this.item.CheckStackSize();
|
|
if (Records.x.InCombat(false))
|
|
{
|
|
Links.x.inventory.AddCombatTime(Links.x.characterSheet.character, "Long");
|
|
}
|
|
Item item;
|
|
ItemEquipped itemEquipped;
|
|
Links.x.inventory.AddFromGround(null, null, 0, false, 0f, this.item.ID, (int)this.slider.value, this.item.socketA, this.item.socketB, this.item.durability, Links.x.inventory.openBag.character, false, false, out item, out itemEquipped);
|
|
Links.x.inventory.selectedPlayer.UpdateListsFromInv(true);
|
|
if (Links.x.joy)
|
|
{
|
|
if (this.item.inGroundMenu)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.item.backImage.gameObject);
|
|
}
|
|
else
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(Links.x.inventory.GetGridTransform(this.item.bagGridID).gameObject);
|
|
}
|
|
}
|
|
base.StartCoroutine(this.Closing());
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001498 RID: 5272 RVA: 0x0018FC65 File Offset: 0x0018DE65
|
|
private IEnumerator Closing()
|
|
{
|
|
if (Links.x.joy)
|
|
{
|
|
while (Links.x.gameplay.actionStart)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
this.closing = true;
|
|
base.gameObject.GetComponent<Animator>().Play("CloseSubMenu");
|
|
yield return new WaitForSecondsRealtime(0.2f);
|
|
this.closing = false;
|
|
this.open = false;
|
|
this.CloseMenu();
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06001499 RID: 5273 RVA: 0x0018FC74 File Offset: 0x0018DE74
|
|
public void CloseFromButton()
|
|
{
|
|
this.open = false;
|
|
if (Links.x.joy)
|
|
{
|
|
if (this.item.inGroundMenu)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.item.backImage.gameObject);
|
|
}
|
|
else
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(Links.x.inventory.GetGridTransform(this.item.bagGridID).gameObject);
|
|
}
|
|
}
|
|
this.CloseMenu();
|
|
}
|
|
|
|
// Token: 0x0600149A RID: 5274 RVA: 0x0018FCEC File Offset: 0x0018DEEC
|
|
public void CloseMenu()
|
|
{
|
|
Links.x.inventory.inSlider = false;
|
|
this.open = false;
|
|
this.item = null;
|
|
if (base.gameObject.activeInHierarchy)
|
|
{
|
|
base.gameObject.GetComponent<Animator>().Play("CloseSubMenu");
|
|
}
|
|
bool flag = this.closing;
|
|
}
|
|
|
|
// Token: 0x040023AA RID: 9130
|
|
public Item item;
|
|
|
|
// Token: 0x040023AB RID: 9131
|
|
public Slider slider;
|
|
|
|
// Token: 0x040023AC RID: 9132
|
|
public TextMeshProUGUI max;
|
|
|
|
// Token: 0x040023AD RID: 9133
|
|
public TextMeshProUGUI btnText;
|
|
|
|
// Token: 0x040023AE RID: 9134
|
|
private int partyNum;
|
|
|
|
// Token: 0x040023AF RID: 9135
|
|
private bool closing;
|
|
|
|
// Token: 0x040023B0 RID: 9136
|
|
public Image img;
|
|
|
|
// Token: 0x040023B1 RID: 9137
|
|
public bool open;
|
|
|
|
// Token: 0x040023B2 RID: 9138
|
|
private float lastSliderTime;
|
|
}
|