Пример #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #2
0
    //
    // Inheritance Methods
    //

    protected override void OnComponentRegistrationFinished()
    {
        base.OnComponentRegistrationFinished();

        // Init UI elements
        zoomPanel     = FindObjectOfType <ZoomPanel>();
        backgrounds   = FindObjectOfType <BackgroundsComponent>();
        cellInspector = FindObjectOfType <CellInspector>();
        var centerTopContainerT = GameObject.Find("CenterTopContainer").transform;

        collapseToggleLeft  = centerTopContainerT.Find("ColapseToggleLeft").GetComponent <Toggle>();
        collapseToggleRight = centerTopContainerT.Find("ColapseToggleRight").GetComponent <Toggle>();
        collapseToggleDown  = centerTopContainerT.Find("ColapseToggleDown").GetComponent <Toggle>();
        footer      = centerTopContainerT.Find("Footer");
        legendPanel = footer.Find("LegendPanel").GetComponent <LegendPanel>();
        toolbox     = FindObjectOfType <Toolbox>();

        siblingIndex = transform.GetSiblingIndex();
    }
Пример #3
0
    /// <summary>
    /// Magnify component on top of UI.
    /// </summary>
    /// <param name="zoomIn">True to zoom in/ False to zoom out.</param>
    private void ZoomOnComponent(bool zoomIn)
    {
        if (zoomIn)
        {
            GameObject zoomPanel = Resources.Load <GameObject>("Zoom");
            ZoomPanel = Instantiate(zoomPanel, this.transform.root);

            RectTransform panel_rt = ZoomPanel.GetComponent <RectTransform>();
            Vector2       size     = this.GetComponent <RectTransform>().sizeDelta;
            panel_rt.sizeDelta           = new Vector2(size.x, size.y);
            ZoomPanel.transform.position = new Vector3(
                this.transform.position.x,
                this.transform.position.y + size.y / 6
                );

            Image panelImage = ZoomPanel.GetComponent <Image>();
            panelImage.sprite = this.GetComponent <Image>().sprite;
        }
        else
        {
            Destroy(ZoomPanel);
        }
    }
Пример #4
0
        protected override void OnVisualParentChanged(DependencyObject oldParent)
        {
            base.OnVisualParentChanged(oldParent);

            if (this.Parent is ZoomPanel zoomPanel)
            {
                this.ZoomPanel = zoomPanel;

                scaleConverter = new ReciprocalConverter();
                scaleTransform = new ScaleTransform();

                // ParentScale X -> scale X
                BindingHelper.SetBinding(
                    ZoomPanel, ZoomPanel.ScaleProperty,
                    scaleTransform, ScaleTransform.ScaleXProperty,
                    converter: scaleConverter);

                // ParentScale Y -> scale Y
                BindingHelper.SetBinding(
                    ZoomPanel, ZoomPanel.ScaleProperty,
                    scaleTransform, ScaleTransform.ScaleYProperty,
                    converter: scaleConverter);
            }
        }
Пример #5
0
        public override void Initialize()
        {
            base.Initialize();

            SetBackground(ResourceManager.CreateImage("Images/background"), Adjustment.CENTER);

            //Init all lists
            gridContainerList = new List<Container<GridLayout>>();
            imageList = new List<ImageItem>();
            pendingUrlImages = new List<string>();

            //Search Text Area
            this.searchTextArea = new TextArea(SEARCH_TEXTAREA_TEXT, 1, 100);
            this.searchTextArea.BackgroundImage = ResourceManager.CreateImage("Images/top_search");
            this.searchTextArea.Padding = new Padding(25, 0, 0, 70);
            this.searchTextArea.Size = new Vector2(searchTextArea.BackgroundImage.Size.X, searchTextArea.BackgroundImage.Size.Y);
            AddComponent(searchTextArea, -80.0f, Preferences.ViewportManager.TopAnchor);

            //Search Button
            searchButton = new Button(ResourceManager.CreateImage("Images/bt_search"), ResourceManager.CreateImage("Images/bt_search_pressed"));
            searchButton.Pivot = new Vector2(1, 0);
            searchButton.Released += delegate
            {
                //Clear previous images
                ClearContent();
                //Search new images using TextArea text
                SearchImages(searchTextArea.Text);
            };
            AddComponent(searchButton, Preferences.ViewportManager.TopRightAnchor +  new Vector2( -12, 12));

            //Content Tab Panel
            contentTabPanel = new TabPanel(458, 632);
            //AddComponent(contentTabPanel, 0, BUTTON_HEIGHT + SPACING);
            AddComponent(contentTabPanel, 11, 90);
            //ZoomPanel
            zoomPanel = new ZoomPanel(this);
        }