콘솔에 이미지를 등록한 후 사용자에게 공지를 띄울 수 있습니다.
이미지 공지를 화면에 띄워 줍니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE
static void ShowImageNotices(GamebaseRequest.ImageNotice.Configuration configuration, GamebaseCallback.ErrorDelegate closeCallback, GamebaseCallback.GamebaseDelegate<string> eventCallback = null)
Example
public void ShowImageNotices()
{
Gamebase.ImageNotice.ShowImageNotices(
null,
(error) =>
{
// Called when the entire imageNotice is closed.
...
},
(scheme, error) =>
{
// Called when custom event occurred.
...
});
}
사용자 설정 이미지 공지를 화면에 띄워 줍니다. GamebaseRequest.ImageNotice.Configuration으로 사용자 설정 이미지 공지를 만들 수 있습니다.
Example
public void ShowImageNotices(int colorR = 0 , int colorG = 0, int colorB = 0, int colorA = 128, long timeOut = 5000)
{
GamebaseRequest.ImageNotice.Configuration configuration = new GamebaseRequest.ImageNotice.Configuration();
configuration.colorR = colorR;
configuration.colorG = colorG;
configuration.colorB = colorB;
configuration.colorA = colorA;
configuration.timeOut = timeOut;
Gamebase.ImageNotice.ShowImageNotices(
configuration,
(error) =>
{
// Called when the entire imageNotice is closed.
...
},
(scheme, error) =>
{
// Called when custom event occurred.
...
});
}
Parameter | Values | Description |
---|---|---|
colorR | 0~255 | 내비게이션 바 색상 R |
colorG | 0~255 | 내비게이션 바 색상 G |
colorB | 0~255 | 내비게이션 바 색상 B |
colorA | 0~255 | 내비게이션 바 색상 Alpha |
timeoutMS | long | 이미지 공지 최대 로딩 시간 (단위 : millisecond) default: 5000 |
closeImageNotices API를 호출하여 현재 표시 중인 이미지 공지를 모두 종료할 수 있습니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE
static void CloseImageNotices()
WebView를 표시합니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE
static void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, GamebaseCallback.ErrorDelegate closeCallback = null, List<string> schemeList = null, GamebaseCallback.GamebaseDelegate<string> schemeEvent = null)
Standalone에서는 WebViewAdapter를 통해서 WebView를 지원하며 WebView가 열려 있을 때 UI로 입력되는 Event를 Blocking하지 않습니다.
Example
private void SchemeEvent(string scheme, GamebaseError error)
{
Debug.Log(string.Format("[SchemeEvent] scheme:{0}", scheme));
}
private void CloseCallback(GamebaseError error)
{
Debug.Log("CloseCallback");
}
public void ShowWebView()
{
GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = new GamebaseRequest.Webview.GamebaseWebViewConfiguration();
configuration.title = "Title";
configuration.orientation = GamebaseScreenOrientation.Portrait;
configuration.colorR = 128;
configuration.colorG = 128;
configuration.colorB = 128;
configuration.colorA = 255;
configuration.barHeight = 40;
configuration.buttonVisible = true;
var schemeList = new List<string>() { "customScheme://openBrowser" };
Gamebase.Webview.ShowWebView("https://www.toast.com/", configuration, CloseCallback, schemeList, SchemeEvent);
}
Parameter | Values | Description |
---|---|---|
title | string | WebView의 제목 |
orientation | GamebaseScreenOrientation.UNSPECIFIED | 미지정 |
GamebaseScreenOrientation.PORTRAIT | 세로 모드 | |
GamebaseScreenOrientation.LANDSCAPE | 가로 모드 | |
GamebaseScreenOrientation.LANDSCAPE_REVERSE | 가로 모드를 180도 회전 | |
contentMode | GamebaseWebViewContentMode.RECOMMENDED | 현재 플랫폼 추천 브라우저 |
GamebaseWebViewContentMode.MOBILE | 모바일 브라우저 | |
GamebaseWebViewContentMode.DESKTOP | 데스크탑 브라우저 | |
colorR | 0~255 | 내비게이션 바 색상 R |
colorG | 0~255 | 내비게이션 바 색상 G |
colorB | 0~255 | 내비게이션 바 색상 B |
colorA | 0~255 | 내비게이션 바 색상 Alpha |
buttonVisible | true or false | 뒤로 가기 버튼 활성 또는 비활성 |
barHeight | height | 내비게이션 바 높이 |
backButtonImageResource | ID of resource | 뒤로 가기 버튼 이미지 |
closeButtonImageResource | ID of resource | 닫기 버튼 이미지 |
url | "http://" or "https://" or "file://" | 웹 URL |
[TIP]
iPadOS 13 이상에서 WebView는 기본적으로 데스크탑 모드입니다. contentMode =
GamebaseWebViewContentMode.MOBILE
설정으로 모바일 모드로 변경할 수 있습니다.
Gamebase에서 지정해 놓은 Scheme 입니다.
scheme | 용도 |
---|---|
gamebase://dismiss | WebView 닫기 |
gamebase://goBack | WebView 뒤로가기 |
gamebase://getUserId | 현재 로그인되어 있는 게임 유저의 사용자 ID를 표시 |
gamebase://getMaintenanceInfo | 점검 내용을 WebPage에 표시 |
다음 API를 이용하여 보여지고 있는 WebView를 닫을 수 있습니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE
static void CloseWebview()
ExampleCloseWebview
public void CloseWebview()
{
Gamebase.Webview.CloseWebview();
}
다음 API를 통하여 외부 브라우져를 열 수 있습니다. 파라미터로 전송되는 url은 유효한 값이어야 합니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void OpenWebBrowser(string url)
Example
public void OpenWebBrowser(string url)
{
Gamebase.Webview.OpenWebBrowser(url);
}
시스템 알림을 표시할 수 있습니다. 시스템 알림에 콜백을 등록할 수도 있습니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID
static void ShowAlert(string title, string message)
static void ShowAlert(string title, string message, GamebaseCallback.VoidDelegate buttonCallback)
Example
public void ShowAlertD()
{
Gamebase.Util.ShowAlert
(
"Title",
"Message"
);
}
public void ShowAlertDialog()
{
Gamebase.Util.ShowAlert
(
"Title",
"Message",
() => {
Debug.Log("ButtonClick");
}
);
}
다음 API를 사용하여 쉽게 메시지를 표시할 수 있습니다.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID
static void ShowToast(string message, int duration)
static void ShowToast(string message, GamebaseUIToastType type)
Example
public void ShowToast(string message, int duration)
{
Gamebase.Util.ShowToast(
message,
duration
);
}
public void ShowToast(string message, GamebaseUIToastType type)
{
Gamebase.Util.ShowToast(
message,
type
);
}
Error | Error Code | Description |
---|---|---|
UI_IMAGE_NOTICE_TIMEOUT | 6901 | 이미지 공지 표시 중 타임아웃이 발생했습니다. |
UI_UNKNOWN_ERROR | 6999 | 알수 없는 오류입니다(정의되지 않은 오류입니다). |