/*static public bool xAddObjectToContainer(GameObject objInHand, GameObject objUseOn)
* {
* Container subContainer = objUseOn.GetComponent<Container>();
* if (subContainer.AddItemToContainer(objInHand.name))
* {
* Container ObjInHandContainer=objInHand.GetComponent<Container>();
* if (ObjInHandContainer!=null)
* {
* subContainer=objInHand.GetComponent<Container>();
* subContainer.ContainerParent=objUseOn.name;
* }
* return true;
* }
* else
* {
* return false;
* }
* }*/
public void OpenContainer()
{
playerUW.playerInventory.ContainerOffset = 0;
ScrollButtonStatsDisplay.ScrollValue = 0;
ObjectInteraction currObjInt = this.gameObject.GetComponent <ObjectInteraction>();
if (currObjInt.PickedUp == false)
{ //The requested container is open in the game world. This can cause problems!
//Debug.Log ("Opening a container in the real world");
SpillContents();
return;
}
//Sort the container
Container.SortContainer(this);
GameObject.Find("ContainerOpened").GetComponent <UITexture>().mainTexture = currObjInt.GetEquipDisplay().texture;
if (this.isOpenOnPanel == false)
{
this.isOpenOnPanel = true;
ContainerParent = playerUW.playerInventory.currentContainer;
}
playerUW.playerInventory.currentContainer = this.name;
if (playerUW.playerInventory.currentContainer == "")
{
playerUW.playerInventory.currentContainer = playerUW.name;
this.ContainerParent = playerUW.name;
}
for (int i = 0; i < 8; i++)
{
string sItem = this.GetItemAt(i);
playerUW.playerInventory.SetObjectAtSlot(i + 11, sItem);
}
}