Esempio n. 1
0
        public void Execute()
        {
            var roomList          = CacheSet.FoundryRoomCache.FindAll();
            PlayerFoundryLogic pf = new PlayerFoundryLogic();

            foreach (var room in roomList)
            {
                room.Progress = 0;
                room.Level    = 0;
                foreach (var player in room.Players)
                {
                    pf.SetUser(player);
                    pf.ResetUser();
                    var target = GameSession.Get(player);
                    if (target != null)
                    {
                        LCResetGearFoundryInfo package = new LCResetGearFoundryInfo();
                        package.NextFoundryTimeInTicks = pf.MyFoundry.NextFoundryTime;
                        package.Progress = new PBGearFoundryProgressInfo()
                        {
                            CurrentLevel = room.Level, CurrentProgress = room.Progress
                        };
                        package.RewardFlags.AddRange(pf.MyFoundry.CanReceiveRewards);
                        byte[] buffer = CustomActionDispatcher.GeneratePackageStream(package.PacketActionId, ProtoBufUtils.Serialize(package));
                        target.SendAsync(buffer, 0, buffer.Length);
                    }
                }
            }
        }