Example #1
0
 public MsgConfigInfo(MsgConfigInfo info)
 {
     id         = info.id;
     msgType    = info.msgType;
     content    = info.content;
     effect     = info.effect;
     audio_name = info.audio_name;
     serverErrorCode.AddRange(info.serverErrorCode);
 }
Example #2
0
 public void MsgTypeTip(MsgConfigInfo info, MsgSettingConfigInfo setting)
 {
     msgInfo      = info;
     SettingEnd   = setting;
     Content.text = info.content;
     //Debug.LogError("text  =" + Content.text + "width = " + Content.width + "height = " + Content.height);
     SetLabelShow(Content, setting, info);
     SetShowInfo(setting);
 }
        string GetFloatTemp(string oldTemp, string newTemp, int index)
        {
            float         temp = 100 * Convert.ToSingle(newTemp);
            MsgConfigInfo info = ConfigReader.msgXmlInfoDic[index];

            if (temp != 0)
            {
                oldTemp += string.Format(info.content, newTemp + "%");
                return(oldTemp);
            }
            return(oldTemp);
        }
        string GetTemp(string oldTemp, string newTemp, int index)
        {
            int           temp = Convert.ToInt32(newTemp);
            MsgConfigInfo info = ConfigReader.msgXmlInfoDic[index];

            if (temp != 0)
            {
                oldTemp += string.Format(info.content, newTemp);
                return(oldTemp);
            }
            return(oldTemp);
        }
Example #5
0
 void CheckMsgEnd()
 {
     if (currentIsEnd && worldMsg != null && worldMsg.Count != 0)
     {
         Msg msg = worldMsg.Dequeue();
         msg.Init();
         MsgConfigInfo        msginfo = ConfigReader.GetMsgInfo(msg.msgID);
         MsgSettingConfigInfo setting = ConfigReader.GetMsgSettingInfo(msginfo.effect);
         msg.MsgTypeTip(msginfo, setting);
         currentIsEnd     = false;
         msg.msgEndEvent += MsgEnd;
     }
 }
Example #6
0
    public void ShowMsg(MsgConfigInfo msginfo)
    {
        MsgSettingConfigInfo setting = null;

        if (msginfo == null)
        {
            //GameMethod.DebugError("error :msgID" + msgID);
            return;
        }
        setting = ConfigReader.GetMsgSettingInfo(msginfo.effect);
        if (setting == null)
        {
            //GameMethod.DebugError("error :msginfo.effect");
            return;
        }
        switch ((MsgType)msginfo.msgType)
        {
        case MsgType.MsgType1:
            if (localMsg == null)
            {
                localMsg = new Msg();
            }
            localMsg.Init();
            localMsg.MsgTypeTip(msginfo, setting);
            break;

        case MsgType.MsgType2:
            Msg msg = new Msg();
            msg.msgID = msginfo.id;
            worldMsg.Enqueue(msg);
            CheckMsgEnd();
            break;

        case MsgType.MsgType4:

            break;
        }
    }
Example #7
0
 void SetLabelShow(UILabel worldLocalLabel, MsgSettingConfigInfo setting, MsgConfigInfo info)
 {
     worldLocalLabel.fontSize       = setting.font_size;
     worldLocalLabel.color          = setting.color;
     worldLocalLabel.alpha          = setting.alpha_start_in / Alpha;
     worldLocalLabel.effectStyle    = (UILabel.Effect)setting.font_effect;
     worldLocalLabel.effectColor    = setting.fontEffect_color;
     worldLocalLabel.effectDistance = setting.fontEffect_distance;
     worldLocalLabel.depth          = 100;
     root.transform.parent          = GameMethod.GetUiCamera.transform;
     root.transform.localScale      = setting.scale_start_in;
     root.transform.localPosition   = setting.position_start_in;
     root.gameObject.SetActive(true);
     if (setting.if_frame != 0)
     {
         frame.SetDimensions((info.content.Length * setting.font_size + 80), setting.font_size + 15);
         frame.gameObject.SetActive(true);
     }
     else
     {
         frame.gameObject.SetActive(false);
     }
 }
Example #8
0
    public ReadMsgConfig(string xmlFilePath)
    {
        //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset;
        ResourceItem xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET);
        TextAsset    xmlfile     = xmlfileUnit.Asset as TextAsset;

        if (!xmlfile)
        {
            //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath);
        }

        xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlfile.text);
        XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("MsgCfg ").ChildNodes;

        for (int i = 0; i < infoNodeList.Count; i++)
        {
            if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null)
            {
                continue;
            }

            string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("id").InnerText;
            //Debug.LogError(typeName);
            MsgConfigInfo msgInfo = new MsgConfigInfo();
            msgInfo.id = Convert.ToInt32(typeName);
            #region 搜索
            foreach (XmlElement xEle in infoNodeList[i].ChildNodes)
            {
                switch (xEle.Name)
                {
                case "content":
                {
                    msgInfo.content = Convert.ToString(xEle.InnerText);
                }
                break;

                case "type":
                {
                    msgInfo.msgType = Convert.ToInt32(xEle.InnerText);
                }
                break;

                case "errorcode":
                {
                    string   codes = Convert.ToString(xEle.InnerText);
                    string[] words = codes.Split(new char[] { ',' });
                    if (words != null && words.Length > 0)
                    {
                        foreach (string s in words)
                        {
                            //msgInfo.serverErrorCode.Add(Convert.ToInt32(s));
                        }
                    }
                }
                break;

                case "sound":
                {
                    msgInfo.audio_name = Convert.ToString(xEle.InnerText);
                }
                break;

                case "effect":
                    msgInfo.effect = Convert.ToInt32(xEle.InnerText);
                    break;
                }
            }
            #endregion
            ConfigReader.msgXmlInfoDic.Add(msgInfo.id, msgInfo);
        }
    }
        void ShowVipPre()
        {
            int vipLevel = PresonInfoCtrl.Instance.mVipLevel;

            foreach (var item in ConfigReader.ViplevelXmlInfoDict.Values)
            {
                string            temp       = null;
                string[]          value      = null;
                MsgConfigInfo     info       = null;
                HeroBuyConfigInfo heroinfo   = null;
                RuneConfigInfo    runeinfo   = null;
                int          runeLevel       = 0;
                int          j               = 0;
                ResourceUnit objHomeBaseUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadVIPInfoUI, ResourceType.PREFAB);
                GameObject   obj             = GameObject.Instantiate(objHomeBaseUnit.Asset) as GameObject;
                obj.transform.parent        = mGrid.transform;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                obj.name = (j++).ToString();
                value    = item.VipHero.Split(':');

                UILabel uil      = obj.transform.FindChild("InfoLabel").GetComponent <UILabel>();
                UILabel viplevel = obj.transform.FindChild("NameLabel").GetComponent <UILabel>();
                viplevel.text = "VIP " + item.VipUserLevel.ToString();
                info          = ConfigReader.msgXmlInfoDic[20001];
                for (int i = 0; i < value.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        //英雄ID  20001
                        int index = Convert.ToInt32(value[i]);
                        if (index == 0)
                        {
                            break;
                        }
                        heroinfo = ConfigReader.GetHeroBuyInfo(Convert.ToInt32(value[i]));
                        if (heroinfo == null)
                        {
                            Debug.LogError("herocfg not find id");
                            return;
                        }
                    }
                    else
                    {
                        //英雄时限
                    }
                }//temp 暂时当Label用
                if (heroinfo != null)
                {
                    temp = string.Format(info.content, heroinfo.Name);
                }
                value = item.VipRune.Split(':');
                info  = ConfigReader.msgXmlInfoDic[20002];
                for (int i = 0; i < value.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        //符文ID
                        int index = Convert.ToInt32(value[i]);
                        if (index == 0)
                        {
                            break;
                        }
                        runeinfo = ConfigReader.GetRuneFromID((uint)index);
                        if (runeinfo == null)
                        {
                            Debug.LogError("runecfg not find id");
                            return;
                        }
                    }
                    else
                    {
                        //符文等级
                        runeLevel = Convert.ToInt32(value[i]);
                    }
                }
                if (runeLevel != 0)
                {
                    temp += (string.Format(info.content, runeinfo.RuneName, runeLevel));
                }

                temp = GetTemp(temp, item.VipPrivilege1, 21001);
                temp = GetTemp(temp, item.VipPrivilege2, 21002);
                temp = GetTemp(temp, item.VipPrivilege3, 21003);
                temp = GetFloatTemp(temp, item.VipPrivilege4, 21004);

                temp = GetTemp(temp, item.VipPrivilege5, 21005);
                temp = GetFloatTemp(temp, item.VipPrivilege6, 21006);
                temp = GetFloatTemp(temp, item.VipPrivilege7, 21007);
                temp = GetTemp(temp, item.VipPrivilege8, 21008);

                temp     = GetTemp(temp, item.VipPrivilege9, 21009);
                temp     = GetTemp(temp, item.VipPrivilege10, 21010);
                uil.text = temp;
            }
        }
Example #10
0
    public void ShowMsg(int msgID)
    {
        MsgConfigInfo msginfo = ConfigReader.GetMsgInfo(msgID);

        ShowMsg(msginfo);
    }
    public void ShowMsg(int msgID)
    {
        MsgConfigInfo msginfo = ConfigReader.GetMsgInfo(msgID);//读取的是 “请选择英雄”

        ShowMsg(msginfo);
    }