Beispiel #1
0
    void Start()
    {
        Content.cellSize        = new Vector2(UIManager.sizeDelta.x, Content.cellSize.y);
        GalleryPanel.galleryAR += Instan;
        OnSearchHat            += SearchHat;

        m_informationPanel = FindObjectOfType <InformationPanel>();
        hatData            = FindObjectOfType <HatData>();

        EventTrigger trigger = m_ScrollRect.gameObject.GetComponent <EventTrigger>();

        EventTrigger.Entry entry = new EventTrigger.Entry();

        entry.eventID = EventTriggerType.Drag;
        entry.callback.AddListener((data) => { OnDragDelegate((PointerEventData)data); });
        trigger.triggers.Add(entry);


        m_ListContentHatPanel = new List <GameObject>();
        m_ListElementOffsetX  = Screen.width;

        backButton.onClick.AddListener(() =>
        {
            AppController.OnBackAR();
            StartCoroutine(ResetValues());
        });

        m_HatData = new List <HatDataD>();
        HatDataD d1 = new HatDataD();

        d1.hatId        = "welfleet";
        d1.hatName      = "Benjamin Paul";
        d1.hatBrand     = "Fedora";
        d1.hatPhoto     = hatPhoto;
        d1.hatColorList = new List <string>();
        d1.hatSizeList  = new List <string> {
            "s", "m", "l"
        };
        d1.hatColor = "black";

        HatDataD d2 = new HatDataD();

        d2.hatId        = "county line";
        d2.hatName      = "County Line";
        d2.hatBrand     = "Fedora";
        d2.hatPhoto     = hatPhoto2;
        d2.hatColorList = new List <string> {
            "black", "gray"
        };
        d2.hatSizeList = new List <string> {
            "m", "l"
        };
        d2.hatColor = "black";

        m_HatData.Add(d1);
        m_HatData.Add(d2);

        // LoadContentGG += GG;
    }
Beispiel #2
0
    public void Instan(Product p)
    {
        HatDataD _hatData = new HatDataD();

        _hatData.hatId   = p.title();
        _hatData.hatName = p.title();
        var variants = (List <Shopify.Unity.ProductVariant>)p.variants();

        GameObject element = Instantiate(m_ContentHatPanelPrefb, transform);

        element.SetActive(true);
        element.GetComponent <HatPanelArPrefab>().LoadInformation(_hatData.hatId,
                                                                  _hatData.hatName,
                                                                  _hatData.hatBrand,
                                                                  _hatData.hatPhoto,
                                                                  _hatData.hatColorList,
                                                                  _hatData.hatSizeList,
                                                                  _hatData.hatColor);

        var    List_color_code_map = p.tags();
        string colorDefault        = "";
        string sku = "";

        colorDefault = Utils.GetColorDefault(List_color_code_map);
        sku          = Utils.GetSKU(List_color_code_map);

        var img = p.images();

        foreach (Shopify.Unity.ImageEdge item in img.edges())
        {
            string URLglobal = item.node().transformedSrc("large");

            if (colorDefault != "" && sku != "")
            {
                if (URLglobal.Contains(sku + "-" + colorDefault + "-F01"))
                {
                    string _URLImage = URLglobal;
                    StartCoroutine(Utils.OnDownloadImage(_URLImage, (spri) =>
                    {
                        element.GetComponent <HatPanelArPrefab>().m_HatPhoto.sprite = spri;
                    }));
                }
            }
        }

        m_ListContentHatPanel.Add(element);
        Hatproducts.Add(p);
    }