Ejemplo n.º 1
0
        public void AddItem()
        {
            RectTransform rt      = Instantiate(prototype);
            var           newItem = rt.GetComponent <GraphItem>();

            rt.SetParent(rtParent, false);
            rt.gameObject.SetActive(true);
            graphItems.Add(newItem);

            var setupData = new GraphSubscriber.MicrogridVarAndIndex
            {
                index = graphItems.Count - 1,
                mvar  = this.mvar
            };

            newItem.gSubscriber.loadOnSetup
                = new List <GraphSubscriber.MicrogridVarAndIndex>()
                {
                setupData
                };

            CheckLimit();
            FixLabel();
            SetGlobalAxisLimits();
        }
Ejemplo n.º 2
0
        public void AddCanvas()
        {
            RectTransform newCanvas = Instantiate(prototype);

            newCanvas.transform.SetParent(rtParent, false);
            newCanvas.gameObject.SetActive(true);
            canvases.Add(newCanvas);

            var g = newCanvas.GetComponentInChildren <GraphSubscriber>();

            graphSubscribers.Add(g);
            var setupData = new GraphSubscriber.MicrogridVarAndIndex
            {
                index = canvases.Count - 1,
                mvar  = MicrogridVar.PCHP
            };

            g.loadOnSetup = new List <GraphSubscriber.MicrogridVarAndIndex>()
            {
                setupData
            };
        }