Inheritance: BaseInventoryEditor
        public void InsertCollinearWallTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(1, 0), new Point(5, 0));
            blueEditor.InsertWall(new Point(3, 0), new Point(7, 0));
        }
        public void InsertOpeningInNoWall()
        {
            BlueprintEditor blueEditor  = GetInstance();
            Opening         testOpening = new Door(new Point(2, 0));

            blueEditor.InsertOpening(testOpening);
        }
Exemplo n.º 3
0
    public override void InitNodeEditor(Vector2 pos, NodeData.NodeType _type, BlueprintEditor _m_Editor)
    {
        base.InitNodeEditor(pos, _type, _m_Editor);

        // -- ALL EVENTS HAVE AT LEAST ONE OUTPUT
        outputs.Add(new Connector(this, Connector.FlowType.Output));
    }
        public void InsertColumnInWall()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(1, 1), new Point(1, 4));
            blueEditor.InsertColumn(new Point(1, 3));
        }
        public void SetOwnerTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.SetOwner(user3);
            Assert.AreEqual(blueprintTest.Owner, user3);
        }
Exemplo n.º 6
0
    public void SetEditor(BlueprintEditor _in)
    {
        m_Editor = _in;

        knownBlueprints.Clear();

        string[] paths = Directory.GetDirectories("Assets/Blueprints");
        for (int i = 0; i < paths.GetLength(0); i++)
        {
            string bpName = paths[i].Remove(0, 18); // ew #TODO make this not rank, const string paths out and use their length

            Debug.Log("Checking Path : " + paths[i] + "   name : " + bpName);

            Blueprint bp = AssetDatabase.LoadAssetAtPath("Assets/Blueprints/" + bpName + "/" + bpName + ".asset", typeof(Blueprint)) as Blueprint;

            if (bp != null)
            {
                knownBlueprints.Add(bp);

                Debug.Log("Adding BP " + bp);
                Debug.Log("Adding BP name : " + bp.str_Name);
            }
            else
            {
                Debug.Log("Blueprint was null @ " + i);
            }
        }
    }
        public void InsertWallInColumnPlaceBorderTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertColumn(new Point(2, 6));
            blueEditor.InsertWall(new Point(2, 3), new Point(2, 6));
        }
        public void InsertOpeningOutOfRangeTest()
        {
            BlueprintEditor blueEditor  = GetInstance();
            Opening         testOpening = new Door(new Point(50, -3));

            blueEditor.InsertOpening(testOpening);
        }
Exemplo n.º 9
0
    public static void OpenWindow(BlueprintEditor editor, bool creatingAField, BlueprintField currentField)
    {
        var instance = GetWindow <BlueprintEditEditor>();

        instance.editor         = editor;
        instance.creatingAField = creatingAField;
        instance.currentField   = currentField;
    }
        public void RemoveSingleWallBeamsCountTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(0, 0), new Point(5, 0));
            blueEditor.RemoveWall(new Point(0, 0), new Point(5, 0));
            Assert.IsTrue(materials.IsBeamsEmpty());
        }
    //Renders the blueprint editor panel and updates EditorGUILayout and GUILayout components inside the blueprint editor panel
    public static void Render()
    {
        //Render the grid tile texture
        GUI.DrawTextureWithTexCoords(new Rect(0.0f, 0.0f, Screen.width, Screen.height), BlueprintStyleHelper.GetPanelBackgroundTexture(), new Rect(_pan.x, _pan.y, Screen.width * 0.05f, Screen.height * 0.05f));

        //Render the blueprint
        BlueprintEditor.GetBlueprint().Render();
    }
        private BlueprintEditor GetInstance()
        {
            Session session = conn.LogIn("designer3", "12345", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          newInstance      = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            return(newInstance);
        }
        public void ConstructorTest()
        {
            Session session = conn.LogIn("designer3", "12345", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          blueEditor       = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            Assert.IsNotNull(blueEditor);
        }
        public void InsertFirstWallBeamsCountTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(5, 5), new Point(8, 5));
            int expectedResult = 2;
            int actualResult   = materials.BeamsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void InsertOversizedWallBeamsCountTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(0, 0), new Point(12, 0));
            int expectedResult = 4;
            int actualResult   = materials.BeamsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void RemoveUnexistentOpening()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(2, 3), new Point(2, 1));
            blueEditor.RemoveOpening(new Door(new Point(2, 2)));
            int expectedResult = 0;
            int actualResult   = materials.OpeningsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void InsertIntersectedTShapeWallsCount()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(5, 5), new Point(8, 5));
            blueEditor.InsertWall(new Point(8, 2), new Point(8, 7));
            int expectedResult = 3;
            int actualResult   = materials.WallsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void ContinuousWallsInsertedNotMergeTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(0, 0), new Point(3, 0));
            blueEditor.InsertWall(new Point(3, 0), new Point(7, 0));
            int expectedResult = 2;
            int actualResult   = materials.WallsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void InsertNotIntersectedWallsBeamsCount()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(5, 5), new Point(8, 5));
            blueEditor.InsertWall(new Point(5, 3), new Point(8, 3));
            int expectedResult = 4;
            int actualResult   = materials.BeamsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void InsertColumnCorrectly()
        {
            BlueprintEditor blueEditor  = GetInstance();
            Point           columnPoint = new Point(1, 1);

            blueEditor.InsertColumn(columnPoint);
            int expectedResult = 1;
            int actualResult   = materials.GetColumns().Count;

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void GetOpeningTemplatesTest()
        {
            initializerWithData();
            Session session = conn.LogIn("architect", "architect", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          editor           = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);
            ICollection <Template>   templates        = editor.GetTemplates();

            Assert.IsNotNull(templates);
        }
        public void SignBlueprintTest()
        {
            IUserRepository          users            = new UserRepository();
            Session                  session          = conn.LogIn("architect", "architect", users);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          blueEditor       = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            blueEditor.Sign();
            Assert.AreEqual(1, blueprintTest.GetSignatures().Count);
        }
        public void RemoveUnexistentColumn()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(2, 3), new Point(2, 1));
            blueEditor.RemoveColumn(new Point(1, 1));
            int expectedResult = 0;
            int actualResult   = materials.GetColumns().Count;

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void InsertOpeningsTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(0, 0), new Point(3, 0));
            blueEditor.InsertOpening(new Door(new Point(1, 0)));
            blueEditor.InsertOpening(new Door(new Point(2, 0)));
            int expectedResult = 2;
            int actualResult   = materials.OpeningsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void RemoveFromTShapeWallMergeTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(5, 5), new Point(8, 5));
            blueEditor.InsertWall(new Point(8, 3), new Point(8, 7));
            blueEditor.RemoveWall(new Point(5, 5), new Point(8, 5));
            int expectedResult = 1;
            int actualResult   = materials.WallsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void MultipleInsertionsTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertWall(new Point(2, 3), new Point(2, 1));
            blueEditor.InsertWall(new Point(8, 1), new Point(8, 3));
            blueEditor.InsertWall(new Point(10, 1), new Point(10, 3));
            blueEditor.InsertWall(new Point(1, 2), new Point(11, 2));
            int expectedResult = 11;
            int actualResult   = materials.WallsCount();

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void MultipleInsertionsOfColumnTest()
        {
            BlueprintEditor blueEditor = GetInstance();

            blueEditor.InsertColumn(new Point(2, 3));
            blueEditor.InsertColumn(new Point(8, 1));
            blueEditor.InsertColumn(new Point(10, 1));
            blueEditor.InsertColumn(new Point(1, 2));
            int expectedResult = 4;
            int actualResult   = materials.GetColumns().Count;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 28
0
            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                IWindowsFormsEditorService svc = (IWindowsFormsEditorService)
                                                 provider.GetService(typeof(IWindowsFormsEditorService));

                if (svc != null)
                {
                    Blueprint       ActiveParams = (Blueprint)value;
                    BlueprintEditor NewEditor    = new BlueprintEditor(ActiveParams);
                    NewEditor.ShowDialog();
                    value = NewEditor.ActiveBlueprint;
                }
                return(value);
            }
        public void InsertFirstWallTest()
        {
            BlueprintEditor blueEditor = GetInstance();
            Wall            testWall   = new Wall(new Point(5, 5), new Point(8, 5));

            blueEditor.InsertWall(new Point(5, 5), new Point(8, 5));
            ICollection <Wall> actualWallCollection = materials.GetWalls();
            IEnumerator <Wall> itr = actualWallCollection.GetEnumerator();

            itr.MoveNext();
            Wall actualResultWall = (Wall)itr.Current;

            Assert.AreEqual(testWall, actualResultWall);
        }
Exemplo n.º 30
0
    //Renders the blueprint editor footer and updates EditorGUILayout and GUILayout components inside the blueprint editor footer
    public static void Render()
    {
        //Begin area for drawing the blueprint editor footer
        GUILayout.BeginArea(new Rect(Screen.width * 0.5f - 100.0f, Screen.height - 52.0f, Screen.width * 0.5f + 100.0f, 52.0f));

        //If the developer presses the close blueprint button
        if (GUILayout.Button("Close Blueprint", GUILayout.Width(200.0f), GUILayout.Height(30.0f)))
        {
            //Close the blueprint
            BlueprintEditor.CloseBlueprint();
        }

        //End area for drawing the blueprint editor footer
        GUILayout.EndArea();
    }