private void Initialize() { if (_textControlGraphic == null) { _textControlGraphic = InitializeTextControlGraphic(new InvariantTextPrimitive()); _textControlGraphic.Name = "Text"; _textControlGraphic.Color = System.Drawing.Color.Yellow; this.Graphics.Add(_textControlGraphic); } this.TextGraphic.VisualStateChanged += OnTextVisualStateChanged; if (_pointControlGraphic == null) { _pointControlGraphic = InitializePointControlGraphic(new AnchorPointGraphic()); _pointControlGraphic.Name = "Point"; this.Graphics.Add(_pointControlGraphic); } if (_lineGraphic == null) { _lineGraphic = new ArrowGraphic(false); _lineGraphic.Name = "Line"; _lineGraphic.Color = System.Drawing.Color.Yellow; _lineGraphic.LineStyle = LineStyle.Dash; this.Graphics.Add(_lineGraphic); } }
void OnBegan() { originalPos = cam.ScreenToViewportPoint(Input.mousePosition); originalPos.x = Mathf.Clamp(originalPos.x, limitX, 1 - limitX); originalPos.y = Mathf.Clamp(originalPos.y, limitY, 1 - limitY); if (ag == null) { ag = new GameObject().AddComponent <ArrowGraphic>(); ag.transform.SetParent(p); ag.transform.localScale = Vector3.one; ag.transform.localPosition = Vector3.zero; ag.transform.localRotation = Quaternion.identity; ag.texWidth = texWidth; } ag.SetPos(originalPos, originalPos, paintColor, type, texWidth, texHeight); }
private void OnCloneComplete() { _textControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Text"); }) as IControlGraphic); _pointControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Point"); }) as IControlGraphic); _lineGraphic = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Line"); }) as ArrowGraphic; Platform.CheckForNullReference(_lineGraphic, "_lineGraphic"); Platform.CheckForNullReference(_pointControlGraphic, "_pointControlGraphic"); Platform.CheckForNullReference(_textControlGraphic, "_textControlGraphic"); Initialize(); }