【问题标题】:Using Google Play Quests in Unity 4在 Unity 4 中使用 Google Play 任务
【发布时间】:2015-10-27 16:43:13
【问题描述】:

5以下的unity版本可以使用google play游戏任务吗?我正在使用 Unity 4.5.2f1,并且正在使用最新的 google play 游戏插件。当我添加此代码以显示任务时:

    PlayGamesPlatform.Instance.Quests.ShowAllQuestsUI(
            (QuestUiResult result, IQuest quest, IQuestMilestone milestone) => {
            // ...
    });

引用的 scipts(QuestUiResult、IQues 和 IQuesMilestone)在当前上下文中不存在。

我做错了吗?

非常感谢任何帮助,谢谢。

【问题讨论】:

    标签: android google-play-games


    【解决方案1】:

    我认为它应该在 4.5 中工作。我遇到的唯一问题是导入示例 unitypackages 效果不佳,但手动添加源代码。

    TrivalQuest 示例中,您应该能够调用类似:

    using GooglePlayGames;
    using GooglePlayGames.BasicApi;
    using GooglePlayGames.BasicApi.Quests;
    
     public void ViewQuests()
        {
            Debug.Log("clicked:ViewQuests");
            PlayGamesPlatform.Instance.Quests.ShowAllQuestsUI(
                (QuestUiResult result, IQuest quest, IQuestMilestone milestone) =>
                {
                    if (result == QuestUiResult.UserRequestsQuestAcceptance)
                    {
                        Debug.Log("User Requests Quest Acceptance");
                        AcceptQuest(quest);
                    }
    
                    if (result == QuestUiResult.UserRequestsMilestoneClaiming)
                    {
                        Debug.Log("User Requests Milestone Claim");
                        ClaimMilestone(milestone);
                    }
                });
        }
    

    【讨论】:

    • 非常感谢 :) 就像一个魅力。我所需要的只是包括使用 GooglePlayGames.BasicApi.Quests。然而,我仍然坚持的一件事是任务的奖励系统。假设我在玩家首选项中有一个硬币价值,我如何添加 10 个硬币作为完成任务的奖励?再次感谢@Clayton Wilkinson
    • 另外,我在导入最新的 GPGS 插件时发现的一个问题是,其中一个脚本中引用了 Texture2D.blackTexture,我认为 Unity 4 中不存在,所以我不得不更改它等于 null 以修复编译错误。
    • 感谢您的反馈!任务的奖励取决于您 - Play 管理中心上与任务相关的数据文件包含数据。例如,它可以是 json,然后在请求请求时读取它。
    • 我仍然不太明白如何从我的统一项目中的 json 文件访问数据。我创建了另一个问题。你介意看看吗?谢谢。 @克莱顿威尔金森
    猜你喜欢
    • 1970-01-01
    • 2019-03-02
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多