コード例 #1
0
        public override bool addElement(int type, string id)
        {
            bool elementAdded = false;

            if (type == Controller.EXIT)
            {
                string[] generalScenes = controller.getIdentifierSummary().groupIds <IChapterTarget> ();

                if (generalScenes.Length > 0)
                {
                    string selectedScene = id;
                    if (selectedScene != null)
                    {
                        Exit newExit = new Exit(true, 240, 240, 100, 100);
                        newExit.setNextSceneId(selectedScene);
                        ExitDataControl newExitDataControl = new ExitDataControl(sceneDataControl, newExit);

                        exitsList.Add(newExit);
                        exitsDataControlList.Add(newExitDataControl);
                        elementAdded = true;
                    }
                }
            }

            return(elementAdded);
        }
コード例 #2
0
        private void performAddExit(object sender, string target)
        {
            Exit newExit = new Exit(true, 240, 240, 100, 100);

            newExit.setDestinyScale(1f);
            newExit.setNextSceneId(target);
            ExitDataControl newExitDataControl = new ExitDataControl(sceneDataControl, newExit);

            exitsList.Add(newExit);
            exitsDataControlList.Add(newExitDataControl);
        }
コード例 #3
0
            private void DrawExit(SceneDataControl scene, ExitDataControl exit)
            {
                var scenes = Controller.Instance.SelectedChapterDataControl.getScenesList();
                var index  = scenes.getSceneIndexByID(exit.getNextSceneId());

                // If the exit points to a cutscene it normally is out of the array
                if (index < 0 || index > scenes.getScenes().Count)
                {
                    return;
                }

                var polygon = AdaptToViewport(GetExitArea(scene, exit), space);

                if (polygon == null || polygon.Length == 0)
                {
                    // If the exit is empty use the scene center itself to prevent errors
                    polygon = new [] { AdaptToViewport(GetSceneRect(scene), space).center };
                }

                var c = sceneColors[scene.getId()];

                c = new Color(c.r, c.g, c.b, 0.8f);
                HandleUtil.DrawPolygon(polygon, c);

                var nextScene = scenes.getScenes()[index];
                var sceneRect = AdaptToViewport(GetSceneRect(nextScene), space);

                Vector2 origin = polygon.Center(), destination;

                if (exit.hasDestinyPosition())
                {
                    destination   = new Vector2(exit.getDestinyPositionX(), exit.getDestinyPositionY());
                    destination.x = sceneRect.x + (destination.x / sizes[nextScene.getPreviewBackground()].x) * sceneRect.width;
                    destination.y = sceneRect.y + (destination.y / sizes[nextScene.getPreviewBackground()].y) * sceneRect.height;
                }
                else
                {
                    destination = sceneRect.ToPoints().Center();
                }

                HandleUtil.DrawPolyLine(new [] { origin, destination }, false, sceneColors[scene.getId()], 4);

                DrawArrowCap(destination, (destination - origin), 15f);
            }
コード例 #4
0
        public override bool moveElementDown(DataControl dataControl)
        {
            bool elementMoved = false;
            int  elementIndex = exitsList.IndexOf((Exit)dataControl.getContent());

            if (elementIndex < exitsList.Count - 1)
            {
                Exit            o = exitsList[elementIndex];
                ExitDataControl c = exitsDataControlList[elementIndex];
                exitsList.RemoveAt(elementIndex);
                exitsDataControlList.RemoveAt(elementIndex);
                exitsList.Insert(elementIndex + 1, o);
                exitsDataControlList.Insert(elementIndex + 1, c);
                controller.DataModified();
                elementMoved = true;
            }

            return(elementMoved);
        }
コード例 #5
0
            private Vector2[] GetExitArea(SceneDataControl scene, ExitDataControl exit, bool layoutCall)
            {
                var holder = GetSceneRect(scene, layoutCall);
                var xRatio = holder.width / images[scene.getPreviewBackground()].width;
                var yRatio = holder.height / images[scene.getPreviewBackground()].height;

                Vector2[] polygon   = null;
                var       rectangle = exit.getRectangle();

                if (rectangle.isRectangular())
                {
                    polygon = new Rect(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight()).ToPoints();
                }
                else
                {
                    polygon = rectangle.getPoints().ToArray();
                }

                return(polygon.ToList().ConvertAll(p => (new Vector2(p.x * xRatio, p.y * yRatio) + holder.position)).ToArray());
            }
コード例 #6
0
 private Vector2[] GetExitArea(SceneDataControl scene, ExitDataControl exit)
 {
     return(GetExitArea(scene, exit, false));
 }