Beispiel #1
0
 public override bool redoTool()
 {
     descriptionsController.addDescription(description);
     descriptionsController.addDescriptionController(descriptionController);
     descriptionsController.setSelectedDescription(descriptionsController.getDescriptionCount() - 1);
     Controller.getInstance().updatePanel();
     return(false);
 }
Beispiel #2
0
 public override bool doTool()
 {
     description = (Description)descriptionsController.getSelectedDescription();
     descriptionsController.addDescription(description);
     descriptionController = new DescriptionController(description);
     descriptionsController.addDescriptionController(descriptionController);
     descriptionsController.setSelectedDescription(descriptionsController.getDescriptionCount() - 1);
     return(true);
 }
Beispiel #3
0
    public override bool doTool()
    {
        bool elementDeleted = false;

        lastSelectedDescription = descriptionsController.getSelectedDescriptionNumber();
        if (descriptionsController.getSelectedDescriptionNumber() > 0)
        {
            deletedDescriptionController = descriptionsController.removeSelectedDescription();
            descriptionsController.setSelectedDescription(descriptionsController.getDescriptionCount() - 1);
            elementDeleted = true;
        }



        // If it was the last one, show an error message
        else
        {
            //TODO cambiar cadenas
            Controller.getInstance().showErrorDialog(TC.get("Operation.DeleteResourcesTitle"), TC.get("Operation.DeleteResourcesErrorLastResources"));
        }

        return(elementDeleted);
    }
Beispiel #4
0
    /**
     * Constructor.
     *
     * @param sceneDataControl
     *            Parent scene controller
     * @param activeArea
     *            Exit of the data control structure
     */
    public BarrierDataControl(SceneDataControl sceneDataControl, Barrier barrier)
    {
        this.sceneDataControl = sceneDataControl;
        this.barrier          = barrier;

        // Create subcontrollers
        Dictionary <string, ConditionsController.ConditionContextProperty> context1 = new Dictionary <string, ConditionsController.ConditionContextProperty>();

        ConditionsController.ConditionOwner parent = new ConditionsController.ConditionOwner(Controller.SCENE, sceneDataControl.getId());
        ConditionsController.ConditionOwner owner  = new ConditionsController.ConditionOwner(Controller.BARRIER, barrier.getId(), parent);

        context1.Add(ConditionsController.CONDITION_OWNER, owner);

        conditionsController = new ConditionsController(barrier.getConditions(), context1);

        descriptionController = new DescriptionsController(barrier.getDescriptions());

        //Barriers can only have name, and only one description, so we set selectedDEscription to 0
        descriptionController.setSelectedDescription(0);
    }
Beispiel #5
0
    private void Awake()
    {
        conditionsTex   = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24");
        noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24");

        descriptionsList = new DataControlList()
        {
            RequestRepaint = Repaint,
            elementHeight  = 20,
            Columns        = new List <ColumnList.Column>()
            {
                new ColumnList.Column()
                {
                    Text = TC.get("Item.Name")
                },
                new ColumnList.Column()
                {
                    Text = TC.get("Conditions.Title")
                }
            },
            drawCell = (rect, index, column, isActive, isFocused) =>
            {
                var description = descriptions.getDescriptionController(index);
                switch (column)
                {
                case 0:
                    if (index == descriptionsList.index)
                    {
                        description.renameElement(EditorGUI.TextField(rect, description.getName()));
                    }
                    else
                    {
                        EditorGUI.LabelField(rect, description.getName());
                    }
                    break;

                case 1:
                    if (GUI.Button(rect, description.getConditionsController().getBlocksCount() > 0 ? conditionsTex : noConditionsTex))
                    {
                        ConditionEditorWindow window =
                            (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(description.getConditionsController());
                    }
                    break;
                }
            },
            onSelectCallback = (list) =>
            {
                descriptions.setSelectedDescription(list.index);
                description = descriptions.getSelectedDescriptionController();
            }
        };

        descriptionsList.index = 0;

        nameField = new TextWithSoundField()
        {
            Label    = TC.get("Item.Name"),
            FileType = FileType.ITEM_DESCRIPTION_NAME_SOUND
        };

        briefField = new TextWithSoundField()
        {
            Label    = TC.get("Item.Description"),
            FileType = FileType.ITEM_DESCRIPTION_BRIEF_SOUND
        };

        fullField = new TextWithSoundField()
        {
            Label    = TC.get("Item.DetailedDescription"),
            FileType = FileType.ITEM_DESCRIPTION_DETAILED_SOUND
        };
    }