Exemple #1
0
    public string FormatCharTitle(string channelHead, string name, string time, string srcText, uint uid = 0)
    {
        try
        {
            //          if (srcText.FirstOrDefault() == '<')
            //          {
            //              return RichXmlHelper.RemoveP(RichXmlHelper.RichXmlAdapt(srcText));
            //          }
            // 普通文本转换成富文本
            var color       = string.Format("#{0:X8}", (uint)ConstDefine.GetChatColor(ChannelType));
            var yellow      = GXColor.Yellow;
            var colorYellow = string.Format("#{0:X8}", (uint)yellow);
            var gray        = GXColor.Gray;
            var colorGray   = string.Format("#{0:X8}", (uint)gray);

            string text = "";

            if (ChannelType == CHATTYPE.CHAT_SYS)
            {
                text = RichXmlHelper.RichXmlAdapt(string.Format(
                                                      "<color value=\"{0}\">{1} </color>",
                                                      string.Format("#{0:X8}", (uint)ConstDefine.GetChatColor(CHATTYPE.CHAT_NINE)),
                                                      channelHead,
                                                      new XText(srcText).ToString())); // xml escape
            }
            else
            {
                text = RichXmlHelper.RichXmlAdapt(string.Format(
                                                      //"<color value=\"{0}\">{1}</color>{2}",
                                                      "{0} {1}",
                                                      //color,
                                                      channelHead,
                                                      ChatDataManager.GetPlayerHrefString(name, uid, Cmd.GXColor.Yellow),
                                                      new XText(srcText).ToString())); // xml escape
            }

            //Debug.Log(text);
            return(text);
        }
        catch (Exception e)
        {
            Debug.LogError(string.Format("e.Message:{0},e.StackTrace:{1}", e.Message, e.StackTrace));
        }
        return(String.Empty);
    }
Exemple #2
0
    private void SetSelectSecondType(uint type, bool force = false)
    {
        if (null == mSecondTabCreator)
        {
            return;
        }
        if (m_uint_activeStype == type && !force)
        {
            return;
        }
        UISecondTypeGrid sGrid = null;

        if (m_uint_activeFType != 0)
        {
            sGrid = mSecondTabCreator.GetGrid <UISecondTypeGrid>(mlstFirstTabIds.IndexOf(m_uint_activeFType), m_dic[m_uint_activeFType].IndexOf(m_uint_activeStype));
            if (null != sGrid)
            {
                sGrid.SetHightLight(false);
            }
        }

        m_uint_activeStype = type;
        if (m_uint_activeFType != 0)
        {
            sGrid = mSecondTabCreator.GetGrid <UISecondTypeGrid>(mlstFirstTabIds.IndexOf(m_uint_activeFType), m_dic[m_uint_activeFType].IndexOf(m_uint_activeStype));
            if (null != sGrid)
            {
                sGrid.SetHightLight(true);
            }
        }
        m_UIXmlRichText.Clear();
        BibleDataBase table = GameTableManager.Instance.GetTableItem <BibleDataBase>(m_uint_activeFType, (int)m_uint_activeStype);

        if (table == null)
        {
            Engine.Utility.Log.Warning("华夏宝典表格大类{0}-小类{1}数据为空!", m_uint_activeFType, m_uint_activeStype);
            return;
        }
        string content = table.content;

        m_UIXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(content));
    }
Exemple #3
0
    public string FormatPrivateAddCharHead(string channelHead, string extentedString, string srcText, string voicefileid = "")
    {
        //  Log.LogGroup("ZDY", "enter :FormatPrivateAddCharHead");
        if (srcText.FirstOrDefault() == '<')
        {
            return(RichXmlHelper.RemoveP(RichXmlHelper.RichXmlAdapt(srcText)));
        }

        //Log.LogGroup("ZDY", "普通文本转换成富文本:" + srcText + " " + srcText.Length);
        // 普通文本转换成富文本
        var color = string.Format("#{0:X8}", (uint)ConstDefine.GetChatColor(GameCmd.CHATTYPE.CHAT_PRIVATE));

        string xtext = new XText(srcText).ToString();

        return(RichXmlHelper.RichXmlAdapt(string.Format("<color value=\"{0}\">{1}{2}:{3}</color>",
                                                        color,
                                                        channelHead,
                                                        extentedString,
                                                        xtext))); // xml escape
    }
Exemple #4
0
    public string FormatAddCharHead(string channelHead, string extentedString, string srcText)
    {
        if (srcText.FirstOrDefault() == '<')
        {
            return(RichXmlHelper.RemoveP(RichXmlHelper.RichXmlAdapt(srcText)));
        }
        // 普通文本转换成富文本
        var color = string.Format("#{0:X8}", (uint)ConstDefine.GetChatColor(ChannelType));

        // Debug.Log("FormatAddCharHead:" + srcText + " " + srcText.Length);

        string xtext = new XText(srcText).ToString();

        //Debug.Log("FormatAddCharHeadxtext:" + xtext);

        return(RichXmlHelper.RichXmlAdapt(string.Format("<color value=\"{0}\">{1}{2}:{3}</color>",
                                                        color,
                                                        channelHead,
                                                        extentedString,
                                                        xtext))); // xml escape
    }
    protected override void OnShow(object data)
    {
        base.OnShow(data);

        if (data is LangTalkData)
        {
            m_LangTalkData = data as LangTalkData;

            m_trans_BtnRoot.transform.DestroyChildren();

            m_trans_BtnRoot.transform.parent.GetComponent <UIScrollView>().ResetPosition();

            table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(m_LangTalkData.nNpcId);
            if (npcdb != null)
            {
                m_label_Npc_Name.text = npcdb.strName;
            }

            m_UIXmlRichText.Clear();
            if (m_LangTalkData.lstTalks.Count > 0)
            {
                m_UIXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(m_LangTalkData.lstTalks[0].strText));
            }

            for (int i = 0; i < m_LangTalkData.buttons.Count; i++)
            {
                GameObject go = NGUITools.AddChild(m_trans_BtnRoot.gameObject, m_btn_btn.gameObject);
                if (go != null)
                {
                    go.GetComponentInChildren <UILabel>().text = m_LangTalkData.buttons[i].strBtnName;
                    go.name = string.Format("btn_{0}", i);
                    UIEventListener.Get(go).onClick = onClick_Btn_Btn;
                    go.transform.localPosition      = new UnityEngine.Vector3(0, -i * 58, 0);
                    go.SetActive(true);
                }
            }
        }
    }
Exemple #6
0
    void SetContent(QuestionTab type)
    {
        m_UIXmlRichText.Clear();
        QuestionDataBase db = GameTableManager.Instance.GetTableItem <QuestionDataBase>((uint)type);

        if (db == null)
        {
            Engine.Utility.Log.Error("问卷表格id{0}的数据为空", (uint)type);
            return;
        }

        switch (type)
        {
        case QuestionTab.GongGao:
            m_trans_GongGao.gameObject.SetActive(true);
            m_trans_WenJuan.gameObject.SetActive(false);
            m_trans_FanKui.gameObject.SetActive(false);
            m_label_title.text = db.title;
            string content = db.descr;
            m_UIXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(content));
            break;

        case QuestionTab.WenJuan_1:
            m_trans_GongGao.gameObject.SetActive(false);
            m_trans_WenJuan.gameObject.SetActive(true);
            m_trans_FanKui.gameObject.SetActive(false);
            m_label_WenJuanText.text = db.descr;
            H5Address = db.H5Address;
            CreateRewardObj(m_trans_WJRewardGrid, db);
            SetWenJuanBtn();
            break;

        case QuestionTab.WenJuan_2:
            m_trans_GongGao.gameObject.SetActive(false);
            m_trans_WenJuan.gameObject.SetActive(true);
            m_trans_FanKui.gameObject.SetActive(false);
            m_label_WenJuanText.text = db.descr;
            H5Address = db.H5Address;
            CreateRewardObj(m_trans_WJRewardGrid, db);
            SetWenJuanBtn();
            break;

        case QuestionTab.WenJuan_3:
            m_trans_GongGao.gameObject.SetActive(false);
            m_trans_WenJuan.gameObject.SetActive(true);
            m_trans_FanKui.gameObject.SetActive(false);
            m_label_WenJuanText.text = db.descr;
            H5Address = db.H5Address;
            CreateRewardObj(m_trans_WJRewardGrid, db);
            SetWenJuanBtn();
            break;

        case QuestionTab.FanKui:
            m_trans_GongGao.gameObject.SetActive(false);
            m_trans_WenJuan.gameObject.SetActive(false);
            m_trans_FanKui.gameObject.SetActive(true);
            m_label_FanKuiText.text = db.descr;
            CreateRewardObj(m_trans_FKRewardGrid, db);
            SetFanKuiBtn();
            break;
        }
    }
Exemple #7
0
    bool ShowTalkStr(int nindex)
    {
        bool success = false;

        if (m_dialogInfo != null)
        {
            if (m_dialogInfo.buttons != null)
            {
                if (m_dialogInfo.buttons.Count < 2)
                {
                    StopAllCoroutines();
                    //倒计时
                    tempTime  = 0;
                    CLOSETIME = CONST_TASK_CD;
                    m_label_LabelNext.gameObject.SetActive(true);
                    m_label_LabelNext.text = ((int)CLOSETIME).ToString() + "秒后自动跳过";
                    StartCoroutine(WaitToClose());
                }
                else
                {
                    m_label_LabelNext.gameObject.SetActive(false);
                }
            }
        }


        ResetDes();
        if (m_dialogInfo != null)
        {
            if (m_dialogInfo.lstTalks != null)
            {
                if (nindex < m_dialogInfo.lstTalks.Count)
                {
                    LangTalkData.Talk talkInfo = m_dialogInfo.lstTalks[nindex];

                    if (talkInfo.bUser)
                    {
                        string name = "";
                        if (Client.ClientGlobal.Instance().MainPlayer != null)
                        {
                            name = Client.ClientGlobal.Instance().MainPlayer.GetName();
                        }
                        m_label_nameLabel.text = name;
                        ShowRoleTexture(true);
                    }
                    else
                    {
                        table.NpcDataBase npcdata = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(m_dialogInfo.nNpcId);
                        if (npcdata != null)
                        {
                            ShowRoleTexture(false, npcdata);

                            m_label_nameLabel.text = npcdata.strName;
                        }
                    }

                    bool useRichText = false;//富文本有泄漏bug 暂时不用
                    if (useRichText)
                    {
                        string desc = string.Format("<size value=\"24\"><color value=\"#1c2850\">{0} </color></size>", talkInfo.strText);
                        if (uiXmlRichText != null)
                        {
                            this.uiXmlRichText.fontSize = 24;
                            this.uiXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(desc));
                        }
                    }
                    else
                    {
                        string desc = string.Format("[1c2850]{0}[-]", talkInfo.strText);
                        m_label_normalText.text = desc;
                    }

                    success = true;
                }
            }

            if (m_dialogInfo.talkVoice != null && nindex < m_dialogInfo.talkVoice.Length)
            {
                Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
                if (audio != null && m_nPlayingAudioId != 0)
                {
                    audio.StopEffect(m_nPlayingAudioId);
                }
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(m_dialogInfo.talkVoice[nindex]);
                if (resDB == null)
                {
                    Engine.Utility.Log.Error("找不到选择角色的Mp3资源");
                }

                if (audio != null && resDB != null)
                {
                    //m_nPlayingAudioId = audio.PlayUIEffect(resDB.strPath);
                    Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
                    if (mainPlayer != null)
                    {
                        Transform tf = mainPlayer.GetTransForm();
                        if (tf != null)
                        {
                            m_nPlayingAudioId = audio.PlayEffect(tf.gameObject, resDB.strPath, false, true);
                        }
                    }
                }
            }
        }

        //是否显示下一个
        //bool nextVisible = (null != m_dialogInfo
        //    && null != m_dialogInfo.lstTalks
        //    && (m_dialogInfo.lstTalks.Count > nindex + 1));
        //if (null != m_label_LabelNext && m_label_LabelNext.gameObject.activeSelf != nextVisible)
        //{
        //    m_label_LabelNext.gameObject.SetActive(nextVisible);
        //}

        return(success);
    }
Exemple #8
0
    void ShowTaskInfo(QuestTraceInfo quest)
    {
        if (quest == null)
        {
            m_label_taskName.text = "";
            richText.Clear();
            m_trans_detailInfo.gameObject.SetActive(false);
            return;
        }
        m_trans_detailInfo.gameObject.SetActive(true);



        if (m_CurrPage != MissionPanelPageEnum.Page_已接)
        {
            m_btn_btnGiveUp.gameObject.SetActive(false);
        }
        else
        {
            if (quest.taskSubType == TaskSubType.Guild)
            {
                m_btn_btnGiveUp.gameObject.SetActive(false);
            }
            else
            {
                m_btn_btnGiveUp.gameObject.SetActive(quest.taskType != GameCmd.TaskType.TaskType_Normal);
            }
        }



        //暂时因为版本问题关闭氏族的放弃按钮
        //if (quest.taskType == GameCmd.TaskType.TaskType_Clan)
        //{
        //    m_btn_btnGiveUp.gameObject.SetActive(false);
        //}



        m_label_taskReward.gameObject.SetActive(quest.taskType != GameCmd.TaskType.TaskType_Token);
        m_currquest = quest;

        m_label_taskName.text = quest.QuestTable.strName;

        richText.Clear();
        string desc = string.Format("<size value=\"24\"><color value=\"#1c2850\">{0} </color></size>", quest.strIntro);

        richText.AddXml(RichXmlHelper.RichXmlAdapt(desc));

        if (quest.Items.Count <= 0) //请求任务奖励
        {
            NetService.Instance.Send(new GameCmd.stRequestTaskRewardScriptUserCmd_C()
            {
                task_id = quest.taskId
            });
        }
        else
        {
            m_lstRewardItemInfo = GetRewardInfoList(quest.exp, quest.money, quest.gold, quest.Items, quest.ItemNum);
            m_rewardItemGridCreator.CreateGrids(m_lstRewardItemInfo != null ? m_lstRewardItemInfo.Count : 0);
            //ShowReward(quest.Items, quest.ItemNum, quest.gold, quest.money, quest.exp);
        }
    }