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

108 lines
2.9 KiB
C#

using System;
using UnityEngine;
using UnityEngine.UI;
// Token: 0x020000C4 RID: 196
public class MiniMap : MonoBehaviour
{
// Token: 0x06001257 RID: 4695 RVA: 0x001645E3 File Offset: 0x001627E3
private void Start()
{
this.on = false;
}
// Token: 0x06001258 RID: 4696 RVA: 0x001645EC File Offset: 0x001627EC
public void OpenMenu()
{
base.enabled = true;
float num = Links.x.diorama.aspect.x * 2048f;
float num2 = Links.x.diorama.aspect.y * 2048f;
this.mapImage.texture = Links.x.diorama.sceneInfo.sceneMap;
if (this.characterTexture)
{
this.characterTexture.Release();
}
this.characterTexture = new RenderTexture((int)(num / 2f), (int)(num2 / 2f), 16, RenderTextureFormat.ARGB32);
this.characterImage.texture = this.characterTexture;
Camera currentCameraView = Links.x.diorama.currentCameraView;
currentCameraView.targetTexture = this.characterTexture;
this.sceneMapRender = currentCameraView.gameObject.GetComponent<SceneMapRender>();
if (!this.sceneMapRender)
{
this.sceneMapRender = currentCameraView.gameObject.AddComponent<SceneMapRender>();
}
Links.x.fellowship.SetMinimapIcons(true);
this.sceneMapRender.StartRendering();
this.on = true;
}
// Token: 0x06001259 RID: 4697 RVA: 0x00164718 File Offset: 0x00162918
private void Update()
{
if (Links.x.hasMain)
{
if (!this.on)
{
if (Links.x.gaia.sceneLoaded)
{
this.OpenMenu();
}
}
else if (!Links.x.gaia.sceneLoaded)
{
this.on = false;
}
Vector3 vector = Links.x.worldCamera.transform.rotation.eulerAngles;
vector.y += this.offset;
vector = Quaternion.Euler(vector) * Vector3.forward;
this.mTempVector = vector;
this.mTempVector.y = 0f;
this.mTempVector = this.mTempVector.normalized;
this.mTempVector -= this.kReferenceVector;
this.mTempVector.y = 0f;
this.mTempVector = this.mTempVector.normalized;
if (this.mTempVector == Vector3.zero)
{
this.mTempVector = new Vector3(1f, 0f, 0f);
}
this.mTempAngle = Mathf.Atan2(this.mTempVector.x, this.mTempVector.z);
this.mTempAngle = (this.mTempAngle * 57.29578f + 90f) * -2f;
this.compassTr.rotation = Quaternion.AngleAxis(this.mTempAngle, this.kReferenceVector);
}
}
// Token: 0x04001E37 RID: 7735
public RawImage mapImage;
// Token: 0x04001E38 RID: 7736
public RawImage characterImage;
// Token: 0x04001E39 RID: 7737
public RectTransform mapImageRT;
// Token: 0x04001E3A RID: 7738
public RenderTexture characterTexture;
// Token: 0x04001E3B RID: 7739
public SceneMapRender sceneMapRender;
// Token: 0x04001E3C RID: 7740
public bool on;
// Token: 0x04001E3D RID: 7741
[Header("Compass")]
public Transform compassTr;
// Token: 0x04001E3E RID: 7742
public Vector3 kReferenceVector = new Vector3(0f, 0f, 1f);
// Token: 0x04001E3F RID: 7743
private Vector3 mTempVector;
// Token: 0x04001E40 RID: 7744
private float mTempAngle;
// Token: 0x04001E41 RID: 7745
public float offset;
}