Пример #1
0
        private void Clear()
        {
            ClearMyShapeDatas();

            foreach (PointData pointData in m_Points)
            {
                pointData.NameUpdated.Unsubscribe(NameUpdated);
                ShapeDataFactory.RemoveShapeData(pointData);
            }

            m_Points.Clear();

            foreach (LineData lineData in m_Lines)
            {
                ShapeDataFactory.RemoveShapeData(lineData);
            }

            m_Lines.Clear();

            foreach (PolygonData polygonData in m_Polygons)
            {
                ShapeDataFactory.RemoveShapeData(polygonData);
            }

            m_Polygons.Clear();
        }
Пример #2
0
        public TetrahedronBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            for (int i = 0; i < m_Points.Length; i++)
            {
                m_Points[i] = dataFactory.CreatePointData();
                m_Points[i].NameUpdated.Subscribe(NameUpdated);
            }

            for (int i = 0; i < m_Lines.Length; i++)
            {
                m_Lines[i] = dataFactory.CreateLineData();
            }

            for (int i = 0; i < m_Polygons.Length; i++)
            {
                m_Polygons[i] = dataFactory.CreatePolygonData();
            }

            ConstructLines();
            ConstructPolygons();

            m_CompositeShapeData = dataFactory.CreateCompositeShapeData();

            m_CompositeShapeData.SetPoints(m_Points);
            m_CompositeShapeData.SetLines(m_Lines);
            m_CompositeShapeData.SetPolygons(m_Polygons);

            OnDeserialized();
        }
Пример #3
0
        public CubeBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            for (int i = 0; i < m_Points.Length; i++)
            {
                m_Points[i] = dataFactory.CreatePointData();
                m_Points[i].NameUpdated.Subscribe(NameUpdated);
            }
            for (int i = 0; i < m_Lines.Length; i++)
            {
                m_Lines[i] = dataFactory.CreateLineData();
            }
            for (int i = 0; i < m_Polygons.Length; i++)
            {
                m_Polygons[i] = dataFactory.CreatePolygonData();
                m_Polygons[i].SetPointsCount(4); // By default polygon has 3 points, we need 4
            }

            ConstructLines();
            ConstructPolygons();

            m_CompositeShapeData = dataFactory.CreateCompositeShapeData();

            m_CompositeShapeData.SetPoints(m_Points);
            m_CompositeShapeData.SetLines(m_Lines);
            m_CompositeShapeData.SetPolygons(m_Polygons);

            OnDeserialized();
        }
Пример #4
0
 private void ApplyDefaultState(ShapeDataFactory shapeDataFactory)
 {
     foreach (ShapeData shapeData in shapeDataFactory.AllDatas)
     {
         shapeData.View.Active    = m_DefaultActiveState;
         shapeData.View.Highlight = m_DefaultHighlightType;
     }
 }
Пример #5
0
 public void SetShapeDataFactory(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
     foreach (ShapeAction shapeAction in m_ShapeActions)
     {
         shapeAction.SetShapeDataFactory(m_ShapeDataFactory);
     }
 }
Пример #6
0
 public void SetShapeDataFactory(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
     foreach (ShapeBlueprint shapeBlueprint in m_ShapeBlueprints)
     {
         shapeBlueprint.SetShapeDataFactory(shapeDataFactory);
     }
 }
Пример #7
0
        public PointOfIntersectionBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            PointData = ShapeDataFactory.CreatePointData();

            m_PointsOnLines[0] = new PointData[2];
            m_PointsOnLines[1] = new PointData[2];

            OnDeserialized();
        }
Пример #8
0
        public void SetShapeDataFactory(ShapeDataFactory shapeDataFactory)
        {
            m_ShapeDataFactory = shapeDataFactory;

            ViewFactory.CollectLostViews();
            ViewFactory.Dispose();
            m_ShapeDataFactory.SetViewFactory(ViewFactory);

            m_LastOrigin = Vector3.positiveInfinity;
        }
Пример #9
0
        public LessonData()
        {
            m_ShapeDataFactory      = new ShapeDataFactory();
            m_ShapeBlueprintFactory = new ShapeBlueprintFactory(m_ShapeDataFactory);

            m_ShapeActionFactory = new ShapeActionFactory(m_ShapeDataFactory);
            m_LessonStageFactory = new LessonStageFactory(m_ShapeActionFactory);

            OnDeserialized();
        }
Пример #10
0
        private void ConstructPrism()
        {
            UpdateVerticesPositionsList();

            for (int i = 0; i < 2 * m_VerticesAtTheBaseCount; i++)
            {
                m_Points.Add(ShapeDataFactory.CreatePointData());
                m_Points[i].NameUpdated.Subscribe(NameUpdated);
            }

            for (int i = 0; i < 3 * m_VerticesAtTheBaseCount; i++)
            {
                m_Lines.Add(ShapeDataFactory.CreateLineData());
            }

            for (int i = 0; i < m_VerticesAtTheBaseCount + 2; i++)
            {
                m_Polygons.Add(ShapeDataFactory.CreatePolygonData());
                // Side faces
                if (i < m_VerticesAtTheBaseCount)
                {
                    m_Polygons[i].SetPointsCount(4);
                }
                // Top and Bottom faces
                else
                {
                    m_Polygons[i].SetPointsCount(m_VerticesAtTheBaseCount);
                }
            }

            ConstructLines();
            ConstructPolygons();

            m_CompositeShapeData.SetPoints(m_Points.ToArray());
            m_CompositeShapeData.SetLines(m_Lines.ToArray());
            m_CompositeShapeData.SetPolygons(m_Polygons.ToArray());

            foreach (ShapeData shapeData in
                     new[] { m_CompositeShapeData }.Cast <ShapeData>()
                     .Concat(m_Points)
                     .Concat(m_Lines)
                     .Concat(m_Polygons))
            {
                AddToMyShapeDatas(shapeData);
            }
        }
Пример #11
0
        public ChoseShapeDataField(ShapeDataFactory shapeDataFactory, CanDependOnShapeBlueprint dependent,
                                   string fieldName, Func <TShapeData> getShapeDataFunc, Action <TShapeData> setShapeDataFunc)
        {
            m_DataFactory      = shapeDataFactory;
            m_Dependent        = dependent;
            m_FieldName        = fieldName;
            m_GetShapeDataFunc = getShapeDataFunc;
            m_SetShapeDataFunc = setShapeDataFunc;

            VisualElement firstRow = new VisualElement {
                style = { flexDirection = FlexDirection.Row }
            };

            firstRow.Add(m_Label = new Label());

            m_ToolbarMenu = new ToolbarMenu {
                text = "Change", style = { flexDirection = FlexDirection.Row }
            };
            m_ToolbarMenu.RemoveFromClassList("unity-toolbar-menu");
            m_ToolbarMenu.AddToClassList("unity-button");

            firstRow.Add(m_ToolbarMenu);

            Add(firstRow);

            IValidator pointNotEmptyValidator =
                new DataNotEmptyValidator <TShapeData>(getShapeDataFunc, action => m_UpdateValidatorAction = action);
            VisualElement validatorField = new ValidatorField(pointNotEmptyValidator);

            Add(validatorField);

            m_DataFactory.BecameDirty.Subscribe(BecameDirty);
            m_AutoSaveScheduler = schedule.Execute(Update);
            m_AutoSaveScheduler.Every(200);

            UpdateList();
            UpdateName();
            m_UpdateValidatorAction?.Invoke();
        }
Пример #12
0
 protected ShapeAction(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
 }
Пример #13
0
 public PrismBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
 {
     m_CompositeShapeData = dataFactory.CreateCompositeShapeData();
     ConstructPrism();
     OnDeserialized();
 }
        public PointPerpendicularProjectionBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            PointData = ShapeDataFactory.CreatePointData();

            OnDeserialized();
        }
Пример #15
0
 public LineBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
 {
     LineData = dataFactory.CreateLineData();
     OnDeserialized();
 }
Пример #16
0
 public ShapeActionFactory(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
     m_ShapeActions     = new List <ShapeAction>();
 }
 public RegularPyramidBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
 {
     m_CompositeShapeData = dataFactory.CreateCompositeShapeData();
     ConstructPyramid();
     OnDeserialized();
 }
        public PointOnSurfaceBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            PointData = ShapeDataFactory.CreatePointData();

            OnDeserialized();
        }
Пример #19
0
 public void SetShapeDataFactory(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
 }
Пример #20
0
 protected ShapeBlueprint(ShapeDataFactory dataFactory)
 {
     m_ShapeDataFactory = dataFactory;
     GeometryUpdated.Subscribe(UpdateGeometry);
 }
Пример #21
0
 public ShapeBlueprintFactory(ShapeDataFactory shapeDataFactory)
 {
     m_ShapeDataFactory = shapeDataFactory;
     m_ShapeBlueprints  = new List <ShapeBlueprint>();
 }
        public PointProjectionFromPointBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
        {
            PointData = ShapeDataFactory.CreatePointData();

            OnDeserialized();
        }
Пример #23
0
 public SetActiveShapeAction(ShapeDataFactory shapeDataFactory) : base(shapeDataFactory)
 {
 }
Пример #24
0
 public PolygonBlueprint(ShapeDataFactory dataFactory) : base(dataFactory)
 {
     PolygonData = dataFactory.CreatePolygonData();
     OnDeserialized();
 }
 public SetHighlightShapeAction(ShapeDataFactory shapeDataFactory) : base(shapeDataFactory)
 {
 }