public void OnNewDay() { int inter = TimeTool.DateTimeToUnixTime(DateTime.Now) - InfoBasic.LastLoginTime; InfoRecord.AddRecordById((int)MemPlayerRecordTypes.TotalOnline, inter / 60); InfoBasic.LastLoginTime = TimeTool.DateTimeToUnixTime(DateTime.Now); }
public void OnLogout() { InfoBasic.LastLoginTime = TimeTool.DateTimeToUnixTime(DateTime.Now); foreach (var userInfoSub in itemSubList) { userInfoSub.OnLogout(); } }
public void OnLogin() { if (TimeManager.IsDifferDay(InfoBasic.LastLoginTime, TimeTool.DateTimeToUnixTime(DateTime.Now))) { OnNewDay(); } InfoBasic.LastLoginTime = TimeTool.DateTimeToUnixTime(DateTime.Now); }
public static bool HasImage(string path) { if (TimeTool.DateTimeToUnixTime(DateTime.Now) > lastCompressTime + 60 && count > 100) { Compress(); lastCompressTime = TimeTool.DateTimeToUnixTime(DateTime.Now); } return(images.ContainsKey(path) && images[path].Image != null); }
public void OnLogin() { if (TimeManager.IsDifferDay(InfoBasic.LastLoginTime, TimeTool.DateTimeToUnixTime(DateTime.Now))) { OnNewDay(); } InfoBasic.LastLoginTime = TimeTool.DateTimeToUnixTime(DateTime.Now); foreach (var userInfoSub in itemSubList) { userInfoSub.OnLogin(); } }
public static void AddImage(string path, Image img, bool isPersist = false) { ImageItem item = new ImageItem { Image = img, Time = TimeTool.DateTimeToUnixTime(DateTime.Now), Persist = isPersist }; images[path] = item; count++; }
public bool UseSeed(int type, int dura) { for (int i = 0; i < 9; i++) { var targetCell = DbFarmState[i]; if (targetCell.Type == 0) { targetCell.Type = type; targetCell.Time = TimeTool.DateTimeToUnixTime(DateTime.Now) + dura; return(true); } } return(false); }
public static void AddImage(string path, Image img) { ImageItem item = new ImageItem(); item.Image = img; item.Time = TimeTool.DateTimeToUnixTime(DateTime.Now); if (images.ContainsKey(path)) { images[path] = item; } else { images.Add(path, item); } count++; }
private void FarmForm_MouseClick(object sender, MouseEventArgs e) { int newsel = GetSelectedCell(e.X, e.Y); if (newsel != -1) { DbFarmState timeState = UserProfile.Profile.InfoFarm.GetFarmState(newsel); if (timeState.Type == -1) { var pricecount = GameResourceBook.OutWoodBuildFarm( (uint)UserProfile.Profile.InfoFarm.GetFarmAvailCount() * 20); if (MessageBoxEx2.Show(string.Format("是否花{0}木材开启额外农田?", pricecount)) == DialogResult.OK) { if (UserProfile.InfoBag.HasResource(GameResourceType.Lumber, pricecount)) { UserProfile.InfoBag.SubResource(GameResourceType.Lumber, pricecount); UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(0, 0)); } else { AddFlowCenter("资源不足", "Red"); } } } else if (timeState.Type > 0) { if (timeState.Time < TimeTool.DateTimeToUnixTime(DateTime.Now)) { UserProfile.InfoBag.AddItem(timeState.Type, 1); UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(0, 0)); } else { int pricecount = (timeState.Time - TimeTool.DateTimeToUnixTime(DateTime.Now)) / 600 + 1; if (MessageBoxEx2.Show(string.Format("是否花{0}钻石催熟作物?", pricecount)) == DialogResult.OK) { if (UserProfile.InfoBag.PayDiamond(pricecount)) { UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(timeState.Type, 0)); } } } } } }
public DbMergeData[] GetAllMergeData() { int time = TimeTool.DateTimeToUnixTime(DateTime.Now); if (MergeMethods == null || UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastMergeTime) < time - GameConstants.MergeWeaponDura) { int[] ids = EquipBook.GetCanMergeId(UserProfile.InfoBasic.Level); List <int> newids = new List <int>(ids); ListTool.RandomShuffle(newids); MergeMethods = new List <DbMergeData>(); for (int i = 0; i < 8; i++) { MergeMethods.Add(CreateMergeMethod(newids[i])); } UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.LastMergeTime, TimeManager.GetTimeOnNextInterval(UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastMergeTime), time, GameConstants.MergeWeaponDura)); } return(MergeMethods.ToArray()); }
public static void Compress() { int now = TimeTool.DateTimeToUnixTime(DateTime.Now); foreach (ImageItem item in images.Values) { if (item.Image != null) { int size = item.Image.Width * item.Image.Height; int time = 60 * 10000 / size; if (item.Time < now - time) { item.Image.Dispose(); item.Image = null; count--; } } } }
public static void Compress() { int now = TimeTool.DateTimeToUnixTime(DateTime.Now); foreach (var pickImg in images.Values) { if (pickImg.Image == null || pickImg.Persist) { continue; } int size = pickImg.Image.Width * pickImg.Image.Height; int time = 60 * 10000 / size; if (pickImg.Time < now - time) { pickImg.Image.Dispose(); pickImg.Image = null; count--; } } }
internal DbCardProduct[] GetCardProductsByType(CardTypes type) { int time = TimeTool.DateTimeToUnixTime(DateTime.Now); if (CardProducts == null || UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastCardShopTime) < time - GameConstants.CardShopDura) { CardProducts = new List <DbCardProduct>(); ReinstallCardProducts(); UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.LastCardShopTime, TimeManager.GetTimeOnNextInterval(UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastCardShopTime), time, GameConstants.CardShopDura)); } List <DbCardProduct> pros = new List <DbCardProduct>(); foreach (DbCardProduct cardProduct in CardProducts) { if (ConfigIdManager.GetCardType(cardProduct.Cid) == type) { pros.Add(cardProduct); } } return(pros.ToArray()); }
internal List <int> GetBlessShopData() { int time = TimeTool.DateTimeToUnixTime(DateTime.Now); if (BlessShopItems == null || UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime) < time - GameConstants.BlessShopDura) { BlessShopItems = new List <int>(); BlessShopItems.Clear(); foreach (var blessData in ConfigData.BlessDict.Values) { if (blessData.Type == 1) { BlessShopItems.Add(blessData.Id); } } ListTool.RandomShuffle(BlessShopItems); BlessShopItems = BlessShopItems.GetRange(0, 5); UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime, TimeManager.GetTimeOnNextInterval(UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime), time, GameConstants.BlessShopDura)); } return(BlessShopItems); }
public void Draw(Graphics g, int menuTar) { bool isTarget = menuTar == Id; Image button = PicLoader.Read("Button", string.Format("{0}{1}.png", MainIconConfig.Icon, isTarget && !InCD ? "on" : "")); int buttony = Y; string info = ""; if (InCD) { int timediff = UserProfile.InfoRecord.GetRecordById(MainIconConfig.Record) - TimeTool.DateTimeToUnixTime(DateTime.Now); info = string.Format("{0:00}:{1:00}", timediff / 60, timediff % 60); Rectangle destBack = new Rectangle(X, buttony, Width, Height); g.DrawImage(button, destBack, 0, 0, Width, Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray); } else { if (isTarget && Id < 20) { buttony = Y - 7; } g.DrawImage(button, X, buttony, Width, Height); } button.Dispose(); if (info != "") { Font font = new Font("ËÎÌå", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); g.DrawString(info, font, Brushes.Black, X + 8, Y + 51); g.DrawString(info, font, Brushes.Lime, X + 6, Y + 50); font.Dispose(); } Font fontMenu = new Font("ËÎÌå", 10 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); g.DrawString(MainIconConfig.Name, fontMenu, Brushes.Black, X + 7, Y + 36); g.DrawString(MainIconConfig.Name, fontMenu, Brushes.White, X + 5, Y + 35); fontMenu.Dispose(); if (isTarget) { Font font = new Font("΢ÈíÑźÚ", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); g.DrawString(MainIconConfig.Des, font, Brushes.White, 11, formHeight - 26); font.Dispose(); } }
public static Image GetImage(string path) { images[path].Time = TimeTool.DateTimeToUnixTime(DateTime.Now); return(images[path].Image ?? nullImage); }
public void OnNewDay() { InfoBasic.LastLoginTime = TimeTool.DateTimeToUnixTime(DateTime.Now); }