Esempio n. 1
0
        private CanvasLines CreateDataObject(GraphData.CategoryData data, GameObject rectMask)
        {
            GameObject obj = new GameObject("Lines", typeof(RectTransform));

            ChartCommon.HideObject(obj, hideHierarchy);
            obj.AddComponent <ChartItem>();
            RectTransform t = obj.GetComponent <RectTransform>();

            obj.AddComponent <CanvasRenderer>();

            //  Canvas c = obj.AddComponent<Canvas>();

            //c.pixelPerfect = false;
            //obj.AddComponent<GraphicRaycaster>();

            CanvasLines lines = obj.AddComponent <CanvasLines>();

            lines.maskable = true;

            t.SetParent(rectMask.transform, false);
            t.localScale       = new Vector3(1f, 1f, 1f);
            t.anchorMin        = new Vector2(0f, 0f);
            t.anchorMax        = new Vector2(0f, 0f);
            t.anchoredPosition = Vector3.zero;
            t.localRotation    = Quaternion.identity;
            return(lines);
        }
        private GameObject CreatePointObject(GraphData.CategoryData data)
        {
            GameObject prefab = data.DotPrefab;

            if (prefab == null)
            {
                if (mEmptyPointPrefab == null)
                {
                    mEmptyPointPrefab = (GameObject)Resources.Load("Chart And Graph/SelectHandle");
                }
                prefab = mEmptyPointPrefab;
            }
            GameObject obj = GameObject.Instantiate(prefab);

            ChartCommon.HideObject(obj, hideHierarchy);
            if (obj.GetComponent <ChartItem>() == null)
            {
                obj.AddComponent <ChartItem>();
            }
            obj.transform.SetParent(transform);
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = Vector3.zero;
            obj.transform.localRotation = Quaternion.identity;

            return(obj);
        }
        private PathGenerator CreateLineObject(GraphData.CategoryData data)
        {
            GameObject obj = GameObject.Instantiate(data.LinePrefab.gameObject);

            ChartCommon.HideObject(obj, hideHierarchy);
            PathGenerator lines = obj.GetComponent <PathGenerator>();

            if (obj.GetComponent <ChartItem>() == null)
            {
                obj.AddComponent <ChartItem>();
            }
            obj.transform.SetParent(transform);
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = Vector3.zero;
            obj.transform.localRotation = Quaternion.identity;
            return(lines);
        }
        private CanvasLines CreateDataObject(GraphData.CategoryData data, GameObject rectMask, bool mask)
        {
            GameObject obj = new GameObject("Lines", typeof(RectTransform));

            ChartCommon.HideObject(obj, hideHierarchy);
            obj.AddComponent <ChartItem>();

            var rend = obj.AddComponent <CanvasRenderer>();

            rend.cullTransparentMesh = false;

            CenterObject(obj, rectMask.GetComponent <RectTransform>());
            //  Canvas c = obj.AddComponent<Canvas>();

            //c.pixelPerfect = false;
            //obj.AddComponent<GraphicRaycaster>();
            CanvasLines lines = obj.AddComponent <CanvasLines>();

            lines.maskable = true;

            return(lines);
        }