Example #1
0
 // Token: 0x0600503A RID: 20538 RVA: 0x001B76B8 File Offset: 0x001B5AB8
 private void BuildWall()
 {
     for (int i = 0; i < this.avatars.Length; i++)
     {
         GameObject gameObject = AssetManagement.Instantiate(this.pedestalGO, base.transform.position, base.transform.rotation) as GameObject;
         gameObject.transform.parent = base.transform;
         Vector3 localPosition = gameObject.transform.localPosition;
         if (this.spawnRightToLeft)
         {
             localPosition.x = (float)(-(float)i % this.numColumns) * this.avatarMargin.x;
         }
         else
         {
             localPosition.x = (float)(i % this.numColumns) * this.avatarMargin.x;
         }
         localPosition.y = (float)(i / this.numColumns) * this.avatarMargin.y;
         gameObject.transform.localPosition = localPosition;
         VRC_AvatarPedestal component = gameObject.GetComponent <VRC_AvatarPedestal>();
         component.transform.Rotate(new Vector3(0f, 180f, 0f));
         component.scale = this.scale;
         GameObject gameObject2 = gameObject.transform.Find("UseVolume").gameObject;
         gameObject2.AddComponent <Highlightable>();
         CapsuleCollider component2 = gameObject2.GetComponent <CapsuleCollider>();
         component2.height *= this.scale * 1.3f;
         component2.radius *= this.scale * 1.3f;
         Vector3 center = new Vector3(component2.center.x, 0.7f, component2.center.z);
         component2.center = center;
     }
 }
Example #2
0
    // Token: 0x06006026 RID: 24614 RVA: 0x0021D488 File Offset: 0x0021B888
    public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
    {
        ItemGroupTableViewCell itemGroupTableViewCell = tableView.GetReusableCell(this.cellPrefab.reuseIdentifier) as ItemGroupTableViewCell;

        if (itemGroupTableViewCell == null)
        {
            itemGroupTableViewCell = (ItemGroupTableViewCell)AssetManagement.Instantiate(this.cellPrefab);
            UnityEngine.Object gameObject = itemGroupTableViewCell.gameObject;
            string             str        = "ItemGroupTableViewCell_";
            int num = ++this.mNumInstancesCreated;
            gameObject.name = str + num.ToString();
            itemGroupTableViewCell.transform.localRotation = Quaternion.identity;
        }
        List <IUIGroupItemDatasource> list = new List <IUIGroupItemDatasource>();

        for (int i = 0; i < this.lcdItemsPerRow; i++)
        {
            int num2 = row * this.lcdItemsPerRow + i;
            if (num2 >= this.searchedItemsSubset.Count)
            {
                break;
            }
            list.Add(this.searchedItemsSubset[num2]);
        }
        itemGroupTableViewCell.Setup(list, this.itemsPerRow, this.uiGroupItemPrefab, this.onItemSelected);
        return(itemGroupTableViewCell);
    }
Example #3
0
 // Token: 0x060054CE RID: 21710 RVA: 0x001D3F10 File Offset: 0x001D2310
 private void InstantiateAvatar(string url, UnityEngine.Object asset)
 {
     if (this.avatar != null)
     {
         UnityEngine.Object.Destroy(this.avatar);
     }
     this.avatar = (AssetManagement.Instantiate(asset) as GameObject);
     Tools.SetLayerRecursively(this.avatar, base.gameObject.layer, -1);
     this.SetupAnimator(this.avatar);
     Camera[] componentsInChildren = this.avatar.GetComponentsInChildren <Camera>();
     foreach (Camera camera in componentsInChildren)
     {
         camera.enabled = false;
     }
     AudioListener[] componentsInChildren2 = this.avatar.GetComponentsInChildren <AudioListener>();
     foreach (AudioListener audioListener in componentsInChildren2)
     {
         audioListener.enabled = false;
     }
     Cloth[] componentsInChildren3 = this.avatar.GetComponentsInChildren <Cloth>();
     foreach (Cloth cloth in componentsInChildren3)
     {
         cloth.enabled = false;
     }
     if (this.onAvatarInstantiated != null)
     {
         this.onAvatarInstantiated(url, this.avatar);
     }
 }
Example #4
0
 // Token: 0x06004952 RID: 18770 RVA: 0x00187B5C File Offset: 0x00185F5C
 private void Initialize()
 {
     if (this.guiRenderPlane != null)
     {
         UnityEngine.Object.Destroy(this.guiRenderPlane);
     }
     if (this.useCurvedSurface)
     {
         this.guiRenderPlane = (AssetManagement.Instantiate(Resources.Load("VRGUICurvedSurface")) as GameObject);
     }
     else
     {
         this.guiRenderPlane = (AssetManagement.Instantiate(Resources.Load("VRGUIFlatSurface")) as GameObject);
     }
     this.guiRenderPlane.transform.parent        = base.transform;
     this.guiRenderPlane.transform.localPosition = this.guiPosition;
     this.guiRenderPlane.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
     this.guiRenderPlane.transform.localScale    = new Vector3(this.guiSize, this.guiSize, this.guiSize);
     this.guiRenderTexture = new RenderTexture(Screen.width, Screen.height, 24);
     this.guiRenderPlane.GetComponent <Renderer>().material.mainTexture = this.guiRenderTexture;
     if (this.customCursor != null)
     {
         this.cursor = this.customCursor;
     }
     else
     {
         this.cursor = (Resources.Load("SimpleCursor") as Texture);
     }
     this.isInitialized = true;
 }
Example #5
0
    // Token: 0x0600569F RID: 22175 RVA: 0x001DCD54 File Offset: 0x001DB154
    private void Start()
    {
        VRCTrackingManager.instance = this;
        GameObject asset = this.TestTracking;

        if (this.ForceTestTracking)
        {
            asset = this.TestTracking;
        }
        else
        {
            asset = this.SteamVrTracking;
        }
        GameObject gameObject = AssetManagement.Instantiate(asset) as GameObject;

        this.activeTrackers.Add(gameObject.GetComponent <VRCTracking>());
        gameObject.transform.SetParent(base.transform);
        GameObject gameObject2 = AssetManagement.Instantiate(this.HandProxyTracking) as GameObject;

        this.activeTrackers.Add(gameObject2.GetComponent <VRCTracking>());
        gameObject2.transform.SetParent(base.transform);
        VRCTrackingManager.playerEyeHeight  = VRCTracking.DefaultEyeHeight;
        VRCTrackingManager.playerArmLength  = VRCTracking.DefaultArmLength;
        VRCTrackingManager._avatarViewPoint = new Vector3(0f, VRCTrackingManager.playerEyeHeight, 0f);
    }
Example #6
0
        // Token: 0x060054DA RID: 21722 RVA: 0x001D435C File Offset: 0x001D275C
        public GameObject Spawn(Vector3 pos, Quaternion rot)
        {
            GameObject gameObject;

            if (this.inactive.Count == 0)
            {
                gameObject      = (GameObject)AssetManagement.Instantiate(this.prefab, pos, rot);
                gameObject.name = string.Concat(new object[]
                {
                    this.prefab.name,
                    " (",
                    this.nextId++,
                    ")"
                });
                gameObject.AddComponent <SimplePool.PoolMember>().myPool = this;
            }
            else
            {
                gameObject = this.inactive.Pop();
                if (gameObject == null)
                {
                    return(this.Spawn(pos, rot));
                }
            }
            gameObject.transform.position = pos;
            gameObject.transform.rotation = rot;
            gameObject.SetActive(true);
            return(gameObject);
        }
Example #7
0
 // Token: 0x0600503F RID: 20543 RVA: 0x001B796C File Offset: 0x001B5D6C
 public void SwitchHMD()
 {
     if (this.cameraInstance != null)
     {
         UnityEngine.Object.Destroy(this.cameraInstance);
     }
     this.current        = HMDManager.GetHmdType();
     this.cameraInstance = HMDManager.InstantiateCameraPrefab();
     if (this.cameraInstance != null)
     {
         this.cameraInstance.transform.parent        = base.transform;
         this.cameraInstance.transform.localPosition = Vector3.zero;
         this.cameraInstance.transform.localRotation = Quaternion.identity;
         this.cameraInstance.transform.localScale    = Vector3.one;
         this.vrCamera = this.cameraInstance.GetComponentInChildren <VRCVrCamera>();
         this.vrCamera.SetMode(this.vrCameraMode);
         this.vrCamera.InitializeCameras(this);
         this.vrCamera.SetExclusiveLights(this.exclusiveLights);
         if (this.disableAudio)
         {
             AudioListener componentInChildren = this.cameraInstance.GetComponentInChildren <AudioListener>();
             componentInChildren.enabled = false;
         }
         if (this.hudPrefab != null)
         {
             GameObject gameObject = AssetManagement.Instantiate(this.hudPrefab) as GameObject;
             gameObject.transform.parent        = this.cameraInstance.transform;
             gameObject.transform.localPosition = Vector3.zero;
             gameObject.transform.localRotation = Quaternion.identity;
             gameObject.transform.localScale    = Vector3.one;
         }
     }
 }
Example #8
0
    // Token: 0x06005900 RID: 22784 RVA: 0x001EDA00 File Offset: 0x001EBE00
    private ObjectInstantiator.PrefabInfo _AddPrefab(string path, GameObject prefab)
    {
        GameObject gameObject = AssetManagement.Instantiate <GameObject>(prefab);

        if (gameObject == null)
        {
            Debug.LogError("Could not instantiate prefab " + path, base.gameObject);
            return(null);
        }
        int viewCount = VRC.Network.CountSubIDs(gameObject, true);
        int idCount   = (from c in VRC.Network.GetAllComponents <Component>(gameObject, true)
                         where c is INetworkID
                         select c).Count <Component>();

        UnityEngine.Object.Destroy(gameObject);
        prefab.SetActive(false);
        ObjectInstantiator.PrefabInfo prefabInfo = new ObjectInstantiator.PrefabInfo
        {
            obj       = prefab,
            name      = path,
            viewCount = viewCount,
            idCount   = idCount
        };
        this.prefabCache.Add(path, prefabInfo);
        return(prefabInfo);
    }
Example #9
0
    // Token: 0x060053DF RID: 21471 RVA: 0x001CF264 File Offset: 0x001CD664
    private void GenerateBulletHitEffect(Vector3 pos, Vector3 dir, Vector3 normal)
    {
        Vector3    toDirection = Vector3.Reflect(dir, normal);
        Quaternion rot         = Quaternion.FromToRotation(Vector3.forward, toDirection);
        GameObject obj         = (GameObject)AssetManagement.Instantiate(this.gunStats.hitEffects[0], pos, rot);

        UnityEngine.Object.Destroy(obj, 2f);
    }
Example #10
0
    // Token: 0x06004CE8 RID: 19688 RVA: 0x0019C064 File Offset: 0x0019A464
    public static void PlayerJoined(string PlayerID)
    {
        GameObject      gameObject      = (GameObject)AssetManagement.Instantiate(Resources.Load("USpeakerPrefab"));
        USpeakOwnerInfo uspeakOwnerInfo = gameObject.AddComponent <USpeakOwnerInfo>();

        uspeakOwnerInfo.Init(new USpeakPlayer
        {
            PlayerID = PlayerID
        });
    }
Example #11
0
    // Token: 0x060053F6 RID: 21494 RVA: 0x001CFC08 File Offset: 0x001CE008
    public void SetProperties(List <VRCPlayerModProperty> properties)
    {
        Dictionary <string, object> dictionary = new Dictionary <string, object>();

        foreach (VRCPlayerModProperty vrcplayerModProperty in properties)
        {
            dictionary[vrcplayerModProperty.name] = vrcplayerModProperty.value();
        }
        this.propPrefab     = (GameObject)Tools.GetOrDefaultFromDictionary(dictionary, "PropPrefab", null);
        this.propAnimations = (RuntimeAnimatorController)Tools.GetOrDefaultFromDictionary(dictionary, "PropAnimations", null);
        VRC_AvatarDescriptor componentInChildren = base.GetComponentInChildren <VRC_AvatarDescriptor>();

        if (componentInChildren == null)
        {
            return;
        }
        this._avatar = componentInChildren.gameObject;
        Animator component = this._avatar.GetComponent <Animator>();

        if (component.isHuman)
        {
            if (this._animator == null)
            {
                this._animator = component;
                if (this.propAnimations != null)
                {
                    this._animControllerManager.Push(this.propAnimations);
                }
            }
            else if (this._animator != component)
            {
                this._animator = component;
            }
            if (this.propPrefab != null)
            {
                this.propInstance = (GameObject)AssetManagement.Instantiate(this.propPrefab);
                this.propApi      = this.propInstance.GetComponent <VRC_PropApi>();
                this.propControls = this.propInstance.GetComponent <VRC_PropController>();
                if (this.propControls != null)
                {
                    this.propControls.controllingPlayer = base.GetComponent <VRC_PlayerApi>();
                }
                HumanBodyBones humanBodyBones = this.propApi.mountPoint;
                this.mountPoint = this._animator.GetBoneTransform(humanBodyBones);
                Quaternion tposeRotation = this._animationController.GetTPoseRotation(humanBodyBones);
                Quaternion localRotation = Quaternion.Inverse(tposeRotation) * this.propInstance.transform.rotation;
                this.propInstance.transform.parent        = this.mountPoint;
                this.propInstance.transform.localPosition = Vector3.zero;
                this.propInstance.transform.localRotation = localRotation;
            }
        }
    }
 // Token: 0x060044BB RID: 17595 RVA: 0x0016FE5C File Offset: 0x0016E25C
 public static void Switch(string _sceneName)
 {
     for (int i = 0; i < SU_SpaceSceneSwitcher.staticSpaceScenes.Count; i++)
     {
         GameObject gameObject = SU_SpaceSceneSwitcher.staticSpaceScenes[i];
         if (gameObject != null && gameObject.name == _sceneName)
         {
             if (SU_SpaceSceneSwitcher.staticMode != SU_SpaceSceneSwitcher.Mode.LOAD_ALL_AT_STARTUP)
             {
                 UnityEngine.Object.Destroy(SU_SpaceSceneSwitcher.currentSpaceScene);
                 SU_SpaceSceneSwitcher.currentSpaceScene = (GameObject)AssetManagement.Instantiate(gameObject, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f));
                 return;
             }
             if (SU_SpaceSceneSwitcher.hSpaceScenes[_sceneName] != null)
             {
                 bool flag = false;
                 IDictionaryEnumerator enumerator = SU_SpaceSceneSwitcher.hSpaceScenes.GetEnumerator();
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         object          obj             = enumerator.Current;
                         DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
                         if (dictionaryEntry.Key.ToString() == _sceneName)
                         {
                             SU_SpaceSceneSwitcher.SetActive((GameObject)dictionaryEntry.Value, true);
                             flag = true;
                         }
                         else
                         {
                             SU_SpaceSceneSwitcher.SetActive((GameObject)dictionaryEntry.Value, false);
                         }
                     }
                 }
                 finally
                 {
                     IDisposable disposable;
                     if ((disposable = (enumerator as IDisposable)) != null)
                     {
                         disposable.Dispose();
                     }
                 }
                 if (flag)
                 {
                     return;
                 }
             }
         }
     }
     Debug.LogWarning("Tried to switch to a space scene named " + _sceneName + " but the scene was not found. Ensure that you configured the array on the SpaceSceneSwitcher prefab correctly and that you typed the name of the space scene prefab correctly (case sensitive) for the Switch function call");
 }
    // Token: 0x0600611D RID: 24861 RVA: 0x00224224 File Offset: 0x00222624
    public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
    {
        RoomTableViewCell roomTableViewCell = tableView.GetReusableCell(this.roomTableViewCellPrefab.reuseIdentifier) as RoomTableViewCell;

        if (roomTableViewCell == null)
        {
            roomTableViewCell = (RoomTableViewCell)AssetManagement.Instantiate(this.roomTableViewCellPrefab);
            UnityEngine.Object gameObject = roomTableViewCell.gameObject;
            string             str        = "RoomTableViewCellInstance_";
            int num = ++this.mNumInstancesCreated;
            gameObject.name = str + num.ToString();
        }
        roomTableViewCell.RefreshCell(this.worlds[row]);
        return(roomTableViewCell);
    }
Example #14
0
 // Token: 0x0600601B RID: 24603 RVA: 0x0021D1CC File Offset: 0x0021B5CC
 private void CreateGroup(List <IUIGroupItemDatasource> items, int itemsPerRow, Action <IUIGroupItemDatasource> onItemSelected)
 {
     for (int i = 0; i < items.Count; i++)
     {
         GameObject gameObject = (GameObject)AssetManagement.Instantiate(this.uiGroupItemPrefab.gameObject);
         gameObject.transform.SetParent(base.transform);
         Vector3 zero = Vector3.zero;
         zero.x = ((float)(-(float)(itemsPerRow - 1)) * 0.5f + (float)i) * this.uiGroupItemWidth;
         gameObject.transform.localPosition = zero;
         gameObject.transform.localScale    = new Vector3(1f, 1f, 1f);
         gameObject.transform.localRotation = Quaternion.identity;
         UiGroupItem component = gameObject.GetComponent <UiGroupItem>();
         this.uiGroupItems.Add(component);
         component.Setup(items[i], onItemSelected);
     }
 }
Example #15
0
    // Token: 0x060053DA RID: 21466 RVA: 0x001CEC44 File Offset: 0x001CD044
    public void SetProperties(List <VRCPlayerModProperty> properties)
    {
        Dictionary <string, object> dictionary = new Dictionary <string, object>();

        foreach (VRCPlayerModProperty vrcplayerModProperty in properties)
        {
            dictionary[vrcplayerModProperty.name] = vrcplayerModProperty.value();
        }
        this.gunPrefab     = (GameObject)Tools.GetOrDefaultFromDictionary(dictionary, "GunPrefab", null);
        this.gunAnimations = (RuntimeAnimatorController)Tools.GetOrDefaultFromDictionary(dictionary, "GunAnimations", null);
        VRC_AvatarDescriptor componentInChildren = base.GetComponentInChildren <VRC_AvatarDescriptor>();

        if (componentInChildren == null)
        {
            return;
        }
        this._avatar = componentInChildren.gameObject;
        Animator component = this._avatar.GetComponent <Animator>();

        if (component.isHuman)
        {
            if (this._animator == null)
            {
                this._animator = component;
                if (this.gunAnimations != null)
                {
                    this._animControllerManager.Push(this.gunAnimations);
                }
            }
            else if (this._animator != component)
            {
                this._animator = component;
            }
            this.rightHand = this._animator.GetBoneTransform(HumanBodyBones.RightHand);
            if (this.gunPrefab != null && this.rightHand != null)
            {
                this.gunInstance = (GameObject)AssetManagement.Instantiate(this.gunPrefab);
                this.gunStats    = this.gunInstance.GetComponent <VRC_GunStats>();
                this.gunControls = this.gunInstance.GetComponent <VRC_PropController>();
                this.gunControls.controllingPlayer = base.GetComponent <VRC_PlayerApi>();
                this.ClipContents = ((this.gunStats.clipSize == 0) ? -1 : this.gunStats.clipSize);
                this.gunInstance.transform.parent        = this.rightHand;
                this.gunInstance.transform.localPosition = Vector3.zero;
                this.gunInstance.transform.localRotation = Quaternion.Inverse(this._animationController.GetTPoseRotation(HumanBodyBones.RightHand)) * this.gunInstance.transform.rotation;
            }
        }
    }
        // Token: 0x0600609A RID: 24730 RVA: 0x0022022C File Offset: 0x0021E62C
        public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
        {
            PlayerTableViewCell playerTableViewCell = tableView.GetReusableCell(this.playerTableViewCellPrefab.reuseIdentifier) as PlayerTableViewCell;

            if (playerTableViewCell == null)
            {
                playerTableViewCell = (PlayerTableViewCell)AssetManagement.Instantiate(this.playerTableViewCellPrefab);
                UnityEngine.Object gameObject = playerTableViewCell.gameObject;
                string             str        = "PlayerTableViewCellInstance_";
                int num = ++this.mNumInstancesCreated;
                gameObject.name = str + num.ToString();
            }
            Player player = this.mPlayers[row];

            playerTableViewCell.RefreshCell(player);
            return(playerTableViewCell);
        }
Example #17
0
    // Token: 0x0600613F RID: 24895 RVA: 0x00224A5C File Offset: 0x00222E5C
    public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
    {
        SubScreenTabTableViewCell subScreenTabTableViewCell = tableView.GetReusableCell(this.subScreenTabPrefab.reuseIdentifier) as SubScreenTabTableViewCell;

        if (subScreenTabTableViewCell == null)
        {
            subScreenTabTableViewCell = (SubScreenTabTableViewCell)AssetManagement.Instantiate(this.subScreenTabPrefab);
            UnityEngine.Object gameObject = subScreenTabTableViewCell.gameObject;
            string             str        = "SubScreenTableViewCellInstance_";
            int num = ++this.mNumInstancesCreated;
            gameObject.name = str + num.ToString();
        }
        VRCUiPage subPage = this.mSubPages[row % this.mSubPages.Count];

        subScreenTabTableViewCell.SetupCell(subPage, this.defaultTabFontSize, this.defaultTabColor, this.selectedTabFontSize, this.selectedTabColor);
        return(subScreenTabTableViewCell);
    }
    // Token: 0x06006307 RID: 25351 RVA: 0x00233A98 File Offset: 0x00231E98
    private void CreatePickerFromBlueprint(ApiAvatar b)
    {
        GameObject    gameObject = AssetManagement.Instantiate(this.pickerPrefab) as GameObject;
        RectTransform component  = gameObject.GetComponent <RectTransform>();

        component.SetParent(this.panel.transform);
        component.localScale    = Vector3.one;
        component.localRotation = Quaternion.identity;
        component.localPosition = new Vector3(this.defaultRect.width / 2f + (float)this.pickers.Count * this.spacing, 0f, 0f);
        VRCUiContentButton component2 = gameObject.GetComponent <VRCUiContentButton>();

        component2.list = this.list;
        component2.Initialize(b.imageUrl, b.name, delegate
        {
            User.CurrentUser.SetCurrentAvatar(b);
            VRCUiManager.Instance.HideScreen("SCREEN");
        }, b.id);
        this.pickers.Add(component2);
    }
Example #19
0
 private void PlayEffect(VRC.Player instigator)
 {
     if (instigator == null)
     {
         return;
     }
     this.LastEffectTime = Time.time;
     if (this.effectPrefabName != null && this.effectPrefabName != string.Empty)
     {
         if (this.effectPrefab == null)
         {
             this.effectPrefab = (GameObject)Resources.Load(this.effectPrefabName);
         }
         if (this.effectPrefab)
         {
             AssetManagement.Instantiate(this.effectPrefab, instigator.transform.position, instigator.transform.rotation);
         }
     }
 }
Example #20
0
    // Token: 0x06005178 RID: 20856 RVA: 0x001BE850 File Offset: 0x001BCC50
    public static GameObject InstantiateCameraPrefab()
    {
        if (HMDManager.Instance == null)
        {
            return(null);
        }
        GameObject gameObject;

        switch (HMDManager.Instance.hmd)
        {
        case HMDManager.HMDType.Unity:
            gameObject = HMDManager.Instance.UnityCameraRigPrefab;
            break;

        case HMDManager.HMDType.Oculus:
            gameObject = HMDManager.Instance.OculusCameraRigPrefab;
            break;

        case HMDManager.HMDType.Steam:
            gameObject = HMDManager.Instance.SteamVRCameraRigPrefab;
            break;

        case HMDManager.HMDType.Gameface:
            gameObject = HMDManager.Instance.CardboardCameraRigPrefab;
            break;

        case HMDManager.HMDType.Cardboard:
            gameObject = HMDManager.Instance.CardboardCameraRigPrefab;
            break;

        default:
            gameObject = null;
            break;
        }
        GameObject result = null;

        if (gameObject != null)
        {
            result = (AssetManagement.Instantiate(gameObject) as GameObject);
        }
        return(result);
    }
Example #21
0
    // Token: 0x06006347 RID: 25415 RVA: 0x00234854 File Offset: 0x00232C54
    public VRCUiPageTab CreateTab(string title, string screenPath, VRCUiPageTabManager.TabContext context, VRCUiPageTabGroup tabGroup = null, UnityAction onClick = null)
    {
        VRCUiPageTab vrcuiPageTab = (VRCUiPageTab)AssetManagement.Instantiate(this.pageTabPrefab);

        vrcuiPageTab.Fill(title, screenPath, context);
        this.allPageTabs.Add(vrcuiPageTab);
        this.currentPageTabs.Add(vrcuiPageTab);
        if (tabGroup != null)
        {
            tabGroup.AddTab(vrcuiPageTab);
            vrcuiPageTab.transform.SetParent(tabGroup.transform);
            vrcuiPageTab.transform.Reset();
        }
        if (onClick != null)
        {
            Button component = vrcuiPageTab.GetComponent <Button>();
            component.onClick.AddListener(onClick);
        }
        return(vrcuiPageTab);
    }
Example #22
0
    // Token: 0x060044CD RID: 17613 RVA: 0x00170380 File Offset: 0x0016E780
    private void Update()
    {
        this._newPos += base.transform.forward * this._velocity.magnitude * Time.deltaTime;
        Vector3    direction = this._newPos - this._oldPos;
        float      magnitude = direction.magnitude;
        RaycastHit raycastHit;

        if (magnitude > 0f && Physics.Raycast(this._oldPos, direction, out raycastHit, magnitude) && raycastHit.transform != this.firedBy && !raycastHit.collider.isTrigger)
        {
            Quaternion rot = Quaternion.FromToRotation(Vector3.up, raycastHit.normal);
            AssetManagement.Instantiate(this.impactEffect, raycastHit.point, rot);
            if (UnityEngine.Random.Range(0, 20) < 2)
            {
                AssetManagement.Instantiate(this.explosionEffect, raycastHit.transform.position, rot);
                UnityEngine.Object.Destroy(raycastHit.transform.gameObject);
            }
            UnityEngine.Object.Destroy(base.gameObject);
        }
        this._oldPos            = base.transform.position;
        base.transform.position = this._newPos;
    }
 // Token: 0x060044B9 RID: 17593 RVA: 0x0016FD00 File Offset: 0x0016E100
 private void Start()
 {
     SU_SpaceSceneSwitcher.staticMode = this.mode;
     if (this.spaceScenes.Length > 0)
     {
         if (SU_SpaceSceneSwitcher.staticSpaceScenes.Count == 0)
         {
             for (int i = 0; i < this.spaceScenes.Length; i++)
             {
                 SU_SpaceSceneSwitcher.staticSpaceScenes.Add(this.spaceScenes[i]);
             }
         }
     }
     else
     {
         Debug.LogError("No Space Scene Prefabs configured for the Space Scene array. Populate array in the inspector with Space Scene prefabs from the Project window. Note! You have to create Prefabs(!) of the space scenes - you cannot assign Unity Scenes to the array.");
     }
     if (SU_SpaceSceneSwitcher.staticMode == SU_SpaceSceneSwitcher.Mode.LOAD_ALL_AT_STARTUP)
     {
         SU_SpaceSceneSwitcher.hSpaceScenes.Clear();
         foreach (GameObject gameObject in this.spaceScenes)
         {
             GameObject gameObject2 = (GameObject)AssetManagement.Instantiate(gameObject, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f));
             SU_SpaceSceneSwitcher.hSpaceScenes.Add(gameObject.name, gameObject2);
             SU_SpaceSceneSwitcher.SetActive(gameObject2, false);
         }
     }
     if (this.sceneIndexLoadFirst >= this.spaceScenes.Length)
     {
         Debug.LogWarning("Scene Index Load First value is greater than the number of Space Scene prefabs in the array. Loading scene with index 0 instead.");
         this.sceneIndexLoadFirst = 0;
         SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst);
     }
     else
     {
         SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst);
     }
 }
Example #24
0
    private void _InstantiateObject(string prefabName, byte[] data, int localID, VRC.Player instantiator)
    {
        int   num = 0;
        float x;

        Protocol.Deserialize(out x, data, ref num);
        float y;

        Protocol.Deserialize(out y, data, ref num);
        float z;

        Protocol.Deserialize(out z, data, ref num);
        Vector3 pos = new Vector3(x, y, z);

        Protocol.Deserialize(out x, data, ref num);
        Protocol.Deserialize(out y, data, ref num);
        Protocol.Deserialize(out z, data, ref num);
        float w;

        Protocol.Deserialize(out w, data, ref num);
        Quaternion rot = new Quaternion(x, y, z, w);
        short      num2;

        Protocol.Deserialize(out num2, data, ref num);
        int[] array = new int[(int)num2];
        for (short num3 = 0; num3 < num2; num3 += 1)
        {
            int num4;
            Protocol.Deserialize(out num4, data, ref num);
            array[(int)num3] = num4;
        }
        ObjectInstantiator.PrefabInfo prefabInfo = this._FetchPrefab(prefabName);
        if (prefabInfo == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Could not find prefab", base.gameObject);
            VRC.Network.UnAllocateSubIDs(array);
            return;
        }
        GameObject gameObject = AssetManagement.Instantiate <GameObject>(prefabInfo.obj, pos, rot);

        if (gameObject == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Could not instantiate prefab", base.gameObject);
            VRC.Network.UnAllocateSubIDs(array);
            return;
        }
        gameObject.SetActive(true);
        ObjectInstantiatorHandle orAddComponent = gameObject.GetOrAddComponent <ObjectInstantiatorHandle>();

        orAddComponent.Instantiator = this;
        orAddComponent.LocalID      = new int?(localID);
        PhotonView orAddComponent2 = gameObject.GetOrAddComponent <PhotonView>();

        orAddComponent2.synchronization   = ViewSynchronization.Off;
        orAddComponent2.ownershipTransfer = OwnershipOption.Takeover;
        if (!VRC.Network.AssignSubIDs(gameObject, array, true))
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Could not assign IDs", base.gameObject);
            UnityEngine.Object.Destroy(gameObject);
            return;
        }
        gameObject.name = string.Concat(new object[]
        {
            prefabInfo.name,
            " (Dynamic Clone ",
            localID,
            ":",
            orAddComponent2.viewID,
            ")"
        });
        Debug.LogFormat("Instantiated a {0} with Local ID {1} and View ID {2}", new object[]
        {
            prefabInfo.name,
            localID,
            orAddComponent2.viewID
        });
        if (!this.spawnedObjects.ContainsKey(localID))
        {
            this.spawnedObjects.Add(localID, new ObjectInstantiator.ObjectInfo
            {
                data       = data,
                gameObject = null,
                prefabName = prefabName
            });
        }
        VRC.Network.ProtectFromCleanup(gameObject, true);
        this.spawnedObjects[localID].objectPath = VRC.Network.GetGameObjectPath(gameObject);
        this.spawnedObjects[localID].gameObject = gameObject;
        VRC.Network.SetOwner(instantiator, gameObject, VRC.Network.OwnershipModificationType.Request, true);
    }
Example #25
0
 // Token: 0x060044A9 RID: 17577 RVA: 0x0016F218 File Offset: 0x0016D618
 private void SpawnAsteroids(bool atSpawnDistance)
 {
     while (this._asteroids.Count < this.maxAsteroids)
     {
         Transform asset = this.prefabAsteroids[UnityEngine.Random.Range(0, this.prefabAsteroids.Length)];
         Vector3   pos   = Vector3.zero;
         if (atSpawnDistance)
         {
             pos = this._cacheTransform.position + UnityEngine.Random.onUnitSphere * this._distanceToSpawn;
         }
         else
         {
             pos = this._cacheTransform.position + UnityEngine.Random.insideUnitSphere * this._distanceToSpawn;
         }
         Transform transform = (Transform)AssetManagement.Instantiate(asset, pos, this._cacheTransform.rotation);
         string    text      = SU_AsteroidField.WeightedRandom <string>(this._materialList);
         if (text != null)
         {
             if (!(text == "VeryCommon"))
             {
                 if (!(text == "Common"))
                 {
                     if (!(text == "Rare"))
                     {
                         if (text == "VeryRare")
                         {
                             transform.GetComponent <Renderer>().sharedMaterial = this.materialVeryRare[UnityEngine.Random.Range(0, this.materialVeryRare.Length)];
                         }
                     }
                     else
                     {
                         transform.GetComponent <Renderer>().sharedMaterial = this.materialRare[UnityEngine.Random.Range(0, this.materialRare.Length)];
                     }
                 }
                 else
                 {
                     transform.GetComponent <Renderer>().sharedMaterial = this.materialCommon[UnityEngine.Random.Range(0, this.materialCommon.Length)];
                 }
             }
             else
             {
                 transform.GetComponent <Renderer>().sharedMaterial = this.materialVeryCommon[UnityEngine.Random.Range(0, this.materialVeryCommon.Length)];
             }
         }
         this._asteroids.Add(transform);
         this._asteroidsMaterials.Add(transform.GetComponent <Renderer>().sharedMaterial);
         this._asteroidsFading.Add(false);
         if (transform.GetComponent <SU_Asteroid>() != null)
         {
             transform.GetComponent <SU_Asteroid>().SetPolyCount(this.polyCount);
             if (transform.GetComponent <Collider>() != null)
             {
                 transform.GetComponent <SU_Asteroid>().SetPolyCount(this.polyCountCollider, true);
             }
         }
         float num = UnityEngine.Random.Range(this.minAsteroidScale, this.maxAsteroidScale) * this.scaleMultiplier;
         transform.localScale  = new Vector3(num, num, num);
         transform.eulerAngles = new Vector3((float)UnityEngine.Random.Range(0, 360), (float)UnityEngine.Random.Range(0, 360), (float)UnityEngine.Random.Range(0, 360));
         if (this.isRigidbody)
         {
             if (transform.GetComponent <Rigidbody>() != null)
             {
                 transform.GetComponent <Rigidbody>().mass            = this.mass * num;
                 transform.GetComponent <Rigidbody>().velocity        = transform.transform.forward * UnityEngine.Random.Range(this.minAsteroidVelocity, this.maxAsteroidVelocity) * this.velocityMultiplier;
                 transform.GetComponent <Rigidbody>().angularVelocity = new Vector3(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(this.minAsteroidAngularVelocity, this.maxAsteroidAngularVelocity) * this.angularVelocityMultiplier;
             }
             else
             {
                 Debug.LogWarning("AsteroidField is set to spawn rigidbody asterodids but one or more asteroid prefabs do not have rigidbody component attached.");
             }
         }
         else
         {
             if (transform.GetComponent <Rigidbody>() != null)
             {
                 UnityEngine.Object.Destroy(transform.GetComponent <Rigidbody>());
             }
             if (transform.GetComponent <SU_Asteroid>() != null)
             {
                 transform.GetComponent <SU_Asteroid>().rotationSpeed  = UnityEngine.Random.Range(this.minAsteroidRotationSpeed, this.maxAsteroidRotationSpeed);
                 transform.GetComponent <SU_Asteroid>().rotationalAxis = new Vector3(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
                 transform.GetComponent <SU_Asteroid>().driftSpeed     = UnityEngine.Random.Range(this.minAsteroidDriftSpeed, this.maxAsteroidDriftSpeed);
                 transform.GetComponent <SU_Asteroid>().driftAxis      = new Vector3(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
             }
         }
     }
 }
Example #26
0
    // Token: 0x0600577B RID: 22395 RVA: 0x001E2320 File Offset: 0x001E0720
    private void AttachAvatarInternal(UnityEngine.Object Prefab, string Name, float Scale = 1f)
    {
        this.WasMeasured = false;
        if (this == null || base.gameObject == null || base.GetComponent <Transform>() == null)
        {
            Debug.LogError("AttachAvatarInternal: VRCAvatarManager was destroyed, could not attach avatar: " + Name);
            return;
        }
        GameObject gameObject = AssetManagement.Instantiate <GameObject>(Prefab);

        if (gameObject == null || gameObject.GetComponent <Transform>() == null)
        {
            Debug.LogError("Could not instantiate avatar " + Name);
            return;
        }
        AvatarValidation.RemoveIllegalComponents(Name, gameObject, true);
        AvatarValidation.EnforceAudioSourceLimits(gameObject);
        if (!this.localPlayer)
        {
            foreach (Camera camera in gameObject.GetComponentsInChildren <Camera>())
            {
                Debug.LogWarning("Removing camera from " + camera.gameObject.name);
                UnityEngine.Object.Destroy(camera);
            }
        }
        int num = 2;

        VRC.Network.AssignNetworkIDsToObject(gameObject, false, VRC.Network.GetOwnerId(base.gameObject).Value, ref num);
        VRC.Network.IsObjectReady(gameObject);
        base.transform.localPosition       = Vector3.zero;
        base.transform.localRotation       = Quaternion.identity;
        gameObject.transform.parent        = base.transform;
        gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
        gameObject.transform.localRotation = new Quaternion(0f, 0f, 0f, 1f);
        gameObject.transform.localScale   *= Scale;
        VRC_AvatarDescriptor component = gameObject.GetComponent <VRC_AvatarDescriptor>();

        if (component == null)
        {
            Debug.LogError("Avatar Missing Descriptor");
            Analytics.Send(ApiAnalyticEvent.EventType.error, "Avatar Missing Descriptor: " + Name, null, null);
            UnityEngine.Object.Destroy(gameObject);
            return;
        }
        if (gameObject.GetComponent <Animator>() == null)
        {
            Debug.Log("Avatar Missing Animator");
            if (base.transform.parent != null)
            {
                Debug.Log("Avatar player object name=" + base.transform.parent.name);
            }
            Analytics.Send(ApiAnalyticEvent.EventType.error, "Avatar Missing Animator: " + Name, null, null);
        }
        if (this._avatarMirrorClone != null)
        {
            this.DestroyAvatarRenderClone();
        }
        if (this.currentAvatar != null)
        {
            VRC_EventHandler[] componentsInChildren2 = this.currentAvatar.GetComponentsInChildren <VRC_EventHandler>();
            foreach (VRC_EventHandler vrc_EventHandler in componentsInChildren2)
            {
                vrc_EventHandler.Unregister();
            }
            if (this.currentAvatar.GetComponent <Transform>() != null)
            {
                this.currentAvatar.GetComponent <Transform>().parent = null;
            }
            UnityEngine.Object.Destroy(this.currentAvatar);
        }
        this.currentAvatar           = gameObject;
        this.currentAvatarDescriptor = component;
        AudioListener[] componentsInChildren3 = gameObject.GetComponentsInChildren <AudioListener>();
        foreach (AudioListener audioListener in componentsInChildren3)
        {
            audioListener.enabled = false;
        }
        if (!this.localPlayer)
        {
            Camera[] componentsInChildren4 = gameObject.GetComponentsInChildren <Camera>();
            foreach (Camera camera2 in componentsInChildren4)
            {
                camera2.enabled = false;
            }
        }
        AudioListener[] componentsInChildren5 = gameObject.GetComponentsInChildren <AudioListener>();
        foreach (AudioListener audioListener2 in componentsInChildren5)
        {
            audioListener2.enabled = false;
        }
        SkinnedMeshRenderer[] componentsInChildren6 = this.currentAvatar.GetComponentsInChildren <SkinnedMeshRenderer>();
        foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren6)
        {
            skinnedMeshRenderer.updateWhenOffscreen = true;
        }
        this.visibleElements      = gameObject.GetComponentsInChildren <Renderer>(true);
        this.visibleElementEnable = new bool[this.visibleElements.Length];
        for (int num2 = 0; num2 < this.visibleElements.Length; num2++)
        {
            this.visibleElementEnable[num2] = this.visibleElements[num2].enabled;
        }
        List <IVRCCullable> list = new List <IVRCCullable>();

        foreach (DynamicBone item in gameObject.GetComponentsInChildren <DynamicBone>(true))
        {
            list.Add(item);
        }
        this.cullableElements   = list.ToArray();
        this._laserSelectRegion = null;
        if (!this.localPlayer && this._vrcPlayer != null)
        {
            Transform transform = this._vrcPlayer.transform.Find("SelectRegion");
            if (transform != null)
            {
                this._laserSelectRegion = transform.gameObject.GetComponent <PlayerSelector>();
            }
        }
        Animator component2 = this.currentAvatar.GetComponent <Animator>();

        if (component2 != null && component2.avatar != null)
        {
            if (component2.isHuman)
            {
                this._nonHuman = false;
                this.currentAvatar.GetOrAddComponent <VRIK>();
                this.currentAvatar.GetOrAddComponent <FullBodyBipedIK>();
                this.currentAvatar.GetOrAddComponent <global::LimbIK>();
                component2.runtimeAnimatorController = null;
                if (component.Animations == VRC_AvatarDescriptor.AnimationSet.Female)
                {
                    this._useFemaleAnims = true;
                }
                else
                {
                    this._useFemaleAnims = false;
                }
                AnimatorOverrideController defaults = this.animatorControllerMale;
                if (this._useFemaleAnims)
                {
                    defaults = this.animatorControllerFemale;
                }
                AnimatorOverrideController defaults2 = this.animatorControllerMaleSitting;
                if (this._useFemaleAnims)
                {
                    defaults2 = this.animatorControllerFemaleSitting;
                }
                this.currentStandingAnims            = this.MergeAnims("CustomStanding", defaults, component.CustomStandingAnims);
                this.currentSittingAnims             = this.MergeAnims("CustomSitting", defaults2, component.CustomSittingAnims);
                component2.runtimeAnimatorController = this.currentStandingAnims;
                component2.updateMode = AnimatorUpdateMode.Normal;
                if (this.currentStandingAnims == null)
                {
                    Debug.LogError(((!(this._vrcPlayer != null)) ? base.gameObject.name : this._vrcPlayer.name) + " has human avatar with broken standing animations.", this);
                    this.currentStandingAnims = this.animatorControllerMale;
                }
                else if (this.currentSittingAnims == null)
                {
                    Debug.LogError(((!(this._vrcPlayer != null)) ? base.gameObject.name : this._vrcPlayer.name) + " has human avatar with broken sitting animations.", this);
                    this.currentSittingAnims = this.animatorControllerMaleSitting;
                }
            }
            else
            {
                this._nonHuman = true;
                if (this.localPlayer)
                {
                    VRCTrackingManager.SetAvatarViewPoint(this.currentAvatarDescriptor.ViewPosition, Vector3.zero);
                }
                this.currentAvatarArmLength = VRCTracking.DefaultArmLength;
                this.currentAvatarEyeHeight = this.currentAvatarDescriptor.ViewPosition.y;
                if (this.localPlayer)
                {
                    VRCTrackingManager.AdjustViewPositionToAvatar();
                }
            }
            if (this.localPlayer)
            {
                component2.cullingMode = AnimatorCullingMode.AlwaysAnimate;
            }
            else
            {
                component2.cullingMode = AnimatorCullingMode.CullUpdateTransforms;
            }
            component2.applyRootMotion = false;
        }
        else
        {
            this._nonHuman = true;
            if (this.localPlayer)
            {
                VRCTrackingManager.SetAvatarViewPoint(this.currentAvatarDescriptor.ViewPosition, Vector3.zero);
            }
            this.currentAvatarArmLength = VRCTracking.DefaultArmLength;
            this.currentAvatarEyeHeight = this.currentAvatarDescriptor.ViewPosition.y;
            if (this.localPlayer)
            {
                VRCTrackingManager.AdjustViewPositionToAvatar();
            }
        }
        Transform transform2 = base.transform.Find("../CameraMount");

        if (transform2 != null && base.transform.parent != null)
        {
            transform2.position = base.transform.parent.TransformPoint(new Vector3(this.currentAvatarDescriptor.ViewPosition.x / base.transform.parent.localScale.x, this.currentAvatarDescriptor.ViewPosition.y / base.transform.parent.localScale.y, 0f));
        }
        MeshRenderer[] componentsInChildren8 = this.currentAvatar.GetComponentsInChildren <MeshRenderer>();
        foreach (MeshRenderer meshRenderer in componentsInChildren8)
        {
            meshRenderer.lightProbeUsage = this.useLightProbes;
        }
        SkinnedMeshRenderer[] componentsInChildren9 = this.currentAvatar.GetComponentsInChildren <SkinnedMeshRenderer>();
        foreach (SkinnedMeshRenderer skinnedMeshRenderer2 in componentsInChildren9)
        {
            skinnedMeshRenderer2.lightProbeUsage     = this.useLightProbes;
            skinnedMeshRenderer2.updateWhenOffscreen = this.localPlayer;
        }
        Vector3 localPosition = new Vector3(0f, this.currentAvatarDescriptor.ViewPosition.y + 0.5f, 0f);

        if (this.profile != null)
        {
            this.profile.localPosition = localPosition;
        }
        if (this.old_profile != null)
        {
            this.old_profile.localPosition = localPosition;
        }
        if (this.localPlayer)
        {
            Tools.SetLayerRecursively(gameObject, LayerMask.NameToLayer("PlayerLocal"), LayerMask.NameToLayer("UiMenu"));
        }
        else
        {
            Tools.SetLayerRecursively(gameObject, LayerMask.NameToLayer("Player"), LayerMask.NameToLayer("UiMenu"));
        }
        if (this.localPlayer)
        {
            this.InitAvatarRenderClone();
        }
        this._isAttached           = true;
        this.localAvatarVisibility = VRCAvatarManager.LocalAvatarVisibility.Visible;
        this.RefreshLocalAvatarVisibility();
        if (this.OnAvatarCreated != null)
        {
            this.OnAvatarCreated(this.currentAvatar, this.currentAvatarDescriptor, false);
        }
    }