Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/SceneMap.cs
2025-05-21 20:40:04 +02:00

1466 lines
37 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
// Token: 0x020000D5 RID: 213
public class SceneMap : MonoBehaviour
{
// Token: 0x060013DD RID: 5085 RVA: 0x00181396 File Offset: 0x0017F596
private void Start()
{
this.canvas.enabled = false;
this.anim.enabled = false;
this.CloseMenu();
}
// Token: 0x060013DE RID: 5086 RVA: 0x001813B8 File Offset: 0x0017F5B8
public void OpenMenu()
{
if (this.contents1.activeSelf)
{
return;
}
Links.x.gameplay.lastMenu = "SceneMap";
Links.x.gameplay.openingAnotherMenu = true;
Links.x.gameplay.CloseAllMenus();
if (!Records.x.inMenus && Links.x.gaia.sceneLoaded)
{
Links.x.gameplay.OpenDock();
}
this.anim.enabled = true;
this.canvas.enabled = true;
this.pinEditBox.SetActive(false);
Records.x.AddMenu(base.gameObject);
bool flag = false;
if (Links.x.joy && (Links.x.gameplay.dockStart || Links.x.gameplay.itemsStart))
{
flag = true;
}
if (flag)
{
this.anim.Play("SceneMapOpen", 0, 1f);
}
else
{
this.anim.Play("SceneMapOpen");
}
this.contents1.SetActive(true);
this.contents2.SetActive(true);
base.enabled = true;
float num = 3686f;
float num2 = 2048f;
this.mapImageRT.sizeDelta = new Vector2(num, num2);
this.characterImageRT.sizeDelta = new Vector2(num, num2);
if (!Links.x.diorama.sceneInfo)
{
Links.x.diorama.sceneInfo = Links.x.diorama.gameObject.GetComponent<SceneInfo>();
}
this.mapImage.texture = Links.x.diorama.sceneInfo.sceneMap;
if (this.characterTexture)
{
this.characterTexture.Release();
}
this.characterTexture = new RenderTexture((int)num, (int)num2, 16, RenderTextureFormat.ARGB32);
RenderTexture active = RenderTexture.active;
RenderTexture.active = this.characterTexture;
GL.Clear(true, true, Color.clear);
RenderTexture.active = active;
this.characterImage.texture = this.characterTexture;
if (Links.x.diorama.sceneName == "F4_BanquetIsle")
{
this.buttons.SetActive(false);
}
else
{
this.buttons.SetActive(true);
}
this.nameField.text = Links.x.diorama.sceneDisplayName;
Camera sceneCamera = Links.x.diorama.GetOutdoorView().sceneCamera;
sceneCamera.targetTexture = this.characterTexture;
this.sceneMapRender = sceneCamera.gameObject.GetComponent<SceneMapRender>();
if (!this.sceneMapRender)
{
this.sceneMapRender = sceneCamera.gameObject.AddComponent<SceneMapRender>();
}
Links.x.fellowship.SetMinimapIcons(true);
this.sceneMapRender.StartRendering();
this.LocalMap();
this.dragMessage.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
this.dragMessage.enabled = false;
this.controllerMessage.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
this.SetControllerMessage();
this.on = true;
if (!Links.x.joy)
{
EventSystem.current.SetSelectedGameObject(null);
}
if (Links.x.joy)
{
Links.x.hudControl.UpdateMenuSwitcher("Scene Map");
}
if (Links.x.joy)
{
if (Links.x.diorama.sceneName == "F4_BanquetIsle")
{
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.localMapButton);
}
else
{
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.userPins[0].gameObject);
}
}
this.dateTimeText.text = Links.x.gameplay.timeText.text;
}
// Token: 0x060013DF RID: 5087 RVA: 0x001817B4 File Offset: 0x0017F9B4
public void SetControllerMessage()
{
if (!Links.x.joy)
{
this.controllerMessage.enabled = false;
return;
}
this.str.Clear();
if (!this.volMapImage.enabled)
{
if (this.dragging)
{
this.str.Clear();
int controllerSprite = Links.x.gameplay.GetControllerSprite("Action", Links.x.gameplay.controllerName);
int controllerSprite2 = Links.x.gameplay.GetControllerSprite("Joystick", Links.x.gameplay.controllerName);
this.str.Append("<voffset=.4em><size=40><sprite=");
this.str.Append(controllerSprite2);
this.str.Append("></size></voffset><cspace=.5em></cspace>Move Pin <voffset=.4em><size=40><sprite=");
this.str.Append(controllerSprite);
this.str.Append("></size></voffset><cspace=.5em></cspace>Place Pin");
this.controllerMessage.text = this.str.ToString();
}
else if (this.currPin || this.hoverPin)
{
bool flag = false;
if (this.currPin)
{
flag = this.currPin.inBox;
}
else if (this.hoverPin)
{
flag = this.hoverPin.inBox;
}
if (flag)
{
this.str.Clear();
this.str.Append("<voffset=.4em><size=40><sprite=");
int controllerSprite3 = Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName);
this.str.Append(controllerSprite3);
this.str.Append("></size></voffset><cspace=.5em></cspace>Start Dragging");
this.controllerMessage.text = this.str.ToString();
}
else
{
this.str.Clear();
int controllerSprite4 = Links.x.gameplay.GetControllerSprite("Action", Links.x.gameplay.controllerName);
int controllerSprite5 = Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName);
this.str.Append("<voffset=.4em><size=40><sprite=");
this.str.Append(controllerSprite4);
this.str.Append("></size></voffset><cspace=.5em></cspace>Label <voffset=.4em><size=40><sprite=");
this.str.Append(controllerSprite5);
this.str.Append("></size></voffset><cspace=.5em></cspace>Start Dragging");
this.controllerMessage.text = this.str.ToString();
}
}
else if (!Records.x.banquetIsle)
{
int controllerSprite6 = Links.x.gameplay.GetControllerSprite("Joystick", Links.x.gameplay.controllerName);
this.str.Append("<voffset=.4em><size=40><sprite=");
this.str.Append(controllerSprite6);
this.str.Append("></size></voffset><cspace=.5em></cspace>Navigate to select pin or map view");
this.controllerMessage.text = this.str.ToString();
}
else
{
this.controllerMessage.text = "";
Links.x.hudControl.JoyBox(false);
}
this.controllerMessage.enabled = true;
return;
}
this.controllerMessage.enabled = false;
this.controllerMessage.text = "";
}
// Token: 0x060013E0 RID: 5088 RVA: 0x00181B14 File Offset: 0x0017FD14
private void Update()
{
if (this.dragging)
{
if (this.currPin && Input.GetMouseButtonUp(0) && Links.x.mk)
{
if (this.overPinBox)
{
Debug.Log("over pin box");
this.currPin.note = "";
}
this.currPin.OnPointerUp();
this.dragging = false;
return;
}
}
else
{
bool flag = false;
if (this.on && this.mapImage.enabled && flag)
{
if (Links.x.rtsCamera.currentBoundsName != "")
{
if (Input.GetMouseButtonUp(0))
{
GameObject gameObject = null;
this.pointer = new PointerEventData(EventSystem.current);
this.pointer.position = Input.mousePosition;
this.raycastResults.Clear();
EventSystem.current.RaycastAll(this.pointer, this.raycastResults);
if (this.raycastResults.Count > 0)
{
int num = 0;
foreach (RaycastResult raycastResult in this.raycastResults)
{
if (num == 0)
{
gameObject = raycastResult.gameObject;
}
num++;
}
}
if (gameObject == this.mapImage.gameObject)
{
if (this.corout != null)
{
base.StopCoroutine(this.corout);
this.corout = null;
}
this.corout = this.StartDragMessage("Cannot move around map while not outside");
base.StartCoroutine(this.corout);
return;
}
}
}
else
{
Vector3 mousePosition = Input.mousePosition;
mousePosition.z = 0f;
this.marker.position = Links.x.menuCamera.ScreenToWorldPoint(mousePosition);
this.marker.localPosition = new Vector3(this.marker.localPosition.x, this.marker.localPosition.y, 0f);
if (Input.GetMouseButtonUp(0))
{
GameObject gameObject2 = null;
this.pointer = new PointerEventData(EventSystem.current);
this.pointer.position = Input.mousePosition;
this.raycastResults.Clear();
EventSystem.current.RaycastAll(this.pointer, this.raycastResults);
if (this.raycastResults.Count > 0)
{
int num2 = 0;
foreach (RaycastResult raycastResult2 in this.raycastResults)
{
if (num2 == 0)
{
gameObject2 = raycastResult2.gameObject;
}
num2++;
}
}
if (this.clickCount > 0 && Time.realtimeSinceStartup < this.clickTime + 0.5f && gameObject2 == this.mapImage.gameObject)
{
this.clickCount = 0;
float num3 = this.marker.transform.position.x - this.bottomLeft.transform.position.x;
float num4 = this.marker.transform.position.y - this.bottomLeft.transform.position.y;
float num5 = this.bottomRight.transform.position.x - this.bottomLeft.transform.position.x;
float num6 = this.topRight.transform.position.y - this.bottomRight.transform.position.y;
float num7 = num3 / num5;
float num8 = num4 / num6;
if (num7 > 1f)
{
num7 = 1f;
}
if (num8 > 1f)
{
num8 = 1f;
}
if (num7 < 0f)
{
num7 = 0f;
}
if (num8 < 0f)
{
num8 = 0f;
}
Camera currentCameraView = Links.x.diorama.currentCameraView;
RaycastHit raycastHit;
if (Physics.Raycast(currentCameraView.ViewportToWorldPoint(new Vector3(num7, num8, 0f)), currentCameraView.transform.forward, out raycastHit, 3000f, 4194321))
{
Links.x.rtsCamera.Jump(raycastHit.point);
Links.x.rtsCamera.EndFollow();
this.StartEndMenu(true);
}
}
else
{
this.clickCount = 1;
this.clickTime = Time.realtimeSinceStartup;
}
}
if (this.clickCount > 0 && Time.realtimeSinceStartup > this.clickTime + 0.5f)
{
this.clickCount = 0;
}
}
}
}
}
// Token: 0x060013E1 RID: 5089 RVA: 0x00181FC8 File Offset: 0x001801C8
public void SetPinImage(Pin pin)
{
if (pin.forWorldMap)
{
if (pin.inBox)
{
pin.img.sprite = this.scenePinFreeSprite;
return;
}
pin.img.sprite = this.scenePinUsedSprite;
return;
}
else
{
if (pin.inBox)
{
pin.img.sprite = this.worldPinFreeSprite;
return;
}
pin.img.sprite = this.worldPinUsedSprite;
return;
}
}
// Token: 0x060013E2 RID: 5090 RVA: 0x00182034 File Offset: 0x00180234
public void StartTyping()
{
Records.x.SetTypingState(true);
}
// Token: 0x060013E3 RID: 5091 RVA: 0x00182041 File Offset: 0x00180241
public void EndTyping()
{
Records.x.SetTypingState(false);
}
// Token: 0x060013E4 RID: 5092 RVA: 0x00182050 File Offset: 0x00180250
public void DoLoad()
{
if (this.undergroundMap)
{
Object.Destroy(this.undergroundMap.gameObject);
this.undergroundMap = null;
}
this.userNotes.Clear();
this.userNotePositions.Clear();
string text = Records.x.openBook + "/Records.es3";
string text2 = "";
if (Links.x.diorama)
{
text2 = Links.x.diorama.sceneName;
}
bool flag = false;
if (Links.x.diorama)
{
flag = Links.x.diorama.underground;
}
if (flag)
{
GameObject gameObject = this.cavesC6;
if (Links.x.diorama.sceneName == "C6_Tomb")
{
gameObject = this.tombsC6;
}
GameObject gameObject2 = Object.Instantiate<GameObject>(gameObject, Vector3.zero, Quaternion.Euler(Vector3.zero), this.undergroundHolder);
gameObject2.GetComponent<RectTransform>().anchoredPosition3D = Vector3.zero;
this.undergroundMap = gameObject2.GetComponent<UndergroundMap>();
this.undergroundMap.Setup();
}
for (int i = 0; i < this.userPins.Count; i++)
{
if (this.userPins[i].startPosition == Vector3.zero)
{
this.userPins[i].GetStartPosition();
}
this.userPins[i].rt.anchoredPosition = this.userPins[i].startPosition;
this.userPins[i].inBox = true;
this.SetPinImage(this.userPins[i]);
}
this.saveFile = new ES3File(text);
if (ES3.FileExists(text))
{
this.userNotes = ES3.Load<List<string>>("Player Notes", text);
this.userNotePositions = ES3.Load<List<Vector3>>("Player Pins", text);
bool flag2 = false;
if (!(text2 == "C6_FortenLazure"))
{
if (ES3.KeyExists("Player Notes " + text2, text) && !flag2)
{
this.userNotesLocal = ES3.Load<List<string>>("Player Notes " + text2, text);
this.userNotePositionsLocal = ES3.Load<List<Vector3>>("Player Pins " + text2, text);
}
else
{
int num = this.userPins.Count / 2;
for (int j = 0; j < num; j++)
{
this.userNotesLocal.Add("");
this.userNotePositionsLocal.Add(this.userPins[j].startPosition);
}
}
}
this.visitedSections = ES3.Load<List<string>>("Visited Sections", text);
}
else
{
for (int k = 0; k < this.userPins.Count; k++)
{
this.userNotes.Add("");
this.userNotePositions.Add(this.userPins[k].rt.anchoredPosition);
this.userNotesLocal.Add("");
this.userNotePositionsLocal.Add(this.userPins[k].startPosition);
}
}
for (int l = 0; l < this.userNotes.Count; l++)
{
this.userPins[l].gameObject.SetActive(true);
if (text2 == "" || text2 == "C6_FortenLazure" || l >= 25)
{
this.userPins[l].note = this.userNotes[l];
this.userPins[l].rt.anchoredPosition = this.userNotePositions[l];
}
else
{
this.userPins[l].note = this.userNotesLocal[l];
this.userPins[l].rt.anchoredPosition = this.userNotePositionsLocal[l];
}
if (this.userPins[l].note != "")
{
this.userPins[l].inBox = false;
}
this.SetPinImage(this.userPins[l]);
}
if (Records.x.banquetIsle)
{
for (int m = 0; m < 25; m++)
{
this.userPins[m].gameObject.SetActive(false);
}
}
if (Records.x.banquetIsle)
{
for (int n = 0; n < 50; n++)
{
this.userPins[n].gameObject.SetActive(false);
}
}
this.SetupWorldMap();
}
// Token: 0x060013E5 RID: 5093 RVA: 0x0018251B File Offset: 0x0018071B
private IEnumerator StartDragMessage(string n)
{
if (Links.x.mk)
{
this.dragMessage.text = n;
this.dragMessage.enabled = true;
yield return new WaitForSecondsRealtime(3f);
this.dragMessage.enabled = false;
}
else
{
this.dragMessage.enabled = false;
}
yield break;
}
// Token: 0x060013E6 RID: 5094 RVA: 0x00182534 File Offset: 0x00180734
public void DoSave()
{
string text = Records.x.openBook + "/Records.es3";
if (this.userPins.Count != this.userNotes.Count)
{
for (int i = 0; i < this.userPins.Count; i++)
{
this.userNotes.Add("");
this.userNotePositions.Add(this.userPins[i].rt.anchoredPosition);
this.userPins[i].tr = this.userPins[i].transform;
}
}
if (Links.x.diorama.sceneName != "C6_FortenLazure" && this.userNotesLocal.Count == 0)
{
for (int j = 0; j < 25; j++)
{
this.userNotesLocal.Add("");
this.userNotePositionsLocal.Add(Vector3.zero);
}
}
for (int k = 0; k < this.userPins.Count; k++)
{
if (Links.x.diorama.sceneName == "C6_FortenLazure" || k >= 25)
{
this.userNotes[k] = this.userPins[k].note;
this.userNotePositions[k] = this.userPins[k].rt.anchoredPosition;
}
else
{
this.userNotesLocal[k] = this.userPins[k].note;
this.userNotePositionsLocal[k] = this.userPins[k].rt.anchoredPosition;
}
}
ES3.Save<List<string>>("Player Notes", this.userNotes, text);
ES3.Save<List<Vector3>>("Player Pins", this.userNotePositions, text);
if (Links.x.diorama.sceneName != "C6_FortenLazure")
{
ES3.Save<List<string>>("Player Notes " + Links.x.diorama.sceneName, this.userNotesLocal, text);
ES3.Save<List<Vector3>>("Player Pins " + Links.x.diorama.sceneName, this.userNotePositionsLocal, text);
}
ES3.Save<List<string>>("Visited Sections", this.visitedSections, text);
if (this.undergroundMap)
{
this.undergroundMap.Save();
}
}
// Token: 0x060013E7 RID: 5095 RVA: 0x001827A7 File Offset: 0x001809A7
public void UpdateLastPinOpened(Pin p)
{
this.lastPin = p;
}
// Token: 0x060013E8 RID: 5096 RVA: 0x001827B0 File Offset: 0x001809B0
public void ReturnLastPinOpened()
{
base.StartCoroutine(this.ReturningPin());
}
// Token: 0x060013E9 RID: 5097 RVA: 0x001827BF File Offset: 0x001809BF
private IEnumerator ReturningPin()
{
if (Links.x.joy)
{
Pin p = this.lastPin;
if (p)
{
yield return new WaitForSeconds(0.1f);
EventSystem.current.SetSelectedGameObject(p.gameObject);
}
this.lastPin = null;
p = null;
}
yield break;
}
// Token: 0x060013EA RID: 5098 RVA: 0x001827D0 File Offset: 0x001809D0
public void OpenPinEditBox(Pin pin, string pinTxt)
{
this.currPin = pin;
this.pinInput.text = pin.note;
this.pinEditBox.SetActive(true);
this.pinInput.gameObject.SetActive(true);
this.pinInput.text = pin.note;
if (Links.x.joy)
{
Links.x.keyboardScript.StartMenu(this.pinInput, null, base.gameObject, "Map");
this.canvasGroup.interactable = false;
}
this.SetControllerMessage();
}
// Token: 0x060013EB RID: 5099 RVA: 0x00182864 File Offset: 0x00180A64
public void ClosePinEditBox()
{
Records.x.SetTypingState(false);
if (this.currPin)
{
this.currPin.note = this.pinInput.text;
this.SetPinImage(this.currPin);
}
this.pinEditBox.SetActive(false);
Pin pin = this.currPin;
this.currPin = null;
if (Links.x.joy)
{
Links.x.hudControl.JoyBox(false);
this.ReturnLastPinOpened();
this.canvasGroup.interactable = true;
if (pin)
{
EventSystem.current.SetSelectedGameObject(pin.gameObject);
Links.x.hudControl.SetJoyBox(pin.gameObject.GetComponent<UITriggerButton>());
}
else
{
EventSystem.current.SetSelectedGameObject(this.allButtons[this.allButtons.Count - 3].gameObject);
}
}
this.SetControllerMessage();
}
// Token: 0x060013EC RID: 5100 RVA: 0x00182954 File Offset: 0x00180B54
public void StartPinHover(string pinTxt, Pin pin)
{
if (Links.x.joy)
{
if (pinTxt == "")
{
pinTxt = "";
}
Links.x.mapTooltip.txt.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
}
else if (pinTxt == "")
{
pinTxt = "Drag pin to place on map\n\nClick to add note";
}
if (pinTxt != "")
{
Links.x.mapTooltip.AddHoverText(pinTxt, pin.gameObject, "UpMap");
}
if (!this.dragging && pin.note != "")
{
this.dragMessage.enabled = Links.x.mk;
this.dragMessage.text = Links.x.gameplay.pinOpenText;
}
this.hoverPin = pin;
this.SetControllerMessage();
}
// Token: 0x060013ED RID: 5101 RVA: 0x00182A44 File Offset: 0x00180C44
public void StartDrag()
{
if (Links.x.joy)
{
int count = this.allButtons.Count;
for (int i = 0; i < count; i++)
{
if (this.allButtons[i] != this.currPin)
{
this.allButtons[i].interactable = false;
}
else
{
string text = "found current pin ";
Pin pin = this.currPin;
Debug.Log(text + ((pin != null) ? pin.ToString() : null));
Navigation navigation = this.allButtons[i].navigation;
navigation.selectOnLeft = null;
navigation.selectOnRight = null;
navigation.selectOnDown = null;
navigation.selectOnUp = null;
this.allButtons[i].navigation = navigation;
this.allButtons[i].interactable = true;
}
}
}
this.SetControllerMessage();
}
// Token: 0x060013EE RID: 5102 RVA: 0x00182B28 File Offset: 0x00180D28
public void EndDrag()
{
this.dragging = false;
if (Links.x.joy)
{
if (Links.x.joy)
{
int count = this.allButtons.Count;
for (int i = 0; i < count; i++)
{
this.allButtons[i].interactable = true;
this.allButtons[i].navigation = Navigation.defaultNavigation;
}
}
this.dragMessage.enabled = false;
}
}
// Token: 0x060013EF RID: 5103 RVA: 0x00182BA0 File Offset: 0x00180DA0
public void EndPinHover(Pin pin)
{
if (pin == this.hoverPin)
{
GameObject currentEventObject = Links.x.gameplay.currentEventObject;
bool flag = true;
if (Links.x.joy && !this.dragging && currentEventObject && currentEventObject.name.Contains("Pin"))
{
flag = false;
}
if (flag)
{
Links.x.mapTooltip.EndHoverText(pin.gameObject, false);
}
if (!this.dragging || Links.x.joy)
{
this.dragMessage.enabled = false;
}
this.hoverPin = null;
this.SetControllerMessage();
}
}
// Token: 0x060013F0 RID: 5104 RVA: 0x00182C48 File Offset: 0x00180E48
public void CheckEnd()
{
string text = this.pinInput.text;
Debug.Log(text);
this.currPin.note = text;
this.SetPinImage(this.currPin);
this.ClosePinEditBox();
}
// Token: 0x060013F1 RID: 5105 RVA: 0x00182C88 File Offset: 0x00180E88
public void LocalMap()
{
Links.x.mapTooltip.EndHoverText(null, true);
this.nameField.text = Links.x.diorama.sceneDisplayName;
for (int i = 0; i < this.userPins.Count; i++)
{
if (this.userPins[i].forWorldMap)
{
this.userPins[i].gameObject.SetActive(false);
}
else
{
bool flag = true;
if (Records.x.banquetIsle)
{
flag = false;
}
if (i >= 25 || flag)
{
this.userPins[i].gameObject.SetActive(true);
}
else
{
this.userPins[i].gameObject.SetActive(false);
}
}
}
this.mapImage.enabled = true;
this.characterImage.enabled = true;
this.volMapImage.enabled = false;
this.worldMapImage.enabled = false;
if (this.undergroundMap)
{
this.undergroundMap.gameObject.SetActive(true);
}
if (Links.x.diorama.underground)
{
this.mapImage.enabled = false;
this.characterImage.enabled = false;
}
for (int j = 0; j < this.sectionNames.Length; j++)
{
if (this.sectionFOW[j])
{
this.sectionFOW[j].enabled = false;
}
}
this.worldMapMarker.SetActive(false);
if (!Links.x.joy)
{
EventSystem.current.SetSelectedGameObject(null);
}
this.SetControllerMessage();
}
// Token: 0x060013F2 RID: 5106 RVA: 0x00182E2C File Offset: 0x0018102C
public void VolMap()
{
Links.x.mapTooltip.EndHoverText(null, true);
this.nameField.text = "Vol";
this.mapImage.enabled = false;
this.characterImage.enabled = false;
this.worldMapImage.enabled = false;
this.volMapImage.enabled = true;
this.worldMapMarker.SetActive(false);
if (this.undergroundMap)
{
this.undergroundMap.gameObject.SetActive(false);
}
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (this.sectionFOW[i])
{
this.sectionFOW[i].enabled = false;
}
}
for (int j = 0; j < this.userPins.Count; j++)
{
if (this.userPins[j].forWorldMap)
{
this.userPins[j].gameObject.SetActive(false);
}
else
{
this.userPins[j].gameObject.SetActive(false);
}
}
if (!Links.x.joy)
{
EventSystem.current.SetSelectedGameObject(null);
}
this.SetControllerMessage();
}
// Token: 0x060013F3 RID: 5107 RVA: 0x00182F64 File Offset: 0x00181164
public void WorldMap()
{
Links.x.mapTooltip.EndHoverText(null, true);
this.nameField.text = "Invimona";
this.mapImage.enabled = false;
this.characterImage.enabled = false;
this.worldMapImage.enabled = true;
this.volMapImage.enabled = false;
if (this.undergroundMap)
{
this.undergroundMap.gameObject.SetActive(false);
}
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (this.sectionFOW[i])
{
this.sectionFOW[i].enabled = true;
}
}
for (int j = 0; j < this.userPins.Count; j++)
{
if (this.userPins[j].forWorldMap)
{
this.userPins[j].gameObject.SetActive(true);
}
else
{
this.userPins[j].gameObject.SetActive(false);
}
}
this.GetWorldMapPosition();
if (!Links.x.joy)
{
EventSystem.current.SetSelectedGameObject(null);
}
this.SetControllerMessage();
}
// Token: 0x060013F4 RID: 5108 RVA: 0x00183094 File Offset: 0x00181294
private void GetWorldMapPosition()
{
this.worldMapMarker.SetActive(false);
string sceneName = Links.x.diorama.sceneName;
if (Links.x.diorama.underground)
{
return;
}
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (sceneName == this.sectionNames[i])
{
this.worldMapMarkerRT.anchoredPosition3D = this.sectionFOW[i].gameObject.GetComponent<RectTransform>().anchoredPosition3D;
this.worldMapMarker.SetActive(true);
this.worldMapMarker.transform.SetAsLastSibling();
return;
}
}
}
// Token: 0x060013F5 RID: 5109 RVA: 0x00183138 File Offset: 0x00181338
private void GetSectionPosition(string s, out float sectionX, out float sectionY, out int indexX, out int indexY)
{
s = s.Substring(0, 2);
sectionX = 0f;
sectionY = 0f;
indexX = 0;
indexY = 0;
if (s.Contains("1"))
{
sectionY = 303.4f;
indexX = 0;
}
if (s.Contains("2"))
{
sectionY = 213.3f;
indexX = 1;
}
if (s.Contains("3"))
{
sectionY = 123.2f;
indexX = 2;
}
if (s.Contains("4"))
{
sectionY = 33.2f;
indexX = 3;
}
if (s.Contains("5"))
{
sectionY = -56.99999f;
indexX = 4;
}
if (s.Contains("6"))
{
sectionY = -147f;
indexX = 5;
}
if (s.Contains("7"))
{
sectionY = -237.2f;
indexX = 6;
}
if (s.Contains("8"))
{
sectionY = -327.4f;
indexX = 7;
}
if (s.Contains("A"))
{
sectionX = -748.6f;
indexY = 0;
}
if (s.Contains("B"))
{
sectionX = -558.1f;
indexY = 1;
}
if (s.Contains("C"))
{
sectionX = -425.3f;
indexY = 2;
}
if (s.Contains("D"))
{
sectionX = -263.5f;
indexY = 3;
}
if (s.Contains("E"))
{
sectionX = -101.3f;
indexY = 4;
}
if (s.Contains("F"))
{
sectionX = -61.1f;
indexY = 5;
}
if (s.Contains("G"))
{
sectionX = 222.8f;
indexY = 6;
}
if (s.Contains("H"))
{
sectionX = 385.3f;
indexY = 7;
}
if (s.Contains("J"))
{
sectionX = 547.4f;
indexY = 8;
}
if (s.Contains("K"))
{
sectionX = 708.6f;
indexY = 9;
}
}
// Token: 0x060013F6 RID: 5110 RVA: 0x00183318 File Offset: 0x00181518
public void SetupWorldMap()
{
for (int i = 0; i < this.sectionFOW.Count; i++)
{
if (this.sectionFOW[i])
{
Object.Destroy(this.sectionFOW[i].gameObject);
}
}
List<Transform> list = new List<Transform>();
foreach (object obj in this.overworldMapHolder.transform)
{
Transform transform = (Transform)obj;
if (transform != this.overworldMapHolder.transform && transform != this.worldMapMarker.transform && transform)
{
list.Add(transform);
}
}
for (int j = 0; j < list.Count; j++)
{
if (list[j])
{
Object.Destroy(list[j].gameObject);
}
}
string text = "";
if (Links.x.diorama)
{
text = Links.x.diorama.sceneName;
}
for (int k = 0; k < this.visitedSections.Count; k++)
{
float num = 0f;
float num2 = 0f;
int num3 = 0;
int num4 = 0;
this.GetSectionPosition(this.visitedSections[k], out num, out num2, out num3, out num4);
if (num != 0f && num2 != 0f && !this.visitedSections[k].Contains("F4") && !this.visitedSections[k].Contains("Statues") && !(this.visitedSections[k] == "C6_Cave") && !(this.visitedSections[k] == "C6_Tomb"))
{
int num5 = num3 * 10 + num4;
this.CreateSection(this.visitedSections[k], text, num5, num, num2);
}
}
}
// Token: 0x060013F7 RID: 5111 RVA: 0x00183540 File Offset: 0x00181740
public void AddNewSection(string newSection)
{
if (Records.x.editor)
{
Debug.Log("Adding new section " + newSection);
}
string text = "";
if (Links.x.diorama)
{
text = Links.x.diorama.sceneName;
}
this.visitedSections.Add(newSection);
float num = 0f;
float num2 = 0f;
int num3 = 0;
int num4 = 0;
this.GetSectionPosition(newSection, out num, out num2, out num3, out num4);
if (num != 0f && num2 != 0f)
{
int num5 = num3 * 10 + num4;
this.CreateSection(newSection, text, num5, num, num2);
}
}
// Token: 0x060013F8 RID: 5112 RVA: 0x001835E4 File Offset: 0x001817E4
public void CreateSection(string s, string curr, int index, float x, float y)
{
if (index > -1 && index < this.sectionFOW.Count)
{
Texture2D texture2D = Resources.Load<Texture2D>("Invimona/" + s + "_FullMap_0");
GameObject gameObject = new GameObject(s);
gameObject.layer = 5;
gameObject.transform.SetParent(this.overworldMapHolder);
gameObject.transform.localScale = new Vector3(1.02f, 1.02f, 1.02f);
gameObject.AddComponent<RectTransform>();
gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(159f, 88f);
gameObject.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(x, y, 0f);
RawImage rawImage = gameObject.AddComponent<RawImage>();
rawImage.texture = this.CreateFow(s);
if (rawImage.texture == null && s != curr)
{
Debug.Log("Deleting section " + s + ", no texture associated");
Object.Destroy(gameObject);
this.sectionFOW[index] = null;
return;
}
rawImage.material = new Material(this.fowMaterial.shader);
rawImage.material.SetTexture("_MapTex", texture2D);
this.sectionFOW[index] = rawImage;
}
}
// Token: 0x060013F9 RID: 5113 RVA: 0x00183720 File Offset: 0x00181920
public void LeavingScene(string s)
{
if (Links.x.diorama.underground || Records.x.banquetIsle)
{
return;
}
int num = -1;
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (this.sectionNames[i] == s)
{
num = i;
break;
}
}
if (num > -1 && this.visitedSections.Contains(s))
{
this.sectionFOW[num].texture = this.CreateFow(s);
}
}
// Token: 0x060013FA RID: 5114 RVA: 0x001837A0 File Offset: 0x001819A0
public void NewScene(string s)
{
this.DoLoad();
int num = -1;
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (this.sectionNames[i] == s)
{
num = i;
break;
}
}
int num2 = -1;
for (int j = 0; j < this.visitedSections.Count; j++)
{
if (this.visitedSections[j] == s)
{
num2 = j;
break;
}
}
if (num2 == -1)
{
this.AddNewSection(s);
num = -1;
for (int k = 0; k < this.sectionNames.Length; k++)
{
if (this.sectionNames[k] == s)
{
num = k;
}
}
if (num > -1 && this.sectionFOW[num])
{
this.sectionFOW[num].texture = Links.x.diorama.fogOfWar.mTexture0;
return;
}
}
else if (num > -1 && this.sectionFOW[num])
{
this.sectionFOW[num].texture = Links.x.diorama.fogOfWar.mTexture0;
}
}
// Token: 0x060013FB RID: 5115 RVA: 0x001838C0 File Offset: 0x00181AC0
public void UpdateScreenSize()
{
if (Links.x.diorama)
{
string sceneName = Links.x.diorama.sceneName;
int num = -1;
for (int i = 0; i < this.sectionNames.Length; i++)
{
if (this.sectionNames[i] == sceneName)
{
num = i;
break;
}
}
if (num > -1 && this.sectionFOW[num])
{
this.sectionFOW[num].texture = Links.x.diorama.fogOfWar.mTexture0;
}
}
}
// Token: 0x060013FC RID: 5116 RVA: 0x00183954 File Offset: 0x00181B54
public Texture2D CreateFow(string s)
{
string text = "AutoSave/" + s + "_FOW";
if (ES3.FileExists(text))
{
List<float> list = ES3.Load<List<float>>("Fow", text);
int num = ES3.Load<int>("FowSize", text);
this.mBuffer0 = new Color32[num * num];
Color color = default(Color);
int count = list.Count;
for (int i = 0; i < count; i++)
{
float num2 = list[i];
color.r = 0f;
color.g = num2;
color.b = 0f;
color.a = 0f;
this.mBuffer0[i] = color;
}
Texture2D texture2D = new Texture2D(num, num, TextureFormat.ARGB32, false);
texture2D.name = s;
texture2D.wrapMode = TextureWrapMode.Clamp;
texture2D.SetPixels32(this.mBuffer0);
texture2D.Apply();
return texture2D;
}
return null;
}
// Token: 0x060013FD RID: 5117 RVA: 0x00183A40 File Offset: 0x00181C40
public void CheckQuests()
{
if (this.undergroundMap)
{
this.undergroundMap.UpdateQuests();
}
}
// Token: 0x060013FE RID: 5118 RVA: 0x00183A5C File Offset: 0x00181C5C
public void CloseMenu()
{
if (this.characterTexture)
{
this.characterTexture.Release();
}
Links.x.fellowship.SetMinimapIcons(false);
this.contents1.SetActive(false);
this.contents2.SetActive(false);
base.enabled = false;
this.canvas.enabled = false;
this.anim.enabled = false;
Links.x.mapTooltip.EndHoverText(null, true);
if (this.sceneMapRender && !this.usingMinimap)
{
this.sceneMapRender.StopRendering();
}
}
// Token: 0x060013FF RID: 5119 RVA: 0x00183AFC File Offset: 0x00181CFC
public void StartEndMenu(bool fromCloseButton)
{
this.on = false;
Records.x.RemoveMenu(base.gameObject);
if (fromCloseButton)
{
Links.x.gameplay.CloseDock();
}
Records.x.RemoveControls(false);
bool flag = false;
if (Links.x.joy && (Links.x.gameplay.dockStart || Links.x.gameplay.itemsStart))
{
flag = true;
}
if (flag)
{
this.anim.Play("SceneMapClose", 0, 1f);
}
else
{
this.anim.Play("SceneMapClose");
}
Links.x.hudControl.JoyBox(false);
}
// Token: 0x04002216 RID: 8726
public Animator anim;
// Token: 0x04002217 RID: 8727
public bool usingMinimap;
// Token: 0x04002218 RID: 8728
public GameObject contents1;
// Token: 0x04002219 RID: 8729
public GameObject contents2;
// Token: 0x0400221A RID: 8730
public TextMeshProUGUI nameField;
// Token: 0x0400221B RID: 8731
public RawImage mapImage;
// Token: 0x0400221C RID: 8732
public RawImage characterImage;
// Token: 0x0400221D RID: 8733
public RawImage worldMapImage;
// Token: 0x0400221E RID: 8734
public Image volMapImage;
// Token: 0x0400221F RID: 8735
public RectTransform mapImageRT;
// Token: 0x04002220 RID: 8736
public RectTransform characterImageRT;
// Token: 0x04002221 RID: 8737
public RenderTexture characterTexture;
// Token: 0x04002222 RID: 8738
public SceneMapRender sceneMapRender;
// Token: 0x04002223 RID: 8739
public Canvas canvas;
// Token: 0x04002224 RID: 8740
public CanvasGroup canvasGroup;
// Token: 0x04002225 RID: 8741
public bool on;
// Token: 0x04002226 RID: 8742
public List<Button> allButtons = new List<Button>();
// Token: 0x04002227 RID: 8743
private List<RaycastResult> raycastResults = new List<RaycastResult>();
// Token: 0x04002228 RID: 8744
private PointerEventData pointer;
// Token: 0x04002229 RID: 8745
private IEnumerator corout;
// Token: 0x0400222A RID: 8746
public GameObject buttons;
// Token: 0x0400222B RID: 8747
public GameObject localMapButton;
// Token: 0x0400222C RID: 8748
[Header("PINS")]
public GameObject pinEditBox;
// Token: 0x0400222D RID: 8749
public TMP_InputField pinInput;
// Token: 0x0400222E RID: 8750
public Pin currPin;
// Token: 0x0400222F RID: 8751
public bool overPinBox;
// Token: 0x04002230 RID: 8752
private RectTransform hoverTr;
// Token: 0x04002231 RID: 8753
public bool dragging;
// Token: 0x04002232 RID: 8754
private Vector3[] v;
// Token: 0x04002233 RID: 8755
private string currText;
// Token: 0x04002234 RID: 8756
private IEnumerator coroutine;
// Token: 0x04002235 RID: 8757
private List<string> userNotes = new List<string>();
// Token: 0x04002236 RID: 8758
private List<Vector3> userNotePositions = new List<Vector3>();
// Token: 0x04002237 RID: 8759
private List<string> userNotesLocal = new List<string>();
// Token: 0x04002238 RID: 8760
private List<Vector3> userNotePositionsLocal = new List<Vector3>();
// Token: 0x04002239 RID: 8761
public List<Pin> userPins = new List<Pin>();
// Token: 0x0400223A RID: 8762
private ES3File saveFile;
// Token: 0x0400223B RID: 8763
private Pin lastPin;
// Token: 0x0400223C RID: 8764
public Material normalMaterial;
// Token: 0x0400223D RID: 8765
public Material hoverMaterial;
// Token: 0x0400223E RID: 8766
public TextMeshProUGUI dragMessage;
// Token: 0x0400223F RID: 8767
public TextMeshProUGUI controllerMessage;
// Token: 0x04002240 RID: 8768
public TextMeshProUGUI dateTimeText;
// Token: 0x04002241 RID: 8769
public Sprite scenePinFreeSprite;
// Token: 0x04002242 RID: 8770
public Sprite scenePinUsedSprite;
// Token: 0x04002243 RID: 8771
public Sprite worldPinFreeSprite;
// Token: 0x04002244 RID: 8772
public Sprite worldPinUsedSprite;
// Token: 0x04002245 RID: 8773
private StringFast str = new StringFast(32);
// Token: 0x04002246 RID: 8774
public RectTransform pinBox;
// Token: 0x04002247 RID: 8775
private Pin hoverPin;
// Token: 0x04002248 RID: 8776
[Header("POSITIONS")]
public RectTransform bottomLeft;
// Token: 0x04002249 RID: 8777
public RectTransform topRight;
// Token: 0x0400224A RID: 8778
public RectTransform bottomRight;
// Token: 0x0400224B RID: 8779
public RectTransform topLeft;
// Token: 0x0400224C RID: 8780
public Transform marker;
// Token: 0x0400224D RID: 8781
public GameObject worldMapMarker;
// Token: 0x0400224E RID: 8782
public RectTransform worldMapMarkerRT;
// Token: 0x0400224F RID: 8783
private float clickTime;
// Token: 0x04002250 RID: 8784
private int clickCount;
// Token: 0x04002251 RID: 8785
[Header("OVERWORLD MAP")]
public string[] sectionNames;
// Token: 0x04002252 RID: 8786
public List<RawImage> sectionFOW = new List<RawImage>();
// Token: 0x04002253 RID: 8787
public Transform overworldMapHolder;
// Token: 0x04002254 RID: 8788
public List<string> visitedSections = new List<string>();
// Token: 0x04002255 RID: 8789
private Color32[] mBuffer0;
// Token: 0x04002256 RID: 8790
public Material fowMaterial;
// Token: 0x04002257 RID: 8791
[Header("UNDERGROUND MAP")]
public GameObject cavesC6;
// Token: 0x04002258 RID: 8792
public GameObject tombsC6;
// Token: 0x04002259 RID: 8793
public Transform undergroundHolder;
// Token: 0x0400225A RID: 8794
public UndergroundMap undergroundMap;
}