public static int GetRateCard(int[] rate, RandomCardSelectorDelegate del, int funcInfo) { while (true) { int sum = 0; foreach (var r in rate) { sum += r; } int roll = MathTool.GetRandom(sum); int quality = 0; sum = 0; for (int i = 0; i < rate.Length; i++) { sum += rate[i]; if (roll < sum) { quality = i; break; } } var cardId = del(funcInfo, quality); if (cardId > 0) { return(cardId); } else { NLog.Debug("GetRateCard cardId = 0 funcInfo " + funcInfo); } } return(0); }
public void OnEventEnd(int id, string type) { UserProfile.InfoRecord.AddRecordById(RecordInfoConfig.Indexer.TotalEvent, 1); if (DungeonId > 0) { EventList.Add(new DbGismoState(id, type)); UserProfile.InfoGismo.CheckEventList(); NLog.Debug("OnEventEnd {0} {1}", id, type); } }
public void CheckPoint(NLog.Logger logger, string name = null) { CheckPoint(name); DateTime lastTime; if (currentPointsList.Count > 1) lastTime = currentPointsList[currentPointsList.Count - 2].Time; else lastTime = currentGroupLevels.Last().GroupStartTime.Value; logger.Debug("Замер производительности [{0}] +{1} секунд.", currentPointsList.Last().Name, (currentPointsList.Last().Time - lastTime).TotalSeconds); }
public void Draw(Graphics g) { try { foreach (var colorTextCompt in textList) { colorTextCompt.Draw(g, tickTime); } } catch (Exception e) {//遇到过枚举器被修改的异常 NLog.Debug(e.ToString()); } }
public void CheckTrapOnSummon(IMonster mon, IPlayer rival) { foreach (var trap in trapList) { var trapConfig = ConfigData.GetSpellTrapConfig(trap.Id); if (trapConfig.EffectSummon != null) { if (self.Mp >= trapConfig.ManaCost && trapConfig.EffectSummon(self, rival, trap, mon, trap.Level)) { RemoveTrap(trap, trapConfig); NLog.Debug(string.Format("RemoveTrap Summon id={0} cardId={1}", trap.Id, mon.Id)); BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(trapConfig.UnitEffect), mon as LiveMonster, false)); return; } } } }
public void EndInit() { dataList.Sort(new CompareByQuality()); qualityIndex = new[] { -1, -1, -1, -1, -1 }; for (int i = 0; i < dataList.Count; i++) { if (dataList[i].Value >= qualityIndex.Length) { NLog.Debug(string.Format("EndInit invalide quality id={0}", dataList[i].Type)); continue; } if (qualityIndex[dataList[i].Value] == -1) { qualityIndex[dataList[i].Value] = i; } } }
public bool CheckTrapOnUseCard(ActiveCard selectCard, Point location, IPlayer rival) { foreach (var trap in trapList) { var trapConfig = ConfigData.GetSpellTrapConfig(trap.Id); if (trapConfig.EffectUse != null) { if (self.Mp >= trapConfig.ManaCost && trapConfig.EffectUse(self, rival, trap, selectCard.CardId, (int)selectCard.CardType)) { RemoveTrap(trap, trapConfig); NLog.Debug(string.Format("RemoveTrap UseCard id={0} cardId={1}", trap.Id, selectCard.CardId)); BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(trapConfig.UnitEffect), location, false)); return(true); } } } return(false); }
public static void Oneloop() { timerManager.DoTimer(); if (hasConnect && client != null) { if (client.State == SocketState.Closed || client.State == SocketState.Closing) { MainForm.Instance.ShowDisconnectSafe("已经与服务器断开连接"); client = null; return; } try { client.Oneloop(); CheckHeartbeat(); } catch (Exception e) { NLog.Debug(e); } } }
public void PrintAllPoints(NLog.Logger logger) { string text = "Результаты замера производительности"; DateTime lastTime = new DateTime(); foreach(var point in currentPointsList) { if (lastTime == default(DateTime)) text += String.Format("\nНачало в {0:hh:mm:ss}", point.Time); else { text += point.GetText(0, lastTime); } lastTime = point.Time; } text += String.Format("\nИтого {0} секунд.", (lastTime - currentPointsList.First().Time).TotalSeconds); logger.Debug(text); }
private static void client_Connected(object sender, NetSocketConnectedEventArgs e) { NLog.Debug("Connected: " + e.SourceIP); C2SSender.Login(UserProfile.ProfileName); hasConnect = true; }
private static void ZipAdd(ZipArchive zipArchive, string basePath, NLog.Logger logger) { foreach (string fileName in Directory.GetFiles(basePath, "*.*", SearchOption.AllDirectories)) { if (File.GetAttributes(fileName).HasFlag(FileAttributes.Directory)) { ZipAdd(zipArchive, basePath + fileName, logger); } else { string entryName = fileName.Substring(basePath.Length); logger.Debug(entryName, fileName); ZipAddEntry(zipArchive, entryName, fileName, logger); } } }