Copy the Plugins/CafeSDKPlugin folder that is included in the sample project to the project. Then, apply the development environment settings as indicated below, depending on the operating system.
2.1 Android Settings
Copy the following file and folder from the Build/Android folder included in the sample project to the project.
ManifestApplicationAdditions.txt
JavaLibs 폴
2.2 iOS 설정
Add project settings to the DefaultEngine.ini file as indicated below.
AdditionalLinkerFlags=-ObjCAdditionalShippingLinkerFlags=-ObjCAdditionalPlistData=<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>gLinkSample</string> </array> </dict> </array><key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict> <key>LSApplicationQueriesSchemes</key><array><string>navercafe</string><string>naversearchapp</string><string>naversearchthirdlogin</string></array> <key>CFBundleURLTypes</key><array><dict><key>CFBundleTypeRole</key><string>Editor</string><key>CFBundleURLSchemes</key><array><string>gLinkSample</string></array></dict></array><key>NSPhotoLibraryUsageDescription</key><string>Access your photos to create a post.</string>
Add framework settings to the Build.cs file as indicated below.
Apply a callback delegate setting to deliver user events that have occurred in PLUG SDK with the callback function.
It is a method that is called by a using callback delegate and it is used for starting / closing PLUG SDK, writing posts (image / video attachment), joining, writing comments, and voting.
Initialization of a plugin that supports the global community and a domestic Naver cafe
When it supports both the global community and a domestic Naver cafe, the initialization setting should be set for both the global community and domestic Naver cafes.
Default channel settings
Settings for the default channel, which is the community for each language on the plugin, is applied with the language that is set on the device.
The following is an example for setting a certain language on the default channel.
If you adjust transparency using the adjustment slider on the upper left side of the plugin screen, you can use the game and the cafe at the same time.
transparency
Description
Alpha value 100%
deliver touch events to the plugin
Alpha value 100% below
deliver touch events to the game
Android
You can set the setTransparentable() method to enable the transparency adjustment slider in the Android environment.
If you set "true" for the isTransparentable parameter value, you can use the transparency adjustment slider (default value: true).
The following is an example of using the transparency adjustment slider.
/** * You can apply setting for using transparency adjustment slider. * * Boolean type value for enabling @param isTransparentable transparency adjustment */Glink.setTransparentable(activity,true)
iOS
Apply the disableTransparentSlider: method setting to use transparency adjustment slider in iOS environment.
(void)disableTransparentSlider:(BOOL)disable;
If you set YES as the disable parameter value, you can use the transparency adjustment slider (default value: YES).
The following is an example of using the transparency adjustment slider.
/* Remove the function for adjusting transparency default : YES */// Use the transparency function[[NCSDKManagergetSharedInstance] disableTransparentSlider:YES];
The following is an example of not using the transparency adjustment slider.
//Remove the transparency function[[NCSDKManagergetSharedInstance] disableTransparentSlider:NO];
Widget
A widget is an element that is automatically displayed on the screen when the fold button is pressed on the plugin. You can use the plugin anywhere in the game by using a widget.
Widget display
You can apply the showWidgetWhenUnloadSDK() method setting in order to display the widget when the fold button is pressed on the plugin.
staticvoidShowWidgetWhenUnloadSdk(bool show)
If you set true on useWidget parameter value, widget is displayed when plug window is folded (default value: true).
The following is an example of displaying the widget.
/** * You can decide whether or not to display the widget when the plugin window is folded. * * Boolean type value for displaying @param useWidget widget */UFUNCTION(BlueprintCallable, Category ="Naver CafeSdk")staticvoidShowWidgetWhenUnloadSdk(bool bUse)
Default position settings for the widget
When the widget is first run, it is displayed on the center-left part of the screen. If you wish to set the default position settings when the widget is first run, use the setWidgetStartPosition() method.
However, when the widget is run again after the user has moved the widget, the widget will be displayed in the position where the user last moved it.
The following is an example for setting the widget's default position to 20% from top, on the right side of the screen.
/** * Apply default position setting for widget. * isLeft: If the value is true, it is displayed on the left. If the value is false, it is displayed on the right. * heightPercentage: You can designate the vertical position using %. **/ UCafeSdkBlueprintLibrary::SetWidgetStartPosition(false,20);
Screen capture
You can capture the game screen by pressing the screen capture button on the widget.
Screen capture button
Screen capture function is run by registering widget screen capture button click listener.
Android
In Android environment, widget screen capture button click listener is registered on following callback function.
You can use the setUseWidgetScreenShot() method to enable screen capture functionality.
staticvoidSetUseScreenshot(boolean use);
If you set useScreenShot parameter value as true, screen capture button is displayed on the widget (default value: true).
The following is an example of not using screen capture function.
/*** Screen capture button is not displayed on the widget.*/UCafeSdkBlueprintLibrary::SetUseScreenshot(true);
Video recording
If you press the video recording button, you can record the game screen while playing the game.
Tasks that should be processed when video recording is complete are carried out by registering OnCafeSdkRecordFinish, which is the recording ended listener
The following is an example of using the recording ended listener.
/** * Register the recording ended callback. */void ACafeSDKSampleProjectGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage){... FCafeSDKPluginModule::OnCafeSdkRecordFinish.AddUObject(this,&ACafeSDKSampleProjectGameMode::OnCafeSdkRecordFinish);... }} /** * Set the recording ended listener. */void ACafeSDKSampleProjectGameMode::OnCafeSdkRecordFinish(const FString& FileUri){ UCafeSdkBlueprintLibrary::StartVideoWrite(FileUri);}
Video recording
If you press the video recording button, you can record the game screen while playing the game.
The video recording function is supported on Android 5.0 or above.
Video recording functionality is supported on iOS 9.0 or above.
Video recording settings
You can use the setUseVideoRecord() method to enable the video recording function.
staticvoidSetUseVideoRecord(bool use)
If you set the use parameter value as true, the video recording button will be displayed on the widget (default value: false).
The video recording button is not displayed on the widget for devices using Android 5.0 or below and iOS 9.0 or below, even if you set the use parameter value as true.
The following is an example of using the video recording function.
/** * You can decide whether to use video recording function. * * Boolean type value for enabling @param use video recording function */... UCafeSdkBlueprintLibrary::SetUseVideoRecord(true);...
Recording ended callback listener
Tasks that should be processed when video recording is ended are carried out by registering the OnCafeSdkRecordFinish listener.
When you press the banner image that is displayed on the home screen of the game plugin, you can go to the App scheme to run game functions.
You can register the banner image for moving to the App scheme from the cafe management menu.
Android
If you set OnCafeSdkClickAppSchemeBanner in the Android environment while there is a banner image that goes to App scheme, the App scheme processing function can be operated when a touch event has occurred.
When pressing a banner image that goes to App scheme in the iOS environment, set the App delegate on openURL: method on the App delegate to process the App scheme as indicated below.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
...// Process the App scheme that is registered on the management menu from the App delegate.//ex : gLinkSample://testif ([[url scheme] isEqualToString:@"gLinkSample"]) {if ([[url host] isEqualToString:@"test"]) { //todo } }...}
Callback listener
Register the callback listener to process events that have occurred in the plugin.
The callback listener is registered on the Unreal Naver cafe plugin library as indicated below.
OnCafeSdkClickAppSchemeBanner is a callback listener that processes events that have occurred when pressing a banner image that goes to the App scheme in an Android environment.
The following is an example of using the post registration listener.
/** Post registration listener settings * Menuld is where @param menuId posts are registered * The number of image files in which @param imageCount is attached * The number of video files in which @param videoCount is attached **/void ACafeSDKSampleProjectGameMode::OnCafeSdkPostedArticle(int32 MenuId, int32 ImageCount, int32 VideoCount){FString Message = FString::Printf(TEXT("OnCafeSdkPostedArticle: %d, %d, %d"), MenuId, ImageCount, VideoCount);ShowMessage(Message);}
Comment registration listener
OnCafeSdkPostedComment is a callback listener that processes events that have occurred when users register comments on posts in the plugin.
OnScreenshotCaptured is callback listener that processes events that have occurred when users pressed the screen capture button on the widget. Refer to "widget” for details about the screen capture button.
The following is an example of using the screen capture button click listener. By using the screen capture function on the callback listener, you can capture the screen when you press the screen capture button.
The following is an example of using the recording ended listener.
/**
* You can decide whether or not to use the video recording function
*
* URI for file route where @param uri video is stored
*/
void ACafeSDKSampleProjectGameMode::OnCafeSdkRecordFinish(const FString& FileUri)
{
UCafeSdkBlueprintLibrary::StartVideoWrite(5, TEXT("subject"), TEXT("text"), FileUri);
}
Game ID linkage
By linking the user’s game ID and cafe ID, they can be managed. You can check for the list of linked game ID and cafe IDs from cafe management menu. In order to link a game ID and cafe ID, the syncGameUserId() method should be used.
static void SyncGameUserId(FString GameUserId)
The following is an example of linking the game ID and cafe ID.
/**
* Link the game ID and cafe ID.
*
* @param gameUserId game ID
*/
void ACafeSDKSampleProjectGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
...
UCafeSdkBlueprintLibrary::SyncGameUserId("userGameID");
...
}
Change theme color
You can change the theme color of the plugin.
In order to change the theme color, the setThemeColor() method is used.
/**
* The default value for the ThemeColorCSSString parameter is ‘#00c73c.’
* The default value for tabBackgroundColorCSSString parameter is ‘#44484e.’
* It is recommended that you use the default value for the tabBackgroundColorCSSString parameter.
**/
void UCafeSdkBlueprintLibrary::SetThemeColor(FString ThemeColorCSSString, FString TabBackgroundColorCSSString)
themeColorCSSString: The default color that is used on the theme (default value: #00c73c)backgroundCSSString: the background color for the tab menu (default value: #44484e). It is recommended that you use the default value.
Caution Do not apply alpha values for the CSS color value.
Correct example: #ff9800
Incorrect example: #e2ff9800
The following is an example of changing the theme color.
The NaverIdLoginBlueprintLibrary.h file is used for the Naver login function.
Init() method
Use the following initialization information to initialize the Naver login functionality.
Client ID received when registering application on the login developer center using Naver IDClient secret received when registering application on the login developer center using Naver ID
The following is an example of initializing the Naver login function.