Exemplo n.º 1
0
	public void Present(uint questID, QuestProcess state, string xml)
	{
		if (state != QuestProcess.QuestProcess_CanDone && state != QuestProcess.QuestProcess_None)
		{
			Debug.LogError(string.Format("不可接受的任务状态: {0} {1}", questID, state));
			return;
		}
		this.questID = questID;
		this.questState = state;
		uiOKButton.GetComponentInChildren<UILabel>().text = this.questState == QuestProcess.QuestProcess_CanDone ? "完成" : "接受";
		uiTitle.text = "任务交接";
		uiXmlRichText.Clear();
		uiXmlRichText.AddXml(xml);
	}
Exemplo n.º 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));
    }
Exemplo n.º 3
0
    private void AddNewTopText(RunLightInfo info)
    {
        GameObject go = GameObject.Instantiate(m_lableObj) as GameObject;

        go.transform.parent = m_trans_root;
        go.transform.transform.localScale = Vector3.one;

        if (m_updateXmlText.Count > 0)
        {
            UIXmlRichText text = m_updateXmlText[m_updateXmlText.Count - 1];
            //localPosition.x  为负数 text.m_layout.x  m_trans_root的x点在右边300
            float width = text.mtrans.localPosition.x + text.m_layout.x;
            if (width <= 0)// 小于0 则全部在panel中了。
            {
                go.transform.transform.localPosition = Vector3.zero;
            }
            else
            {
                go.transform.transform.localPosition = new Vector3(text.mtrans.localPosition.x + text.m_layout.x + 15, 0, 0);
            }
        }
        else
        {
            go.transform.transform.localPosition = Vector3.zero;
        }

        UIXmlRichText xmltext = go.GetComponent <UIXmlRichText>();

        xmltext.extObj      = info;
        xmltext.UrlClicked += OnClickUrl;
        xmltext.AddXml(info.msg);
        xmltext.host.width = Mathf.CeilToInt(xmltext.m_layout.x);
        m_updateXmlText.Add(xmltext);

        if (m_trans_TOP.gameObject.activeSelf == false)
        {
            m_trans_TOP.gameObject.SetActive(true);
        }
    }
Exemplo n.º 4
0
    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);
                }
            }
        }
    }
Exemplo n.º 5
0
    private void AddBottomText()
    {
        if (m_bottomQueue.Count <= 0)
        {
            return;
        }

        string xml = m_bottomQueue.Dequeue();

        UIXmlRichText xmltext = m_bottomXmlText;

        xmltext.fontSize   = 18;
        xmltext.host.width = 1200;

        xmltext.UrlClicked += OnClickUrl;
        xmltext.AddXml(xml);
        if (xmltext.overline)
        {
            xmltext.host.width = 1200;
        }
        else
        {
            xmltext.host.width = Mathf.CeilToInt(xmltext.m_layout.x);
        }

        Vector3 pos = new Vector3(-xmltext.host.width * 0.5f, xmltext.host.height > xmltext.fontSize ? xmltext.host.height * 0.5f : 0, 0);

        xmltext.transform.transform.localPosition = pos;

        pos.y += 5;
        pos.x -= 5;
        m_sprite_buttombg.transform.localPosition = pos;
        m_sprite_buttombg.width  = xmltext.host.width + 10;
        m_sprite_buttombg.height = xmltext.host.height + 10;

        StartCoroutine(WaitForDestroy());
    }
Exemplo n.º 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;
        }
    }
Exemplo n.º 7
0
 public void SetMessage(string xml)
 {
     uiXmlRichText.Clear();
     uiXmlRichText.AddXml(xml);
 }
Exemplo n.º 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);
        }
    }
Exemplo n.º 9
0
    private void SetChatMsgUI_Left(ChatInfo text)
    {
        Vector3 origin = m_trans_redPacket.localPosition;

        m_trans_redPacket.localPosition = new Vector3(146, origin.y, 0);
        if (m_headIcon != null)
        {
            if (text.Channel == GameCmd.CHATTYPE.CHAT_GM)
            {
                UIManager.GetTextureAsyn("n031", ref iuiIconAtlas, () =>
                {
                    if (null != m_headIcon)
                    {
                        m_headIcon.mainTexture = null;
                    }
                }, m_headIcon);
            }
            else
            {
                table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)text.job, (GameCmd.enmCharSex) 1);
                if (sdb != null)
                {
                    UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref iuiIcon,
                                             () => { if (m_headIcon != null)
                                                     {
                                                         m_headIcon.mainTexture = null;
                                                     }
                                             },
                                             m_headIcon, false);
                }
            }
            m_headIcon.transform.localPosition = new Vector3(-m_panelWidth * 0.5f + BorderX, 0, 0);
        }
        if (GameCmd.CHATTYPE.CHAT_GMTOOL == text.Channel)
        {
            text.Channel = GameCmd.CHATTYPE.CHAT_GMTOOL;
        }

        if (text.Channel == GameCmd.CHATTYPE.CHAT_SILENT)
        {
            if (DataManager.Manager <RelationManager>().IsMyFriend(text.Id))
            {
                m_lableChannel.text = "好友";
            }
            else
            {
                m_lableChannel.text = "陌生人";
            }
        }
        else
        {
            m_lableChannel.text = DataManager.Manager <ChatDataManager>().GetChannelStr(text.Channel);
        }

        m_lableChannel.transform.localPosition = m_headIcon.transform.localPosition + new Vector3(m_headIcon.width + 25, 0, 0);


        m_lableName.text = text.Name;
        m_lableName.transform.localPosition = m_lableChannel.transform.localPosition + new Vector3(m_lableChannel.width + 5, 0, 0);

        if (m_spriteNameBg != null)
        {
            m_spriteNameBg.transform.localPosition = m_lableChannel.transform.localPosition + new Vector3(-5, 5, 0);
            m_spriteNameBg.width   = m_lableChannel.width + 10;
            m_spriteNameBg.height  = m_lableChannel.fontSize + 10;
            m_spriteNameBg.enabled = true;
            m_spriteNameBg.ChangeSprite(GetChannelIndex(text.Channel));
        }

        UISprite sp = m_bgSprite as UISprite;

        sp.spriteName = "biankuang_duihuazuo";

        m_bgSprite.width = GetMaxWidth() - 10;//左边小箭头

        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            m_goVoice.gameObject.SetActive(true);
            m_goVoiceTip.SetActive(!m_chatdata.played);

            m_labelVoice.text = string.Format("{0}'", text.voiceLegth.ToString());

            //从左边25开始
            m_normalRichTextContext.offset = new Vector2(25, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(25, -60f);
        }
        else
        {
            m_goVoice.gameObject.SetActive(false);

            //从左边25开始
            m_normalRichTextContext.offset = new Vector2(25, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(25, -10f);
        }
        m_normalRichTextContext.AddXml(text.Content);

        m_bgSprite.height = Mathf.CeilToInt(-m_normalRichTextContext.m_layout.y) + 10;

        if (m_normalRichTextContext.overline)
        {
            m_bgSprite.width = GetMaxWidth();
        }
        else
        {
            m_bgSprite.width = Mathf.CeilToInt(m_normalRichTextContext.m_layout.x) + 15;//多添加15
        }

        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            if (m_bgSprite.width < VOICEBGWIDTH)
            {
                m_bgSprite.width = VOICEBGWIDTH;
            }
            m_bgSprite.transform.localPosition = new Vector3(m_headIcon.transform.localPosition.x + m_headIcon.width + BorderX + headRightOffset, m_bgSprite.transform.localPosition.y, 0);

            float posx = m_bgSprite.transform.localPosition.x + m_spriteVoiceBg.width * 0.5f + 40;
            m_goVoice.transform.localPosition    = new UnityEngine.Vector3(posx, -m_headIcon.height * 0.5f - 28, 0);
            m_goVoice.transform.localRotation    = Quaternion.Euler(Vector3.zero);
            m_labelVoice.transform.localRotation = Quaternion.Euler(Vector3.zero);
            m_labelVoice.transform.localPosition = new UnityEngine.Vector3(-m_labelVoice.transform.localPosition.x, 0, 0);
        }
        else
        {
            m_bgSprite.transform.localPosition = new Vector3(m_headIcon.transform.localPosition.x + m_headIcon.width + BorderX + headRightOffset, m_bgSprite.transform.localPosition.y, 0);
        }
        bound = NGUIMath.CalculateRelativeWidgetBounds(transform, false);
    }
Exemplo n.º 10
0
    public void SetChatInfo(int panelWidth, ChatInfo text, PanelID panelid = PanelID.None)
    {
        m_parentPanelID = panelid;
        m_panelWidth    = panelWidth;
        float halfPanelWidth = m_panelWidth * 0.5f;

        if ((text.Channel == GameCmd.CHATTYPE.CHAT_SYS || text.Id == 0) && !text.IsRedPacket)
        {
            if (m_transNormal.gameObject.activeSelf)
            {
                m_transNormal.gameObject.SetActive(false);
            }
            if (!m_transSys.gameObject.activeSelf)
            {
                m_transSys.gameObject.SetActive(true);
            }


            if (m_spriteTitleBg != null)
            {
                m_spriteTitleBg.transform.localPosition = new UnityEngine.Vector3(-halfPanelWidth, 5, 0);

                m_spriteTitleBg.ChangeSprite(GetChannelIndex(GameCmd.CHATTYPE.CHAT_SYS));
            }

            if (m_lableSysTitle != null)
            {
                if (text.Id == 0)
                {
                    m_lableSysTitle.text = DataManager.Manager <ChatDataManager>().GetChannelStr(text.Channel);
                }
                else
                {
                    m_lableSysTitle.text = "系统";
                }
                m_spriteSysBg.height = m_lableSysTitle.height;

                // m_spriteTitleBg.width = m_lableSysTitle.width + 10;
                //m_spriteTitleBg.height = m_lableSysTitle.height + 10;

                m_lableSysTitle.transform.localPosition = new Vector3(-halfPanelWidth + 5, 0, 0);
            }

            m_spriteSysBg.transform.localPosition = new Vector3(m_spriteTitleBg.transform.localPosition.x + m_spriteTitleBg.width + 2, 0, 0);

            // m_spriteSysBg.width = GetMaxWidth() - m_lableSysTitle.width;
            m_sysRichTextContext.Clear();
            m_sysRichTextContext.AddXml(text.Content);
            bound      = NGUIMath.CalculateRelativeWidgetBounds(transform, false);
            m_chatdata = null;
        }
        else
        {
            if (!m_transNormal.gameObject.activeSelf)
            {
                m_transNormal.gameObject.SetActive(true);
            }
            if (m_transSys.gameObject.activeSelf)
            {
                m_transSys.gameObject.SetActive(false);
            }

            m_chatdata = text;

            m_normalRichTextContext.Clear();
            if (text.IsRedPacket)
            {
                m_trans_normalInfo.gameObject.SetActive(false);
                m_trans_redPacket.gameObject.SetActive(true);
            }
            else
            {
                m_trans_normalInfo.gameObject.SetActive(true);
                m_trans_redPacket.gameObject.SetActive(false);
            }
            m_label_blessmsg.text = text.RichText;
            if (text.IsMe)
            {
                SetChatMsgUI_Right(text);
            }
            else
            {
                SetChatMsgUI_Left(text);
            }
        }
    }