using System; using System.Collections.Generic; using UnityEngine; public class DummyVRHandAnimator : OvrHandAnimator { public bool Grab { get { return this.m_bGrab; } set { this.m_bGrab = value; } } protected override void Start() { for (int i = 0; i < this.m_aryFingerData.Length; i++) { this.m_aryFingerData[i] = new OvrHandAnimator.FingerMorph(); } List list = new List(); this.FindChild(list, this.m_trRootGrasp); for (int j = 0; j < this.m_listRoot.Length; j++) { List list2 = new List(); List list3 = new List(); this.FindChild(list3, this.m_trFingerRoot[j]); using (List.Enumerator enumerator = list3.GetEnumerator()) { while (enumerator.MoveNext()) { Transform trBase = enumerator.Current; Transform transform = list.Find((Transform a) => a.name == trBase.name); if (transform != null) { list2.Add(new OvrHandAnimator.BonePair(trBase, transform)); } else { Debug.LogWarning("指ペアが見つかりません。" + trBase.name); } } } this.m_listRoot[j] = list2; } } public override void Init(AVRControllerButtons f_CtrlBtn) { this.m_CtrlBtn = f_CtrlBtn; } public bool Show { get { return base.gameObject.activeSelf; } set { this.m_bShow = value; if (value) { base.gameObject.SetActive(true); } } } private void OnEnable() { this.OnChangeScreenSizeOrAA(); } protected override void FindChild(List f_list, Transform f_trParent) { for (int i = 0; i < f_trParent.childCount; i++) { this.FindChild(f_list, f_trParent.GetChild(i)); } f_list.Add(f_trParent); } public override void FingerRateTarget(OvrHandAnimator.Finger f_eFinger, float f_fRate) { this.m_fTargetRate[(int)f_eFinger] = f_fRate; } protected override void FingerRateUpdate(OvrHandAnimator.Finger f_eFinger, float f_fRate) { OvrHandAnimator.FingerMorph fingerMorph = this.m_aryFingerData[(int)f_eFinger]; fingerMorph.fTarget = f_fRate; float num = fingerMorph.fTarget - fingerMorph.fNow; float num2 = num * this.m_fEaseRate; fingerMorph.fNow += num2; List list = this.m_listRoot[(int)f_eFinger]; for (int i = 0; i < list.Count; i++) { OvrHandAnimator.BonePair bonePair = list[i]; bonePair.trMain.localRotation = Quaternion.Slerp(bonePair.qBackRot, bonePair.trGrasp.localRotation, fingerMorph.fNow); } } public void OnChangeScreenSizeOrAA() { bool flag = QualitySettings.antiAliasing == 0 && !GameMain.Instance.MainCamera.IsBloomEnabled; if (GameMain.Instance.VRMode && !GameMain.Instance.VRDummyMode) { flag = false; } foreach (Renderer renderer in base.transform.GetComponentsInChildren(true)) { if (renderer == null || renderer.materials == null) { return; } foreach (Material material in renderer.materials) { if (flag) { material.EnableKeyword("UV_POS_REVERSE"); material.DisableKeyword("UV_POS_NORMAL"); } else { material.DisableKeyword("UV_POS_NORMAL"); material.DisableKeyword("UV_POS_REVERSE"); } } } } protected override void Update() { if (base.gameObject.activeSelf != this.m_bShow) { base.gameObject.SetActive(this.m_bShow); } if (this.m_bGrab) { this.FingerRateTarget(OvrHandAnimator.Finger.Thumb, 1f); this.FingerRateTarget(OvrHandAnimator.Finger.Index, 1f); this.FingerRateTarget(OvrHandAnimator.Finger.Middle, 1f); this.FingerRateTarget(OvrHandAnimator.Finger.Ring, 1f); this.FingerRateTarget(OvrHandAnimator.Finger.Little, 1f); } else { this.FingerRateTarget(OvrHandAnimator.Finger.Thumb, 0f); this.FingerRateTarget(OvrHandAnimator.Finger.Index, 0f); this.FingerRateTarget(OvrHandAnimator.Finger.Middle, 0f); this.FingerRateTarget(OvrHandAnimator.Finger.Ring, 0f); this.FingerRateTarget(OvrHandAnimator.Finger.Little, 0f); } for (int i = 0; i < 5; i++) { this.FingerRateUpdate((OvrHandAnimator.Finger)i, this.m_fTargetRate[i]); } } private bool m_bGrab; private bool m_bShow; }