Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Valve.VR Script Issue

Discussion in 'VR' started by haydenpersonal4, Aug 12, 2023.

  1. haydenpersonal4

    haydenpersonal4

    Joined:
    Aug 12, 2023
    Posts:
    2
    Whenever I'm trying to Build an APK, it gives me an error "error CS0246: The type or namespace name 'Valve' could not be found (are you missing a using directive or an assembly reference?)" Here is the code for it.

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using GorillaLocomotion;
    6. using GorillaNetworking;
    7. using Photon.Pun;
    8. using Photon.Realtime;
    9. using Photon.Voice.PUN;
    10. using Photon.Voice.Unity;
    11. using PlayFab;
    12. using PlayFab.ClientModels;
    13. using UnityEngine;
    14. using UnityEngine.UI;
    15. using UnityEngine.XR;
    16. using Valve.VR;
    17.  
    18. public class VRRig : MonoBehaviourPun, IPunObservable, IPunInstantiateMagicCallback
    19. {
    20.     public struct VelocityTime
    21.     {
    22.         public Vector3 vel;
    23.  
    24.         public double time;
    25.  
    26.         public VelocityTime(Vector3 velocity, double velTime)
    27.         {
    28.             vel = velocity;
    29.             time = velTime;
    30.         }
    31.     }
    32.  
    33.     public VRMap head;
    34.  
    35.     public VRMap rightHand;
    36.  
    37.     public VRMap leftHand;
    38.  
    39.     public VRMapThumb leftThumb;
    40.  
    41.     public VRMapIndex leftIndex;
    42.  
    43.     public VRMapMiddle leftMiddle;
    44.  
    45.     public VRMapThumb rightThumb;
    46.  
    47.     public VRMapIndex rightIndex;
    48.  
    49.     public VRMapMiddle rightMiddle;
    50.  
    51.     public bool isOfflineVRRig;
    52.  
    53.     public GameObject mainCamera;
    54.  
    55.     public Transform playerOffsetTransform;
    56.  
    57.     public int SDKIndex;
    58.  
    59.     public bool isMyPlayer;
    60.  
    61.     public AudioSource leftHandPlayer;
    62.  
    63.     public AudioSource rightHandPlayer;
    64.  
    65.     public AudioSource tagSound;
    66.  
    67.     [SerializeField]
    68.     private float ratio;
    69.  
    70.     public Transform headConstraint;
    71.  
    72.     public Vector3 headBodyOffset = Vector3.zero;
    73.  
    74.     public GameObject headMesh;
    75.  
    76.     public Vector3 syncPos;
    77.  
    78.     public Quaternion syncRotation;
    79.  
    80.     public AudioClip[] clipToPlay;
    81.  
    82.     public AudioClip[] handTapSound;
    83.  
    84.     public int currentMatIndex;
    85.  
    86.     public int setMatIndex;
    87.  
    88.     private int tempMatIndex;
    89.  
    90.     public float lerpValueFingers;
    91.  
    92.     public float lerpValueBody;
    93.  
    94.     public GameObject backpack;
    95.  
    96.     public Transform leftHandTransform;
    97.  
    98.     public Transform rightHandTransform;
    99.  
    100.     public SkinnedMeshRenderer mainSkin;
    101.  
    102.     public Photon.Realtime.Player myPlayer;
    103.  
    104.     public GameObject spectatorSkin;
    105.  
    106.     public int handSync;
    107.  
    108.     public Material[] materialsToChangeTo;
    109.  
    110.     public float red;
    111.  
    112.     public float green;
    113.  
    114.     public float blue;
    115.  
    116.     public string playerName;
    117.  
    118.     public Text playerText;
    119.  
    120.     public bool showName;
    121.  
    122.     public CosmeticItemRegistry cosmeticsObjectRegistry = new CosmeticItemRegistry();
    123.  
    124.     public GameObject[] cosmetics;
    125.  
    126.     public GameObject[] overrideCosmetics;
    127.  
    128.     public GameObject[] combinedCosmetics;
    129.  
    130.     public string concatStringOfCosmeticsAllowed = "";
    131.  
    132.     public bool initializedCosmetics;
    133.  
    134.     public CosmeticsController.CosmeticSet cosmeticSet;
    135.  
    136.     public CosmeticsController.CosmeticSet tryOnSet;
    137.  
    138.     public CosmeticsController.CosmeticSet mergedSet;
    139.  
    140.     public CosmeticsController.CosmeticSet prevSet;
    141.  
    142.     public SizeManager sizeManager;
    143.  
    144.     public float pitchScale = 0.3f;
    145.  
    146.     public float pitchOffset = 1f;
    147.  
    148.     public VRRigReliableState reliableState;
    149.  
    150.     public bool inTryOnRoom;
    151.  
    152.     public bool muted;
    153.  
    154.     public float scaleFactor;
    155.  
    156.     private float timeSpawned;
    157.  
    158.     public float doNotLerpConstant = 1f;
    159.  
    160.     public string tempString;
    161.  
    162.     private Photon.Realtime.Player tempPlayer;
    163.  
    164.     private VRRig tempRig;
    165.  
    166.     private float[] speedArray;
    167.  
    168.     private double handLerpValues;
    169.  
    170.     private bool initialized;
    171.  
    172.     public BattleBalloons battleBalloons;
    173.  
    174.     private int tempInt;
    175.  
    176.     public BodyDockPositions myBodyDockPositions;
    177.  
    178.     public ParticleSystem lavaParticleSystem;
    179.  
    180.     public ParticleSystem rockParticleSystem;
    181.  
    182.     public ParticleSystem iceParticleSystem;
    183.  
    184.     public string tempItemName;
    185.  
    186.     public CosmeticsController.CosmeticItem tempItem;
    187.  
    188.     public string tempItemId;
    189.  
    190.     public int tempItemCost;
    191.  
    192.     public int leftHandHoldableStatus;
    193.  
    194.     public int rightHandHoldableStatus;
    195.  
    196.     [SerializeReference]
    197.     public AudioSource[] musicDrums;
    198.  
    199.     public TransferrableObject[] instrumentSelfOnly;
    200.  
    201.     public float bonkTime;
    202.  
    203.     public float bonkCooldown = 2f;
    204.  
    205.     public bool isQuitting;
    206.  
    207.     private VRRig tempVRRig;
    208.  
    209.     public GameObject huntComputer;
    210.  
    211.     public Slingshot slingshot;
    212.  
    213.     public bool playerLeftHanded;
    214.  
    215.     public Slingshot.SlingshotState slingshotState;
    216.  
    217.     private PhotonVoiceView myPhotonVoiceView;
    218.  
    219.     private VRRig senderRig;
    220.  
    221.     public TransferrableObject.PositionState currentState;
    222.  
    223.     private bool isInitialized;
    224.  
    225.     private List<VelocityTime> velocityHistoryList = new List<VelocityTime>();
    226.  
    227.     public int velocityHistoryMaxLength = 200;
    228.  
    229.     private Vector3 lastPosition;
    230.  
    231.     private AudioSource voiceAudio;
    232.  
    233.     public int ExtraSerializedState
    234.     {
    235.         get
    236.         {
    237.             return reliableState.extraSerializedState;
    238.         }
    239.         set
    240.         {
    241.             reliableState.extraSerializedState = value;
    242.         }
    243.     }
    244.  
    245.     public int LeftHandState
    246.     {
    247.         get
    248.         {
    249.             return reliableState.lHandState;
    250.         }
    251.         set
    252.         {
    253.             reliableState.lHandState = value;
    254.         }
    255.     }
    256.  
    257.     public int RightHandState
    258.     {
    259.         get
    260.         {
    261.             return reliableState.rHandState;
    262.         }
    263.         set
    264.         {
    265.             reliableState.rHandState = value;
    266.         }
    267.     }
    268.  
    269.     public int ActiveTransferrableObjectIndex(int idx)
    270.     {
    271.         return reliableState.activeTransferrableObjectIndex[idx];
    272.     }
    273.  
    274.     public int ActiveTransferrableObjectIndexLength()
    275.     {
    276.         return reliableState.activeTransferrableObjectIndex.Length;
    277.     }
    278.  
    279.     public void SetActiveTransferrableObjectIndex(int idx, int v)
    280.     {
    281.         reliableState.activeTransferrableObjectIndex[idx] = v;
    282.     }
    283.  
    284.     public TransferrableObject.PositionState TransferrablePosStates(int idx)
    285.     {
    286.         return reliableState.transferrablePosStates[idx];
    287.     }
    288.  
    289.     public void SetTransferrablePosStates(int idx, TransferrableObject.PositionState v)
    290.     {
    291.         reliableState.transferrablePosStates[idx] = v;
    292.     }
    293.  
    294.     public TransferrableObject.ItemStates TransferrableItemStates(int idx)
    295.     {
    296.         return reliableState.transferrableItemStates[idx];
    297.     }
    298.  
    299.     public void SetTransferrableItemStates(int idx, TransferrableObject.ItemStates v)
    300.     {
    301.         reliableState.transferrableItemStates[idx] = v;
    302.     }
    303.  
    304.     private void Awake()
    305.     {
    306.         Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
    307.         GameObject[] array = cosmetics;
    308.         GameObject value;
    309.         foreach (GameObject gameObject in array)
    310.         {
    311.             if (!dictionary.TryGetValue(gameObject.name, out value))
    312.             {
    313.                 dictionary.Add(gameObject.name, gameObject);
    314.             }
    315.         }
    316.         array = overrideCosmetics;
    317.         foreach (GameObject gameObject2 in array)
    318.         {
    319.             if (dictionary.TryGetValue(gameObject2.name, out value) && value.name == gameObject2.name)
    320.             {
    321.                 value.name = "OVERRIDDEN";
    322.             }
    323.         }
    324.         cosmetics = cosmetics.Concat(overrideCosmetics).ToArray();
    325.         cosmeticsObjectRegistry.Initialize(cosmetics);
    326.         lastPosition = base.transform.position;
    327.     }
    328.  
    329.     private void Start()
    330.     {
    331.         SharedStart();
    332.     }
    333.  
    334.     private void SharedStart()
    335.     {
    336.         if (isInitialized)
    337.         {
    338.             return;
    339.         }
    340.         isInitialized = true;
    341.         myBodyDockPositions = GetComponent<BodyDockPositions>();
    342.         reliableState.SharedStart(isOfflineVRRig, myBodyDockPositions);
    343.         Application.quitting += Quitting;
    344.         concatStringOfCosmeticsAllowed = "";
    345.         playerText.transform.parent.GetComponent<Canvas>().worldCamera = GorillaTagger.Instance.mainCamera.GetComponent<Camera>();
    346.         materialsToChangeTo[0] = UnityEngine.Object.Instantiate(materialsToChangeTo[0]);
    347.         initialized = false;
    348.         currentState = TransferrableObject.PositionState.OnChest;
    349.         if (setMatIndex > -1 && setMatIndex < materialsToChangeTo.Length)
    350.         {
    351.             mainSkin.material = materialsToChangeTo[setMatIndex];
    352.         }
    353.         if (!isOfflineVRRig && base.photonView.IsMine)
    354.         {
    355.             CosmeticsController.instance.currentWornSet.LoadFromPlayerPreferences(CosmeticsController.instance);
    356.             red = PlayerPrefs.GetFloat("redValue");
    357.             green = PlayerPrefs.GetFloat("greenValue");
    358.             blue = PlayerPrefs.GetFloat("blueValue");
    359.             InitializeNoobMaterialLocal(red, green, blue, GorillaComputer.instance.leftHanded);
    360.             playerOffsetTransform = GorillaLocomotion.Player.Instance.turnParent.transform;
    361.             mainCamera = GorillaTagger.Instance.mainCamera;
    362.             leftHand.overrideTarget = GorillaLocomotion.Player.Instance.leftHandFollower;
    363.             rightHand.overrideTarget = GorillaLocomotion.Player.Instance.rightHandFollower;
    364.             SDKIndex = -1;
    365.             ratio = 1f;
    366.             if ((bool)GetComponent<VoiceConnection>() && (bool)GetComponent<Recorder>())
    367.             {
    368.                 GetComponent<VoiceConnection>().InitRecorder(GetComponent<Recorder>());
    369.             }
    370.             playerText.gameObject.SetActive(value: false);
    371.             if (Application.platform == RuntimePlatform.Android && spectatorSkin != null)
    372.             {
    373.                 UnityEngine.Object.Destroy(spectatorSkin);
    374.             }
    375.             if (XRSettings.loadedDeviceName == "OpenVR")
    376.             {
    377.                 leftHand.trackingPositionOffset = new Vector3(0.02f, -0.06f, 0f);
    378.                 leftHand.trackingRotationOffset = new Vector3(-141f, 204f, -27f);
    379.                 rightHand.trackingPositionOffset = new Vector3(-0.02f, -0.06f, 0f);
    380.                 rightHand.trackingRotationOffset = new Vector3(-141f, 156f, 27f);
    381.             }
    382.         }
    383.         else if (isOfflineVRRig)
    384.         {
    385.             CosmeticsController.instance.currentWornSet.LoadFromPlayerPreferences(CosmeticsController.instance);
    386.             if (Application.platform == RuntimePlatform.Android && spectatorSkin != null)
    387.             {
    388.                 UnityEngine.Object.Destroy(spectatorSkin);
    389.             }
    390.             if (XRSettings.loadedDeviceName == "OpenVR")
    391.             {
    392.                 leftHand.trackingPositionOffset = new Vector3(0.02f, -0.06f, 0f);
    393.                 leftHand.trackingRotationOffset = new Vector3(-141f, 204f, -27f);
    394.                 rightHand.trackingPositionOffset = new Vector3(-0.02f, -0.06f, 0f);
    395.                 rightHand.trackingRotationOffset = new Vector3(-141f, 156f, 27f);
    396.             }
    397.         }
    398.         else if (!base.photonView.IsMine && !isOfflineVRRig)
    399.         {
    400.             if (spectatorSkin != null)
    401.             {
    402.                 UnityEngine.Object.Destroy(spectatorSkin);
    403.             }
    404.             head.syncPos = -headBodyOffset;
    405.             if (UnityEngine.Object.FindObjectOfType<GorillaGameManager>() == null)
    406.             {
    407.                 PhotonView.Get(this).RPC("RequestMaterialColor", PhotonView.Get(this).Owner, PhotonNetwork.LocalPlayer, true);
    408.             }
    409.             else
    410.             {
    411.                 PhotonView.Get(this).RPC("RequestMaterialColor", PhotonView.Get(this).Owner, PhotonNetwork.LocalPlayer, false);
    412.                 base.photonView.RPC("RequestCosmetics", base.photonView.Owner);
    413.             }
    414.             if (GorillaGameManager.instance != null && GorillaGameManager.instance.gameObject.GetComponent<GorillaHuntManager>() != null && !GorillaLocomotion.Player.Instance.inOverlay)
    415.             {
    416.                 huntComputer.SetActive(value: true);
    417.             }
    418.             else
    419.             {
    420.                 huntComputer.SetActive(value: false);
    421.             }
    422.         }
    423.         if (base.transform.parent == null)
    424.         {
    425.             base.transform.parent = GorillaParent.instance.transform;
    426.         }
    427.         StartCoroutine(OccasionalUpdate());
    428.     }
    429.  
    430.     private IEnumerator OccasionalUpdate()
    431.     {
    432.         while (true)
    433.         {
    434.             try
    435.             {
    436.                 if (!isOfflineVRRig)
    437.                 {
    438.                     if (PhotonNetwork.IsMasterClient && base.photonView.IsRoomView && base.photonView.IsMine)
    439.                     {
    440.                         Debug.Log("network deleting vrrig");
    441.                         PhotonNetwork.Destroy(base.gameObject);
    442.                     }
    443.                     if (base.photonView.IsRoomView)
    444.                     {
    445.                         Debug.Log("local disabling vrrig");
    446.                         base.gameObject.SetActive(value: false);
    447.                     }
    448.                     if (base.photonView == null || base.photonView.Owner == null || !PhotonNetwork.CurrentRoom.Players.TryGetValue(base.photonView.Owner.ActorNumber, out tempPlayer) || (PhotonNetwork.CurrentRoom.Players.TryGetValue(base.photonView.Owner.ActorNumber, out tempPlayer) && tempPlayer == null))
    449.                     {
    450.                         if (GorillaParent.instance.vrrigs.IndexOf(this) > -1)
    451.                         {
    452.                             GorillaParent.instance.vrrigs.Remove(this);
    453.                         }
    454.                         if (base.photonView != null && base.photonView.Owner != null && GorillaParent.instance.vrrigDict.TryGetValue(base.photonView.Owner, out tempVRRig))
    455.                         {
    456.                             GorillaParent.instance.vrrigDict.Remove(base.photonView.Owner);
    457.                         }
    458.                         Debug.Log("destroying vrrig of " + base.photonView.Owner);
    459.                         UnityEngine.Object.Destroy(base.gameObject);
    460.                     }
    461.                     if (base.photonView != null && base.photonView.Owner != null && !base.photonView.IsRoomView && GorillaParent.instance.vrrigDict.TryGetValue(base.photonView.Owner, out tempVRRig) && tempVRRig != null && tempVRRig != this)
    462.                     {
    463.                         GorillaNot.instance.SendReport("inappropriate tag data being sent multiple vrrigs", base.photonView.Owner.UserId, base.photonView.Owner.NickName);
    464.                         UnityEngine.Object.Destroy(base.gameObject);
    465.                     }
    466.                     if (PhotonNetwork.IsMasterClient && GorillaGameManager.instance == null)
    467.                     {
    468.                         PhotonNetwork.CurrentRoom.CustomProperties.TryGetValue("gameMode", out var value);
    469.                         if (value.ToString().Contains("CASUAL") || value.ToString().Contains("INFECTION"))
    470.                         {
    471.                             PhotonNetwork.InstantiateRoomObject("GorillaPrefabs/Gorilla Tag Manager", base.transform.position, base.transform.rotation, 0);
    472.                         }
    473.                         else if (value.ToString().Contains("HUNT"))
    474.                         {
    475.                             PhotonNetwork.InstantiateRoomObject("GorillaPrefabs/Gorilla Hunt Manager", base.transform.position, base.transform.rotation, 0);
    476.                         }
    477.                         else if (value.ToString().Contains("BATTLE"))
    478.                         {
    479.                             PhotonNetwork.InstantiateRoomObject("GorillaPrefabs/Gorilla Battle Manager", base.transform.position, base.transform.rotation, 0);
    480.                         }
    481.                     }
    482.                 }
    483.                 if (myPhotonVoiceView == null)
    484.                 {
    485.                     myPhotonVoiceView = GetComponent<PhotonVoiceView>();
    486.                 }
    487.                 else
    488.                 {
    489.                     myPhotonVoiceView.SpeakerInUse.enabled = GorillaComputer.instance.voiceChatOn == "TRUE" && !muted;
    490.                 }
    491.             }
    492.             catch
    493.             {
    494.             }
    495.             yield return new WaitForSeconds(1f);
    496.         }
    497.     }
    498.  
    499.     public bool IsItemAllowed(string itemName)
    500.     {
    501.         if (itemName == "Slingshot")
    502.         {
    503.             return true;
    504.         }
    505.         if (concatStringOfCosmeticsAllowed == null)
    506.         {
    507.             return false;
    508.         }
    509.         if (concatStringOfCosmeticsAllowed.Contains(itemName))
    510.         {
    511.             return true;
    512.         }
    513.         bool canTryOn = CosmeticsController.instance.GetItemFromDict(itemName).canTryOn;
    514.         if (inTryOnRoom && canTryOn)
    515.         {
    516.             return true;
    517.         }
    518.         return false;
    519.     }
    520.  
    521.     private void LateUpdate()
    522.     {
    523.         base.transform.localScale = Vector3.one * scaleFactor;
    524.         if (isOfflineVRRig || base.photonView.IsMine)
    525.         {
    526.             if (GorillaGameManager.instance != null)
    527.             {
    528.                 speedArray = GorillaGameManager.instance.LocalPlayerSpeed();
    529.                 GorillaLocomotion.Player.Instance.jumpMultiplier = speedArray[1];
    530.                 GorillaLocomotion.Player.Instance.maxJumpSpeed = speedArray[0];
    531.             }
    532.             else
    533.             {
    534.                 GorillaLocomotion.Player.Instance.jumpMultiplier = 1.1f;
    535.                 GorillaLocomotion.Player.Instance.maxJumpSpeed = 6.5f;
    536.             }
    537.             scaleFactor = GorillaLocomotion.Player.Instance.scale;
    538.             base.transform.localScale = Vector3.one * scaleFactor;
    539.             base.transform.eulerAngles = new Vector3(0f, mainCamera.transform.rotation.eulerAngles.y, 0f);
    540.             base.transform.position = mainCamera.transform.position + headConstraint.rotation * head.trackingPositionOffset * scaleFactor + base.transform.rotation * headBodyOffset * scaleFactor;
    541.             head.MapMine(scaleFactor, playerOffsetTransform);
    542.             rightHand.MapMine(scaleFactor, playerOffsetTransform);
    543.             leftHand.MapMine(scaleFactor, playerOffsetTransform);
    544.             rightIndex.MapMyFinger(lerpValueFingers);
    545.             rightMiddle.MapMyFinger(lerpValueFingers);
    546.             rightThumb.MapMyFinger(lerpValueFingers);
    547.             leftIndex.MapMyFinger(lerpValueFingers);
    548.             leftMiddle.MapMyFinger(lerpValueFingers);
    549.             leftThumb.MapMyFinger(lerpValueFingers);
    550.             reliableState.activeTransferrableObjectIndex = GorillaTagger.Instance.offlineVRRig.reliableState.activeTransferrableObjectIndex;
    551.             reliableState.transferrablePosStates = GorillaTagger.Instance.offlineVRRig.reliableState.transferrablePosStates;
    552.             reliableState.transferrableItemStates = GorillaTagger.Instance.offlineVRRig.reliableState.transferrableItemStates;
    553.             reliableState.extraSerializedState = GorillaTagger.Instance.offlineVRRig.reliableState.extraSerializedState;
    554.             reliableState.lHandState = GorillaTagger.Instance.offlineVRRig.reliableState.lHandState;
    555.             reliableState.rHandState = GorillaTagger.Instance.offlineVRRig.reliableState.rHandState;
    556.             if (XRSettings.loadedDeviceName == "Oculus" && ((isOfflineVRRig && !PhotonNetwork.InRoom) || (!isOfflineVRRig && PhotonNetwork.InRoom)))
    557.             {
    558.                 mainSkin.enabled = (OVRManager.hasInputFocus ? true : false);
    559.             }
    560.             if (OpenVR.Overlay != null && ((isOfflineVRRig && !PhotonNetwork.InRoom) || (!isOfflineVRRig && PhotonNetwork.InRoom)))
    561.             {
    562.                 mainSkin.enabled = ((!OpenVR.Overlay.IsDashboardVisible()) ? true : false);
    563.             }
    564.         }
    565.         else
    566.         {
    567.             if (voiceAudio == null)
    568.             {
    569.                 voiceAudio = myPhotonVoiceView.SpeakerInUse.GetComponent<AudioSource>();
    570.             }
    571.             if (voiceAudio != null)
    572.             {
    573.                 float num = (GorillaTagger.Instance.offlineVRRig.transform.localScale.x - base.transform.localScale.x) / pitchScale + pitchOffset;
    574.                 if (!Mathf.Approximately(voiceAudio.pitch, num))
    575.                 {
    576.                     voiceAudio.pitch = num;
    577.                 }
    578.             }
    579.             if (Time.time > timeSpawned + doNotLerpConstant)
    580.             {
    581.                 base.transform.position = Vector3.Lerp(base.transform.position, syncPos, lerpValueBody * 0.66f);
    582.             }
    583.             else
    584.             {
    585.                 base.transform.position = syncPos;
    586.             }
    587.             base.transform.rotation = Quaternion.Lerp(base.transform.rotation, syncRotation, lerpValueBody);
    588.             base.transform.position = SanitizeVector3(base.transform.position);
    589.             base.transform.rotation = SanitizeQuaternion(base.transform.rotation);
    590.             head.syncPos = base.transform.rotation * -headBodyOffset * scaleFactor;
    591.             head.MapOther(lerpValueBody);
    592.             rightHand.MapOther(lerpValueBody);
    593.             leftHand.MapOther(lerpValueBody);
    594.             rightIndex.MapOtherFinger((float)(handSync % 10) / 10f, lerpValueFingers);
    595.             rightMiddle.MapOtherFinger((float)(handSync % 100) / 100f, lerpValueFingers);
    596.             rightThumb.MapOtherFinger((float)(handSync % 1000) / 1000f, lerpValueFingers);
    597.             leftIndex.MapOtherFinger((float)(handSync % 10000) / 10000f, lerpValueFingers);
    598.             leftMiddle.MapOtherFinger((float)(handSync % 100000) / 100000f, lerpValueFingers);
    599.             leftThumb.MapOtherFinger((float)(handSync % 1000000) / 1000000f, lerpValueFingers);
    600.             leftHandHoldableStatus = handSync % 10000000 / 1000000;
    601.             rightHandHoldableStatus = handSync % 100000000 / 10000000;
    602.             if (!initializedCosmetics && GorillaGameManager.instance != null && GorillaGameManager.instance.playerCosmeticsLookup.TryGetValue(base.photonView.Owner.UserId, out tempString))
    603.             {
    604.                 initializedCosmetics = true;
    605.                 concatStringOfCosmeticsAllowed = tempString;
    606.                 CheckForEarlyAccess();
    607.                 SetCosmeticsActive();
    608.                 myBodyDockPositions.RefreshTransferrableItems();
    609.             }
    610.         }
    611.         if (!isOfflineVRRig)
    612.         {
    613.             tempMatIndex = ((GorillaGameManager.instance != null) ? GorillaGameManager.instance.MyMatIndex(base.photonView.Owner) : 0);
    614.             if (setMatIndex != tempMatIndex)
    615.             {
    616.                 setMatIndex = tempMatIndex;
    617.                 ChangeMaterialLocal(setMatIndex);
    618.             }
    619.         }
    620.     }
    621.  
    622.     public void OnDestroy()
    623.     {
    624.         if (GorillaParent.instance != null && GorillaParent.instance.vrrigDict != null && base.photonView != null && GorillaParent.instance.vrrigDict.TryGetValue(base.photonView.Owner, out var value) && value == this)
    625.         {
    626.             GorillaParent.instance.vrrigDict.Remove(base.photonView.Owner);
    627.         }
    628.         if (!isQuitting && base.photonView != null && base.photonView.IsMine && PhotonNetwork.InRoom && !base.photonView.IsRoomView)
    629.         {
    630.             Debug.Log("shouldnt have happened");
    631.             PhotonNetwork.Instantiate("GorillaPrefabs/Gorilla Player Networked", Vector3.zero, Quaternion.identity, 0);
    632.         }
    633.     }
    634.  
    635.     public void SetHeadBodyOffset()
    636.     {
    637.     }
    638.  
    639.     public void VRRigResize(float ratioVar)
    640.     {
    641.         ratio *= ratioVar;
    642.     }
    643.  
    644.     public int ReturnHandPosition()
    645.     {
    646.         return 0 + Mathf.FloorToInt(rightIndex.calcT * 9.99f) + Mathf.FloorToInt(rightMiddle.calcT * 9.99f) * 10 + Mathf.FloorToInt(rightThumb.calcT * 9.99f) * 100 + Mathf.FloorToInt(leftIndex.calcT * 9.99f) * 1000 + Mathf.FloorToInt(leftMiddle.calcT * 9.99f) * 10000 + Mathf.FloorToInt(leftThumb.calcT * 9.99f) * 100000 + leftHandHoldableStatus * 1000000 + rightHandHoldableStatus * 10000000;
    647.     }
    648.  
    649.     void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info)
    650.     {
    651.         if (base.photonView.IsRoomView && PhotonNetwork.IsMasterClient && info.Sender == null && base.photonView.IsMine)
    652.         {
    653.             PhotonNetwork.Destroy(base.gameObject);
    654.             Debug.Log("network deleting vrrig");
    655.         }
    656.         if (info.Sender == null && base.photonView.IsRoomView)
    657.         {
    658.             base.gameObject.SetActive(value: false);
    659.             Debug.Log("local setting vrrig false");
    660.         }
    661.         timeSpawned = Time.time;
    662.         base.transform.parent = GorillaParent.instance.GetComponent<GorillaParent>().vrrigParent.transform;
    663.         GorillaParent.instance.vrrigs.Add(this);
    664.         if (info.Sender != null && GorillaParent.instance.vrrigDict.TryGetValue(info.Sender, out tempVRRig) && tempVRRig != null && tempVRRig != this)
    665.         {
    666.             GorillaNot.instance.SendReport("inappropriate tag data being sent multiple vrrigs", info.Sender.UserId, info.Sender.NickName);
    667.             UnityEngine.Object.Destroy(base.gameObject);
    668.         }
    669.         if (GorillaParent.instance.vrrigDict.ContainsKey(base.photonView.Owner))
    670.         {
    671.             GorillaParent.instance.vrrigDict[base.photonView.Owner] = this;
    672.         }
    673.         else
    674.         {
    675.             GorillaParent.instance.vrrigDict.Add(base.photonView.Owner, this);
    676.         }
    677.         if (GorillaGameManager.instance != null && GorillaGameManager.instance.GetComponent<PhotonView>().IsMine)
    678.         {
    679.             object value;
    680.             bool didTutorial = base.photonView.Owner.CustomProperties.TryGetValue("didTutorial", out value) && !(bool)value;
    681.             Debug.Log("guy who just joined didnt do the tutorial already: " + didTutorial);
    682.             GorillaGameManager.instance.NewVRRig(base.photonView.Owner, base.photonView.ViewID, didTutorial);
    683.         }
    684.         Debug.Log(info.Sender.UserId, this);
    685.         SharedStart();
    686.     }
    687.  
    688.     void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    689.     {
    690.         if (!isOfflineVRRig)
    691.         {
    692.             if (stream.IsWriting)
    693.             {
    694.                 stream.SendNext(head.rigTarget.localRotation);
    695.                 stream.SendNext(rightHand.rigTarget.localPosition);
    696.                 stream.SendNext(rightHand.rigTarget.localRotation);
    697.                 stream.SendNext(leftHand.rigTarget.localPosition);
    698.                 stream.SendNext(leftHand.rigTarget.localRotation);
    699.                 stream.SendNext(base.transform.position);
    700.                 stream.SendNext(Mathf.RoundToInt(base.transform.rotation.eulerAngles.y));
    701.                 stream.SendNext(ReturnHandPosition());
    702.                 stream.SendNext(currentState);
    703.             }
    704.             else
    705.             {
    706.                 head.syncRotation = SanitizeQuaternion((Quaternion)stream.ReceiveNext());
    707.                 rightHand.syncPos = SanitizeVector3((Vector3)stream.ReceiveNext());
    708.                 rightHand.syncRotation = SanitizeQuaternion((Quaternion)stream.ReceiveNext());
    709.                 leftHand.syncPos = SanitizeVector3((Vector3)stream.ReceiveNext());
    710.                 leftHand.syncRotation = SanitizeQuaternion((Quaternion)stream.ReceiveNext());
    711.                 syncPos = SanitizeVector3((Vector3)stream.ReceiveNext());
    712.                 syncRotation.eulerAngles = SanitizeVector3(new Vector3(0f, (int)stream.ReceiveNext(), 0f));
    713.                 handSync = (int)stream.ReceiveNext();
    714.                 currentState = (TransferrableObject.PositionState)stream.ReceiveNext();
    715.                 lastPosition = syncPos;
    716.                 AddVelocityToQueue(syncPos, info);
    717.             }
    718.         }
    719.     }
    720.  
    721.     public void ChangeMaterial(int materialIndex, PhotonMessageInfo info)
    722.     {
    723.         if (info.Sender == PhotonNetwork.MasterClient)
    724.         {
    725.             ChangeMaterialLocal(materialIndex);
    726.         }
    727.     }
    728.  
    729.     public void ChangeMaterialLocal(int materialIndex)
    730.     {
    731.         setMatIndex = materialIndex;
    732.         if (setMatIndex > -1 && setMatIndex < materialsToChangeTo.Length)
    733.         {
    734.             mainSkin.material = materialsToChangeTo[setMatIndex];
    735.         }
    736.         if (lavaParticleSystem != null)
    737.         {
    738.             if (!isOfflineVRRig && materialIndex == 2 && lavaParticleSystem.isStopped)
    739.             {
    740.                 lavaParticleSystem.Play();
    741.             }
    742.             else if (!isOfflineVRRig && lavaParticleSystem.isPlaying)
    743.             {
    744.                 lavaParticleSystem.Stop();
    745.             }
    746.         }
    747.         if (rockParticleSystem != null)
    748.         {
    749.             if (!isOfflineVRRig && materialIndex == 1 && rockParticleSystem.isStopped)
    750.             {
    751.                 rockParticleSystem.Play();
    752.             }
    753.             else if (!isOfflineVRRig && rockParticleSystem.isPlaying)
    754.             {
    755.                 rockParticleSystem.Stop();
    756.             }
    757.         }
    758.         if (iceParticleSystem != null)
    759.         {
    760.             if (!isOfflineVRRig && materialIndex == 3 && rockParticleSystem.isStopped)
    761.             {
    762.                 iceParticleSystem.Play();
    763.             }
    764.             else if (!isOfflineVRRig && iceParticleSystem.isPlaying)
    765.             {
    766.                 iceParticleSystem.Stop();
    767.             }
    768.         }
    769.     }
    770.  
    771.     [PunRPC]
    772.     public void InitializeNoobMaterial(float red, float green, float blue, bool leftHanded, PhotonMessageInfo info)
    773.     {
    774.         IncrementRPC(info, "InitializeNoobMaterial");
    775.         if (info.Sender == base.photonView.Owner && (!initialized || (initialized && GorillaComputer.instance.friendJoinCollider.playerIDsCurrentlyTouching.Contains(info.Sender.UserId))))
    776.         {
    777.             initialized = true;
    778.             red = Mathf.Clamp(red, 0f, 1f);
    779.             green = Mathf.Clamp(green, 0f, 1f);
    780.             blue = Mathf.Clamp(blue, 0f, 1f);
    781.             InitializeNoobMaterialLocal(red, green, blue, leftHanded);
    782.         }
    783.         else
    784.         {
    785.             GorillaNot.instance.SendReport("inappropriate tag data being sent init noob", info.Sender.UserId, info.Sender.NickName);
    786.         }
    787.         playerLeftHanded = leftHanded;
    788.     }
    789.  
    790.     public void InitializeNoobMaterialLocal(float red, float green, float blue, bool leftHanded)
    791.     {
    792.         materialsToChangeTo[0].color = new Color(red, green, blue);
    793.         if (base.photonView != null)
    794.         {
    795.             playerText.text = NormalizeName(doIt: true, base.photonView.Owner.NickName);
    796.         }
    797.         else if (showName)
    798.         {
    799.             playerText.text = PlayerPrefs.GetString("playerName");
    800.         }
    801.     }
    802.  
    803.     public string NormalizeName(bool doIt, string text)
    804.     {
    805.         if (doIt)
    806.         {
    807.             if (GorillaComputer.instance.CheckAutoBanListForName(text))
    808.             {
    809.                 text = new string(Array.FindAll(text.ToCharArray(), (char c) => char.IsLetterOrDigit(c)));
    810.                 if (text.Length > 12)
    811.                 {
    812.                     text = text.Substring(0, 11);
    813.                 }
    814.                 text = text.ToUpper();
    815.             }
    816.             else
    817.             {
    818.                 text = "BADGORILLA";
    819.             }
    820.         }
    821.         return text;
    822.     }
    823.  
    824.     public void SetJumpLimitLocal(float maxJumpSpeed)
    825.     {
    826.         GorillaLocomotion.Player.Instance.maxJumpSpeed = maxJumpSpeed;
    827.     }
    828.  
    829.     public void SetJumpMultiplierLocal(float jumpMultiplier)
    830.     {
    831.         GorillaLocomotion.Player.Instance.jumpMultiplier = jumpMultiplier;
    832.     }
    833.  
    834.     [PunRPC]
    835.     public void SetTaggedTime(PhotonMessageInfo info)
    836.     {
    837.         IncrementRPC(info, "SetTaggedTime");
    838.         if (GorillaGameManager.instance != null)
    839.         {
    840.             if (info.Sender == PhotonNetwork.MasterClient)
    841.             {
    842.                 GorillaTagger.Instance.ApplyStatusEffect(GorillaTagger.StatusEffect.Frozen, GorillaTagger.Instance.tagCooldown);
    843.                 GorillaTagger.Instance.StartVibration(forLeftController: true, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    844.                 GorillaTagger.Instance.StartVibration(forLeftController: false, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    845.             }
    846.             else
    847.             {
    848.                 GorillaNot.instance.SendReport("inappropriate tag data being sent set tagged time", info.Sender.UserId, info.Sender.NickName);
    849.             }
    850.         }
    851.     }
    852.  
    853.     [PunRPC]
    854.     public void SetSlowedTime(PhotonMessageInfo info)
    855.     {
    856.         IncrementRPC(info, "SetSlowedTime");
    857.         if (!(GorillaGameManager.instance != null))
    858.         {
    859.             return;
    860.         }
    861.         if (info.Sender == PhotonNetwork.MasterClient)
    862.         {
    863.             if (GorillaTagger.Instance.currentStatus != GorillaTagger.StatusEffect.Slowed)
    864.             {
    865.                 GorillaTagger.Instance.StartVibration(forLeftController: true, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    866.                 GorillaTagger.Instance.StartVibration(forLeftController: false, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    867.             }
    868.             GorillaTagger.Instance.ApplyStatusEffect(GorillaTagger.StatusEffect.Slowed, GorillaTagger.Instance.slowCooldown);
    869.         }
    870.         else
    871.         {
    872.             GorillaNot.instance.SendReport("inappropriate tag data being sent set slowed time", info.Sender.UserId, info.Sender.NickName);
    873.         }
    874.     }
    875.  
    876.     [PunRPC]
    877.     public void SetJoinTaggedTime(PhotonMessageInfo info)
    878.     {
    879.         IncrementRPC(info, "SetJoinTaggedTime");
    880.         if (info.Sender == PhotonNetwork.MasterClient)
    881.         {
    882.             GorillaTagger.Instance.StartVibration(forLeftController: true, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    883.             GorillaTagger.Instance.StartVibration(forLeftController: false, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    884.         }
    885.         else
    886.         {
    887.             GorillaNot.instance.SendReport("inappropriate tag data being sent set join tagged time", info.Sender.UserId, info.Sender.NickName);
    888.         }
    889.     }
    890.  
    891.     [PunRPC]
    892.     public void RequestMaterialColor(Photon.Realtime.Player askingPlayer, bool noneBool, PhotonMessageInfo info)
    893.     {
    894.         IncrementRPC(info, "RequestMaterialColor");
    895.         if (base.photonView.IsMine)
    896.         {
    897.             PhotonView.Get(this).RPC("InitializeNoobMaterial", info.Sender, materialsToChangeTo[0].color.r, materialsToChangeTo[0].color.g, materialsToChangeTo[0].color.b, GorillaComputer.instance.leftHanded);
    898.         }
    899.     }
    900.  
    901.     [PunRPC]
    902.     public void RequestCosmetics(PhotonMessageInfo info)
    903.     {
    904.         IncrementRPC(info, "RequestCosmetics");
    905.         if (base.photonView.IsMine && CosmeticsController.instance != null)
    906.         {
    907.             string[] array = CosmeticsController.instance.currentWornSet.ToDisplayNameArray();
    908.             string[] array2 = CosmeticsController.instance.tryOnSet.ToDisplayNameArray();
    909.             base.photonView.RPC("UpdateCosmeticsWithTryon", info.Sender, array, array2);
    910.         }
    911.     }
    912.  
    913.     [PunRPC]
    914.     public void PlayTagSound(int soundIndex, float soundVolume, PhotonMessageInfo info)
    915.     {
    916.         IncrementRPC(info, "PlayTagSound");
    917.         if (info.Sender.IsMasterClient)
    918.         {
    919.             tagSound.volume = Mathf.Max(0.25f, soundVolume);
    920.             tagSound.PlayOneShot(clipToPlay[soundIndex]);
    921.         }
    922.         else
    923.         {
    924.             GorillaNot.instance.SendReport("inappropriate tag data being sent play tag sound", info.Sender.UserId, info.Sender.NickName);
    925.         }
    926.     }
    927.  
    928.     public void Bonk(int soundIndex, float bonkPercent, PhotonMessageInfo info)
    929.     {
    930.         if (info.Sender == base.photonView.Owner)
    931.         {
    932.             if (bonkTime + bonkCooldown < Time.time)
    933.             {
    934.                 bonkTime = Time.time;
    935.                 tagSound.volume = bonkPercent * 0.25f;
    936.                 tagSound.PlayOneShot(clipToPlay[soundIndex]);
    937.                 if (base.photonView.IsMine)
    938.                 {
    939.                     GorillaTagger.Instance.StartVibration(forLeftController: true, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    940.                     GorillaTagger.Instance.StartVibration(forLeftController: false, GorillaTagger.Instance.taggedHapticStrength, GorillaTagger.Instance.taggedHapticDuration);
    941.                 }
    942.             }
    943.         }
    944.         else
    945.         {
    946.             GorillaNot.instance.SendReport("inappropriate tag data being sent bonk", info.Sender.UserId, info.Sender.NickName);
    947.         }
    948.     }
    949.  
    950.     [PunRPC]
    951.     public void PlayDrum(int drumIndex, float drumVolume, PhotonMessageInfo info)
    952.     {
    953.         IncrementRPC(info, "PlayDrum");
    954.         senderRig = GorillaGameManager.instance.FindVRRigForPlayer(info.Sender).GetComponent<VRRig>();
    955.         if (!(senderRig != null) || senderRig.muted)
    956.         {
    957.             return;
    958.         }
    959.         if (drumIndex >= 0 && drumIndex < musicDrums.Length && (senderRig.transform.position - base.transform.position).magnitude < 3f)
    960.         {
    961.             if (base.photonView.IsMine)
    962.             {
    963.                 if (GorillaTagger.Instance.offlineVRRig.musicDrums[drumIndex].gameObject.activeSelf)
    964.                 {
    965.                     GorillaTagger.Instance.offlineVRRig.musicDrums[drumIndex].time = 0f;
    966.                     GorillaTagger.Instance.offlineVRRig.musicDrums[drumIndex].volume = Mathf.Max(Mathf.Min(GorillaComputer.instance.instrumentVolume, drumVolume * GorillaComputer.instance.instrumentVolume), 0f);
    967.                     GorillaTagger.Instance.offlineVRRig.musicDrums[drumIndex].Play();
    968.                 }
    969.             }
    970.             else if (musicDrums[drumIndex].gameObject.activeSelf)
    971.             {
    972.                 musicDrums[drumIndex].time = 0f;
    973.                 musicDrums[drumIndex].volume = Mathf.Max(Mathf.Min(GorillaComputer.instance.instrumentVolume, drumVolume * GorillaComputer.instance.instrumentVolume), 0f);
    974.                 musicDrums[drumIndex].Play();
    975.             }
    976.         }
    977.         else
    978.         {
    979.             GorillaNot.instance.SendReport("inappropriate tag data being sent drum", info.Sender.UserId, info.Sender.NickName);
    980.         }
    981.     }
    982.  
    983.     [PunRPC]
    984.     public void PlaySelfOnlyInstrument(int selfOnlyIndex, int noteIndex, float instrumentVol, PhotonMessageInfo info)
    985.     {
    986.         IncrementRPC(info, "PlaySelfOnlyInstrument");
    987.         if (info.Sender != base.photonView.Owner || muted)
    988.         {
    989.             return;
    990.         }
    991.         if (selfOnlyIndex >= 0 && selfOnlyIndex < instrumentSelfOnly.Length && info.Sender == base.photonView.Owner)
    992.         {
    993.             if (instrumentSelfOnly[selfOnlyIndex].gameObject.activeSelf)
    994.             {
    995.                 instrumentSelfOnly[selfOnlyIndex].PlayNote(noteIndex, Mathf.Max(Mathf.Min(GorillaComputer.instance.instrumentVolume, instrumentVol * GorillaComputer.instance.instrumentVolume), 0f) / 2f);
    996.             }
    997.         }
    998.         else
    999.         {
    1000.             GorillaNot.instance.SendReport("inappropriate tag data being sent self only instrument", info.Sender.UserId, info.Sender.NickName);
    1001.         }
    1002.     }
    1003.  
    1004.     [PunRPC]
    1005.     public void PlayHandTap(int soundIndex, bool isLeftHand, float tapVolume, PhotonMessageInfo info)
    1006.     {
    1007.         IncrementRPC(info, "PlayHandTap");
    1008.         if (info.Sender == base.photonView.Owner)
    1009.         {
    1010.             PlayHandTapLocal(soundIndex, isLeftHand, Mathf.Max(tapVolume, 0.1f));
    1011.         }
    1012.         else
    1013.         {
    1014.             GorillaNot.instance.SendReport("inappropriate tag data being sent hand tap", info.Sender.UserId, info.Sender.NickName);
    1015.         }
    1016.     }
    1017.  
    1018.     public void PlayHandTapLocal(int soundIndex, bool isLeftHand, float tapVolume)
    1019.     {
    1020.         if (soundIndex > -1 && soundIndex < GorillaLocomotion.Player.Instance.materialData.Count)
    1021.         {
    1022.             if (isLeftHand)
    1023.             {
    1024.                 leftHandPlayer.volume = tapVolume;
    1025.                 leftHandPlayer.clip = (GorillaLocomotion.Player.Instance.materialData[soundIndex].overrideAudio ? GorillaLocomotion.Player.Instance.materialData[soundIndex].audio : GorillaLocomotion.Player.Instance.materialData[0].audio);
    1026.                 leftHandPlayer.PlayOneShot(leftHandPlayer.clip);
    1027.             }
    1028.             else
    1029.             {
    1030.                 rightHandPlayer.volume = tapVolume;
    1031.                 rightHandPlayer.clip = (GorillaLocomotion.Player.Instance.materialData[soundIndex].overrideAudio ? GorillaLocomotion.Player.Instance.materialData[soundIndex].audio : GorillaLocomotion.Player.Instance.materialData[0].audio);
    1032.                 rightHandPlayer.PlayOneShot(rightHandPlayer.clip);
    1033.             }
    1034.         }
    1035.     }
    1036.  
    1037.     [PunRPC]
    1038.     public void UpdateCosmetics(string[] currentItems, PhotonMessageInfo info)
    1039.     {
    1040.         IncrementRPC(info, "UpdateCosmetics");
    1041.         if (info.Sender == base.photonView.Owner)
    1042.         {
    1043.             CosmeticsController.CosmeticSet newSet = new CosmeticsController.CosmeticSet(currentItems, CosmeticsController.instance);
    1044.             LocalUpdateCosmetics(newSet);
    1045.         }
    1046.         else
    1047.         {
    1048.             GorillaNot.instance.SendReport("inappropriate tag data being sent update cosmetics", info.Sender.UserId, info.Sender.NickName);
    1049.         }
    1050.     }
    1051.  
    1052.     [PunRPC]
    1053.     public void UpdateCosmeticsWithTryon(string[] currentItems, string[] tryOnItems, PhotonMessageInfo info)
    1054.     {
    1055.         IncrementRPC(info, "UpdateCosmeticsWithTryon");
    1056.         if (info.Sender == base.photonView.Owner)
    1057.         {
    1058.             CosmeticsController.CosmeticSet newSet = new CosmeticsController.CosmeticSet(currentItems, CosmeticsController.instance);
    1059.             CosmeticsController.CosmeticSet newTryOnSet = new CosmeticsController.CosmeticSet(tryOnItems, CosmeticsController.instance);
    1060.             LocalUpdateCosmeticsWithTryon(newSet, newTryOnSet);
    1061.         }
    1062.         else
    1063.         {
    1064.             GorillaNot.instance.SendReport("inappropriate tag data being sent update cosmetics with tryon", info.Sender.UserId, info.Sender.NickName);
    1065.         }
    1066.     }
    1067.  
    1068.     public void UpdateAllowedCosmetics()
    1069.     {
    1070.         if (GorillaGameManager.instance != null && GorillaGameManager.instance.playerCosmeticsLookup.TryGetValue(base.photonView.Owner.UserId, out tempString))
    1071.         {
    1072.             concatStringOfCosmeticsAllowed = tempString;
    1073.             CheckForEarlyAccess();
    1074.         }
    1075.     }
    1076.  
    1077.     public void LocalUpdateCosmetics(CosmeticsController.CosmeticSet newSet)
    1078.     {
    1079.         cosmeticSet = newSet;
    1080.         if (initializedCosmetics)
    1081.         {
    1082.             SetCosmeticsActive();
    1083.         }
    1084.     }
    1085.  
    1086.     public void LocalUpdateCosmeticsWithTryon(CosmeticsController.CosmeticSet newSet, CosmeticsController.CosmeticSet newTryOnSet)
    1087.     {
    1088.         cosmeticSet = newSet;
    1089.         tryOnSet = newTryOnSet;
    1090.         if (initializedCosmetics)
    1091.         {
    1092.             SetCosmeticsActive();
    1093.         }
    1094.     }
    1095.  
    1096.     private void CheckForEarlyAccess()
    1097.     {
    1098.         if (IsItemAllowed("Early Access Supporter Pack"))
    1099.         {
    1100.             concatStringOfCosmeticsAllowed += "LBAAE.LFAAM.LFAAN.LHAAA.LHAAK.LHAAL.LHAAM.LHAAN.LHAAO.LHAAP.LHABA.LHABB.";
    1101.         }
    1102.         initializedCosmetics = true;
    1103.     }
    1104.  
    1105.     public void SetCosmeticsActive()
    1106.     {
    1107.         if (!(CosmeticsController.instance == null))
    1108.         {
    1109.             prevSet.CopyItems(mergedSet);
    1110.             mergedSet.MergeSets(inTryOnRoom ? tryOnSet : null, cosmeticSet);
    1111.             BodyDockPositions component = GetComponent<BodyDockPositions>();
    1112.             mergedSet.ActivateCosmetics(prevSet, this, component, CosmeticsController.instance.nullItem, cosmeticsObjectRegistry);
    1113.         }
    1114.     }
    1115.  
    1116.     public void GetUserCosmeticsAllowed()
    1117.     {
    1118.         if (CosmeticsController.instance != null)
    1119.         {
    1120.             PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(), delegate(GetUserInventoryResult result)
    1121.             {
    1122.                 foreach (ItemInstance item in result.Inventory)
    1123.                 {
    1124.                     if (item.CatalogVersion == CosmeticsController.instance.catalog)
    1125.                     {
    1126.                         concatStringOfCosmeticsAllowed += item.ItemId;
    1127.                     }
    1128.                 }
    1129.                 Debug.Log("successful result. allowed cosmetics are: " + concatStringOfCosmeticsAllowed);
    1130.                 CheckForEarlyAccess();
    1131.                 SetCosmeticsActive();
    1132.             }, delegate(PlayFabError error)
    1133.             {
    1134.                 Debug.Log("Got error retrieving user data:");
    1135.                 Debug.Log(error.GenerateErrorReport());
    1136.                 initializedCosmetics = true;
    1137.                 SetCosmeticsActive();
    1138.             });
    1139.         }
    1140.         concatStringOfCosmeticsAllowed += "Slingshot";
    1141.     }
    1142.  
    1143.     private void Quitting()
    1144.     {
    1145.         isQuitting = true;
    1146.     }
    1147.  
    1148.     public void GenerateFingerAngleLookupTables()
    1149.     {
    1150.         GenerateTableIndex(ref leftIndex);
    1151.         GenerateTableIndex(ref rightIndex);
    1152.         GenerateTableMiddle(ref leftMiddle);
    1153.         GenerateTableMiddle(ref rightMiddle);
    1154.         GenerateTableThumb(ref leftThumb);
    1155.         GenerateTableThumb(ref rightThumb);
    1156.     }
    1157.  
    1158.     private void GenerateTableThumb(ref VRMapThumb thumb)
    1159.     {
    1160.         thumb.angle1Table = new Quaternion[11];
    1161.         thumb.angle2Table = new Quaternion[11];
    1162.         for (int i = 0; i < thumb.angle1Table.Length; i++)
    1163.         {
    1164.             Debug.Log((float)i / 10f);
    1165.             thumb.angle1Table[i] = Quaternion.Lerp(Quaternion.Euler(thumb.startingAngle1), Quaternion.Euler(thumb.closedAngle1), (float)i / 10f);
    1166.             thumb.angle2Table[i] = Quaternion.Lerp(Quaternion.Euler(thumb.startingAngle2), Quaternion.Euler(thumb.closedAngle2), (float)i / 10f);
    1167.         }
    1168.     }
    1169.  
    1170.     private void GenerateTableIndex(ref VRMapIndex index)
    1171.     {
    1172.         index.angle1Table = new Quaternion[11];
    1173.         index.angle2Table = new Quaternion[11];
    1174.         index.angle3Table = new Quaternion[11];
    1175.         for (int i = 0; i < index.angle1Table.Length; i++)
    1176.         {
    1177.             index.angle1Table[i] = Quaternion.Lerp(Quaternion.Euler(index.startingAngle1), Quaternion.Euler(index.closedAngle1), (float)i / 10f);
    1178.             index.angle2Table[i] = Quaternion.Lerp(Quaternion.Euler(index.startingAngle2), Quaternion.Euler(index.closedAngle2), (float)i / 10f);
    1179.             index.angle3Table[i] = Quaternion.Lerp(Quaternion.Euler(index.startingAngle3), Quaternion.Euler(index.closedAngle3), (float)i / 10f);
    1180.         }
    1181.     }
    1182.  
    1183.     private void GenerateTableMiddle(ref VRMapMiddle middle)
    1184.     {
    1185.         middle.angle1Table = new Quaternion[11];
    1186.         middle.angle2Table = new Quaternion[11];
    1187.         middle.angle3Table = new Quaternion[11];
    1188.         for (int i = 0; i < middle.angle1Table.Length; i++)
    1189.         {
    1190.             middle.angle1Table[i] = Quaternion.Lerp(Quaternion.Euler(middle.startingAngle1), Quaternion.Euler(middle.closedAngle1), (float)i / 10f);
    1191.             middle.angle2Table[i] = Quaternion.Lerp(Quaternion.Euler(middle.startingAngle2), Quaternion.Euler(middle.closedAngle2), (float)i / 10f);
    1192.             middle.angle3Table[i] = Quaternion.Lerp(Quaternion.Euler(middle.startingAngle3), Quaternion.Euler(middle.closedAngle3), (float)i / 10f);
    1193.         }
    1194.     }
    1195.  
    1196.     private Quaternion SanitizeQuaternion(Quaternion quat)
    1197.     {
    1198.         if (float.IsNaN(quat.w) || float.IsNaN(quat.x) || float.IsNaN(quat.y) || float.IsNaN(quat.z) || float.IsInfinity(quat.w) || float.IsInfinity(quat.x) || float.IsInfinity(quat.y) || float.IsInfinity(quat.z))
    1199.         {
    1200.             return Quaternion.identity;
    1201.         }
    1202.         return quat;
    1203.     }
    1204.  
    1205.     private Vector3 SanitizeVector3(Vector3 vec)
    1206.     {
    1207.         if (float.IsNaN(vec.x) || float.IsNaN(vec.y) || float.IsNaN(vec.z) || float.IsInfinity(vec.x) || float.IsInfinity(vec.y) || float.IsInfinity(vec.z))
    1208.         {
    1209.             return Vector3.zero;
    1210.         }
    1211.         return Vector3.ClampMagnitude(vec, 1000f);
    1212.     }
    1213.  
    1214.     private void IncrementRPC(PhotonMessageInfo info, string sourceCall)
    1215.     {
    1216.         if (GorillaGameManager.instance != null)
    1217.         {
    1218.             GorillaNot.IncrementRPCCall(info, sourceCall);
    1219.         }
    1220.     }
    1221.  
    1222.     private void AddVelocityToQueue(Vector3 position, PhotonMessageInfo info)
    1223.     {
    1224.         Vector3 velocity;
    1225.         if (velocityHistoryList.Count == 0)
    1226.         {
    1227.             velocity = Vector3.zero;
    1228.             lastPosition = position;
    1229.         }
    1230.         else
    1231.         {
    1232.             velocity = (position - lastPosition) / (float)(info.SentServerTime - velocityHistoryList[0].time);
    1233.         }
    1234.         velocityHistoryList.Insert(0, new VelocityTime(velocity, info.SentServerTime));
    1235.         if (velocityHistoryList.Count > velocityHistoryMaxLength)
    1236.         {
    1237.             velocityHistoryList.RemoveRange(velocityHistoryMaxLength, velocityHistoryList.Count - velocityHistoryMaxLength);
    1238.         }
    1239.     }
    1240.  
    1241.     private Vector3 ReturnVelocityAtTime(double timeToReturn)
    1242.     {
    1243.         if (velocityHistoryList.Count <= 1)
    1244.         {
    1245.             return Vector3.zero;
    1246.         }
    1247.         int num = 0;
    1248.         int num2 = velocityHistoryList.Count - 1;
    1249.         int num3 = 0;
    1250.         if (num2 == num)
    1251.         {
    1252.             return velocityHistoryList[num].vel;
    1253.         }
    1254.         while (num2 - num > 1 && num3 < 1000)
    1255.         {
    1256.             num3++;
    1257.             int num4 = (num2 - num) / 2;
    1258.             if (velocityHistoryList[num4].time > timeToReturn)
    1259.             {
    1260.                 num2 = num4;
    1261.             }
    1262.             else
    1263.             {
    1264.                 num = num4;
    1265.             }
    1266.         }
    1267.         float num5 = (float)(velocityHistoryList[num].time - timeToReturn);
    1268.         double num6 = velocityHistoryList[num].time - velocityHistoryList[num2].time;
    1269.         if (num6 == 0.0)
    1270.         {
    1271.             num6 = 0.001;
    1272.         }
    1273.         num5 /= (float)num6;
    1274.         num5 = Mathf.Clamp(num5, 0f, 1f);
    1275.         return Vector3.Lerp(velocityHistoryList[num].vel, velocityHistoryList[num2].vel, num5);
    1276.     }
    1277. }
    1278.  
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,864
    I don't think you can do any valve code for standalone.
    Is there a way to refactor your code without using valve code, or using conditional compilation to remove those parts for android
     
  3. haydenpersonal4

    haydenpersonal4

    Joined:
    Aug 12, 2023
    Posts:
    2
    This script uses Valve for the Locomotion
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,864
    Maybe make sure android is checked in the valve assembly definition. But maybe the internal code doesn't work on android.
    If so, you have to refactor the code