Exemple #1
0
    protected void EditGUI()
    {
        if (!voxelArray.FacesAreSelected())
        {
            return;
        }

        TutorialGUI.TutorialHighlight("paint");
        if (ActionBarButton(GUIIconSet.instance.paint))
        {
            PaintGUI paintGUI = gameObject.AddComponent <PaintGUI>();
            paintGUI.title   = "Paint Faces";
            paintGUI.handler = (VoxelFace paint) =>
            {
                voxelArray.PaintSelectedFaces(paint);
            };
            paintGUI.paint = voxelArray.GetSelectedPaint();
        }
        TutorialGUI.ClearHighlight();

        TutorialGUI.TutorialHighlight("create object");
        if (ActionBarButton(GUIIconSet.instance.create))
        {
            TypePickerGUI picker = gameObject.AddComponent <TypePickerGUI>();
            picker.title      = "Create";
            picker.categories = new PropertiesObjectType[][] {
                GameScripts.entityTemplates, GameScripts.objectTemplates
            };
            picker.categoryNames = new string[] { "Substance", "Object" };
            picker.handler       = (PropertiesObjectType type) =>
            {
                if (typeof(Substance).IsAssignableFrom(type.type))
                {
                    Substance substance = (Substance)type.Create();
                    voxelArray.substanceToCreate = substance;
                    var createGUI = gameObject.AddComponent <CreateSubstanceGUI>();
                    createGUI.voxelArray = voxelArray;
                }
                else if (typeof(ObjectEntity).IsAssignableFrom(type.type))
                {
                    ObjectEntity obj = (ObjectEntity)type.Create();
                    if (!voxelArray.PlaceObject(obj))
                    {
                        DialogGUI.ShowMessageDialog(gameObject, OBJECT_NO_ROOM_ERROR);
                    }
                }
            };
        }
        TutorialGUI.ClearHighlight();

        GUILayout.FlexibleSpace();
        int moveCount = 0;

        if (touchListener.currentTouchOperation == TouchListener.TouchOperation.MOVE &&
            touchListener.movingAxis is MoveAxis)
        {
            moveCount = Mathf.Abs(((MoveAxis)touchListener.movingAxis).moveCount);
        }
        if (moveCount != 0)
        {
            ActionBarLabel(moveCount.ToString());
        }
        else
        {
            ActionBarLabel(SelectionString(voxelArray.selectionBounds.size));
        }
    }