Unity
using UnityEngine;
using System;
using Viveport;
public class ViveportDemo : MonoBehaviour
{
static string VIVEPORT_ID = "bd67b286-aafc-449d-8896-bb7e9b351876";
// Use this for initialization
void Start ()
{
Api.Init(InitStatusHandler, VIVEPORT_ID);
}
private static void InitStatusHandler(int nResult)
{
Viveport.Core.Logger.Log("Init(): " + nResult);
if (nResult != 0)
{
Viveport.Core.Logger.Log("Platform setup error ...");
// Handle error
}
Viveport.Core.Logger.Log("Version: " + Api.Version());
Api.QueryRuntimeMode(QueryRunTimeHandler); // QueryRunMode function
}
private static void ShutdownHandler(int nResult)
{
Viveport.Core.Logger.Log("Shutdown(): " + nResult);
if (nResult != 0)
{
// Handle error
}
// Do something
// Do more things
}
private static void QueryRunTimeHandler(int nResult,int nMode)
{
if (nResult == 0)
{
Viveport.Core.Logger.Log("QueryRunTimeHandler is successful" + nResult + "Running mode is " + nMode);
// nMode = 1 (Viveport Desktop mode), nMode = 2 (Viveport Arcade mode)
if (nMode == 1)
{
// Use Viveport API
}
else
{
// Use Viveport Arcade API
}
}
else
{
Viveport.Core.Logger.Log("QueryRunTimeHandler error: " + nResult);
}
}
}