public void OpenContainer()
{
GameWorldController.instance.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;
UWHUD.instance.ContainerOpened.GetComponent<RawImage>().texture=currObjInt.GetEquipDisplay().texture;
if (this.isOpenOnPanel==false)
{
this.isOpenOnPanel=true;
ContainerParent=GameWorldController.instance.playerUW.playerInventory.currentContainer;
}
GameWorldController.instance.playerUW.playerInventory.currentContainer=this.name;
if (GameWorldController.instance.playerUW.playerInventory.currentContainer=="")
{
GameWorldController.instance.playerUW.playerInventory.currentContainer=GameWorldController.instance.playerUW.name;
this.ContainerParent=GameWorldController.instance.playerUW.name;
}
for (int i = 0; i<8; i++)
{
string sItem = this.GetItemAt(i);
GameWorldController.instance.playerUW.playerInventory.SetObjectAtSlot(i+11,sItem);
}
UWHUD.instance.ContainerOpened.GetComponent<ContainerOpened>().BackpackBg.SetActive(true);
if (CountItems()>=8)
{
UWHUD.instance.ContainerOpened.GetComponent<ContainerOpened>().InvUp.SetActive(true);
UWHUD.instance.ContainerOpened.GetComponent<ContainerOpened>().InvDown.SetActive(true);
}
else
{
UWHUD.instance.ContainerOpened.GetComponent<ContainerOpened>().InvUp.SetActive(false);
UWHUD.instance.ContainerOpened.GetComponent<ContainerOpened>().InvDown.SetActive(false);
}
}