Example #1
0
    public void Reset(string sUsage = "", string sTitle = "", string sContent = "", string sYes = "", string sNo = "", int nTimeout = 0, OVMsgBoxTimeoutAct nTimeoutAct = OVMsgBoxTimeoutAct.Close)
    {
        if (null == _parent)
        {
            _parent   = transform.parent.transform;
            _textTime = SetText("BG/Time", "");
        }

        if (sUsage != null)
        {
            _sUsage = sUsage;
        }

        int btn_count = 0;

        if (sYes.Length != 0)
        {
            ++btn_count;
        }
        if (sNo.Length != 0)
        {
            ++btn_count;
        }

        string[] id  = { "BG/Yes", "BG/No", "BG/OK" };
        int[]    t   = { 2, 2, 1 };
        string[] cap = { sYes, sNo, sYes };
        for (int i = 0; i < 3; ++i)
        {
            Transform btn = transform.Find(id[i]);
            if (btn)
            {
                if (btn_count != t[i])
                {
                    //GameObject.DestroyImmediate(btn.gameObject);
                    btn.gameObject.SetActive(false);
                }
                else
                {
                    btn.gameObject.SetActive(true);
                    // OVUIEventListener.Get(btn.gameObject);
                    transform.Find(id[i] + "/Text").GetComponent <Text>().text = cap[i];
                }
            }
        }

        _nTime       = nTimeout;
        _nTimeoutAct = nTimeoutAct;

        SetText("BG/Title", sTitle);
        SetText("BG/Text", sContent);
        if (nTimeout > 0)
        {
            _textTime = SetText("BG/Time", nTimeout.ToString());
        }
        else
        {
            _textTime = SetText("BG/Time", "");
        }
    }
Example #2
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);
    }