Пример #1
0
        public int ApplyHoldLode(int serverId, int sceneId, ref MsgSceneLode msg)
        {
            var mgr = GetLodeManager(serverId);

            if (mgr == null)
            {
                return((int)ErrorCodes.Unknow);
            }
            mgr.ApplyHoldLode(sceneId, ref msg);
            return((int)ErrorCodes.OK);
        }
Пример #2
0
        public int ApplyHoldLode(LodeManager _this, ref MsgSceneLodeList msg)
        {
            System.DateTime startTime = DataTimeExtension.EpochStart; // 当地时区
            List <int>      keys      = new List <int>(_this.mDbData.SceneLodeList.Keys);

            for (int i = 0; i < keys.Count; i++)
            {
                //foreach (var tmp in _this.mDbData.SceneLodeList)
                var          tmp       = _this.mDbData.SceneLodeList[keys[i]];
                MsgSceneLode sceneLode = new MsgSceneLode();
                sceneLode.SceneId  = tmp.SceneId;
                sceneLode.TeamId   = tmp.TeamId;
                sceneLode.TeamName = tmp.TeamName;
                sceneLode.FlagId   = tmp.FlagId;
                DateTime rstTime = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(tmp.ResetTime);
                if (rstTime < DateTime.Now)
                {
                    tmp.ResetTime     += 60 * 60 * 24;
                    sceneLode.TeamId   = 0;
                    sceneLode.TeamName = "";
                }

                foreach (var v in tmp.LodeList)
                {
                    msgLode l = new msgLode();
                    l.Id = v.Value.Id;
                    if (null == v.Value)
                    {
                        DateTime dt = startTime.AddSeconds(v.Value.UpdateTime);
                        if (dt < DateTime.Now && l.Times <= 0)
                        {
                            var tb = Table.GetLode(l.Id);
                            if (tb != null)
                            {
                                v.Value.Times      = tb.CanCollectNum;
                                v.Value.UpdateTime = 0;
                            }
                        }
                    }
                    l.Times      = v.Value.Times;
                    l.UpdateTime = v.Value.UpdateTime;
                    sceneLode.LodeList.Add(v.Key, l);
                }
                msg.LodeList.Add(sceneLode);
            }
            return((int)ErrorCodes.OK);
        }
Пример #3
0
        public int ApplyHoldLode(LodeManager _this, int sceneId, ref MsgSceneLode msg)
        {
            DBSceneLode sl = null;

            if (false == _this.mDbData.SceneLodeList.TryGetValue(sceneId, out sl))
            {
                return((int)ErrorCodes.Unknow);
            }
            System.DateTime startTime = DataTimeExtension.EpochStart; // 当地时区
            DateTime        rstTime   = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(sl.ResetTime);

            if (rstTime < DateTime.Now)
            {
                sl.ResetTime += 60 * 60 * 24;
                sl.TeamId     = 0;
                sl.TeamName   = "";
            }

            foreach (var v in sl.LodeList)
            {
                msgLode l = new msgLode();
                l.Id = v.Value.Id;
                if (null == v.Value)
                {
                    DateTime dt = startTime.AddSeconds(v.Value.UpdateTime);
                    if (dt < DateTime.Now && v.Value.Times <= 0)
                    {
                        var tb = Table.GetLode(l.Id);
                        if (tb != null)
                        {
                            v.Value.Times = tb.CanCollectNum;
                        }
                    }
                }
                l.Times      = v.Value.Times;
                l.UpdateTime = v.Value.UpdateTime;
                msg.LodeList.Add(v.Key, l);
            }
            msg.TeamId    = sl.TeamId;
            msg.TeamName  = sl.TeamName;
            msg.FlagId    = sl.FlagId;
            msg.ResetTime = sl.ResetTime;
            return((int)ErrorCodes.OK);
        }
Пример #4
0
 public int ApplyHoldLode(int sceneId, ref MsgSceneLode msg)
 {
     return(mImpl.ApplyHoldLode(this, sceneId, ref msg));
 }
Пример #5
0
 public static int ApplyHoldLode(int serverId, int sceneId, ref MsgSceneLode msg)
 {
     return(mImpl.ApplyHoldLode(serverId, sceneId, ref msg));
 }
Пример #6
0
 public void NotifyLodeInfo(MsgSceneLode info)
 {
     SceneManager.Instance.UnionName     = info.TeamName;
     PlayerDataManager.Instance.LodeInfo = info;
 }