Ejemplo n.º 1
0
        private static bool CanPopupWin(PopupWinItem popupWinItem, PopupWinTimeItem lastPopupWinTimeItem, int hour, int minute)
        {
            bool result;

            if (null == popupWinItem.Times)
            {
                result = false;
            }
            else
            {
                int time2 = lastPopupWinTimeItem.Hour * 60 + lastPopupWinTimeItem.Minute;
                int time3 = hour * 60 + minute;
                for (int i = 0; i < popupWinItem.Times.Length; i++)
                {
                    int time4 = popupWinItem.Times[i].Hour * 60 + popupWinItem.Times[i].Minute;
                    if (time4 > time2)
                    {
                        if (time3 >= time4)
                        {
                            return(true);
                        }
                    }
                }
                result = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
        private static void ParseXmlItem(SystemXmlItem systemXmlItem, List <PopupWinItem> popupWinItemList)
        {
            int    id         = systemXmlItem.GetIntValue("ID", -1);
            int    hintFileID = systemXmlItem.GetIntValue("HintFileID", -1);
            string times      = systemXmlItem.GetStringValue("Times");

            if (!string.IsNullOrEmpty(times))
            {
                PopupWinTimeItem[] popupWinTimeItemArray = PopupWinMgr.ParsePopupWinTimeItems(times);
                if (null == popupWinTimeItemArray)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("解析弹窗配置表中的时间项为数组时失败, ID={0}", id), null, true);
                }
                else
                {
                    PopupWinItem popupWinItem = new PopupWinItem
                    {
                        ID         = id,
                        HintFileID = hintFileID,
                        Times      = popupWinTimeItemArray
                    };
                    popupWinItemList.Add(popupWinItem);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 是否能否弹窗
        /// </summary>
        /// <param name="broadcastInfoItem"></param>
        /// <returns></returns>
        private static bool CanPopupWin(PopupWinItem popupWinItem, PopupWinTimeItem lastPopupWinTimeItem, int hour, int minute)
        {
            if (null == popupWinItem.Times)
            {
                return(false);
            }

            int time2 = lastPopupWinTimeItem.Hour * 60 + lastPopupWinTimeItem.Minute;
            int time3 = hour * 60 + minute;

            for (int i = 0; i < popupWinItem.Times.Length; i++)
            {
                int time1 = popupWinItem.Times[i].Hour * 60 + popupWinItem.Times[i].Minute;
                if (time1 <= time2) //已经广播过了
                {
                    continue;
                }

                if (time3 >= time1)
                {
                    return(true);
                }
            }

            return(false);
        }