コード例 #1
0
        public GuildStorageManager(GuildEntity parent)
        {
            GuildStorageManager slotCount = this;

            if (!FeatureMatrix.IsEnable("GuildStorage"))
            {
                return;
            }
            this.Parent   = parent;
            this.SlotInfo = null;
            GuildService instance = GuildService.Instance;
            IEntity      entity   = this.Parent.Entity;
            Location     location = new Location()
            {
                ID       = (long)parent.GuildSN,
                Category = "PlayerService.PlayerService"
            };

            this.ItemConn       = instance.Connect(entity, location);
            this.StorageCount   = 0;
            this.Processing     = true;
            this.BriefTodayLogs = new List <GuildStorageBriefLogElement>();
            this.BriefOldLogs   = new List <GuildStorageBriefLogElement>();
            this.ItemTodayLogs  = new List <GuildStorageItemLogElement>();
            this.ItemOldLogs    = new List <GuildStorageItemLogElement>();
            JoinWithGuildInventory  joinWithGuildInventory = new JoinWithGuildInventory();
            QuildGuildStorageStatus quildGuildStorageStatu = new QuildGuildStorageStatus();

            this.LastLogCrawl = DateTime.MinValue;
            joinWithGuildInventory.OnComplete += new Action <Operation>((Operation __) => slotCount.RequestItemServiceOperation(quildGuildStorageStatu));
            joinWithGuildInventory.OnFail     += new Action <Operation>((Operation __) => this.Processing = false);
            quildGuildStorageStatu.OnComplete += new Action <Operation>((Operation __) =>
            {
                slotCount.StorageCount = quildGuildStorageStatu.Status.SlotCount;
                slotCount.ApplyStorage(quildGuildStorageStatu.Status.Inventory);
                slotCount.Processing = false;
                try
                {
                    using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                    {
                        GetGuildStorageSetting getGuildStorageSetting = heroesDataContext.GetGuildStorageSetting(new int?(parent.GuildSN)).FirstOrDefault <GetGuildStorageSetting>();
                        if (getGuildStorageSetting != null)
                        {
                            slotCount.GoldPickLimit  = getGuildStorageSetting.GoldLimit;
                            slotCount.AccessLimitTag = getGuildStorageSetting.AccessLimitTag;
                        }
                        else
                        {
                            heroesDataContext.InitGuildStorageSetting(new int?(parent.GuildSN));
                        }
                    }
                }
                catch (Exception exception)
                {
                    Log <GuildStorageManager> .Logger.Error(exception);
                }
                slotCount.BroadCastInventoryInfo();
            });
            quildGuildStorageStatu.OnFail     += new Action <Operation>((Operation __) => this.Processing = false);
            this.ItemConn.ConnectionSucceeded += new EventHandler <EventArgs <IEntityProxy> >((object s, EventArgs <IEntityProxy> e) => slotCount.RequestItemServiceOperation(joinWithGuildInventory));
            this.QueryStorageLog(true);
        }
コード例 #2
0
 public GuildChatRoom(GuildService service, long guildID)
 {
     this.Service = service;
     this.members = new Dictionary <long, IGuildChatMember>();
     this.GuildID = guildID;
 }