コード例 #1
0
ファイル: ChatApp.cs プロジェクト: sogoodgames/peach
    // ------------------------------------------------------------------------
    private void DrawChatOptions(Message message)
    {
        if (message == null)
        {
            Debug.LogError("Message null.");
            return;
        }
        if (!message.Player)
        {
            Debug.LogError("Hecked up script config. NPC has chat options.");
            return;
        }
        if (!message.HasOptions())
        {
            Debug.LogError("Attempting to draw options for message with no options.");
            return;
        }

        // if we've answered this question multiple times, mark this convo done
        if (m_activeChat.VisitedMessages.FindAll(m => m.Node == message.Node).Count > 1)
        {
            FinishConvo();
            return;
        }

        for (int i = 0; i < message.Options.Length; i++)
        {
            // if we've already been to this conversation option,
            // skip drawing whatever option we selected last time
            if (message.MadeSelection() && i == message.OptionSelection)
            {
                continue;
            }

            // draw bubble
            GameObject option = Instantiate(
                MessageOptionPrefab,
                ChatOptionsParent
                ) as GameObject;

            // setup bubble
            MessageButton messageButton = option.GetComponent <MessageButton>();

            // check if clue needs met
            if (PhoneOS.ClueRequirementMet(message.ClueNeeded[i]))
            {
                // set button text & hook up option function
                messageButton.Text.text = message.Options[i];
                SetButtonListener(messageButton.Button, message, i);
                //Debug.Log("created option [" + message.options[i] + "] with index " + i + " for message " + message.node);
            }
            else
            {
                // mark it as unavilable
                messageButton.Text.text = "[clue needed]";
            }
        }
    }
コード例 #2
0
ファイル: NotesApp.cs プロジェクト: sogoodgames/peach
 private void PopulateNotes()
 {
     foreach (ClueID clue in clueNotes.Keys)
     {
         if (PhoneOS.ClueRequirementMet(clue))
         {
             GameObject noteObj = Instantiate(NotePrefab, NotesParent);
             NoteUI     noteUI  = noteObj.GetComponent <NoteUI>();
             if (noteUI)
             {
                 noteUI.Text.text = clueNotes[clue];
             }
         }
     }
 }