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); }