예제 #1
0
        /// <summary>
        /// 显示公告。
        /// </summary>
        /// <param name="id">公告编号。</param>
        /// <param name="param">公告参数。</param>
        public void ShowNotice(int id, string param)
        {
            LuaTable cfg = ConfigManager.Instance.Common.GetNoticeConfig(id);

            if (cfg == null)
            {
                LogMgr.LogWarning("Unknow notice id:{0}", id);
                return;
            }

            //解析消息内容
            string text = id == SpecialNoticeID?ParseSpecialNotice(param) : ParseNotice(cfg, param);

            int channel = cfg.Get <int>("channel");

            //是否走马灯显示
            string pos = cfg.Get <string>("pos");

            if (pos.IndexOf("1") != -1 || pos.IndexOf("2") != -1)
            {
                //登录和选角不弹走马灯
                if (MapMgr.Instance.CurMapType != MapMgr.MapType.Map_Login && MapMgr.Instance.CurMapType != MapMgr.MapType.Map_SelectRole)
                {
                    UITips.ShowNotice(text);
                }
            }

            if (pos.IndexOf("4") != -1)
            {
                ChatMessage chat = new ChatMessage(1, channel, text);
                AddMessage(chat);
                TriggerEventNotice(chat);
            }
            if (pos.IndexOf("5") != -1)
            {
                UITips.ShowTips(text);
            }
        }