Пример #1
0
    // Token: 0x0600188E RID: 6286 RVA: 0x00083E44 File Offset: 0x00082044
    public AvatarGearParts GetRagdollGear()
    {
        AvatarGearParts avatarGearParts = new AvatarGearParts();

        try
        {
            IUnityItem unityItem;
            bool       flag;
            if (this._items.TryGetValue(global::LoadoutSlotType.GearHolo, out unityItem))
            {
                flag = !unityItem.IsLoaded;
                if (unityItem.Prefab)
                {
                    HoloGearItem component = unityItem.Prefab.GetComponent <HoloGearItem>();
                    if (component && component.Configuration.Ragdoll)
                    {
                        avatarGearParts.Base = (UnityEngine.Object.Instantiate(component.Configuration.Ragdoll.gameObject) as GameObject);
                    }
                    else
                    {
                        avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
                    }
                }
                else
                {
                    avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
                }
            }
            else
            {
                flag = true;
                avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
            }
            if (flag)
            {
                foreach (global::LoadoutSlotType loadoutSlotType in LoadoutManager.GearSlots)
                {
                    if (this._items.TryGetValue(loadoutSlotType, out unityItem))
                    {
                        GameObject gameObject = unityItem.Create(Vector3.zero, Quaternion.identity);
                        if (gameObject)
                        {
                            avatarGearParts.Parts.Add(gameObject);
                        }
                    }
                    else if (Singleton <ItemManager> .Instance.TryGetDefaultItem(ItemUtil.ItemClassFromSlot(loadoutSlotType), out unityItem))
                    {
                        GameObject gameObject2 = unityItem.Create(Vector3.zero, Quaternion.identity);
                        if (gameObject2)
                        {
                            avatarGearParts.Parts.Add(gameObject2);
                        }
                    }
                }
            }
        }
        catch (Exception exception)
        {
            Debug.LogException(exception);
        }
        return(avatarGearParts);
    }
Пример #2
0
    // Token: 0x0600188D RID: 6285 RVA: 0x00083D20 File Offset: 0x00081F20
    public AvatarGearParts GetAvatarGear()
    {
        bool            flag            = false;
        AvatarGearParts avatarGearParts = new AvatarGearParts();
        IUnityItem      unityItem;

        if (this._items.TryGetValue(global::LoadoutSlotType.GearHolo, out unityItem))
        {
            avatarGearParts.Base = unityItem.Create(Vector3.zero, Quaternion.identity);
        }
        if (!avatarGearParts.Base)
        {
            flag = true;
            avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultAvatar.gameObject) as GameObject);
        }
        if (flag)
        {
            foreach (global::LoadoutSlotType loadoutSlotType in LoadoutManager.GearSlots)
            {
                if (this._items.TryGetValue(loadoutSlotType, out unityItem))
                {
                    GameObject gameObject = unityItem.Create(Vector3.zero, Quaternion.identity);
                    if (gameObject)
                    {
                        avatarGearParts.Parts.Add(gameObject);
                    }
                }
                else
                {
                    GameObject defaultGearItem = Singleton <ItemManager> .Instance.GetDefaultGearItem(ItemUtil.ItemClassFromSlot(loadoutSlotType));

                    if (defaultGearItem)
                    {
                        GameObject gameObject2 = UnityEngine.Object.Instantiate(defaultGearItem) as GameObject;
                        if (gameObject2)
                        {
                            avatarGearParts.Parts.Add(gameObject2);
                        }
                    }
                }
            }
        }
        return(avatarGearParts);
    }