Exemplo n.º 1
0
    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"));
        }
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    void Start()
    {
        OVSDK.Init(1000, "01ec17dac7140c0fbe936ee128310000", "omni=1");

        OVSDK.LoadString("SampleString");
        _MsgboxIniting = OVSDK.MsgBox("", "", OVSDK.GetString("WaitInit"));
    }
Exemplo n.º 4
0
 bool OnClickSampleMsgBoxOK(OVMsgBox hmb, string sEvent, GameObject sender)
 {
     if (sEvent == "click")
     {
         Debug.Log("sample msgbox ok clicked.");
         hmb.Close();
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
    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>");
        //}
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
    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;
        }
    }
Exemplo n.º 9
0
    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;
        }
    }
Exemplo n.º 10
0
    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);
    }
Exemplo n.º 11
0
    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);
    }
Exemplo n.º 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);
                }
            }
        }
    }
Exemplo n.º 13
0
 public void OnClickLoadGame()
 {
     OVSDK.LoadGameData(OnLoadGameDone);
     _MsgboxLoadingGame = OVSDK.MsgBox("LoadGame", "Loading", "Loading saved game data...");
 }
Exemplo n.º 14
0
 public static int GetDlgNum()
 {
     return(OVMsgBox.GetVisibleCount());
 }