public void Init() { if (hasInit) return; hasInit = true; changeObjs.Add(orientationC); changeObjs.Add(graphTypeC); changeObjs.Add(graphC); changeObjs.Add(resizeC); changeObjs.Add(seriesCountC); changeObjs.Add(seriesNoCountC); changeObjs.Add(tooltipEnabledC); changeObjs.Add(autoAnimEnabledC); legend.Init (); xAxis.Init (yAxis, false); yAxis.Init (xAxis, true); for (int j = 0; j < lineSeries.Count; j++) { if (!activeInHierarchy(lineSeries[j])) continue; WMG_Series theSeries = lineSeries[j].GetComponent<WMG_Series>(); theSeries.Init(j); } theTooltip = this.gameObject.AddComponent<WMG_Graph_Tooltip>(); // Add tooltip script theTooltip.hideFlags = HideFlags.HideInInspector; // Don't show tooltip script theTooltip.theGraph = this; // Set tooltip graph if (tooltipEnabled) theTooltip.subscribeToEvents(true); autoAnim = this.gameObject.AddComponent<WMG_Graph_Auto_Anim>(); // Add automatic animations script autoAnim.hideFlags = HideFlags.HideInInspector; // Don't show automatic animations script autoAnim.theGraph = this; // Set automatic animations graph if (autoAnimationsEnabled) autoAnim.subscribeToEvents(true); groups.SetList (_groups); groups.Changed += groupsChanged; graphTypeC.OnChange += GraphTypeChanged; tooltipEnabledC.OnChange += TooltipEnabledChanged; autoAnimEnabledC.OnChange += AutoAnimationsEnabledChanged; orientationC.OnChange += OrientationChanged; resizeC.OnChange += ResizeChanged; graphC.OnChange += GraphChanged; seriesCountC.OnChange += SeriesCountChanged; seriesNoCountC.OnChange += SeriesNoCountChanged; setOriginalPropertyValues(); PauseCallbacks(); }
void Start() { // Create legend GameObject legendObj = GameObject.Instantiate(legendPrefab) as GameObject; changeSpriteParent(legendObj, graphBackground.transform.parent.gameObject); legend = legendObj.GetComponent<WMG_Legend>(); legend.theGraph = this; for (int j = 0; j < lineSeries.Count; j++) { if (!activeInHierarchy(lineSeries[j])) continue; WMG_Series theSeries = lineSeries[j].GetComponent<WMG_Series>(); theSeries.createLegendEntry(j); } checkCache(); // Set all cache variables to the current values setCacheFlags(true); // Set all cache change flags to true to update everything on start orientationTypeChanged = false; // Except orientation, since this swaps the orientation theTooltip = this.gameObject.AddComponent<WMG_Graph_Tooltip>(); // Add tooltip script theTooltip.hideFlags = HideFlags.HideInInspector; // Don't show tooltip script theTooltip.theGraph = this; // Set tooltip graph autoAnim = this.gameObject.AddComponent<WMG_Graph_Auto_Anim>(); // Add automatic animations script autoAnim.hideFlags = HideFlags.HideInInspector; // Don't show automatic animations script autoAnim.theGraph = this; // Set automatic animations graph setOriginalPropertyValues(); }