SortContainer() публичный статический Метод

public static SortContainer ( Container, cn ) : void
cn Container,
Результат void
Пример #1
0
    /*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);
        }
    }
Пример #2
0
    public void OpenContainer()
    {
        UWCharacter.Instance.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!
            SpillContents();
            return;
        }
        //Sort the container
        Container.SortContainer(this);
        UWHUD.instance.ContainerOpened.GetComponent <RawImage>().texture = GetContainerEquipDisplay().texture;       //currObjInt.GetEquipDisplay().texture;
        if (this.isOpenOnPanel == false)
        {
            this.isOpenOnPanel = true;
            ContainerParent    = UWCharacter.Instance.playerInventory.currentContainer;
        }
        UWCharacter.Instance.playerInventory.currentContainer = this.name;
        if (UWCharacter.Instance.playerInventory.currentContainer == "")
        {
            UWCharacter.Instance.playerInventory.currentContainer = UWCharacter.Instance.name;
            this.ContainerParent = UWCharacter.Instance.name;
        }
        for (short i = 0; i < 8; i++)
        {
            string sItem = this.GetItemAt(i);
            UWCharacter.Instance.playerInventory.SetObjectAtSlot((short)(i + 11), sItem);
        }
        UWHUD.instance.ContainerOpened.GetComponent <ContainerOpened>().BackpackBg.SetActive(true);
        if ((CountItems() >= 8) && (this != UWCharacter.Instance.playerInventory.playerContainer))
        {
            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);
        }
    }