void PlayerLeftResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();


    writer.EndObject();
}
void AuthUserRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("AuthorizationTicket");
    writer.String(AuthorizationTicket.c_str());

    writer.EndObject();
}
void PlayFab::MatchmakerModels::writeRegionEnumJSON(Region enumVal, PFStringJsonWriter& writer)
{
    switch (enumVal)
    {
    case RegionUSCentral:
        writer.String("USCentral");
        break;
    case RegionUSEast:
        writer.String("USEast");
        break;
    case RegionEUWest:
        writer.String("EUWest");
        break;
    case RegionSingapore:
        writer.String("Singapore");
        break;
    case RegionJapan:
        writer.String("Japan");
        break;
    case RegionBrazil:
        writer.String("Brazil");
        break;
    case RegionAustralia:
        writer.String("Australia");
        break;

    }
}
Пример #4
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;
    }
}
void VirtualCurrencyRechargeTime::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("SecondsToRecharge");
    writer.Int(SecondsToRecharge);
    writer.String("RechargeTime");
    writeDatetime(RechargeTime, writer);
    writer.String("RechargeMax");
    writer.Int(RechargeMax);

    writer.EndObject();
}
void StartGameResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    if (GameID.length() > 0) {
        writer.String("GameID");
        writer.String(GameID.c_str());
    }
    if (ServerHostname.length() > 0) {
        writer.String("ServerHostname");
        writer.String(ServerHostname.c_str());
    }
    writer.String("ServerPort");
    writer.Uint(ServerPort);

    writer.EndObject();
}
void UserInfoRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("PlayFabId");
    writer.String(PlayFabId.c_str());
    writer.String("MinCatalogVersion");
    writer.Int(MinCatalogVersion);

    writer.EndObject();
}
void PlayerLeftRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("LobbyId");
    writer.String(LobbyId.c_str());
    writer.String("PlayFabId");
    writer.String(PlayFabId.c_str());

    writer.EndObject();
}
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();
}
Пример #10
0
void PlayFab::writeDatetime(time_t datetime, PFStringJsonWriter& writer)
{
	char buff[40];
	strftime(buff, 40, "%Y-%m-%dT%H:%M:%S.000Z", gmtime (&datetime));
	writer.String(buff);
}
void ItemInstance::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    if (ItemId.length() > 0) {
        writer.String("ItemId");
        writer.String(ItemId.c_str());
    }
    if (ItemInstanceId.length() > 0) {
        writer.String("ItemInstanceId");
        writer.String(ItemInstanceId.c_str());
    }
    if (ItemClass.length() > 0) {
        writer.String("ItemClass");
        writer.String(ItemClass.c_str());
    }
    if (PurchaseDate.notNull()) {
        writer.String("PurchaseDate");
        writeDatetime(PurchaseDate, writer);
    }
    if (Expiration.notNull()) {
        writer.String("Expiration");
        writeDatetime(Expiration, writer);
    }
    if (RemainingUses.notNull()) {
        writer.String("RemainingUses");
        writer.Int(RemainingUses);
    }
    if (UsesIncrementedBy.notNull()) {
        writer.String("UsesIncrementedBy");
        writer.Int(UsesIncrementedBy);
    }
    if (Annotation.length() > 0) {
        writer.String("Annotation");
        writer.String(Annotation.c_str());
    }
    if (CatalogVersion.length() > 0) {
        writer.String("CatalogVersion");
        writer.String(CatalogVersion.c_str());
    }
    if (BundleParent.length() > 0) {
        writer.String("BundleParent");
        writer.String(BundleParent.c_str());
    }
    if (DisplayName.length() > 0) {
        writer.String("DisplayName");
        writer.String(DisplayName.c_str());
    }
    if (UnitCurrency.length() > 0) {
        writer.String("UnitCurrency");
        writer.String(UnitCurrency.c_str());
    }
    writer.String("UnitPrice");
    writer.Uint(UnitPrice);
    if (!BundleContents.empty()) {
        writer.String("BundleContents");
        writer.StartArray();
        for (std::list<std::string>::iterator iter = BundleContents.begin(); iter != BundleContents.end(); iter++) {
            writer.String(iter->c_str());
        }
        writer.EndArray();
    }
    if (!CustomData.empty()) {
        writer.String("CustomData");
        writer.StartObject();
        for (std::map<std::string, std::string>::iterator iter = CustomData.begin(); iter != CustomData.end(); ++iter) {
            writer.String(iter->first.c_str());
            writer.String(iter->second.c_str());
        }
        writer.EndObject();
    }

    writer.EndObject();
}
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();
}
void StartGameRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("Build");
    writer.String(Build.c_str());
    writer.String("Region");
    writeRegionEnumJSON(pfRegion, writer);
    writer.String("GameMode");
    writer.String(GameMode.c_str());
    if (CustomCommandLineData.length() > 0) {
        writer.String("CustomCommandLineData");
        writer.String(CustomCommandLineData.c_str());
    }
    writer.String("ExternalMatchmakerEventEndpoint");
    writer.String(ExternalMatchmakerEventEndpoint.c_str());

    writer.EndObject();
}