예제 #1
0
    public void AttachNewDressItem(DressCategory category, int dressCode, bool isAttachCreatePosition = true)
    {
        GameObject newDressItem = DressCreator.Instance.CloneDressItem(category, dressCode);

        if (newDressItem != null)
        {
            UIDragDropDressItem dragDrop = newDressItem.GetComponent <UIDragDropDressItem>();
            dragDrop.pressItemEvent   += ShowGuidDressItem;
            dragDrop.dragEndItemEvent += DeleteOldGuideItem;

            DressItem dressItem = newDressItem.GetComponent <DressItem>();
            selectedDressItems.Add(dressItem);
            newDressItem.transform.parent = transform;
            if (isAttachCreatePosition)
            {
                newDressItem.transform.localPosition = dressItem.createPosition;
            }
            else
            {
                newDressItem.transform.localPosition = dragDrop.attachPosition;
            }
            newDressItem.transform.localScale            = Vector3.one;
            newDressItem.GetComponent <UISprite>().depth = (int)dressItem.dressSpriteDepth;
        }
    }
예제 #2
0
    private void ShowGuidDressItem(DressItem pressedDressItem)
    {
        GameObject guideDressItem = DressCreator.Instance.CloneDressItem(pressedDressItem.dressCategory, pressedDressItem.dressCode);

        if (guideDressItem != null)
        {
            DressItem dressItem = guideDressItem.GetComponent <DressItem>();
            dressItem.transform.parent = transform;

            UIDragDropDressItem dragDrop = guideDressItem.GetComponent <UIDragDropDressItem>();
            dressItem.transform.localPosition         = dragDrop.attachPosition;
            dressItem.transform.localScale            = Vector3.one;
            dressItem.GetComponent <UISprite>().alpha = 0.7f;
            dressItem.GetComponent <UISprite>().depth = pressedDressItem.GetComponent <UISprite>().depth - 1;

            this.guideDressItem = guideDressItem;
        }
    }