Exemple #1
0
        public void AddLog(string key, BaseUnit nation = null, params object[] objs)
        {
            if (!BaseGlobal.IsUnReadData)
            {
                return;
            }
            if (nation != null)
            {
                if (!nation.IsPlayer())
                {
                    return;
                }
            }
            BaseLogData tempData = new BaseLogData();

            tempData.Date    = BaseGlobal.DateTimeMgr.GetCurDateStr();
            tempData.Desc    = Util.GetStr(key, objs);
            tempData.ID      = IDUtil.Gen();
            tempData.CurTime = 0;
            Data.Insert(0, tempData);
            if (Data.Count > MaxCount)
            {
                RemLastLog();
            }
            Callback_OnAddedLog?.Invoke(tempData);
        }
Exemple #2
0
        public void RemLog(BaseLogData data)
        {
            if (!BaseGlobal.IsUnReadData)
            {
                return;
            }
            var lastIndex = Data.Count - 1;

            if (lastIndex < 0)
            {
                return;
            }
            Data.Remove(data);
            Callback_OnRemoveLog?.Invoke(data);
            UpdateTimer.Restart();
        }