/// <summary>
    /// Offers the trade, presenting the given text. Success delegate is called before the enumerator
    /// finishes but after the trade is performed.
    /// </summary>
    /// <returns>The trade.</returns>
    /// <param name="trade">Trade.</param>
    /// <param name="tradeText">Trade text.</param>
    /// <param name="success">Success.</param>
    public static IEnumerator OfferTrade(TradingOffer trade, string tradeText, System.Action <TradingResult> success)
    {
        var acceptOption = new DialogBox.Choice("Accept", () => {
            if (PerformTrade(trade))
            {
                success(TradingResult.SUCCEED);
                PlayClip(instance.acceptSound);
            }
            else
            {
                success(TradingResult.FAILACCEPT);
            }
        });

        var denyOption = new DialogBox.Choice("Deny", () => {
            success(TradingResult.FAILDENY);
            PlayClip(instance.declineSound);
        });

        yield return(DialogSystem.Instance().DisplayMessageAndChoices(tradeText, acceptOption, denyOption));
    }
示例#2
0
 void BeginDisplayingMessage()
 {
     StartCoroutine(DialogSystem.Instance().DisplayMessageAndChoices(message,
                                                                     new DialogBox.Choice("Chirp?", () => print("Uh huh.")),
                                                                     new DialogBox.Choice("I see, I see.", () => print("No you don't."))));
 }