public void OnSaveButtonClick()
    {
        //Remove all stickers in sticker list
        while (lastSavedStickers.Count > 0)
        {
            lastSavedStickers.RemoveAt(0);
        }

        //Put stickers from content scroll in lastSavedStickers list
        for (int i = 0; i < contentScroll.GetContentComponents().Length; i++)
        {
            lastSavedStickers.Add(new Sticker(contentScroll.GetContentComponents()[i].GetComponent <QROption>().GetSticker()));
        }

        OnDetailsChanged();
    }
示例#2
0
    public void CloseEditStickerPanel(bool forceClose = false)
    { //When forceClose parameter is set to true, the function does not check for pending changes, it just closes the window
        //If any sticker has pending changes, display warning popup
        bool isDirty = false;

        if (!forceClose)
        {
            //For each sticker in the scroll
            for (int i = 0; i < contentScroll.GetContentComponents().Length; i++)
            {
                //Find the corresponding sticker in the file
                Sticker contentSticker = contentScroll.GetContentComponents()[i].GetComponent <QROption>().GetSticker();
                //compare each field. if any have changes,
                if (contentSticker.itemDescription != stickersFromFile[i].itemDescription)
                {
                    isDirty = true;
                    break;
                }
                else if (contentSticker.owner != stickersFromFile[i].owner)
                {
                    isDirty = true;
                    break;
                }
                else if (contentSticker.price != stickersFromFile[i].price)
                {
                    isDirty = true;
                    break;
                }
            }
        }

        //If there are pending changes show the warning popup else close the window
        if (isDirty)
        {
            saveFavoritesWarning.OpenSaveFavoritesWarning();
        }
        else
        {
            this.gameObject.SetActive(false);
            savedFavoritesPanel.gameObject.SetActive(true);
        }
    }