private static void DropInventory() { PartyMemberAI selChar = UIInventoryManager.Instance.SelectedCharacter.gameObject.Component <PartyMemberAI>(); Container container = GameResources.LoadPrefab <Container>("DefaultDropItem", false); //assign another mesh, less ugly, less giant, less looking like a f*****g 3 year old baby? ugh.................. var dropObject = GameResources.Instantiate <GameObject>(container.gameObject, selChar.gameObject.transform.position, Quaternion.identity); dropObject.tag = "DropItem"; dropObject.layer = LayerUtility.FindLayerValue("Dynamics"); dropObject.transform.localRotation = Quaternion.AngleAxis(Random.Range((float)0f, (float)360f), Vector3.up); InstanceID eid = dropObject.Component <InstanceID>(); eid.Guid = Guid.NewGuid(); eid.UniqueID = eid.Guid.ToString(); dropObject.Component <Persistence>().TemplateOnly = true; Container component = dropObject.Component <Container>(); component.ManualLabelName = "Drop Items"; component.DeleteMeIfEmpty = true; AlphaControl control = dropObject.AddComponent <AlphaControl>(); if (control != null) { control.Alpha = 0f; control.FadeIn(1f); } // opening created container... code taken from Container.Open() UILootManager.Instance.SetData(selChar, dropObject.Component <Inventory>(), dropObject.gameObject); UILootManager.Instance.ShowWindow(); dropObject.Component <Inventory>().CloseInventoryCB = component.CloseInventoryCB; }
public void AttachCapeNew(Transform skeleton) { if (!IEModOptions.CapesHidden) // Only inserted line really... { Equipment component = base.GetComponent <Equipment>(); if (component == null) { return; } Equippable neck = null; if (component.CurrentItems != null) { if (component.CurrentItems.Neck != null && component.CurrentItems.Neck.Appearance.bodyPiece == AppearancePiece.BodyPiece.Cape) { neck = component.CurrentItems.Neck; } } else if (component.DefaultEquippedItems != null && component.DefaultEquippedItems.Neck != null && component.DefaultEquippedItems.Neck.Appearance.bodyPiece == AppearancePiece.BodyPiece.Cape) { neck = component.DefaultEquippedItems.Neck; } if (neck == null) { if (this.m_capeMeshObject != null) { GameUtilities.Destroy(this.m_capeMeshObject); this.m_capeMeshObject = null; } this.m_capeCachedEquippable = null; return; } if (this.m_capeCachedEquippable == neck) { return; } if (this.m_capeMeshObject != null) { GameUtilities.Destroy(this.m_capeMeshObject); this.m_capeMeshObject = null; } this.m_capeCachedEquippable = neck; if (this.FindBone(skeleton, "bn_cloth_01") == null) { this.AddCapeBone(this.FindBone(skeleton, "Neck")); } string capePrefabPath = this.GetCapePrefabPath(); NPCAppearance.s_loader.LoadBundle <GameObject>(capePrefabPath, false); if (NPCAppearance.s_loader.obj) { this.m_capeMeshObject = Object.Instantiate(NPCAppearance.s_loader.obj) as GameObject; this.m_capeMeshObject.name = "Cape Mesh"; this.m_capeMeshObject.transform.parent = base.transform; this.m_capeMeshObject.transform.localPosition = Vector3.zero; this.m_capeMeshObject.transform.localRotation = Quaternion.identity; if (base.gameObject.layer != PE_Paperdoll.PaperdollLayer) { this.m_capeMeshObject.layer = LayerUtility.FindLayerValue("Dynamics"); } else { this.m_capeMeshObject.layer = PE_Paperdoll.PaperdollLayer; } ClothMesh clothMesh = this.m_capeMeshObject.GetComponent <ClothMesh>(); if (clothMesh != null) { clothMesh.SkeletonObject = skeleton.gameObject; clothMesh.SkinnedMeshes = new SkinnedMeshRenderer[1]; SkinnedMeshRenderer sLoader = this.m_capeMeshObject.GetComponent <SkinnedMeshRenderer>(); string str = "Art/Character/Textures/Cape/m_Cape01_V"; str = (neck.Appearance.materialVariation >= 10 ? string.Concat(str, neck.Appearance.materialVariation, string.Empty) : string.Concat(str, "0", neck.Appearance.materialVariation)); NPCAppearance.s_loader.LoadBundle <GameObject>(str, false); if (!NPCAppearance.s_loader.obj) { Debug.LogError(string.Concat("Cape Material Asset could not be found! Searched for at: '", str, "'")); } else { sLoader.material = NPCAppearance.s_loader.obj as Material; } clothMesh.SkinnedMeshes[0] = sLoader; } } } }