NAV
Unity Unreal Engine 4

GS2-News

GS2-SDK for Game Engine のリファレンス

ゲームエンジン向けSDKモデル

EzNews

説明
section string セクション名
content string コンテンツ名
title string 記事見出し
scheduleEventId string イベントGRN
timestamp long タイムスタンプ
frontMatter string Front Matter

EzSetCookieRequestEntry

説明
key string 記事を閲覧できるようにするために設定してほしい Cookie のキー値
value string 記事を閲覧できるようにするために設定してほしい Cookie の値

メソッド

getContentsUrl

getContentsUrl

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->news.wantGrant(
    [](gs2::ez::account::AsyncEzWantGrantResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "news.wantGrant failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
            BrowserUrl = r.getResult()->getBrowserUrl();
            ZipUrl = r.getResult()->getZipUrl();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace1") // namespaceName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzWantGrantResult> asyncResult = null;
    var current = gs2.News.WantGrant(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace1"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
    var browserUrl = result.BrowserUrl;
    var zipUrl = result.ZipUrl;
}

お知らせ記事へのアクセスに設定が必要なクッキーのリストを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
accessToken string ~ 128文字 ユーザーID

Result

説明
items SetCookieRequestEntry[] お知らせコンテンツにアクセスするために設定の必要なクッキーのリスト
browserUrl string お知らせコンテンツにアクセスするためのURL
zipUrl string ZIP形式のお知らせコンテンツにアクセスするためのURL Cookieの設定は不要

listNewses

listNewses

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->news.describeNews(
    [](gs2::ez::account::AsyncEzDescribeNewsResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "news.describeNews failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
            ContentHash = r.getResult()->getContentHash();
            TemplateHash = r.getResult()->getTemplateHash();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace1") // namespaceName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDescribeNewsResult> asyncResult = null;
    var current = gs2.News.DescribeNews(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace1"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
    var contentHash = result.ContentHash;
    var templateHash = result.TemplateHash;
}

お知らせ記事の一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
accessToken string ~ 128文字 ユーザーID

Result

説明
items News[] お知らせ記事のリスト
contentHash string お知らせ記事データのハッシュ値
templateHash string テンプレートデータのハッシュ値