Exemplo n.º 1
0
    //public Screen getMainScreen()
    //{
    //    for (int i = 0; i < Screen.AllScreens.Length; i++)
    //    {
    //        Screen scr = Screen.AllScreens[i];
    //        if (scr.Bounds.X == 0 && scr.Bounds.Y == 0)
    //        {
    //            return scr;
    //        }
    //    }
    //    return Screen.AllScreens[0];
    //}

    //public Screen getSecondScreen()
    //{
    //    for (int i = 0; i < Screen.AllScreens.Length; i++)
    //    {
    //        Screen scr = Screen.AllScreens[i];
    //        if ((scr.Bounds.X != 0 || scr.Bounds.Y != 0) && !(scr.Bounds.X == 0 && scr.Bounds.Y == 0))
    //        {
    //            return scr;
    //        }
    //    }
    //    return Screen.AllScreens[0];
    //}



    void OnGUI()
    {
        if (GUI.Button(new Rect(200, 200, 200, 200), "OpenGame"))
        {
            VRSettings.enabled = false;
            OpenVR.ShutdownInternal();

            //Application.OpenURL("D:/testgame/Game/备选/Knockout/Knockout.exe");
            StartProcess("D:/testgame/Game/备选/Knockout/Knockout.exe");
            //StartProcess(@"D:/testgame/Game/备选/HoloBall光之球/HoloBall/HoloBall.exe");
            //SetWindowLong(GetActiveWindow(), GWL_STYLE, WS_BORDER);
            SetWindowPos(OpenWin, -1, (int)screenPosition.x, (int)screenPosition.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW);
        }

        if (GUI.Button(new Rect(500, 200, 200, 200), "CloseGame"))
        {
            //KillProcess("Knockout");
            if (proo != null && !proo.HasExited)
            {
                proo.Kill();
                proo = null;
            }
            EVRInitError a = EVRInitError.None;
            OpenVR.InitInternal(ref a, EVRApplicationType.VRApplication_Scene);
            VRSettings.enabled = true;
        }
    }