Example #1
0
    /**
     * Constructor.
     *
     * @param sceneDataControl
     *            Parent scene controller
     * @param activeArea
     *            Exit of the data control structure
     */
    public ActiveAreaDataControl(SceneDataControl sceneDataControl, ActiveArea activeArea)
    {
        this.sceneDataControl         = sceneDataControl;
        this.activeArea               = activeArea;
        conditionsController          = new ConditionsController(new Conditions());
        this.influenceAreaDataControl = new InfluenceAreaDataControl(sceneDataControl, activeArea.getInfluenceArea(), this);
        descriptionsController        = new DescriptionsController(activeArea.getDescriptions());

        // Create subcontrollers
        actionsListDataControl = new ActionsListDataControl(activeArea.getActions(), this);
    }
Example #2
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);
    }
    /**
     * Constructor
     *
     * @param npc
     *            Contained NPC data
     */
    public NPCDataControl(NPC npc)
    {
        this.npc           = npc;
        this.resourcesList = npc.getResources();

        selectedResources = 0;

        // Add a new resource if the list is empty
        if (resourcesList.Count == 0)
        {
            resourcesList.Add(new ResourcesUni());
        }

        // Create the subcontrollers
        resourcesDataControlList = new List <ResourcesDataControl>();
        foreach (ResourcesUni resources in resourcesList)
        {
            resourcesDataControlList.Add(new ResourcesDataControl(resources, Controller.NPC));
        }

        actionsListDataControl = new ActionsListDataControl(npc.getActions(), this);

        descriptionController = new DescriptionsController(npc.getDescriptions());
    }
    /**
     * Constructor.
     *
     * @param item
     *            Contained item
     */
    public ItemDataControl(Item item)
    {
        this.item          = item;
        this.resourcesList = item.getResources();

        selectedResources = 0;

        // Add a new resource if the list is empty
        if (resourcesList.Count == 0)
        {
            resourcesList.Add(new ResourcesUni());
        }

        // Create the subcontrollers
        resourcesDataControlList = new List <ResourcesDataControl>();
        foreach (ResourcesUni resources in resourcesList)
        {
            resourcesDataControlList.Add(new ResourcesDataControl(resources, Controller.ITEM));
        }

        actionsListDataControl = new ActionsListDataControl(item.getActions(), this);

        descriptionController = new DescriptionsController(item.getDescriptions());
    }
        public GeoElementDataControl(GeoElement geoElement)
        {
            this.geoElement = geoElement;

            this.resourcesList = geoElement.Resources;

            selectedResources = 0;

            // Add a new resource if the list is empty
            if (resourcesList.Count == 0)
            {
                resourcesList.Add(new ResourcesUni());
            }

            // Create the subcontrollers
            resourcesDataControlList = new List <ResourcesDataControl>();
            foreach (ResourcesUni resources in resourcesList)
            {
                resourcesDataControlList.Add(new ResourcesDataControl(resources, GEO_ELEMENT));
            }

            descriptionController = new DescriptionsController(geoElement.Descriptions);

            geoActionDataControls = new ListDataControl <GeoElementDataControl, GeoActionDataControl>(this, geoElement.Actions, new []
            {
                new ListDataControl <GeoElementDataControl, GeoActionDataControl> .ElementFactoryView
                {
                    Titles =
                    {
                        { ENTER_ACTION,   "Geo.Create.Title.EnterAction"   },
                        { EXIT_ACTION,    "Geo.Create.Title.ExitAction"    },
                        { LOOK_TO_ACTION, "Geo.Create.Title.LookToAction"  },
                        { INSPECT_ACTION, "Geo.Create.Title.InspectAction" }
                    },
                    Messages =
                    {
                        { ENTER_ACTION,   "Geo.Create.Message.EnterAction"   },
                        { EXIT_ACTION,    "Geo.Create.Message.ExitAction"    },
                        { LOOK_TO_ACTION, "Geo.Create.Message.LookToAction"  },
                        { INSPECT_ACTION, "Geo.Create.Message.InspectAction" }
                    },
                    Errors =
                    {
                        { ENTER_ACTION,   "Geo.Create.Error.EnterAction"   },
                        { EXIT_ACTION,    "Geo.Create.Error.ExitAction"    },
                        { LOOK_TO_ACTION, "Geo.Create.Error.LookToAction"  },
                        { INSPECT_ACTION, "Geo.Create.Error.InspectAction" }
                    },
                    ElementFactory = new DefaultElementFactory <GeoActionDataControl>(new DefaultElementFactory <GeoActionDataControl> .ElementCreator()
                    {
                        TypeDescriptors = new []
                        {
                            new TD
                            {
                                Type        = ENTER_ACTION,
                                ContentType = typeof(EnterAction)
                            },
                            new TD
                            {
                                Type        = EXIT_ACTION,
                                ContentType = typeof(ExitAction)
                            },
                            new TD
                            {
                                Type        = LOOK_TO_ACTION,
                                ContentType = typeof(InspectAction)
                            },
                            new TD
                            {
                                Type        = INSPECT_ACTION,
                                ContentType = typeof(LookToAction)
                            }
                        },
                        CreateDataControl = action => new GeoActionDataControl(action as GeoAction),
                        CreateElement     = (type, id, _) =>
                        {
                            switch (type)
                            {
                            case ENTER_ACTION:   return(new GeoActionDataControl(new EnterAction()));

                            case EXIT_ACTION:    return(new GeoActionDataControl(new ExitAction()));

                            case LOOK_TO_ACTION: return(new GeoActionDataControl(new LookToAction()));

                            case INSPECT_ACTION: return(new GeoActionDataControl(new InspectAction()));

                            default: return(null);
                            }
                        }
                    })
                }
            });

            geometryDataControls = new ListDataControl <GeoElementDataControl, GMLGeometryDataControl>(this, geoElement.Geometries, new []
            {
                new ListDataControl <GeoElementDataControl, GMLGeometryDataControl> .ElementFactoryView()
                {
                    Titles         = { { GEOMETRY, "Geo.Create.Title.Geometry" } },
                    Messages       = { { GEOMETRY, "Geo.Create.Message.Geometry" } },
                    Errors         = { { GEOMETRY, "Geo.Create.Error.Geometry" } },
                    ElementFactory = new DefaultElementFactory <GMLGeometryDataControl>(new DefaultElementFactory <GMLGeometryDataControl> .ElementCreator
                    {
                        CreateDataControl = geometry => new GMLGeometryDataControl(geometry as GMLGeometry),
                        CreateElement     = (type, id, _) => new GMLGeometryDataControl(new GMLGeometry()),
                        TypeDescriptors   = new []
                        {
                            new DefaultElementFactory <GMLGeometryDataControl> .ElementCreator.TypeDescriptor
                            {
                                ContentType = typeof(GMLGeometry),
                                Type        = GEOMETRY
                            }
                        }
                    })
                }
            });
        }
Example #6
0
 public RemoveDescriptionTool(DescriptionsController descriptionsController)
 {
     this.descriptionsController = descriptionsController;
 }
Example #7
0
 public AddDescriptionTool(DescriptionsController descriptionsController)
 {
     this.descriptionsController = descriptionsController;
 }
Example #8
0
 public DuplicateDescriptionTool(DescriptionsController descriptionsController)
 {
     this.descriptionsController = descriptionsController;
 }