예제 #1
0
    public static void DeepLinkToApplication(ulong appId, string packageName, string extraData = null, string roomId = null, DeepLinkErrorDelegate errorCallback = null, DeepLinkSuccessDelegate successCallback = null)
    {
        LaunchingOtherApp = true;

        DeepLinkData data = new DeepLinkData();

        data.SenderAppId       = GetAppIDFromConfig();
        data.ExtraData         = extraData;
        data.MultiplayerRoomId = roomId;

#if !UNITY_EDITOR
        data.DeviceId = GetAndroidDeviceID();
#endif

#if !UNITY_EDITOR
        if (packageName.Contains("vrhealth"))
        {
            data.ExtraData = data.ExtraData + ";" + GetAndroidDeviceID();
        }
#endif

        var options = new ApplicationOptions(); options.SetDeeplinkMessage(JsonConvert.SerializeObject(data));
        Oculus.Platform.Application.LaunchOtherApp(appId, options).OnComplete(delegate(Message <string> message)
        {
            if (message.IsError)
            {
                Debug.Log("Error launching other app: " + message.GetError().Message);
                LaunchingOtherApp = false;
                if (errorCallback != null)
                {
                    errorCallback(message.GetError().Message);
                }
            }
            else
            {
                if (successCallback != null)
                {
                    successCallback(message.Data);
                }
            }
        });
    }
    public void ButtonClick()
    {
        //Home_Menu_Control.Current.Loading.gameObject.SetActive(true);

        if (!Home_Menu_Control.Current.loadSceneActivated)
        {
            Home_Menu_Control.Current.loadSceneActivated = true;
            Home_Menu_Control.Current.loadSceneTimer     = 1.5f;


            if (GameVer != StaticHolder.Current.GameVersion)
            {
                if (GameVer == 0) //timeline
                {
                    print("loading timeline");
                    var options = new ApplicationOptions(); options.SetDeeplinkMessage("deep_timeline");
                    try
                    {
                        Oculus.Platform.Application.LaunchOtherApp(2392788894113126, options);
                    }
                    catch (UnityException e)
                    {
                        Debug.LogError("Failed to Launch Deep link");
                        Debug.LogException(e);
                    }
                }
                else if (GameVer == 1) //interview
                {
                    print("loading interview");
                    var options = new ApplicationOptions(); options.SetDeeplinkMessage("deep_interview");
                    try
                    {
                        Oculus.Platform.Application.LaunchOtherApp(2925398060834283, options);
                    }
                    catch (UnityException e)
                    {
                        Debug.LogError("Failed to Launch Deep link");
                        Debug.LogException(e);
                    }
                }
                else if (GameVer == 2) //story
                {
                    print("loading tte");
                    var options = new ApplicationOptions(); options.SetDeeplinkMessage("deep_througheyes");

                    try
                    {
                        Oculus.Platform.Application.LaunchOtherApp(2487172244639921, options);
                    }
                    catch (UnityException e)
                    {
                        Debug.LogError("Failed to Launch Deep link");
                        Debug.LogException(e);
                    }
                }
            }
            else
            {
                if (TimelinePos > 0)
                {
                    StaticHolder.Current.TimelineState = TimelinePos;
                }
                else
                {
                    StaticHolder.Current.TimelineState = 0;
                }
                if (Speaker > 0)
                {
                    StaticHolder.Current.InterviewState = Speaker;
                }
                else
                {
                    StaticHolder.Current.InterviewState = 0;
                }
                if (Home2)
                {
                    StaticHolder.Current.home = true;
                }
                else
                {
                    StaticHolder.Current.home = false;
                }
                if (Saigon2)
                {
                    StaticHolder.Current.saigon = true;
                }
                else
                {
                    StaticHolder.Current.saigon = false;
                }

                if (loaderOverwrite != null)
                {
                    VRpointer.Current.fadepref = loaderOverwrite;
                }

                //Home_Menu_Control.Current.LoadViz();

                VRpointer.Current.SceneSwap(LoadScene);
                Debug.Log(LoadScene + " load scene");
            }
        }
        else
        {
            print("Waiting to process, reset in " + Home_Menu_Control.Current.loadSceneTimer);
        }
    }