Ejemplo n.º 1
0
        /**
         * Updates the data contained in the data control with a new chapter. This
         * method is essential for some undo/redo tools
         *
         * @param chaper
         */
        public void update(Chapter chapter)
        {
            this.chapter = chapter;

            // Create the subcontrollers
            playerDataControl            = new PlayerDataControl(chapter.getPlayer());
            scenesListDataControl        = new ScenesListDataControl(chapter.getObjects <Scene> (), this.getPlayer().getPreviewImage());
            cutscenesListDataControl     = new CutscenesListDataControl(chapter.getObjects <Cutscene> ());
            booksListDataControl         = new BooksListDataControl(chapter.getObjects <Book> ());
            itemsListDataControl         = new ItemsListDataControl(chapter.getObjects <Item> ());
            atrezzoListDataControl       = new AtrezzoListDataControl(chapter.getObjects <Atrezzo> ());
            npcsListDataControl          = new NPCsListDataControl(chapter.getObjects <NPC> ());
            conversationsListDataControl = new ConversationsListDataControl(chapter.getObjects <Conversation> ());
            TimersListDataControl      timersListDataControl       = new TimersListDataControl(chapter.getObjects <Timer> ());
            GlobalStateListDataControl globalStatesListDataControl = new GlobalStateListDataControl(chapter.getObjects <GlobalState> ());
            MacroListDataControl       macrosListDataControl       = new MacroListDataControl(chapter.getObjects <Macro> ());

            advancedFeaturesDataControl = new AdvancedFeaturesDataControl();
            advancedFeaturesDataControl.setTimerListDataControl(timersListDataControl);
            advancedFeaturesDataControl.setGlobalStatesListDataContorl(globalStatesListDataControl);
            advancedFeaturesDataControl.setMacrosListDataControl(macrosListDataControl);
            this.completables = chapter.getCompletabes();
            // assessmentProfilesDataControl = new AssessmentProfilesDataControl(chapter.getAssessmentProfiles());
            //adaptationProfilesDataControl = new AdaptationProfilesDataControl(chapter.getAdaptationProfiles());
        }
        public DataControl getReferencedElementDataControl()
        {
            switch (type)
            {
            case Controller.ATREZZO_REFERENCE:
                AtrezzoListDataControl aldc = Controller.getInstance().getSelectedChapterDataControl().getAtrezzoList();
                foreach (AtrezzoDataControl adc in aldc.getAtrezzoList())
                {
                    if (adc.getId().Equals(this.getElementId()))
                    {
                        return(adc);
                    }
                }
                break;

            case Controller.NPC_REFERENCE:
                NPCsListDataControl nldc = Controller.getInstance().getSelectedChapterDataControl().getNPCsList();
                foreach (NPCDataControl ndc in nldc.getNPCs())
                {
                    if (ndc.getId().Equals(this.getElementId()))
                    {
                        return(ndc);
                    }
                }
                break;

            case Controller.ITEM_REFERENCE:
                ItemsListDataControl ildc = Controller.getInstance().getSelectedChapterDataControl().getItemsList();
                foreach (ItemDataControl idc in ildc.getItems())
                {
                    if (idc.getId().Equals(this.getElementId()))
                    {
                        return(idc);
                    }
                }
                break;
            }
            return(null);
        }