コード例 #1
0
    public static IEnumerator CheckUpdate()
    {
        Text   info          = GameStart.info;
        string centerAddress = JsonHelpers.GetString(GameStart.appConfig, "centerAddress", "");

        info.text += "\ncenterAddress: " + centerAddress;
        string apiKey = JsonHelpers.GetString(GameStart.appConfig, "apiKey", "");

        info.text += "\napiKey: " + apiKey;
        string clientVersionVal = JsonHelpers.GetString(GameStart.appConfig, "clientVersion", "");

        clientVersion = new ClientVersion(clientVersionVal);
        info.text    += "\n+Major: " + clientVersion.Major;
        info.text    += "\n+Minor: " + clientVersion.Minor;
        info.text    += "\n+Patch: " + clientVersion.Patch;
        info.text    += "\n+Release: " + clientVersion.Release;
        var fsDic   = fsData.CreateDictionary();
        var request = fsDic.AsDictionary;

        request["major"]   = new fsData(clientVersion.Major);
        request["minor"]   = new fsData(clientVersion.Minor);
        request["patch"]   = new fsData(clientVersion.Patch);
        request["release"] = new fsData(clientVersion.Release);
        var param = Json.Generate(fsDic);

        WebHelpers.httpResCallbackHandler += HandleCheckUpdate;
        WebHelpers.CreatHttpRequest(centerAddress + "/version", apiKey, param, "POST");

        yield return(new WaitForSeconds(1.0f));
    }