public void SetIconPath(string iconPath) { IconPath = iconPath; Image icon = transform.FindChild("Icon").GetComponent <Image> (); icon.sprite = UGUIUtility.LoadSprite(iconPath); }
void OpenTask(int taskID) { if (taskID != _CurrentTaskID && 0 < taskID && taskID <= _TaskDatas.Length) { _CurrentTaskID = taskID; _CurrentTaskData = _TaskDatas[taskID - 1]; Text desc = transform.FindChild("Center/bg/desc").GetComponent <Text> (); desc.text = _CurrentTaskData.Desc; Image icon = transform.FindChild("Down/Icon").GetComponent <Image> (); icon.sprite = UGUIUtility.LoadSprite(_CurrentTaskData.IconPath); Text title = transform.FindChild("Top/Title").GetComponent <Text> (); title.text = _CurrentTaskData.Title; } }