Exemple #1
0
        public CameraPreview(Camera camera, GUIPanel previewsPanel)
        {
            Camera       = camera;
            previewPanel = previewsPanel.AddPanel();

            // Render texture GUI
            renderTexturePanel = previewPanel.AddPanel();
            renderTextureGUI   = new GUIRenderTexture(null);
            renderTexturePanel.AddElement(renderTextureGUI);

            // Control GUI
            controlsPanel = previewPanel.AddPanel(-1);
            GUILayoutX controlsLayout = controlsPanel.AddLayoutX();

            controlsLayout.SetHeight(16);

            cameraNameLabel = new GUILabel(string.Empty);
            pinButton       = new GUIButton(string.Empty);
            pinButton.SetWidth(16);
            pinButton.SetHeight(16);
            pinButton.OnClick += () =>
            {
                IsPinned = !IsPinned;
                UpdatePinButton();
            };

            controlsLayout.AddElement(cameraNameLabel);
            controlsLayout.AddFlexibleSpace();
            controlsLayout.AddElement(pinButton);

            UpdatePinButton();
        }