コード例 #1
0
void AuthUserResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("Authorized");
    writer.Bool(Authorized);
    if (PlayFabId.length() > 0) {
        writer.String("PlayFabId");
        writer.String(PlayFabId.c_str());
    }

    writer.EndObject();
}
コード例 #2
0
void UserInfoResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    if (PlayFabId.length() > 0) {
        writer.String("PlayFabId");
        writer.String(PlayFabId.c_str());
    }
    if (Username.length() > 0) {
        writer.String("Username");
        writer.String(Username.c_str());
    }
    if (TitleDisplayName.length() > 0) {
        writer.String("TitleDisplayName");
        writer.String(TitleDisplayName.c_str());
    }
    if (!Inventory.empty()) {
        writer.String("Inventory");
        writer.StartArray();
        for (std::list<ItemInstance>::iterator iter = Inventory.begin(); iter != Inventory.end(); iter++) {
            iter->writeJSON(writer);
        }
        writer.EndArray();
    }
    if (!VirtualCurrency.empty()) {
        writer.String("VirtualCurrency");
        writer.StartObject();
        for (std::map<std::string, Int32>::iterator iter = VirtualCurrency.begin(); iter != VirtualCurrency.end(); ++iter) {
            writer.String(iter->first.c_str());
            writer.Int(iter->second);
        }
        writer.EndObject();
    }
    if (!VirtualCurrencyRechargeTimes.empty()) {
        writer.String("VirtualCurrencyRechargeTimes");
        writer.StartObject();
        for (std::map<std::string, VirtualCurrencyRechargeTime>::iterator iter = VirtualCurrencyRechargeTimes.begin(); iter != VirtualCurrencyRechargeTimes.end(); ++iter) {
            writer.String(iter->first.c_str());
            iter->second.writeJSON(writer);
        }
        writer.EndObject();
    }
    writer.String("IsDeveloper");
    writer.Bool(IsDeveloper);
    if (SteamId.length() > 0) {
        writer.String("SteamId");
        writer.String(SteamId.c_str());
    }

    writer.EndObject();
}
コード例 #3
0
void MultitypeVar::writeJSON(PFStringJsonWriter& writer)
{
    switch (mType)
    {
    case MultitypeNull:
        writer.Null();
        break;
    case MultitypeBool:
        writer.Bool(mBool);
        break;
    case MultitypeNumber:
        writer.Double(mNumber);
        break;
    case MultitypeString:
        writer.String(mString.c_str());
        break;
    }
}