2020年1月1日 星期三

Unity筆記:Steam成就系統


----
(2020/6/30)
----
之前場外人生弄了一百個成就,
其實邊玩邊解鎖還蠻有趣的,
小地圖王國也會弄一系列,
不過這次會留一些來做之後的成就,
總之要上架前還是要先做點成就系統,
這樣上架時的頁面才能標註有成就支援,
(如果沒有做完就給他審的話他會要你先把它撤掉或做完)
不過如果你先撤掉再給他審完再補上去好像就可以了(??),
總之遲早要做,開始吧:

https://steamworks.github.io/

installation - Releases - 下載Unitypackage

直接丟進專案,

把Assets\Scripts\Steamworks.NET的SteamManager

中的

// If Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the
// Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM.

// Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and
// remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)". 1360670
// See the Valve documentation for more information: https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown

/*if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid))*/

改成

if (SteamAPI.RestartAppIfNecessary((AppId_t)你的APPID,就是商店頁面網址的那個值))
{
Application.Quit();
return;
}


改好後,只要在場景中創個空物件,把SteamManager丟進去,
(該物件將不會被摧毀)

之後其他腳本調用只要用using Steamworks就可以了,


解鎖與清空成就的程式:

public void 解鎖成就(string 對應編號)
    {
        SteamUserStats.SetAchievement(對應編號);
        SteamUserStats.StoreStats();
    }
    public void 清除所有成就()
    {
        SteamUserStats.ResetAllStats(true);
        SteamUserStats.StoreStats();
    }


再來就是到後台去把成就設定弄好,
弄那個設定意外花時間的,
要一直等它網頁載入,
不過一勞永逸,等等就把它做完吧。
(っ´ω`c)
----

沒有留言:

張貼留言

你發現了這篇網誌的留言板,在這留點什麼吧|д・)