Exemple #1
0
    public void ShowMessage(CEvent evt, EMessageType type, Action <bool> callback = null)
    {
        //如果已经显示了,就直接返回
        if (mVisible && evt.GetParamCount() == 0)
        {
            return;
        }
        this.m_eMessageType = type;
        this.m_actCallBack  = callback;
        Show();
        //根据不同的消息类型,显示不同的提示消息
        switch (this.m_eMessageType)
        {
        //如果是重试消息的话
        case EMessageType.EMT_Double:
            this.m_firstButton.gameObject.SetActive(true);
            this.m_secondButton.gameObject.SetActive(true);
            this.m_centerButton.gameObject.SetActive(false);
            this.m_firstButton.normalSprite  = StringConfigManager.GetString("MessageWindow.EMT_Double.TryAgainButton");
            this.m_secondButton.normalSprite = StringConfigManager.GetString("MessageWindow.EMT_Double.QuitButton");
            this.m_title.text   = evt.GetParam("title") as string;   //StringConfigManager.GetString("MessageWindow.EMT_NetTryAgain.Title");
            this.m_content.text = evt.GetParam("content") as string; //StringConfigManager.GetString("MessageWindow.EMT_NetTryAgain.Content");
            break;

        case EMessageType.EMT_Tip:
            this.m_frame.spriteName = StringConfigManager.GetString("EMessageType.EMT_Tip.Frame");
            this.m_firstButton.gameObject.SetActive(false);
            this.m_secondButton.gameObject.SetActive(false);
            this.m_centerButton.gameObject.SetActive(false);
            this.m_title.gameObject.SetActive(false);
            this.m_content.alignment = NGUIText.Alignment.Center;
            this.m_content.text      = evt.GetParam("content") as string;//StringConfigManager.GetString("EMessageType.EMT_UpdateTip.Content1");
            break;

        case EMessageType.EMT_SureTip:
            this.m_frame.spriteName = StringConfigManager.GetString("EMessageType.EMT_Tip.Frame");
            this.m_firstButton.gameObject.SetActive(false);
            this.m_secondButton.gameObject.SetActive(false);
            this.m_centerButton.gameObject.SetActive(true);
            this.m_title.gameObject.SetActive(false);
            this.m_content.alignment = NGUIText.Alignment.Center;
            this.m_content.text      = evt.GetParam("content") as string;
            break;

        case EMessageType.EMT_UpdateDownload:
            this.m_frame.spriteName = StringConfigManager.GetString("EMessageType.EMT_UpdateTip.Frame");
            this.m_firstButton.gameObject.SetActive(true);
            this.m_secondButton.gameObject.SetActive(true);
            this.m_firstButton.normalSprite  = StringConfigManager.GetString("MessageWindow.EMT_UpdateDownload.LookNewButton");
            this.m_secondButton.normalSprite = StringConfigManager.GetString("MessageWindow.EMT_Double.TryAgainButton");
            this.m_title.gameObject.SetActive(false);
            this.m_content.alignment = NGUIText.Alignment.Center;
            this.m_content.text      = string.Format(StringConfigManager.GetString("EMessageType.EMT_UpdateDownload.Content"), evt.GetParam("index"), evt.GetParam("total"), evt.GetParam("fileName"));
            break;

        case EMessageType.EMT_None:
            break;
        }
    }