Beispiel #1
0
    public void SetData(string title, string content, List <UIPromptInfo> promptInfo)
    {
        m_TitleLabel.text  = title;
        m_ContentText.text = content;

        for (int i = 0; i < promptInfo.Count; i++)
        {
            GameObject promptObj = (GameObject)Instantiate(m_PromptPrefab, m_PromptsBar);
            UIPrompt   prompt    = promptObj.GetComponent <UIPrompt>();
            if (prompt != null)
            {
                prompt.SetIcon(promptInfo[i].m_IconSprite); // TODO need a way to associate the icons with the input so that they can be set together
                prompt.SetLabel(promptInfo[i].m_LabelText);
            }
        }
    }
 // set the current screen prompts
 public virtual void SetPrompts(Transform parent, GameObject prefab, List <UIPromptInfo> newPrompts)
 {
     for (int i = 0; i < newPrompts.Count; i++)
     {
         GameObject promptObj = (GameObject)Instantiate(prefab, parent);
         UIPrompt   prompt    = promptObj.GetComponent <UIPrompt>();
         if (prompt != null)
         {
             prompt.SetIcon(newPrompts[i].m_IconSprite);
             prompt.SetLabel(newPrompts[i].m_LabelText);
         }
         else
         {
             Debug.LogErrorFormat("No prompt script attached to {0} on the {1} screen.", promptObj.name, name);
         }
     }
 }