// обработчик события создания точки модели private void Model_PointCreated(CMShape shape, CMPoint point) { // создание вида для очередной точки const string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789"; string pointName = letters[pointViewDict.Count].ToString(); CVPoint pointView = CVPoint.Create(pointName, point, pointsObj, nextPointsPos.Dequeue()); pointView.MouseDown += PointView_MouseDown; pointViewDict.Add(point.Id, pointView); }
public override void Do() { if (IsDone) { throw new Exception("CCreatePointAction already was done (point id: " + CreatedPointView.Model.Id + ")"); } Owner.nextPointsPos.Enqueue(pointPos); // добавление позиции точки в очередь CMPoint point = Owner.model.CreatePoint(); // !! вид для точки создается в обработчике события CMShape.PointCreated CreatedPointView = Owner.pointViewDict[point.Id]; // получаем созданный вид точки }
private CVPoint Init(string name, CMPoint pointModel, Transform parent, Vector3 localPos) { Model = pointModel; transform.parent = parent; transform.localScale = Vector3.one * 0.12f; transform.localRotation = Quaternion.identity; transform.GetComponent <SphereCollider>().radius = 1; Position = localPos; label = CVLabel.Create(transform, name); this.name = "point " + Name; return(this); }
public static CVPoint Create(string name, CMPoint pointModel, Transform parent, Vector3 localPos) { return(GameObject.CreatePrimitive(PrimitiveType.Sphere) .AddComponent <CVPoint>() .Init(name, pointModel, parent, localPos)); }