432 lines
12 KiB
C#
432 lines
12 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Kino;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x020000D1 RID: 209
|
|
public class RenderPortraitSetup : MonoBehaviour
|
|
{
|
|
// Token: 0x0600134B RID: 4939 RVA: 0x00174780 File Offset: 0x00172980
|
|
public void Setup(int index, string character, Body body, Transform head, RenderPortraits rp, float idleTime, RenderTexture rt, Library.Characters crow)
|
|
{
|
|
this.directionalLight = rp.directionalLight;
|
|
this.idle = idleTime;
|
|
this.texCapture = rt;
|
|
base.StartCoroutine(this.TakeCaptures(index, character, body, head, rp, idleTime, crow));
|
|
}
|
|
|
|
// Token: 0x0600134C RID: 4940 RVA: 0x001747C4 File Offset: 0x001729C4
|
|
public void PlayAnimation(string animName, string bodyAnimName)
|
|
{
|
|
if (this.bodyObject.GetLookIK())
|
|
{
|
|
if (this.bodyObject.anim.runtimeAnimatorController.name.Contains("Vol"))
|
|
{
|
|
this.cam.gameObject.transform.GetChild(3).gameObject.GetComponent<Animator>().Play(animName, -1, 0f);
|
|
}
|
|
if (bodyAnimName != "")
|
|
{
|
|
this.bodyObject.anim.Play(bodyAnimName);
|
|
}
|
|
if (this.bodyObject.GetLookIK().solver.target == null)
|
|
{
|
|
this.bodyObject.GetLookIK().solver.IKPositionWeight = 0.7f;
|
|
this.bodyObject.GetLookIK().solver.target = this.cam.gameObject.transform.GetChild(3);
|
|
this.bodyObject.GetLookIK().enabled = true;
|
|
this.bodyObject.GetLookIK().solver.bodyWeight = 0.1f;
|
|
}
|
|
this.SetLookAt();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600134D RID: 4941 RVA: 0x001748E4 File Offset: 0x00172AE4
|
|
public void SetLookAt()
|
|
{
|
|
if (this.bodyObject)
|
|
{
|
|
this.bodyObject.GetLookIK().solver.IKPositionWeight = 0.7f;
|
|
this.bodyObject.GetLookIK().enabled = true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600134E RID: 4942 RVA: 0x00174920 File Offset: 0x00172B20
|
|
public void FreshBlink()
|
|
{
|
|
if (this.bodyObject.headAnim)
|
|
{
|
|
this.bodyObject.headAnim.FreshBlink();
|
|
}
|
|
if (Time.timeScale < 0.5f)
|
|
{
|
|
this.bodyObject.anim.updateMode = AnimatorUpdateMode.UnscaledTime;
|
|
return;
|
|
}
|
|
this.bodyObject.anim.updateMode = AnimatorUpdateMode.Normal;
|
|
}
|
|
|
|
// Token: 0x0600134F RID: 4943 RVA: 0x00174980 File Offset: 0x00172B80
|
|
public void FaceForward()
|
|
{
|
|
this.bodyObject.transform.localRotation = Quaternion.Euler(new Vector3(0f, 60f, 0f));
|
|
this.cam.orthographicSize = 0.99f;
|
|
this.cam.clearFlags = CameraClearFlags.Color;
|
|
this.cam.backgroundColor = Color.clear;
|
|
this.cam.gameObject.transform.GetChild(2).gameObject.SetActive(false);
|
|
this.obs.enabled = true;
|
|
}
|
|
|
|
// Token: 0x06001350 RID: 4944 RVA: 0x00174A10 File Offset: 0x00172C10
|
|
public void FaceToTheSide()
|
|
{
|
|
this.bodyObject.transform.localRotation = Quaternion.Euler(new Vector3(0f, 100f, 0f));
|
|
this.cam.orthographicSize = 0.7f;
|
|
this.cam.clearFlags = CameraClearFlags.Color;
|
|
this.cam.backgroundColor = Color.black;
|
|
this.cam.gameObject.transform.GetChild(2).gameObject.SetActive(true);
|
|
this.obs.enabled = false;
|
|
}
|
|
|
|
// Token: 0x06001351 RID: 4945 RVA: 0x00174AA0 File Offset: 0x00172CA0
|
|
public void ToggleCrossFade(bool state)
|
|
{
|
|
MenuCameraCrossFade component = this.cam.gameObject.GetComponent<MenuCameraCrossFade>();
|
|
if (component)
|
|
{
|
|
component.enabled = state;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001352 RID: 4946 RVA: 0x00174ACD File Offset: 0x00172CCD
|
|
public void ToggleDownsampling(bool state)
|
|
{
|
|
if (this.savedCharacter && this.savedCharacter.party)
|
|
{
|
|
this.obs.enabled = state;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001353 RID: 4947 RVA: 0x00174AF8 File Offset: 0x00172CF8
|
|
public void CheckForModel()
|
|
{
|
|
bool flag = false;
|
|
if (!this.model)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (!flag && (!this.model.activeSelf || this.model.transform.parent == Links.x.archives.tr))
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
Links.x.fellowship.AddPortraitChange(this.savedCharacter);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001354 RID: 4948 RVA: 0x00174B66 File Offset: 0x00172D66
|
|
public void HeadBobble()
|
|
{
|
|
base.StartCoroutine(this.Bobble());
|
|
}
|
|
|
|
// Token: 0x06001355 RID: 4949 RVA: 0x00174B75 File Offset: 0x00172D75
|
|
private IEnumerator Bobble()
|
|
{
|
|
if (this.bodyObject)
|
|
{
|
|
this.bodyObject.GetLookIK().solver.IKPositionWeight = 0.7f;
|
|
Transform t = this.cam.gameObject.transform.GetChild(4);
|
|
Transform t2 = this.cam.gameObject.transform.GetChild(3);
|
|
t.position = t2.position;
|
|
if (!this.bodyObject.headBone)
|
|
{
|
|
this.bodyObject.GetHead();
|
|
}
|
|
int i = Random.Range(4, 8);
|
|
this.bodyObject.GetLookIK().solver.target = t;
|
|
Vector3 straightAhead = t2.position;
|
|
int num3;
|
|
for (int j = 0; j < i; j = num3 + 1)
|
|
{
|
|
float num = -0.3f;
|
|
float num2 = 0.3f;
|
|
t.position = straightAhead + new Vector3(Random.Range(num, num2), Random.Range(num, num2), Random.Range(num, num2));
|
|
yield return new WaitForSeconds(0.1f);
|
|
num3 = j;
|
|
}
|
|
this.bodyObject.GetLookIK().solver.target = t2;
|
|
t = null;
|
|
t2 = null;
|
|
straightAhead = default(Vector3);
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06001356 RID: 4950 RVA: 0x00174B84 File Offset: 0x00172D84
|
|
public void CrossFade()
|
|
{
|
|
if (!this.cam.gameObject.GetComponent<MenuCameraCrossFade>())
|
|
{
|
|
this.cam.gameObject.AddComponent<MenuCameraCrossFade>();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001357 RID: 4951 RVA: 0x00174BAE File Offset: 0x00172DAE
|
|
private IEnumerator TakeCaptures(int index, string character, Body body, Transform head, RenderPortraits rp, float idleTime, Library.Characters crow)
|
|
{
|
|
this.directionalLight.enabled = true;
|
|
this.characterRow = crow;
|
|
bool flag = false;
|
|
if (this.obs)
|
|
{
|
|
flag = true;
|
|
}
|
|
this.cam.gameObject.SetActive(true);
|
|
this.model.SetActive(true);
|
|
this.bodyObject = body;
|
|
Transform child = this.cam.gameObject.transform.GetChild(1);
|
|
body.transform.SetParent(child, true);
|
|
this.obs = this.cam.gameObject.GetComponent<Obscurance>();
|
|
this.obs.enabled = false;
|
|
if (this.savedCharacter)
|
|
{
|
|
if (this.savedCharacter.party && (Links.x.creation || Links.x.characterSheet.open || !this.firstCrossFade))
|
|
{
|
|
MenuCameraCrossFade menuCameraCrossFade = this.cam.gameObject.GetComponent<MenuCameraCrossFade>();
|
|
if (!menuCameraCrossFade)
|
|
{
|
|
menuCameraCrossFade = this.cam.gameObject.AddComponent<MenuCameraCrossFade>();
|
|
}
|
|
if (menuCameraCrossFade)
|
|
{
|
|
menuCameraCrossFade.enabled = true;
|
|
if (!this.firstCrossFade)
|
|
{
|
|
menuCameraCrossFade.StartCrossFadeFast();
|
|
}
|
|
else
|
|
{
|
|
menuCameraCrossFade.StartCrossFade();
|
|
}
|
|
}
|
|
this.obs.enabled = true;
|
|
this.obs.downsampling = false;
|
|
}
|
|
this.firstCrossFade = true;
|
|
}
|
|
this.cam.orthographicSize = 0.7f;
|
|
if (body.GetLookIK() && this.savedCharacter)
|
|
{
|
|
body.anim.enabled = true;
|
|
if (body.anim.runtimeAnimatorController.name.Contains("Dialogue") && this.savedCharacter.party)
|
|
{
|
|
if (!Links.x.creation)
|
|
{
|
|
body.GetLookIK().solver.IKPositionWeight = 0.7f;
|
|
body.GetLookIK().solver.target = this.cam.gameObject.transform.GetChild(3);
|
|
body.GetLookIK().enabled = true;
|
|
body.GetLookIK().solver.bodyWeight = 0.1f;
|
|
}
|
|
else
|
|
{
|
|
body.GetLookIK().solver.IKPositionWeight = 0f;
|
|
body.GetLookIK().solver.target = this.cam.gameObject.transform.GetChild(3);
|
|
body.GetLookIK().enabled = true;
|
|
body.GetLookIK().solver.bodyWeight = 0.1f;
|
|
}
|
|
this.bodyObject.anim.Play("Look Around Less", -1, idleTime);
|
|
this.party = true;
|
|
Transform child2 = this.cam.gameObject.transform.GetChild(2);
|
|
if (!flag)
|
|
{
|
|
child2.localPosition = new Vector3(Random.Range(-0.98f, 2.75f), child2.localPosition.y, child2.localPosition.z);
|
|
}
|
|
this.cam.gameObject.transform.GetChild(3).gameObject.GetComponent<Animator>().Play("talk1", -1, 0f);
|
|
}
|
|
if (this.savedCharacter.stats.animal)
|
|
{
|
|
this.cam.gameObject.transform.GetChild(2).gameObject.GetComponent<SpriteRenderer>().enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.cam.gameObject.transform.GetChild(2).gameObject.GetComponent<SpriteRenderer>().enabled = true;
|
|
}
|
|
this.FreshBlink();
|
|
}
|
|
else
|
|
{
|
|
if (body.GetLookIK())
|
|
{
|
|
body.GetLookIK().enabled = false;
|
|
body.GetLookIK().solver.IKPositionWeight = 0f;
|
|
}
|
|
if (this.model.name.Contains("Boro"))
|
|
{
|
|
this.cam.orthographicSize = 1f;
|
|
}
|
|
}
|
|
this.cam.enabled = true;
|
|
this.cam.targetTexture = null;
|
|
body.SetLayer(26);
|
|
body.isPortrait = true;
|
|
body.SetMagicaClothState(true);
|
|
body.SetMagicaClothWind();
|
|
body.SetMeshState(true, false);
|
|
if (!body.anim.runtimeAnimatorController)
|
|
{
|
|
body.anim.runtimeAnimatorController = this.animatorOverrideController;
|
|
}
|
|
if (this.savedCharacter)
|
|
{
|
|
if (!this.savedCharacter.party)
|
|
{
|
|
body.transform.localRotation = Quaternion.Euler(rp.rot);
|
|
}
|
|
else
|
|
{
|
|
body.transform.localRotation = Quaternion.Euler(new Vector3(0f, 100f, 0f));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
body.transform.localRotation = Quaternion.Euler(rp.rot);
|
|
}
|
|
if (Time.timeScale < 0.5f)
|
|
{
|
|
body.anim.updateMode = AnimatorUpdateMode.UnscaledTime;
|
|
}
|
|
else
|
|
{
|
|
body.anim.updateMode = AnimatorUpdateMode.Normal;
|
|
}
|
|
if (body)
|
|
{
|
|
body.anim.speed = 1f;
|
|
if (Records.x.filming && Time.timeScale < 0.5f)
|
|
{
|
|
body.anim.speed = 0.2f;
|
|
}
|
|
}
|
|
body.gameObject.transform.localPosition = new Vector3(0f, this.characterRow._Height * -1f, this.characterRow._PortraitZ);
|
|
if (this.savedCharacter && this.savedCharacter.party && this.savedCharacter.stats.race == "Yeti")
|
|
{
|
|
body.gameObject.transform.localPosition = new Vector3(0f, -4f, 0.1f);
|
|
}
|
|
Vector3 local = body.gameObject.transform.localPosition;
|
|
if (body)
|
|
{
|
|
body.anim.Rebind();
|
|
if (!body.anim.runtimeAnimatorController)
|
|
{
|
|
body.anim.runtimeAnimatorController = Links.x.archives.GetOverrideController("_Volling_Unarmed");
|
|
}
|
|
if (body.anim.runtimeAnimatorController.name.Contains("Dialogue"))
|
|
{
|
|
this.bodyObject.anim.Play("Look Around Less", -1, idleTime);
|
|
}
|
|
body.anim.Update(0f);
|
|
body.anim.enabled = false;
|
|
body.anim.enabled = true;
|
|
body.anim.cullingMode = AnimatorCullingMode.AlwaysAnimate;
|
|
}
|
|
if (!this.stop)
|
|
{
|
|
if (this.gamecard)
|
|
{
|
|
this.gamecard.stopPlaying = true;
|
|
}
|
|
this.Render(0, index);
|
|
if (this.portrait)
|
|
{
|
|
this.portrait.currIndex = -1;
|
|
}
|
|
yield return new WaitForSecondsRealtime(0.1f);
|
|
}
|
|
if (!this.stop)
|
|
{
|
|
if (!this.savedCharacter)
|
|
{
|
|
this.cam.enabled = false;
|
|
}
|
|
this.cam.targetTexture = this.texCapture;
|
|
}
|
|
yield return new WaitForSecondsRealtime(0.25f);
|
|
body.gameObject.transform.localPosition = local;
|
|
yield return new WaitForSecondsRealtime(0.25f);
|
|
if (!this.savedCharacter)
|
|
{
|
|
this.cam.enabled = false;
|
|
this.cam.targetTexture = null;
|
|
this.cam.gameObject.SetActive(false);
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06001358 RID: 4952 RVA: 0x00174BE3 File Offset: 0x00172DE3
|
|
public void Reload()
|
|
{
|
|
this.cam.enabled = false;
|
|
this.cam.targetTexture = null;
|
|
this.cam.gameObject.SetActive(false);
|
|
Object.Destroy(this);
|
|
}
|
|
|
|
// Token: 0x06001359 RID: 4953 RVA: 0x00174C14 File Offset: 0x00172E14
|
|
public void Render(int index, int i)
|
|
{
|
|
if (this.texCapture != null && !this.stop)
|
|
{
|
|
if (!this.model.activeSelf)
|
|
{
|
|
this.model.SetActive(true);
|
|
}
|
|
this.cam.targetTexture = this.texCapture;
|
|
}
|
|
}
|
|
|
|
// Token: 0x04002085 RID: 8325
|
|
public Light directionalLight;
|
|
|
|
// Token: 0x04002086 RID: 8326
|
|
public Camera cam;
|
|
|
|
// Token: 0x04002087 RID: 8327
|
|
public GameObject model;
|
|
|
|
// Token: 0x04002088 RID: 8328
|
|
public Portrait portrait;
|
|
|
|
// Token: 0x04002089 RID: 8329
|
|
public GameCard gamecard;
|
|
|
|
// Token: 0x0400208A RID: 8330
|
|
public AnimatorOverrideController animatorOverrideController;
|
|
|
|
// Token: 0x0400208B RID: 8331
|
|
private Obscurance obs;
|
|
|
|
// Token: 0x0400208C RID: 8332
|
|
public RenderTexture texCapture;
|
|
|
|
// Token: 0x0400208D RID: 8333
|
|
public bool stop;
|
|
|
|
// Token: 0x0400208E RID: 8334
|
|
public bool party;
|
|
|
|
// Token: 0x0400208F RID: 8335
|
|
public float idle;
|
|
|
|
// Token: 0x04002090 RID: 8336
|
|
private Body bodyObject;
|
|
|
|
// Token: 0x04002091 RID: 8337
|
|
public Character savedCharacter;
|
|
|
|
// Token: 0x04002092 RID: 8338
|
|
public Library.Characters characterRow;
|
|
|
|
// Token: 0x04002093 RID: 8339
|
|
private bool firstCrossFade;
|
|
}
|