void Initialize()
    {
        if (init)
        {
            return;
        }
        init = true;
        //Navigation button event handlers
        if (BackButton != null)
        {
            BackButton.AddEventListener("onclick", () => {
                App.MoveBack();
            });
        }
        if (HomeButton != null)
        {
            HomeButton.AddEventListener("onclick", () => {
                App.MoveToCollections(true);
            });
        }

        //Carousel events
        Carousel.AddEventListener("onload", () => {
            SelectDefault();
            isReady = true;
            ItemLoaded();
        });

        Carousel.AddEventListener("onselect", () => {
            if (Textures == null)
            {
                return;
            }
            Colors.Selected = Textures[Carousel.Selected];
            CurrentTexture  = Textures[Carousel.Selected];
        });

        //Color icon select event
        Colors.AddEventListener("onselect", () => {
            if (Textures == null)
            {
                return;
            }
            Carousel.Selected = Textures.IndexOf(Colors.SelectedModelTexture);
            CurrentTexture    = Colors.SelectedModelTexture;
        });

        Link.AddEventListener("onclick", () => {
            if (Model != null)
            {
                Application.OpenURL(Model.Link);
            }
        });
        ViewInHome.AddEventListener("onclick", () => {
            if (CurrentTexture != null)
            {
                App.MoveToARView(CurrentTexture);
            }
        });
    }
 void Awake()
 {
     BackButton.AddEventListener("onclick", () => {
         App.MoveToCollections();
     });
     HomeButton.AddEventListener("onclick", () => {
         App.MoveToCollections(true);
     });
 }
Exemple #3
0
    //Add event listeners to buttons
    void Awake()
    {
        if (BackButton != null)
        {
            BackButton.AddEventListener("onclick", () => {
                App.MoveTo(App.ProductPage);
                ARScene.Clear();
            });
        }
        if (HomeButton != null)
        {
            HomeButton.AddEventListener("onclick", () => {
                App.MoveToCollections(true);
                ARScene.Clear();
            });
        }
        AddButton.AddEventListener("onclick", () => {
            App.MoveToCollections(true);
        });

        Reset.AddEventListener("onclick", () => {
            ARScene.Reset();
        });

        Info.AddEventListener("onclick", () => {
            ARToolPanel.ARProductInfo.Build(ARScene.ModelTexturesInScene);
            ARToolPanel.ARProductInfo.SetScrollPosition("top");
            ARToolPanel.ARProductInfo.OnSelect = (model) => {
                Variant v        = model.GetParent <Variant>();
                ARToolPanel.Mode = ARTool.Hidden;
                App.MoveToInfo(v);
            };
            ARToolPanel.Mode = ARTool.ProductInfo;
        });

        Help.AddEventListener("onclick", () => {
            ARToolPanel.Mode = ARTool.Help;
        });

        Color.AddEventListener("onclick", () => {
            ARModel toReplace = ARScene.SelectedModel;
            ARToolPanel.ARColorPicker.Build(ARScene.SelectedModelTexture);
            ARToolPanel.ARColorPicker.SetScrollPosition("top");
            ARToolPanel.ARColorPicker.OnSelect = (model) => {
                ARScene.AddModel(model, toReplace);
            };
            ARToolPanel.Mode = ARTool.ColorPicker;
        });
    }
    public void AddModel(ModelTexture modeltexture, string title)
    {
        GameObject textGO = MakeText(title);

        ClickBox clickBox = textGO.GetComponent <ClickBox>();

        clickBox.AddEventListener("onclick", () => {
            if (OnSelect != null)
            {
                OnSelect(modeltexture);
            }
        });
        Grid.AddElement(textGO);
        Grid.AddElement(Instantiate(HLine));
    }
 void Awake()
 {
     if (IconClickBox != null)
     {
         IconClickBox.AddEventListener("onclick", () => {
             if (Mode == CenterIcon.Screenshot)
             {
                 Flash.hold = true;
                 Flash.Start();
                 NativeAid.SavePhoto(capture);
                 NativeAid.HapticEvent(HEvent.Success);
                 Flash.hold = false;
             }
         });
     }
 }
    public Vector2 SetBoxSize()
    {
        Vector2 size = new Vector2(-1, -1);

        if (Text == null)
        {
            return(size);
        }

        //Get text bounding box and text rect transform
        RectTransform rect = Text.gameObject.GetComponent <RectTransform>();

        if (rect == null)
        {
            return(size);
        }
        size = TextBBox;

        //Set text title, font size a rect size
        Text.text      = Title;
        Text.fontSize  = fontSize_px;
        Text.font      = Font;
        rect.sizeDelta = size;

        if (ButtonBackground == null)
        {
            return(size);
        }
        if (clickBox == null)
        {
            clickBox = ButtonBackground.gameObject.GetComponent <ClickBox>();
            if (clickBox != null)
            {
                clickBox.AddEventListener("onclick", () => { RunEvent("onclick"); });
            }
        }
        size += 2 * buttonPadding_px;
        ButtonBackground.sizeDelta = size;
        return(size);
    }
 public void Build(Collection assets)
 {
     Instagram.AddEventListener("onclick", () => {
         Application.OpenURL($"instagram://user?username={instagramAccountName}");
     });
     Facebook.AddEventListener("onclick", () => {
   #if UNITY_IOS
         Application.OpenURL($"fb://profile/{facebookPageId}");
   #elif UNITY_ANDROID
         Application.OpenURL($"fb://page/{facebookPageId}");
   #endif
     });
     List <Collection> cols   = assets.Children <Collection>();
     List <Collection> imcols = new List <Collection>();
     foreach (Collection col in cols)
     {
         if (col.Thumbnail.Texture != null)
         {
             imcols.Add(col);
         }
     }
     carousel.Build <Collection>(imcols);
 }
Exemple #8
0
    void Awake()
    {
        if (ImageClickBox == null)
        {
            return;
        }
        ImageClickBox.AddEventListener("onclick", () => {
            if (FolderCarousel == null)
            {
                return;
            }

            GameObject obj = FolderCarousel.SelectedObject;
            if (obj == null)
            {
                return;
            }

            FolderImage image = obj.GetComponent <FolderImage>();
            if (image == null)
            {
                return;
            }

            Folder folder = image.Folder;
            if (folder == null)
            {
                return;
            }

            if (folder.GetType() == typeof(Collection))
            {
                SelectedCollection = (Collection)(object)folder;
                RunEvent("oncollection");
            }
        });
    }