示例#1
0
文件: Main.cs 项目: HeroVR/Omniverse
    void OnOVSDKInit()
    {
        Debug.Log("OnOVSDKInit: " + OVSDK.GetInitResult());

        OVSDK.DeviceInfo dev = OVSDK.GetDeviceInfo();
        Debug.Log("shop=" + dev.sShopName + ";shopid=" + dev.nShop + ";shop_category=" + dev.sCategory + ";device_sn=" + dev.sNo);

        OVSDK.UserInfo user = OVSDK.GetUserInfo();
        Debug.Log(string.Format("{0}name={1};id={2};phone={3};qrcode={4};balance={5}", OVSDK.IsGuest() ? "[GUEST]" : "", user.sUserName, user.nUserId, user.sUserPhone, user.sQrcode, user.nUserBalance));

        OnClickLoadGame();

//#if UNITY_EDITOR
        OVSDK.CheckOmniViveAvailable();
//#endif

        // buttons in sample-scene
        OVSDK._ControllerRay.RayVisibility = OVControllerRay.RayVisibility_AlwaysShow;

        if (_MsgboxIniting != null)
        {
            _MsgboxIniting.Close();
            _MsgboxIniting = null;
        }

        if (OVSDK.GetUserInfo().nGamePrepareLeft > 0)
        {
            //OVMsgBox hmb = OVSDK.MsgBox("prepare_game", OVSDK.GetString("PrepareStage"), OVSDK.GetString("PrepareConfirm"), OVSDK.GetString("Close"), "", OVSDK.GetUserInfo().nGamePrepareLeft);
            //hmb._onEvent = OnPrepareMsgBoxEvent;
        }
        else
        {
            //OVSDK.MsgBox("", OVSDK.GetString("InitResult"), OVSDK._sInitResult, OVSDK.GetString("Close"));
        }
    }
示例#2
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    static bool onMsgBoxSystemMenuEvent(OVMsgBox hmb, string sEvent, GameObject go)
    {
        if (sEvent == "click")
        {
            if (go.name == "Yes")
            {
                ExitGame(true);
                if (!DllIsDevMode())
                {
                    MsgBox("", "", GetString("Wait"));
                }
            }
            else if (go.name == "No")
            {
                ExitGame(false);
                if (!DllIsDevMode())
                {
                    MsgBox("", "", GetString("Wait"));
                }
            }

            hmb.Close();
            return(true);
        }

        return(false);
    }
示例#3
0
文件: Main.cs 项目: HeroVR/Omniverse
    void Start()
    {
        OVSDK.Init(1000, "01ec17dac7140c0fbe936ee128310000", "omni=1");

        OVSDK.LoadString("SampleString");
        _MsgboxIniting = OVSDK.MsgBox("", "", OVSDK.GetString("WaitInit"));
    }
示例#4
0
文件: Main.cs 项目: HeroVR/Omniverse
 bool OnClickSampleMsgBoxOK(OVMsgBox hmb, string sEvent, GameObject sender)
 {
     if (sEvent == "click")
     {
         Debug.Log("sample msgbox ok clicked.");
         hmb.Close();
         return(true);
     }
     return(false);
 }
示例#5
0
文件: Main.cs 项目: HeroVR/Omniverse
    public void OnClickSampleMsgBox()
    {
        OVMsgBox hmb = OVSDK.MsgBox("", "OVSDK", "Hello World!!", OVSDK.GetString("OK"));

        hmb._onEvent = OnClickSampleMsgBoxOK;
        // test MsgBoxJson;
        //if (OVMsgBoxMenu._AllMsgBoxJson.Count == 0)	{
        //	OVSDK.MsgBoxJson("test");
        //}
        //else {
        //	OVSDK.onEventMsgBoxJsonText("test ExtendButton 1|<size=14><color=#FFFFFF>Remaining Game time : </color><color=#00FFFF>{0} Min.</color></size>");
        //}
    }
示例#6
0
文件: Main.cs 项目: HeroVR/Omniverse
    bool OnPrepareMsgBoxEvent(OVMsgBox hmb, string sEvent, GameObject sender)
    {
        if (sEvent == "timeout")
        {
            hmb.Reset("prepare_game_done", null, OVSDK.GetString("PrepareEnd"), OVSDK.GetString("OK"));
            return(true);
        }

        if (sEvent == "click" && sender.name == "OK" && hmb.usage == "prepare_game")
        {
            OVSDK.ConfirmPlayGame();
        }
        return(false);
    }
示例#7
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    public static OVMsgBox MsgBox(string sUsage = "", string sTitle = "", string sContent = "", string sYes = "", string sNo = "", int nTimeout = 0, OVMsgBoxTimeoutAct nTimeoutAct = OVMsgBoxTimeoutAct.Close)
    {
        OVMsgBox   hmb = null;
        GameObject mb  = GameObject.Instantiate(Resources.Load("OVSDK_MsgBox"), Vector3.zero, Quaternion.identity) as GameObject;

        if (mb)
        {
            hmb = mb.GetComponentInChildren <OVMsgBox>();
            if (hmb)
            {
                hmb.Reset(sUsage, sTitle, sContent, sYes, sNo, nTimeout, nTimeoutAct);
            }
        }
        return(hmb);
    }
示例#8
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    private static void onEventResumeGame(string sJson)
    {
        if (_MsgboxResumeGame)
        {
            _MsgboxResumeGame.Close();
            _MsgboxResumeGame = null;
        }

        if (!_DisableResumeGame)
        {
            _ResumeGameInfo = JsonUtility.FromJson <ResumeGameInfo>(sJson);
            string tx = string.Format(GetString("ResumeConfirm"), _ResumeGameInfo.reAmt.ToString("F2"), _ResumeGameInfo.reTicket.ToString());
            _MsgboxResumeGame          = MsgBox("ResumeGame", GetString("Resume"), tx, GetString("ResumeYes"), GetString("ResumeNo"), 15, OVMsgBoxTimeoutAct.Close);
            _MsgboxResumeGame._onEvent = onMsgBoxResumeGame;
        }
    }
示例#9
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    private static void onEventResumeGameResult(string sRet)
    {
        if (sRet.Length > 0)
        {
            MsgBox("", "", string.Format(GetString("ResumeFailed"), sRet), "", "", 10, OVMsgBoxTimeoutAct.Close);
        }
        else
        {
            MsgBox("", "", GetString("ResumeSuccess"), "", "", 2);
        }

        if (_MsgboxResumeGame)
        {
            _MsgboxResumeGame.Close();
            _MsgboxResumeGame = null;
        }
    }
示例#10
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    static bool onMsgBoxBuy(OVMsgBox hmb, string sEvent, GameObject go)
    {
        if (hmb.usage == "buy.confirm" && sEvent == "click" && go.name == "Yes")
        {
            DllBuy(_BuyParam.sItem, _BuyParam.nPrice, _BuyParam.sOutTradeNo);
            hmb.Reset("buy.request", "", GetString("Wait"));
            return(true);
        }

        if (sEvent == "destroy")
        {
            if (hmb == _MsgboxBuy)
            {
                _MsgboxBuy = null;
            }
        }

        return(false);
    }
示例#11
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
    private static bool onMsgBoxResumeGame(OVMsgBox hmb, string sEvent, GameObject sender)
    {
        if (sEvent == "click")
        {
            if (sender.name == "Yes")
            {
                if (hmb == _MsgboxResumeGame)
                {
                    if (_ResumeGameInfo.isAgain != 0)
                    {
                        DllSendCommand(3, "", 0);
                        hmb.Reset(null, "", GetString("Wait"));
                        return(true);
                    }
                    else
                    {
                        hmb.Reset(null, "", GetString("ResumeError"), "", "", 5, OVMsgBoxTimeoutAct.QuitGame);
                        return(true);
                    }
                }
            }
            else if (sender.name == "No")
            {
                if (hmb == _MsgboxResumeGame)
                {
                    hmb.Reset(null, "", GetString("Bye"), "", "", 3, OVMsgBoxTimeoutAct.QuitGame);
                    return(true);
                }
            }
        }
        else if (sEvent == "destroy")
        {
            if (hmb == _MsgboxResumeGame)
            {
                _MsgboxResumeGame = null;
            }
        }

        return(false);
    }
示例#12
0
    void UpdateVisibility()
    {
        if (null == _Ray[1].line)
        {
            _bShow = false;
        }

        bool value = _nRayVisibility == RayVisibility_AlwaysShow ||
                     (_nRayVisibility == RayVisibility_Auto && OVMsgBox.GetCount() > 0);

        if (_bShow == value)
        {
            return;
        }

        if (_bShow != value)
        {
            if (value)
            {
                SteamVR_Events.NewPoses.Listen(OnControllerNewPoses);
            }
            else
            {
                SteamVR_Events.NewPoses.Remove(OnControllerNewPoses);
            }
        }
        if (value)
        {
            if (null == _Ray[1].line)
            {
                GameObject prefab       = Resources.Load <GameObject>("OVSDK_Ray");
                GameObject prefab_spark = Resources.Load <GameObject>("OVSDK_Spark");
                if (prefab)
                {
                    for (int i = 0; i < RAY_COUNT; ++i)
                    {
                        GameObject t = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
                        t.layer               = 31;
                        _Ray[i].line          = t.transform;
                        _Ray[i].line_renderer = t.transform.Find("Line").GetComponent <LineRenderer>();
                        _Ray[i].line.gameObject.SetActive(false);

                        if (_Ray[i].line_renderer && i == RAY_MOUSE)
                        {
                            _Ray[i].line_renderer.transform.localRotation = Quaternion.identity;
                        }
                        if (prefab_spark != null)
                        {
                            _Ray[i].spark = GameObject.Instantiate(prefab_spark, Vector3.zero, Quaternion.identity) as GameObject;
                            _Ray[i].spark.SetActive(false);
                        }
                    }
                }
            }
        }

        _bShow = value;
        if (_bShow)
        {
            if (_OVSDKCamera == null)
            {
                CreateOVSDKCamera();
            }
            _OVSDKCamera.enabled     = true;
            _nMainCameraCullingMask  = Camera.main.cullingMask;
            Camera.main.cullingMask &= ~_nCollideLayerMask;
        }
        else
        {
            if (_OVSDKCamera != null)
            {
                _OVSDKCamera.enabled = false;
            }
            Camera.main.cullingMask = _nMainCameraCullingMask;
            foreach (RayData i in _Ray)
            {
                if (i.line != null)
                {
                    i.line.gameObject.SetActive(false);
                }
                if (i.spark != null)
                {
                    i.spark.SetActive(false);
                }
            }
        }
    }
示例#13
0
文件: Main.cs 项目: HeroVR/Omniverse
 public void OnClickLoadGame()
 {
     OVSDK.LoadGameData(OnLoadGameDone);
     _MsgboxLoadingGame = OVSDK.MsgBox("LoadGame", "Loading", "Loading saved game data...");
 }
示例#14
0
文件: OVSDK.cs 项目: HeroVR/Omniverse
 public static int GetDlgNum()
 {
     return(OVMsgBox.GetVisibleCount());
 }