void Awake() { ChartLine c = gameObject.GetComponent<ChartLine>(); // c.sortingOrder = 103; chart = c.UIChartLine; chart.chartType = UIChartLine.ChartType.LINE; chart.Title = "Total Water Loss"; //TODO: localization chart.UnitX = "Year"; //TODO: localization chart.UnitY = "L"; //TODO: localization chart.Width = 4; chart.Height = 2; chart.Thickness = 0.015f; chart.PointSize = 0.03f; chart.SetSize(1, 5); for (int j = 0; j < 5; j++) { float rnd = Random.Range(50.0f, 400.0f); chart.SetValue(0, j, rnd); } for (int i = 0; i < 5; i++) { chart.SetLabelX(i, string.Format("{0}", 2010 + i)); } chart.SetColor(0, Color.blue); chart.Create(); time = System.Environment.TickCount; }
void Awake() { if (Application.isPlaying) { uiChartLine = (UIChartLine)UIManager.Instance.Add(type, gameObject, ""); uiChartLine.SortingOrder = sortingOrder; uiChartLine.scrollArea = scrollArea; } }
void Awake() { if (Application.isPlaying) { // Debug.Log(gameObject.name+ " <color=red>Init</color>"); // Debug.Log("transform:" + gameObject.transform); uiChartLine = (UIChartLine)UIManager.Instance.Add(type, gameObject, ""); uiChartLine.SortingOrder = sortingOrder; uiChartLine.scrollArea = scrollArea; } }
}//LoadSprite() /// <summary> /// Adds a UI button. /// </summary> /// <param name="obj">Parent game object.</param> /// <param name="fileName">Resource file name with path, relative to Rersources folder.</param> public UIObject Add(UIType type, GameObject obj, string fileName, Sprite spr = null) { Log.Info("Add: <color=yellow>"+obj.name+" - id:"+obj.GetComponent<GUIText>()+"</color> type:"+type); //// Log.GameTimes("_______________-_-_-_-_-_ <color=yellow>"+fileName+" _____ obj: "+obj+"</color>, type: "+type); if(images.ContainsKey(obj.GetInstanceID())) { //give warning, then return existing one (ignore new registration) Log.Debug("This button already registered, ignoring new registration. <color=cyan>" + obj.name+"</color> "); return images[obj.GetInstanceID()]; } Sprite[] sprList = new Sprite[1]; if(fileName.Length == 0) { if(spr == null) { Log.Debug("This button <color=yellow>"+obj.name+"</color> has no image."); } else { Log.Debug("Sprite >>>>>>>>>>>>>>>>> "+spr.name); sprList[0] = spr; } } else { sprList = LoadSprite(fileName); } UIObject image = null; switch(type) { case UIType.Image: Log.Debug("Add UIImage"); image = new UIImage(obj, sprList); break; case UIType.Button: Log.Debug("Add UIButton"); image = new UIButton(obj, sprList); break; case UIType.ToggleButton: Log.Debug("Add UIToggleButton"); image = new UIToggleButton(obj, sprList); break; case UIType.Slider: Log.Debug("Add UISlider"); image = new UISlider(obj, sprList); break; case UIType.Character: Log.Debug("Add UICharacter"); image = new UICharacter(obj, sprList); break; case UIType.ChartPie: Log.Debug("Add UIChartPie"); image = new UIChartPie(obj); break; case UIType.ChartLine: Log.Debug("Add UIChartLine"); image = new UIChartLine(obj); break; case UIType.Checkbox: Log.Debug("Add Checkbox"); image = new UICheckbox(obj, sprList); break; default: Log.Exception("Invalid UIType to add:" + type); break; } //TODO remove this images.Add(obj.GetInstanceID(), image); // //images.Add(""+lastId++, image); //Log.Info("Button added:"+obj.name+" image:"+image.Name); return image; }//Add()