For games with online feature, you must integrate the following
1) Prevention of excessive immersion in games (in section 4) (click here)
2) Shutdown ⇒ only for games with age rating of below 19. (click here)
If you have any questions, feel free to contact STOVE Store Support.
PC SDK provides API to integrate additional services into games.
Additional services supported by PC SDK include custom event log, PC SDK version inquiry, over-immersion prevention notification, shutdown notification, tracking clue inquiry.
Games can send custom in-game events (game logs) to the Stove platform. Also, the game can query the semantic version of the PC SDK currently in use.
PC SDK semantic version inquiry can be obtained as a return value, not a callback.
The Over Immersion Prevention Alert delivers a warning phrase about over immersion in the game through a callback every hour.
Shutdown notification is a system that restricts children under the age of 18 from using the game at a specific time per day of the week by their parents. When the requirements are met, notifications are delivered through callbacks up to 4 times.
1. Callback setting
In order to communicate with the PC SDK using the additional service API, the game must define a delegate function to connect to the callback pointer of the StovePCCallback structure below.
public class StovePCCallback
{
public StovePCErrorDelegate OnError;
public StovePCInitializationCompleteDelegate OnInitializationComplete;
public StovePCTokenDelegate OnToken;
public StovePCUserDelegate OnUser;
public StovePCOwnershipDelegate OnOwnership;
public StovePCStatDelegate OnStat;
public StovePCSetStatDelegate OnSetStat;
public StovePCAchievementDelegate OnAchievement;
public StovePCAllAchievementDelegate OnAllAchievement;
public StovePCRankDelegate OnRank;
// Callback called when StashCustomEvent processing is complete
public StovePCStashCustomEventDelegate OnStashCustomEvent;
// ADD 2.6.0 Start
// Callback that is called every hour to prevent over-immersion
public StovePCOverImmersionDelegate OnOverImmersion;
// Callback to be called on shutdown limit
public StovePCShutdownDelegate OnShutdown;
// 2.6.0 End
}
Plain Text
복사
Connect the delegate to the callback of the StovePCCallback class as in Integrating 2) Config, Callback Settings.
// Create StovePCCallback class instance
this.callback = new StovePCCallback
{
OnError = new StovePCErrorDelegate(this.OnError),
OnInitializationComplete = new StovePCInitializationCompleteDelegate(this.OnInitializationComplete),
OnToken = new StovePCTokenDelegate(this.OnToken),
OnUser = new StovePCUserDelegate(this.OnUser),
OnOwnership = new StovePCOwnershipDelegate(this.OnOwnership),
// game support service
OnStat = new StovePCStatDelegate(this.OnStat),
OnSetStat = new StovePCSetStatDelegate(this.OnSetStat),
OnAchievement = new StovePCAchievementDelegate(this.OnAchievement),
OnAllAchievement = new StovePCAllAchievementDelegate(this.OnAllAchievement),
OnRank = new StovePCRankDelegate(this.OnRank),
//Extra service
OnStashCustomEvent = new StovePCStashCustomEventDelegate(this.OnStashCustomEvent)
// ADD 2.6.0 Start
OnOverImmersion = new StovePCOverImmersionDelegate(this.OnOverImmersion);
OnShutdown = new StovePCShutdownDelegate(this.OnShutdown);
// 2.6.0 End
};
Plain Text
복사
You are not required to implement the OnStashCustomEvent callback. You only need to connect if your game uses the custom event log feature.
Warning
The OnOverImmersion callback must be implemented if legally required to prevent overimmersion/addiction to games.
The OnShutdown callback must be implemented if a selective shutdown is required by law.
2. Logging custom events
Log custom events (game logs) with StovePC.StashCustomEvent function.
// input parameters
// string name: event name
// string category1 : primary category name
// string category2: 2nd category name
// float simpleValue : simple value
// StovePCCustomEventParameter[] parameters : detailed parameter information
StovePCResult result = StovePC.StashCusomEvent("EVENT_NAME", "CATEGORY1", "CATEGORY2", 1.0f, parameters);
if(result == StovePCResult.NoError)
{
// handle success
}
Plain Text
복사
When the StovePC.StashCustomEvent function is successfully processed, the OnStashCustomEvent callback is called.
The StovePCCustomEvent structure passed to the callback contains the event name, primary category name, secondary category name, and simple values passed when calling the API.
The StovePCCustomEventParameter structure passed to the callback contains parameter information passed when calling the API.
void OnStashCustomEvent(StovePCCustomEvent customEvent, StovePCCustomEventParameter[] parameters)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("OnStashCustomEvent");
sb.AppendFormat(" - customEvent.Name : {0}" + Environment.NewLine, customEvent.Name);
sb.AppendFormat(" - customEvent.Category1 : {0}" + Environment.NewLine, customEvent.Category1);
sb.AppendFormat(" - customEvent.Category2 : {0}" + Environment.NewLine, customEvent.Category2);
sb.AppendFormat(" - customEvent.SimpleValue : {0}" + Environment.NewLine, customEvent.SimpleValue.ToString());
sb.AppendFormat(" - parameters.Length : {0}" + Environment.NewLine, parameters.Length);
for (int i = 0; i < parameters.Length; i++)
{
sb.AppendFormat(" - parameters[{0}].Name : {1}" + Environment.NewLine, i, parameters[i].Name);
sb.AppendFormat(" - parameters[{0}].Value : {1}", i, parameters[i].Value);
if (i < parameters.Length - 1)
sb. AppendFormat(Environment. NewLine);
}
Debug.Log(sb.ToString());
}
Plain Text
복사
If an error occurs while running the StovePC_StashCustomEvent function, the OnError callback is called.
3. Get PC SDK semantic version
Use the StovePC.GetSDKVersion function to retrieve the version information of the PC SDK currently being linked.
string version = StovePC.GetSDKVersion();
if(version != "")
{
// handle success
}
Plain Text
복사
4. Prevention of excessive immersion in games
The OnOverImmersion callback is called every hour after starting the game.
The StovePCOverImmersion structure passed to the callback contains the message, the elapsed time of using the game, and the minimum exposure time (in seconds) of the message.
•
StovePCOverImmersion.Message: Overimmersion message
•
StovePCOverImmersion.ElapsedTimeInHours: Elapsed time
•
StovePCOverImmersion.MinExposureTimeInSeconds : Minimum exposure time of message (in seconds)
The message is translated based on the language set in the PC SDK.
private void OnOverImmersion(StovePCOverImmersion overImmersion)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("OnOverImmersion");
sb.AppendFormat(" - overImmersion.Message : {0}" + Environment.NewLine, overImmersion.Message);
sb.AppendFormat(" - overImmersion.ElapsedTimeInHours : {0}" + Environment.NewLine, overImmersion.ElapsedTimeInHours.ToString());
sb.AppendFormat(" - overImmersion.MinExposureTimeInSeconds : {0}", overImmersion.MinExposureTimeInSeconds.ToString());
Debug.Log(sb.ToString());
}
Plain Text
복사
Guide to over-immersion messages
게임을 플레이한 지 1 시간이 지났습니다. 과도한 게임이용은 정상적인 일상생활에 지장을 줄 수 있습니다.
5. Shutdown
After starting the game, the OnShutdown callback is called based on the timetable registered in the shutdown system only for those subject to selective shutdown.
The OnShutdown callback can be called up to 4 times, and the time it is called and the actions to be taken in the game are as follows.
•
Shutdown event after successful PCSDK initialization
◦
Shutdown notification 10 minutes ago: Shows only notification that you will be logged out after 10 minutes
◦
Notification of shutdown 5 minutes ago: Shows only notification that you will be logged out after 5 minutes
◦
Shutdown notification 1 minute ago: Displays only notification that you will be logged out after 1 minute
◦
Shutdown Notification: Displays a notification that you will be logged out and ends the game immediately upon user confirmation
The StovePCShutdown structure passed to the callback contains the remaining time until shutdown, the message, and the message exposure time (in seconds).
•
StovePCShutdown.InadvanceTimeInMinutes: The remaining time (minutes) until the user shuts down. If 0, the game ends immediately.
•
StovePCShutdown.Message : Shutdown notification message
•
StovePCShutdown.ExposureTimeInSeconds: message exposure time (seconds)
private void OnShutdown(StovePCShutdown shutdown)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("OnShutdown");
sb.AppendFormat(" - shutdown.InadvanceTimeInMinutes : {0}" + Environment.NewLine, shutdown.InadvanceTimeInMinutes.ToString());
sb.AppendFormat(" - shutdown.Message : {0}" + Environment.NewLine, shutdown.Message);
sb.AppendFormat(" - shutdown.ExposureTimeInSeconds : {0}", shutdown.ExposureTimeInSeconds.ToString());
Debug.Log(sb.ToString());
}
Plain Text
복사
Shutdown Message Information
10 minutes : 회원님은 게임 시간 선택제 적용 대상으로 10 분 후 게임 이용이 제한됩니다.
5 minutes : 회원님은 게임 시간 선택제 적용 대상으로 5 분 후 게임 이용이 제한됩니다.
1 minutes : 회원님은 게임 시간 선택제 적용 대상으로 1 분 후 게임 이용이 제한됩니다.
0 minutes : 회원님은 게임 시간 선택제 적용 대상으로 게임 이용이 제한되어 게임을 종료합니다.
6. Tracking clue search
Retrieve a set of clues for tracing stove platform logs with StovePC.GetTraceHint function.
StovePCTraceHint traceHint = StovePC.GetTraceHint();
if (traceHint.Result == StovePCResult.NoError)
{
sb.AppendLine("GetTraceHint Success");
sb.AppendFormat(" - traceHint.SessionId : {0}" + Environment.NewLine, traceHint.SessionId);
sb.AppendFormat(" - traceHint.RefSessionId : {0}" + Environment.NewLine, traceHint.RefSessionId);
sb.AppendFormat(" - traceHint.Uuid : {0}" + Environment.NewLine, traceHint.Uuid);
sb.AppendFormat(" - traceHint.ServiceProtocol : {0}" + Environment.NewLine, traceHint.ServiceProtocol);
sb.AppendFormat(" - traceHint.RefSourceType : {0}", traceHint.RefSourceType);
Debug.Log(sb.ToString());
}
else
{
// handle failure
}
Plain Text
복사
The StovePC.GetTraceHint function returns a StovePCTraceHint structure.
The returned StovePCTraceHint structure includes the session ID and reference session ID.
Also included are error codes for function calls.