...
코드 블럭 |
---|
#include "KakaoGameLib.h"
std::wstring worldId = TEXT("worldId"); // worldId
std::wstring guildId = TEXT("guildId"); // guildId
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Open a chat room in KakaoTalk
kgKakaoGuildChat.openKakaoTalkGuildChat(worldId, guildId, [this](KakaoGame::Data::KGResult result) {
if (result.isSuccess()) {
// Successfully moved to the chat tab of the Kakao Talk app
}
else {
// Failed to move to the chat tab of the Kakao Talk app
}
}); |
|
28.1.2. Send a message to the guild chat room
This is an example of sending a message to a guild chat room. (Guide : 20. Kakaotalk Message Template V2 )
Unity
...
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// [TODO] Set Template ID
int templateId = 1234;
KGKakaoGuildChat.SendNewGuildChatMessage(
worldId,
guildId,
templateId,
null,
(result) => {
if (result.isSuccess == true)
{
//A guild message has been sent successfully.
}
else
{
//A guild message could not be been sent successfully.
}
}); |
Android
...
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] worldId
FString worldId = TEXT("test_world_id");
// [TODO] guildId
FString guildId = TEXT("test_guild_id");
FKGKakaoGuildChat::OpenKakaoTalkGuildChat(worldId, guildId, FKGResultDelegate::CreateLambda([=](FKGResult result) {
if (result.IsSuccess())
{
// Successfully moved to the chat tab of the Kakao Talk app
}
else
{
// Failed to move to the chat tab of the Kakao Talk app
}
})); |
|
28.1.2. Send a message to the guild chat room
This is an example of sending a message to a guild chat room. (Guide : 20. Kakaotalk Message Template V2 )
Unity
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// [TODO] Set Template ID
int templateId = 1234;
KGKakaoGuildChat.SendNewGuildChatMessage(
worldId,
guildId,
templateId,
null,
(result) => {
if (result.isSuccess == true)
{
//A guild message has been sent successfully.
}
else
{
//A guild message could not be been sent successfully.
}
}); |
|
Android
코드 블럭 |
---|
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// [TODO] Set Template ID
int templateId = 1234;
KGKakaoGuildChat.sendNewGuildChatMessage(worldId, guildId, templateId, Settings.extra, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
if (result.isSuccess()) {
//A guild message has been sent successfully.
} else {
//A guild message could not be been sent successfully.
}
}
}); |
|
iOS
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// [TODO] Set Template ID
int templateId = 1234;
[KGKakaoGuildChat sendNewGuildChatMessageWithWorldId:worldId guildId:guildId templateId:templateId extra:nil completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
//A guild message has been sent successfully.
}
else
{
//A guild message could not be been sent successfully.
}
}]; |
|
Windows Sync
코드 블럭 |
---|
#include "KakaoGameLib.h"
// [TODO] Set World ID
std::wstring worldId;
// [TODO] Set Guild ID
std::wstring guildId;
// [TODO] Set Template ID
std::wstring templateId;
// [TODO] Optional : Setting the value defined in the template message
std::map<std::wstring, std::wstring> arguments;
KakaoGame::Data::KGResult result;
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Send guild chat message
kgKakaoGuildChat.sendGuildChatMessage(worldId, guildId, templateId, arguments, result);
if (result.isSuccess()) {
// Successfully sending guild chat message
}
else {
// Failed to send guild chat message
if (KakaoGame::Data::KGResultCode::ExceedDailyUsage == result.code) {
// Occurs when the daily quota (regardless of recipient) that one person can send for a specific app is exceeded
}
else {
// Other errors
}
}
|
|
Windows Async
코드 블럭 |
---|
#include "KakaoGameLib.h"
// [TODO] Set World ID
std::wstring worldId;
// [TODO] Set Guild ID
std::wstring guildId;
// [TODO] Set Template ID
std::wstring templateId;
// [TODO] Optional : Setting the value defined in the template message
std::map<std::wstring, std::wstring> arguments;
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Send guild chat message
kgKakaoGuildChat.sendGuildChatMessage(worldId, guildId, templateId, arguments, [this](KakaoGame::Data::KGResult result) {
if (result.isSuccess()) {
// Successfully sending guild chat message
}
else {
// Failed to send guild chat message
if (KakaoGame::Data::KGResultCode::ExceedDailyUsage == result.code) {
// Occurs when the daily quota (regardless of recipient) that one person can send for a specific app is exceeded
}
else {
// Other errors
}
}
}); |
|
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] Set World ID
FString worldId = TEXT("test_world_1");
// [TODO] Set Guild ID
FString guildId = TEXT("test_guild_1");
// [TODO] Set Template ID
FString templateId = TEXT("4108");
// [TODO] Optional : Setting the value defined in the template message
TMap<FString, FString> argumentMap;
// Send guild chat message
FKGKakaoGuildChat::SendGuildChatMessage(worldId, guildId, templateId, argumentMap, FKGResultDelegate::CreateLambda([=](FKGResult result) {
if (result.IsSuccess())
{
// Successfully sending guild chat message
}
else
{
if (result.GetCode() == FKGResultCode::ExceedDailyUsage)
{
// Occurs when the daily quota (regardless of recipient) that one person can send for a specific app is exceeded
}
else
{
// Other errors
}
}
})); |
|
28.1.3. Show guild chat user consent window
This is an example of displaying the user consent window when the user does not agree to the use of the guild chat function when using the guild chat function.
Unity 예제
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// Show guild chat user consent window
KGKakaoGuildChat.ShowGuildChatAgreementView((result, isAgreed) => {
if (result.isSuccess)
{
// Guild chat user consent window pop up successfully
if (isAgreed == true)
// KakaoTalk Guild Chat User Consent Acquisition
else
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
else
{
// Failure to open guild chat user consent window
}
});
|
|
Android 예제
코드 블럭 |
---|
// Show guild chat user consent window
KGKakaoGuildChat.showGuildChatAgreementView(activity, new KGResultCallback<Boolean>() {
@Override
public void onResult(KGResult<Boolean> result) {
if (result.isSuccess()) {
// Guild chat user consent window pop up successfully
boolean isAgreed = result.getContent();
if (isAgreed) {
// KakaoTalk Guild Chat User Consent Acquisition
} else {
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
} else {
// |
|
Aguildmessagecouldnotbebeensentsuccessfully. iOS 예제
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h> |
|
#import <KakaoGameKakao/KakaoGameKakao.h>
// |
|
[TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// [TODO] Set Template ID
int templateId = 1234;
[KGKakaoGuildChat sendNewGuildChatMessageWithWorldId:worldId guildId:guildId templateId:templateId extra:nil completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
//A guild message has been sent successfully. Show guild chat user consent window
[KGKakaoGuildChat showGuildChatAgreementViewWithCompletionHandler:^(NSError *error, BOOL isAgreed) {
if (IS_SUCCESS(error))
{
// Guild chat user consent window pop up successfully
if (isAgreed == YES)
// KakaoTalk Guild Chat User Consent Acquisition
else
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
else
{
// |
|
Aguildmessagecouldnotbebeensentsuccessfully.
Windows Sync
코드 블럭 |
---|
#include "KakaoGameLib.h"
|
|
// [TODO] Set World ID
std::wstring worldId;
// [TODO] Set Guild ID
std::wstring guildId;
// [TODO] Set Template ID
std::wstring templateId;
// [TODO] Optional : Setting the value defined in the template message
std::map<std::wstring, std::wstring> arguments;
KakaoGame::Data::KGResult result;
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Send guild chat message
kgKakaoGuildChat.sendGuildChatMessage(worldId, guildId, templateId, arguments, result);
if (result.isSuccess()) {
// Successfully sending guild chat messageKakaoGame::Data::KGResult result;
bool isAgreed;
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Show guild chat user consent window
kgKakaoGuildChat.showGuildChatAgreementView(result, isAgreed);
if (result.isSuccess()) {
// Guild chat user consent window pop up successfully
if (isAgreed) {
// KakaoTalk Guild Chat User Consent Acquisition
}
else {
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
}
else {
// |
|
Failedsend message
if (KakaoGame::Data::KGResultCode::ExceedDailyUsage == result.code) {
// Occurs when the daily quota (regardless of recipient) that one person can send for a specific app is exceeded
}
else {
// Other errors
}
}
Windows Async
코드 블럭 |
#include "KakaoGameLib.h"
// [TODO] Set World ID
std::wstring worldId;
// [TODO] Set Guild ID
std::wstring guildId;
// [TODO] Set Template ID
std::wstring templateId;
// [TODO] Optional : Setting the value defined in the template message
std::map<std::wstring, std::wstring> arguments;
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Send guild chat message
kgKakaoGuildChat.sendGuildChatMessage(worldId, guildId, templateId, arguments, [this](KakaoGame::Data::KGResult result) {
if (result.isSuccess()) {
// Successfully sending guild chat message
}
else {
// Failed to send guild chat message
if (KakaoGame::Data::KGResultCode::ExceedDailyUsage == result.code) {
// Occurs when the daily quota (regardless of recipient) that one person can send for a specific app is exceeded
}
else {
// Other errors
}
}
}Windows Async
코드 블럭 |
---|
#include "KakaoGameLib.h"
KakaoGame::API::KGKakaoGuildChat kgKakaoGuildChat;
// Show guild chat user consent window
kgKakaoGuildChat.showGuildChatAgreementView([this](KakaoGame::Data::KGResult result, bool isAgreed) {
if (result.isSuccess()) {
// Guild chat user consent window pop up successfully
if (isAgreed) {
// KakaoTalk Guild Chat User Consent Acquisition
}
else {
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
}
else {
// Failure to open guild chat user consent window
}
}, reinterpret_cast<HWND>(GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle());
|
|
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// Show guild chat user consent window
FKGKakaoGuildChat::ShowGuildChatAgreementView(FKGResultWitIsAgreedDelegate::CreateLambda([=](FKGResult result, bool isAgreed) {
if (result.IsSuccess())
{
// Guild chat user consent window pop up successfully
if (isAgreed == true)
{
// KakaoTalk Guild Chat User Consent Acquisition
}
else
{
// KakaoTalk guild chat user consent failure (when closing or canceling the user consent window)
}
}
else
{
// Failure to open guild chat user consent window
}
})); |
|
정보 |
---|
Message Template V2 If you use Message Template V2, please refer to the following guide. (LINK) |
...