Ejemplo n.º 1
0
 public void OnRow_PutChildAtBottom()
 {
     _root.WithProp(PropFactory.Row());
     _root.WithProp(PropFactory.ItemBase());
     ApplyProps(_root);
     Assert.That(_child.Space, Is.EqualTo(new RectangleF(0, 700, 20, 20)));
 }
Ejemplo n.º 2
0
        public static void CreateWoodenBuilding(int xPos, int yPos, int xLength, int yLength)
        {
            for (int y = 0; y <= 1; y++)
            {
                for (int x = 0; x < xLength; x++)
                {
                    map.AddObjectAt(PropFactory.CreateWoodWall(), xPos + x, yPos + ((yLength - 1) * y));
                }
            }

            for (int x = 0; x <= 1; x++)
            {
                for (int y = 1; y < yLength - 1; y++)
                {
                    map.AddObjectAt(PropFactory.CreateWoodWall(), xPos + ((xLength - 1) * x), yPos + y);
                }
            }

            for (int x = 0; x < xLength; x++)
            {
                for (int y = 0; y < yLength; y++)
                {
                    map.GetBlockAt(x + xPos, y + yPos).TerrainList[0] = new Terrain("wood_floor_bmp");
                }
            }
        }
Ejemplo n.º 3
0
        public void MultipleItemsInColumn_AtTheBottom()
        {
            var e  = new RectangleF(0, 40, 120, 120);
            var e1 = new RectangleF(0, 160, 220, 120);
            var e2 = new RectangleF(0, 280, 120, 320);
            var e3 = new RectangleF(0, 600, 120, 120);

            var c  = WidgetFactory.Container(new RectangleF(0, 0, 120, 120));
            var c1 = WidgetFactory.Container(new RectangleF(0, 0, 220, 120));
            var c2 = WidgetFactory.Container(new RectangleF(0, 0, 120, 320));
            var c3 = WidgetFactory.Container(new RectangleF(0, 0, 120, 120));

            _root.AddChild(c);
            _root.AddChild(c1);
            _root.AddChild(c2);
            _root.AddChild(c3);
            _root.WithProp(PropFactory.Column());
            _root.WithProp(_justifyEnd);

            ApplyProps(_root);
            Assert.That(c.Space, Is.EqualTo(e));
            Assert.That(c1.Space, Is.EqualTo(e1));
            Assert.That(c2.Space, Is.EqualTo(e2));
            Assert.That(c3.Space, Is.EqualTo(e3));
        }
        public void cleanup()
        {
            //Cleanup slide trash
            CleanupInfo cleanupInfo = new CleanupInfo();

            slideshow.cleanup(cleanupInfo, ResourceProvider);

            undoBuffer.clear(); //Can't really recover from this one, so just erase all undo
            List <Guid> cleanupSlides = new List <Guid>(projectGuidDirectories());

            foreach (Slide slide in slideshow.Slides)
            {
                Guid guid;
                if (Guid.TryParse(slide.UniqueName, out guid))
                {
                    cleanupSlides.Remove(guid);
                }
                foreach (String file in ResourceProvider.listFiles("*", slide.UniqueName, true))
                {
                    if (!cleanupInfo.isClaimed(file))
                    {
                        try
                        {
                            editorController.ResourceProvider.delete(file);
                        }
                        catch (Exception ex)
                        {
                            Logging.Log.Error("Cleanup -- Failed to delete file '{0}'. Reason: {1}", file, ex.Message);
                        }
                    }
                }
            }
            foreach (Guid dir in cleanupSlides)
            {
                try
                {
                    editorController.ResourceProvider.delete(dir.ToString("D"));
                }
                catch (Exception ex)
                {
                    Logging.Log.Error("Cleanup -- Failed to delete directory '{0}'. Reason: {1}", dir, ex.Message);
                }
            }

            PropFactory   propFactory = standaloneController.PropFactory;
            DDAtlasPlugin plugin;

            using (Stream pluginFileStream = editorController.ResourceProvider.openFile("Plugin.ddp"))
            {
                plugin = SharedXmlSaver.Load <DDAtlasPlugin>(pluginFileStream);
            }
            plugin.setDependencyIds(cleanupInfo.getObjects <String>(ShowPropAction.PropClass)
                                    .Select(n => propFactory.getDependencyIdForProp(n))
                                    .Where(id => id.HasValue)
                                    .Select(id => id.Value));
            using (Stream pluginFileStream = editorController.ResourceProvider.openWriteStream("Plugin.ddp"))
            {
                SharedXmlSaver.Save(plugin, pluginFileStream);
            }
        }
Ejemplo n.º 5
0
        public void BottomRightMargin_OnFirstWidgetFirstRow() //todo last test
        {
            var w2Expected = new RectangleF(255, 0, 1000, 120);
            var w3Expected = new RectangleF(25, 130, 220, 120);

            _root = new Widget(new RectangleF(0, 0, 1280, 720));
            IWidget w1 = new Widget(new RectangleF(Vector2.Zero, new Vector2(220, 120)));

            _root.AddChild(w1);

            ((IApplicableProp)PropFactory.Margin(0, 10, 0, 10)).ApplyOn(w1);

            IWidget w2 = new Widget(new RectangleF(Vector2.Zero, new Vector2(1000, 120)));

            _root.AddChild(w2);

            IWidget w3 = new Widget(new RectangleF(Vector2.Zero, new Vector2(220, 120)));

            _root.AddChild(w3);
            _root.AddChild(WidgetFactory.Container(new RectangleF(Vector2.Zero, new Vector2(220, 120))));

            _root.WithProp(PropFactory.Row());
            _root.WithProp(PropFactory.JustifyCenter());

            ApplyProps(_root);

            Assert.That(w2.Space, Is.EqualTo(w2Expected));
            Assert.That(w3.Space, Is.EqualTo(w3Expected));
        }
Ejemplo n.º 6
0
        public void MultipleMargins_OnFirstWidgetSecondRow()
        {
            var w2Expected = new RectangleF(40, 130, 220, 120);
            var w3Expected = new RectangleF(260, 120, 220, 120);

            var margin = PropFactory.Margin(10, 0, 10, 0);

            _root = new Widget(new RectangleF(0, 0, 1280, 720));
            _root.AddChild(new Widget(new RectangleF(Vector2.Zero, new Vector2(1220, 120))));

            IWidget w2 = new Widget(new RectangleF(Vector2.Zero, new Vector2(220, 120)));
            var     w3 = new Widget(new RectangleF(Vector2.Zero, new Vector2(220, 120)));

            _root.AddChild(w2);
            _root.AddChild(w3);

            ((IApplicableProp)margin).ApplyOn(w2);

            _root.WithProp(PropFactory.Row());
            _root.WithProp(PropFactory.JustifyCenter());

            ApplyProps(_root);

            Assert.That(w2.Space, Is.EqualTo(w2Expected));
            Assert.That(w3.Space, Is.EqualTo(w3Expected));
        }
Ejemplo n.º 7
0
        public void RowWithFourW_MaximizesSpaceBetween()
        {
            var child  = WidgetFactory.Container(new RectangleF(0, 0, 130, 120));
            var child1 = WidgetFactory.Container(new RectangleF(0, 0, 120, 110));
            var child2 = WidgetFactory.Container(new RectangleF(0, 0, 200, 200));
            var child3 = WidgetFactory.Container(new RectangleF(0, 0, 90, 110));

            _root.AddChild(child);
            _root.AddChild(child1);
            _root.AddChild(child2);
            _root.AddChild(child3);
            _root.WithProp(PropFactory.Row());
            _root.WithProp(_justifyBetween);

            ApplyProps(_root);

            var exp  = new RectangleF(0, 0, 130, 120);
            var exp1 = new RectangleF(377, 0, 120, 110);
            var exp2 = new RectangleF(743, 0, 200, 200);
            var exp3 = new RectangleF(1190, 0, 90, 110);

            Assert.That(child.Space, Is.EqualTo(exp));
            Assert.That(child1.Space, Is.EqualTo(exp1));
            Assert.That(child2.Space, Is.EqualTo(exp2));
            Assert.That(child3.Space, Is.EqualTo(exp3));
        }
Ejemplo n.º 8
0
 public void OnCol_PutChildAtRight()
 {
     _root.WithProp(PropFactory.Column());
     _root.WithProp(PropFactory.ItemBase());
     ApplyProps(_root);
     Assert.That(_child.Space, Is.EqualTo(new RectangleF(1260, 0, 20, 20)));
 }
Ejemplo n.º 9
0
 public void OnColWithJustifyEnd_PutsInLowerRightCorner()
 {
     _root.WithProp(PropFactory.Column());
     _root.WithProp(PropFactory.JustifyEnd());
     _root.WithProp(PropFactory.ItemBase());
     ApplyProps(_root);
     Assert.That(_child.Space, Is.EqualTo(new RectangleF(1260, 700, 20, 20)));
 }
Ejemplo n.º 10
0
        public void VerticalStretch_OnContainer_HeightAsBigAsParent()
        {
            IWidget c = WidgetFactory.Container(100, 120);

            _root !.AddChild(c);
            c.WithProp(PropFactory.VerticalStretch());
            TreeVisitor.ApplyPropsOnTree(_root);
            Assert.That(c.Space, Is.EqualTo(new RectangleF(0, 0, 100, 402)));
        }
Ejemplo n.º 11
0
        public void HorizontalStretch_OnContainer_WidthAsBigAsParent()
        {
            IWidget c = WidgetFactory.Container(100, 120);

            _root !.AddChild(c);
            c.WithProp(PropFactory.HorizontalStretch());
            ApplyProps(c);
            Assert.That(c.Space, Is.EqualTo(new RectangleF(0, 0, 400, 120)));
        }
Ejemplo n.º 12
0
        public void OnACenteredRow_CentersCorrectly()
        {
            var c = WidgetFactory.Container(20, 20);

            _root.AddChild(c);
            ApplyRow();
            ((IApplicableProp)PropFactory.JustifyCenter()).ApplyOn(_root);
            _itemCenter.ApplyOn(_root);
            Assert.That(c.Space, Is.EqualTo(new RectangleF(630, 350, 20, 20)));
        }
Ejemplo n.º 13
0
        public void ApplyOn_OneWidget_TotalSpaceOccupiedIsUpdatedWithMargin()
        {
            IApplicableProp margin = (IApplicableProp)PropFactory.Margin(3);

            var expected = new RectangleF(0, 0, 126, 126);

            margin.ApplyOn(_widget);

            Assert.That(_widget.TotalSpaceOccupied, Is.EqualTo(expected));
        }
Ejemplo n.º 14
0
 void Start(){
     SSDirector director = SSDirector.GetInstance();
     director.CurrentScenceController = this;
     patrol_factory = Singleton<PropFactory>.Instance;
     action_manager = gameObject.AddComponent<PatrolActionManager>() as PatrolActionManager;
     LoadResources();
     main_camera.GetComponent<CameraFlow>().follow = player;
     recorder = Singleton<ScoreRecorder>.Instance;
     player_speed *= 0.01f;
 }
Ejemplo n.º 15
0
        public void ApplyOn_3MarginWidgetInRow_SpaceOf3FromBorders()
        {
            var margin = PropFactory.Margin(3);

            var expected = new RectangleF(3, 3, 120, 120);

            ((IApplicableProp)margin).ApplyOn(_widget);

            Assert.That(_widget.Space, Is.EqualTo(expected));
        }
Ejemplo n.º 16
0
 public PropTimelineView(String name, PropEditController propEditController, PropFactory propFactory)
     : base(name)
 {
     ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Top)
     {
         AllowedDockLocations = DockLocation.Top | DockLocation.Bottom | DockLocation.Floating
     };
     this.PropEditController = propEditController;
     this.PropFactory        = propFactory;
 }
Ejemplo n.º 17
0
    void Start()
    {
        wall_sign = 1;
        SSDirector director = SSDirector.GetInstance();

        director.CurrentSceneController = this;
        patrol_factory = Singleton <PropFactory> .Instance;
        action_manager = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
        recorder = Singleton <ScoreRecorder> .Instance;
    }
Ejemplo n.º 18
0
    public void LoadResources()
    {
        Map map = new Map();

        map.LoadMap();
        player = Instantiate(Resources.Load <GameObject>("Prefabs/Player"));
        player.transform.position = new Vector3(3.5f, 0, -2.5f);
        props = PropFactory.GetInstance().GetProps();
        actionManager.player = player;
        actionManager.props  = props;
    }
    void Awake()
    {
        SSDirector director = SSDirector.GetInstance();

        director.CurrentScenceController = this;
        patrol_factory = Singleton <PropFactory> .Instance;
        action_manager = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
        //main_camera.GetComponent<CameraHelpness>().follow = player;
        recorder = Singleton <ScoreRecorder> .Instance;
    }
Ejemplo n.º 20
0
        public void ApplyOn_RowOfWidgets_OffsetsRowNotInternally()
        {
            var marginWidgetExpected = new RectangleF(10, 10, 120, 120);
            var secondWidgetExpected = new RectangleF(130, 10, 120, 120);

            var margin = PropFactory.Margin(10);

            ((IApplicableProp)margin).ApplyOn(_root);
            ((IApplicableProp)PropFactory.Row()).ApplyOn(_root);
            Assert.That(_widget.Space, Is.EqualTo(marginWidgetExpected));
            Assert.That(_secondWidget.Space, Is.EqualTo(secondWidgetExpected));
        }
Ejemplo n.º 21
0
        public void MarginLeft_MovesWidgetsInRow()
        {
            var marginWidgetExpected = new RectangleF(10, 0, 120, 120);
            var secondWidgetExpected = new RectangleF(130, 0, 120, 120);

            var margin = PropFactory.MarginLeft(10);

            ((IApplicableProp)margin).ApplyOn(_widget);
            ((IApplicableProp)PropFactory.Row()).ApplyOn(_root);
            Assert.That(_widget.Space, Is.EqualTo(marginWidgetExpected));
            Assert.That(_secondWidget.Space, Is.EqualTo(secondWidgetExpected));
        }
Ejemplo n.º 22
0
        public void OnRowWithJustifyEndTwoWidgets_DoesNotFuckItUp()
        {
            var c1 = WidgetFactory.Container(30, 40);

            _root.AddChild(c1);
            _root.WithProp(PropFactory.Row());
            _root.WithProp(PropFactory.JustifyEnd());
            _root.WithProp(PropFactory.ItemBase());
            ApplyProps(_root);
            Assert.That(_child.Space, Is.EqualTo(new RectangleF(1230, 700, 20, 20)));
            Assert.That(c1.Space, Is.EqualTo(new RectangleF(1250, 680, 30, 40)));
        }
Ejemplo n.º 23
0
        public void VerticalStretch_OnColWithSiblings_AsBigAsCanBeRespectingSiblings()
        {
            IWidget c = WidgetFactory.Container();

            _root !.AddChild(c);
            _root.WithProp(new Column());
            c.WithProp(PropFactory.VerticalStretch());
            IWidget c1 = WidgetFactory.Container(100, 120);

            _root !.AddChild(c1);
            TreeVisitor.ApplyPropsOnTree(_root);
            Assert.That(c.Space, Is.EqualTo(new RectangleF(0, 0, 0, 282)));
        }
Ejemplo n.º 24
0
        public void ApplyOn_WidgetInRow_SeparatesFromOtherWidget()
        {
            var marginWidgetExpected = new RectangleF(10, 10, 120, 120);
            var secondWidgetExpected = new RectangleF(140, 0, 120, 120);

            var margin = PropFactory.Margin(10);

            ((IApplicableProp)margin).ApplyOn(_widget);

            ((IApplicableProp)PropFactory.Row()).ApplyOn(_root);
            Assert.That(_widget.Space, Is.EqualTo(marginWidgetExpected));
            Assert.That(_secondWidget.Space, Is.EqualTo(secondWidgetExpected));
        }
Ejemplo n.º 25
0
        public void FlexContainerWithSize_IgnoresSizeAndStartsFromZero()
        {
            _root = WidgetFactory.Container(400, 300);
            _root.AddChild(WidgetFactory.Container(new RectangleF(0, 0, 120, 60)));
            _root.AddChild(WidgetFactory.Container(new RectangleF(0, 0, 120, 90)));

            _root.WithProp(PropFactory.Flex());
            ApplyRow();

            var expected = new RectangleF(0, 0, 240, 90);

            Assert.That(_root.Space, Is.EqualTo(expected));
        }
Ejemplo n.º 26
0
 void Restart()
 {
     player.GetComponent <Animator>().Play("New State");
     player.transform.position = new Vector3(3.5f, 0, -2.5f);
     player.transform.rotation = Quaternion.Euler(0, 0, 0);
     PropFactory.GetInstance().ResetAll();
     foreach (var each in props)
     {
         each.Value.GetComponent <Animator>().SetBool("run", true);
     }
     SetPlayerArea(5);
     actionManager.StartAll();
 }
Ejemplo n.º 27
0
        public void ColWithOneChild_PutsAtCenter()
        {
            var child = WidgetFactory.Container(new RectangleF(0, 0, 130, 120));

            _root.AddChild(child);
            _root.WithProp(PropFactory.Column());
            _root.WithProp(_justifyAround);

            ApplyProps(_root);
            var expected = new RectangleF(0, 300, 130, 120);

            Assert.That(child.Space, Is.EqualTo(expected));
        }
Ejemplo n.º 28
0
    void Start()
    {
        SSDirector director = SSDirector.getInstance();

        director.currentScenceController = this;
        PF             = Singleton <PropFactory> .Instance;
        recorder       = Singleton <ScoreRecorder> .Instance;
        action_manager = gameObject.AddComponent <PropActionManager>() as PropActionManager;
        LoadResources();

        /*if(main_camera == null)
         *  Debug.Log("333");*/
        main_camera.GetComponent <CameraFollow>().player = player;
    }
Ejemplo n.º 29
0
        public void RowWithOneChild_NothingHappens()
        {
            var child = WidgetFactory.Container(new RectangleF(0, 0, 130, 120));

            _root.AddChild(child);

            _root.WithProp(PropFactory.Row());
            _root.WithProp(_justifyBetween);

            ApplyProps(_root);
            var expected = new RectangleF(0, 0, 130, 120);

            Assert.That(child.Space, Is.EqualTo(expected));
        }
Ejemplo n.º 30
0
        public void OneChildInAColumn_PutsItOnTheBottom()
        {
            var child = WidgetFactory.Container(new RectangleF(0, 0, 220, 120));

            _root.AddChild(child);

            _root.WithProp(PropFactory.Column());
            _root.WithProp(_justifyEnd);
            ApplyProps(_root);

            var expected = new RectangleF(0, 600, 220, 120);

            Assert.That(child.Space, Is.EqualTo(expected));
        }