2015-06-07 123 views
6

背景
我正在处理已发布在Google Play商店中的android game
现在我打算添加Cloud Save功能作为更新。
(FYI:我使用的是团结和Play Games plugin保存到Google Play云自动保存

问题
后的研究和实验时间,我目前停留在如何自动保存游戏。

我的游戏是一个迷你游戏的集合,玩家可以继续玩,直到他用完了。
我希望保存在玩家输掉的时候自动发生。

据插件,这是我保存到云:

public void SaveGame (ISavedGameMetadata game, byte[] savedData) { 
    /* code omitted */ 
    savedGameClient.CommitUpdate(game, updatedMetadata, savedData, OnSavedGameWritten); 
} 

我需要2个参数的功能SaveGame,第一个是元数据,那么第二个一个是数据本身。

无处不在我搜索(甚至在谷歌),我找不到自动生成元数据的方法。
根据我的研究,我可以从下面的功能的元数据:

void ShowSelectUI() { 
    uint maxNumToDisplay = 5; 
    bool allowCreateNew = true; 
    bool allowDelete = true; 

    // I will need to call this function first 
    // This will display a dialog to the player 
    // The player will need to create a new save manually afterwards 
    ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame; 
    savedGameClient.ShowSelectSavedGameUI("Select saved game", 
              maxNumToDisplay, 
              allowCreateNew, 
              allowDelete, 
              OnSavedGameSelected); 
} 


public void OnSavedGameSelected (SelectUIStatus status, ISavedGameMetadata game) { 
    // And then from the callback function I get the meta data 
    // (ISavedGameMetadata game) 

    if (status == SelectUIStatus.SavedGameSelected) { 
     // handle selected game save 
    } else { 
     // handle cancel or error 
    } 
} 

这样,用户将需要打开一个对话框,然后创建一个新的由本人保存。
这不可能发生在我的比赛中,因为我需要保存每次球员输球。

参考
我知道,它应该是可能的,一个游戏叫Get Bigger! Mola可能每个球员失去,而无需打开一个保存对话框随时保存进度。

问题
任何人都可以给我任何线索吗?
我花了整整一天的搜索没有答案...
任何形式的帮助将不胜感激。

+1

你想通了这一点了吗?我有同样的问题。我很积极,必须有办法做到这一点,因为许多游戏允许基于谷歌帐户的云存储,但我似乎无法找到关于该主题的任何内容。 – Bhaskar

回答

0

我个人并不熟悉您尝试保存统计数据的资产。 但是,我确实使用了我个人可以推荐的这个资产Stan's Native

如果你想要别的东西免费的,还有这些链接,Search Native

无论如何,你应该检查谷歌教程大约有theie云中工作,有大量的信息,对Android的网站,不涉及统一。 Android Developer

0

如提到的here,你可以打开一个新的快照而不必从列表中选择一个,只需指定文件名,如果存在,它将使用它,否则它会创建一个新的快照。

事情是这样的:

 ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame; 
    savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork, 
     ConflictResolutionStrategy.UseLongestPlaytime, delegate(SavedGameRequestStatus status, ISavedGameMetadata metadata) { 
      // your code here .... 
     });