Пример #1
0
 /// <summary>
 /// Shuts down a hover prefab effect
 /// </summary>
 /// <param name="hover"></param>
 void TriggerOut(ChartItemEffect hover)
 {
     hover.TriggerOut(true);
     ChartMaterialController control = hover.GetComponent<ChartMaterialController>();
     if (control)
         control.TriggerOff();
 }
Пример #2
0
 /// <summary>
 /// Shuts down a hover prefab effect
 /// </summary>
 /// <param name="hover"></param>
 void TriggerIn(ChartItemEffect hover)
 {
     hover.TriggerIn(false);
     ChartMaterialController control = hover.GetComponent<ChartMaterialController>();
     if (control)
         control.TriggerOn();
 }
Пример #3
0
 /// <summary>
 /// utillity method that can be used in derived classes in order to 
 /// </summary>
 /// <param name="hover"></param>
 /// <param name="index"></param>
 /// <param name="type"></param>
 /// <param name="rect"></param>
 protected void SetupHoverObjectToRect(ChartItemEffect hover, int index, int type,Rect rect)
 {
     if (hover == null)
         return;
     RectTransform transform = hover.GetComponent<RectTransform>();
     transform.localScale = new Vector3(1f, 1f, 1f);
     transform.sizeDelta = new Vector2(rect.width, rect.height);
     transform.anchoredPosition3D = new Vector3(rect.center.x, rect.center.y, 0f);
 }
Пример #4
0
        /// <summary>
        /// sets the transform of the hover object based on the data in this graphic
        /// </summary>
        /// <param name="hover"></param>
        /// <param name="index"></param>
        protected override void SetUpHoverObject(ChartItemEffect hover, int index, int type, object data)
        {
            if (hover == null)
            {
                return;
            }
            if (mLines == null || mLines.Count == 0)
            {
                return;
            }
            if (index < 0)
            {
                return;
            }

            if (mPointRender)
            {
                if (index >= mLines[0].PointCount)
                {
                    return;
                }
                Vector4       point     = mLines[0].getPoint(index);
                RectTransform transform = hover.GetComponent <RectTransform>();
                transform.localScale = new Vector3(1f, 1f, 1f);
                float size = mPointSize;
                if (point.w >= 0f)
                {
                    size = point.w;
                }
                transform.sizeDelta          = new Vector2(size, size);
                transform.anchoredPosition3D = new Vector3(point.x, point.y, 0f);
            }
            else
            {
                if (index >= mLines[0].LineCount)
                {
                    return;
                }
                Vector3 from;
                Vector3 to;
                mLines[0].GetLine(index, out from, out to);

                if (ViewRect.HasValue)
                {
                    Vector2 vFrom = from;
                    Vector2 vTo   = to;
                    TrimLine(ViewRect.Value, ref vFrom, ref vTo);
                    from = new Vector3(vFrom.x, vFrom.y, from.z);
                    to   = new Vector3(vTo.x, vTo.y, to.z);
                }

                Vector3       dir       = (to - from);
                float         angle     = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
                RectTransform transform = hover.GetComponent <RectTransform>();
                transform.sizeDelta     = new Vector2(dir.magnitude, Thickness);
                transform.localScale    = new Vector3(1f, 1f, 1f);
                transform.localRotation = Quaternion.Euler(0f, 0f, angle);
                Vector3 point = (from + to) * 0.5f;
                transform.anchoredPosition3D = new Vector3(point.x, point.y, 0f);
            }
        }