c# - PlayerStats.Valid 不返回 true
问题描述
我正在尝试通过 google play 服务获取用户状态,以便为我的游戏制作每日奖励系统,但我没有将价值恢复为真实,我的游戏连接到 google play 但我无法获取用户的数据。这是下面的代码片段
private string gameId = "3140248";
private bool testMode = true;
public List<Upgrades> upgrades = new List<Upgrades>();
public List<Area> areas = new List<Area>();
public Text Loading;
public GameObject ErrorGoogle;
public PlayerStats PlayerStats;
public void Start()
{
StartCoroutine("Connection");
}
IEnumerator Connection()
{
yield return new WaitForSeconds(2f);
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
PlayerStats = new PlayerStats();
Social.localUser.Authenticate((bool success) =>
{
if (success == false)
{
ErrorGoogle.SetActive(true);
}
else if (PlayerStats.Valid)
{
Database();
}
});
}
解决方案
推荐阅读
- sql - 如何使用 sp_MSforeachdb
- java - 如何加载 org.springframework.jdbc.core.RowMapper 库
- c# - 为什么 Automapper 需要 IMapper 接口用于地图?
- java - Java mxGraph 中是否有可能限制单元格移动但不禁用它?
- javascript - 当间隔停止时,如何重构函数以返回承诺?
- excel - 如何使用“SUMPRODUCT”从两个不同类型的列中获取布尔结果?
- excel - excel 中高于平均值的数字 (SUM)
- java - 调用使用spring AOP封装的方法时出现HttpMessageNotWritableException
- javascript - JQuery 表单验证插件正则表达式(模式方法)问题
- python - Python beautifulsoup print 不打印整个 html 页面