コード例 #1
0
    /**
     * Deletes the chapter data control in the given position. It also updates
     * automatically the selectedChapter if necessary
     *
     * @param chapter
     */
    public ChapterDataControl removeChapterDataControl(int index)
    {
        chapters.RemoveAt(index);
        ChapterDataControl removed = chapterDataControlList[index];

        chapterDataControlList.RemoveAt(index);
        chapterToolManagers.RemoveAt(index);
        setSelectedChapterInternal(selectedChapter - 1);
        return(removed);
    }
コード例 #2
0
    public bool replaceSelectedChapter(Chapter newChapter)
    {
        int chapter = this.getSelectedChapter();

        chapters[getSelectedChapter()]  = newChapter;
        chapterDataControlList[chapter] = new ChapterDataControl(newChapter);
        identifierSummary = new IdentifierSummary(newChapter);
        identifierSummary.loadIdentifiers(getSelectedChapterData());

        return(true);
    }
        private void UpdateChapter()
        {
            if (Controller.Instance.SelectedChapterDataControl != null && lastSelectedChapterDataControl != Controller.Instance.SelectedChapterDataControl)
            {
                completableListDataControl = new CompletableListDataControl(Controller.Instance.SelectedChapterDataControl.getObjects <Completable>());
                Controller.Instance.SelectedChapterDataControl.RegisterExtraDataControl(completableListDataControl);

                lastSelectedChapterDataControl = Controller.Instance.SelectedChapterDataControl;
                Controller.Instance.updateVarFlagSummary();
            }
        }
コード例 #4
0
    /**
     * Moves the selected chapter to the next position of the chapter's list.
     *
     */
    public bool moveChapterDown(int index)
    {
        // If the chapter can be moved
        if (index < chapterDataControlList.Count - 1)
        {
            // Move the chapter and update the selected chapter
            Chapter c = chapters[index];
            chapters.RemoveAt(index);
            chapters.Insert(index + 1, c);
            // Move the chapter and update the selected chapter
            ChapterDataControl con = chapterDataControlList[index];
            chapterDataControlList.RemoveAt(index);
            chapterDataControlList.Insert(index + 1, con);

            setSelectedChapterInternal(index + 1);
            return(true);
        }
        return(false);
    }
コード例 #5
0
        private void UpdateChapter()
        {
            if (Controller.Instance.SelectedChapterDataControl != null && lastSelectedChapterDataControl != Controller.Instance.SelectedChapterDataControl)
            {
                // QRCodeslist list manages only QRCodes
                unityScenes = new ListDataControl <ChapterDataControl, UnitySceneDataControl>(
                    Controller.Instance.SelectedChapterDataControl,
                    Controller.Instance.SelectedChapterDataControl.getObjects <UnityScene>(),
                    new ListDataControl <ChapterDataControl, UnitySceneDataControl> .ElementFactoryView
                {
                    Titles         = { { 3428323, "UnityPlugin.Create.Title.UnityScene" } },
                    DefaultIds     = { { 3428323, "UnityScene" } },
                    Errors         = { { 3428323, "UnityPlugin.Create.Error.UnityScene" } },
                    Messages       = { { 3428323, "UnityPlugin.Create.Message.UnityScene" } },
                    ElementFactory = new DefaultElementFactory <UnitySceneDataControl>(
                        new DefaultElementFactory <UnitySceneDataControl> .ElementCreator()
                    {
                        CreateDataControl = unityScene => new UnitySceneDataControl(unityScene as UnityScene),
                        CreateElement     = (type, id, _) => new UnitySceneDataControl(new UnityScene {
                            Id = id
                        }),
                        TypeDescriptors = new[]
                        {
                            new DefaultElementFactory <UnitySceneDataControl> .ElementCreator.TypeDescriptor
                            {
                                Type        = 3428323,
                                ContentType = typeof(UnityScene),
                                RequiresId  = true
                            }
                        }
                    })
                });

                Controller.Instance.SelectedChapterDataControl.RegisterExtraDataControl(unityScenes);
                SelectedUnityScene = -1;


                lastSelectedChapterDataControl = Controller.Instance.SelectedChapterDataControl;
                Controller.Instance.updateVarFlagSummary();
            }
        }
コード例 #6
0
        private void UpdateChapter()
        {
            if (Controller.Instance.SelectedChapterDataControl != null && lastSelectedChapterDataControl != Controller.Instance.SelectedChapterDataControl)
            {
                // QRCodeslist list manages only QRCodes
                qrCodes = new ListDataControl <ChapterDataControl, QRCodeDataControl>(
                    Controller.Instance.SelectedChapterDataControl,
                    Controller.Instance.SelectedChapterDataControl.getObjects <QR>(),
                    new ListDataControl <ChapterDataControl, QRCodeDataControl> .ElementFactoryView
                {
                    Titles         = { { 3428323, "QR.Create.Title.QRCode" } },
                    DefaultIds     = { { 3428323, "QRCode" } },
                    Errors         = { { 3428323, "QR.Create.Error.QRCode" } },
                    Messages       = { { 3428323, "QR.Create.Message.QRCode" } },
                    ElementFactory = new DefaultElementFactory <QRCodeDataControl>(
                        new DefaultElementFactory <QRCodeDataControl> .ElementCreator()
                    {
                        CreateDataControl = qr => new QRCodeDataControl(qr as QR),
                        CreateElement     = (type, id, _) => new QRCodeDataControl(new QR(id)),
                        TypeDescriptors   = new[]
                        {
                            new DefaultElementFactory <QRCodeDataControl> .ElementCreator.TypeDescriptor
                            {
                                Type        = 3428323,
                                ContentType = typeof(QR),
                                RequiresId  = true
                            }
                        }
                    })
                });
                Controller.Instance.SelectedChapterDataControl.RegisterExtraDataControl(qrCodes);
                SelectedQRCode = -1;


                lastSelectedChapterDataControl = Controller.Instance.SelectedChapterDataControl;
                Controller.Instance.updateVarFlagSummary();
            }
        }
コード例 #7
0
    /**
     * Moves the selected chapter to the previous position of the chapter's
     * list.
     */
    public bool moveChapterUp(int index)
    {
        // If the chapter can be moved
        if (index > 0)
        {
            // Move the chapter and update the selected chapter
            Chapter c = chapters[index];
            chapters.RemoveAt(index);
            chapters.Insert(index - 1, c);
            // Move the chapter and update the selected chapter
            ChapterDataControl con = chapterDataControlList[index];
            chapterDataControlList.RemoveAt(index);
            chapterDataControlList.Insert(index - 1, con);

            ChapterToolManager man = chapterToolManagers[index];
            chapterToolManagers.RemoveAt(index);
            chapterToolManagers.Insert(index - 1, man);

            setSelectedChapterInternal(index - 1);
            return(true);
        }
        return(false);
    }
コード例 #8
0
ファイル: GeoController.cs プロジェクト: merchf/JS-uAdventure
        private void UpdateChapter()
        {
            if (Controller.Instance.SelectedChapterDataControl != null && lastSelectedChapterDataControl != Controller.Instance.SelectedChapterDataControl)
            {
                // Map scenes list manages only map scenes
                mapScenes = new ListDataControl <ChapterDataControl, MapSceneDataControl>(
                    Controller.Instance.SelectedChapterDataControl,
                    Controller.Instance.SelectedChapterDataControl.getObjects <MapScene>(),
                    new ListDataControl <ChapterDataControl, MapSceneDataControl> .ElementFactoryView
                {
                    Titles         = { { 8923478, "Geo.Create.Title.MapScene" } },
                    DefaultIds     = { { 8923478, "MapScene" } },
                    Errors         = { { 8923478, "Geo.Create.Error.MapScene" } },
                    Messages       = { { 8923478, "Geo.Create.Message.MapScene" } },
                    ElementFactory = new DefaultElementFactory <MapSceneDataControl>(
                        new DefaultElementFactory <MapSceneDataControl> .ElementCreator()
                    {
                        CreateDataControl = ms => new MapSceneDataControl(ms as MapScene),
                        CreateElement     = (type, id, _) => new MapSceneDataControl(new MapScene(id)),
                        TypeDescriptors   = new[]
                        {
                            new DefaultElementFactory <MapSceneDataControl> .ElementCreator.TypeDescriptor
                            {
                                Type        = 8923478,
                                ContentType = typeof(MapScene),
                                RequiresId  = true
                            }
                        }
                    })
                });
                Controller.Instance.SelectedChapterDataControl.RegisterExtraDataControl(mapScenes);
                SelectedMapScene = -1;

                // Geo Elements list manages only geo elements
                geoElements = new ListDataControl <ChapterDataControl, GeoElementDataControl>(
                    Controller.Instance.SelectedChapterDataControl,
                    Controller.Instance.SelectedChapterDataControl.getObjects <GeoElement>(),
                    new ListDataControl <ChapterDataControl, GeoElementDataControl> .ElementFactoryView
                {
                    Titles         = { { 6493512, "Geo.Create.Title.GeoElement" } },
                    DefaultIds     = { { 6493512, "GeoElement" } },
                    Errors         = { { 6493512, "Geo.Create.Error.GeoElement" } },
                    Messages       = { { 6493512, "Geo.Create.Message.GeoElement" } },
                    ElementFactory = new DefaultElementFactory <GeoElementDataControl>(
                        new DefaultElementFactory <GeoElementDataControl> .ElementCreator()
                    {
                        CreateDataControl = g => new GeoElementDataControl(g as GeoElement),
                        CreateElement     = (type, id, extra) =>
                        {
                            var geoElement = new GeoElement(id);
                            var place      = extra[0] as SearchData;
                            if (place != null)
                            {
                                geoElement.Geometries[0].Type   = GMLGeometry.GeometryType.Polygon;
                                geoElement.Geometries[0].Points = place.boundingBox.ToPoints().Select(p => new Vector2d(p.y, p.x)).ToArray();
                            }
                            return(new GeoElementDataControl(geoElement));
                        },
                        TypeDescriptors = new[]
                        {
                            new DefaultElementFactory <GeoElementDataControl> .ElementCreator.TypeDescriptor
                            {
                                Type            = 6493512,
                                ContentType     = typeof(GeoElement),
                                RequiresId      = true,
                                ExtraParameters = new Action <Action <object> > []
                                {
                                    callback => { ScriptableObject.CreateInstance <PlaceInputDialog>().Init(sd => callback(sd)); }
                                }
                            }
                        }
                    })
                });

                Controller.Instance.SelectedChapterDataControl.RegisterExtraDataControl(geoElements);
                SelectedGeoElement = -1;

                lastSelectedChapterDataControl = Controller.Instance.SelectedChapterDataControl;
                Controller.Instance.updateVarFlagSummary();
            }
        }