Exemple #1
0
    public override void WindowGUI()
    {
        if (slidingPanel && GUI.enabled)
        {
            GUI.enabled = false;
            GUI.color   = new Color(1, 1, 1, 2); // reverse disabled tinting
        }

        scroll = GUILayout.BeginScrollView(scroll);

        if (voxelArray.selectionChanged && !freezeUpdates)
        {
            worldSelected = false;
            voxelArray.selectionChanged = false;
            scroll           = Vector2.zero;
            scrollVelocity   = Vector2.zero;
            selectedEntities = new List <Entity>(voxelArray.GetSelectedEntities());
            UpdateEditEntity();
        }

        bool propertiesDisplayed = false;

        if (worldSelected)
        {
            GUILayout.BeginVertical(GUI.skin.box);
            PropertiesObjectGUI(voxelArray.world);
            GUILayout.EndVertical();
            propertiesDisplayed = true;
            EntityReferencePropertyManager.Reset(null);
        }
        else if (editEntity != null)
        {
            EntityPropertiesGUI();
            propertiesDisplayed = true;
        }
        else
        {
            EntityReferencePropertyManager.Reset(null);
        }

        if (Input.touchCount == 1)
        {
            if (horizontalSlide && (!adjustingSlider) && PanelContainsPoint(touchStartPos))
            {
                slidingPanel = true;
            }
        }
        else
        {
            adjustingSlider = false;
            slidingPanel    = false;
        }

        if (slidingPanel)
        {
            Touch touch = Input.GetTouch(0);
            if (Event.current.type == EventType.Repaint) // scroll at correct rate
            {
                slide += touch.deltaPosition.x / scaleFactor;
            }
            normallyOpen = slide > SLIDE_HIDDEN / 2;
        }
        else
        {
            if (Event.current.type == EventType.Repaint)
            {
                bool shouldOpen = normallyOpen && propertiesDisplayed;
                slide += 2000 * Time.deltaTime * (shouldOpen ? 1 : -1);
            }
        }
        if (slide > 0)
        {
            slide = 0;
        }
        if (slide < SLIDE_HIDDEN)
        {
            slide = SLIDE_HIDDEN;
        }

        GUILayout.Space(bottomGap);
        GUILayout.EndScrollView();
    }