Exemple #1
0
    public override void OnInit()
    {
        base.OnInit();
        UIMainText  = null;
        m_yesButton = FindChild("confirm");
        m_noButton  = FindChild("cancel");
        m_textLabel = FindChild("textLabel");

        m_oneButton = FindChild("OneButton");
        m_twoButton = FindChild("TwoButton");
        //AddPropChangedNotify((int)MVCPropertyID.enMainPlayer, OnPropertyChanged);
    }
Exemple #2
0
    void Reset()
    {
        UILabel label = m_textLabel.GetComponent <UILabel>();

        if (null != label)
        {
            label.text = "";
        }
        if (null != UIMainText)
        {
            UIMainText.HideWindow();
            UIMainText.Destroy();
            UIMainText = null;
        }
    }
Exemple #3
0
    public void ShowMsgBox(OnButtonCallbacked yesCallbacked, OnButtonCallbacked noCallbacked, UICommonMsgBoxCfg boxCfg)
    {
        Reset();
        m_yesCallbacked = yesCallbacked;
        m_noCallbacked  = noCallbacked;
        if (!string.IsNullOrEmpty(boxCfg.yesIcon))
        {
            UISprite sprite = m_yesButton.GetComponent <UISprite>();
            sprite.spriteName = boxCfg.yesIcon;
        }
        if (!string.IsNullOrEmpty(boxCfg.noIcon))
        {
            UISprite sprite = m_noButton.GetComponent <UISprite>();
            sprite.spriteName = boxCfg.noIcon;
        }

        // 显示一个按钮
        if (boxCfg.buttonNum == 1)
        {
            m_oneButton.SetActive(true);
            m_twoButton.SetActive(false);
        }
        // 显示两个按钮
        else
        {
            m_oneButton.SetActive(false);
            m_twoButton.SetActive(true);
        }

        if (boxCfg.isUsePrefab)
        {
            UIMainText = UIMsgBoxMainText.Load(boxCfg.mainTextPrefab);
            UIMainText.SetParent(m_textLabel);
            UIMainText.ShowWindow();
        }
        else
        {
            UILabel label = m_textLabel.GetComponent <UILabel>();
            if (null != label)
            {
                label.text = boxCfg.mainTextPrefab;
            }
        }
        ShowWindow();
    }
    public void ShowMsgBox(OnButtonCallbacked yesCallbacked, OnButtonCallbacked noCallbacked, OnButtonCallbacked refuserCallbacked, UIFriendCfgItem boxCfg)
    {
        m_yesCallbacked     = yesCallbacked;
        m_noCallbacked      = noCallbacked;
        m_refuserCallbacked = refuserCallbacked;
        if (!string.IsNullOrEmpty(boxCfg.yesIcon))
        {
            UISprite sprite = m_yesButton.GetComponent <UISprite>();
            sprite.spriteName = boxCfg.yesIcon;
        }
        if (!string.IsNullOrEmpty(boxCfg.noIcon))
        {
            UISprite sprite = m_noButton.GetComponent <UISprite>();
            sprite.spriteName = boxCfg.noIcon;
        }

        // 显示按钮
        switch (boxCfg.buttonNum)
        {
        case 1:
            InsertOneButton();
            break;

        case 2:
            InsertTwoButton();
            break;

        case 3:
            InsertThreeButton();
            break;

        default:
            InsertOneButton();
            break;
        }
        if (boxCfg.isUsePrefab)
        {
            int tmpIndex = 0;
            foreach (string prefabStr in boxCfg.textPrefabList)
            {
                UIMsgBoxMainText UITmpText = UIMsgBoxMainText.Load(prefabStr);
                UITmpText.SetParent(m_messageInfoList[tmpIndex++]);
                UITmpText.WindowRoot.transform.localPosition = Vector3.zero;
                UITmpText.ShowWindow();
            }
        }
        else
        {
            int tmpIndex = 0;
            foreach (string prefabStr in boxCfg.textPrefabList)
            {
                UILabel label = m_messageInfoList[tmpIndex++].GetComponent <UILabel>();
                if (null != label)
                {
                    label.text = prefabStr;
                }
            }


//             foreach (GameObject tmpMsg in m_messageInfoList)
//             {
//                 UILabel label = tmpMsg.GetComponent<UILabel>();
//                 if (null != label)
//                 {
//                     label.text = boxCfg.textPrefabList[tmpIndex++];
//                 }
//             }
        }
        if (null != m_insertUIWnd)
        {
            m_insertUIWnd.SetParent(m_InsertItemPrefa);
            m_insertUIWnd.WindowRoot.transform.localPosition = new Vector3(0, 0, 0);
            m_insertUIWnd.WindowRoot.SetActive(true);
            m_insertUIWnd.SetLocalScale(Vector3.one);
            UIPanel panel = m_insertUIWnd.WindowRoot.GetComponent <UIPanel>();
            panel.depth = this.WindowRoot.GetComponent <UIPanel>().depth + 1;
            m_insertUIWnd.ShowWindow();
        }
        ShowWindow();
    }