private static void SetCombatResult(int teamId, bool isWin) { if (_combatProcessList != null) { if (!_combatProcessList.ContainsKey(teamId)) { _combatProcessList.Add(teamId, new TeamCombatResult()); } lock (ThisLock) { TeamCombatResult tempList = _combatProcessList[teamId]; tempList.IsWin = isWin; } } }
/// <summary> /// 加入组队,若已经在其它组队则自动退出 /// </summary> /// <param name="teamId"></param> public bool AddTeam(int teamId) { if (_teamList == null) { return(false); } if (_teamList.ContainsKey(teamId)) { var team = _teamList[teamId]; if (!team.IsAllow) { return(false); } //是否在其它组队 if (_userList.ContainsKey(_userId)) { int oldTeamId = _userList[_userId]; if (oldTeamId != teamId) { LeaveTeam(oldTeamId); _userList[_userId] = teamId; } } else { _userList.Add(_userId, teamId); } GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(_userId); team.Append(gameUser); return(true); } return(false); }
/// <summary> /// 创建组队 /// </summary> /// <param name="user"></param> /// <param name="plotId"></param> /// <returns></returns> private int Create(GameUser user, int plotId) { if (_teamList == null) { return(-1); } int teamId = NextTeamId; MorePlot morePlot = GetItem(plotId); var team = new MorePlotTeam { MorePlot = morePlot, TeamID = teamId, TeamUser = new TeamUser { UserId = user.UserID, NickName = user.NickName, //UserLv = user.UserLv, //UseMagicID = user.UseMagicID }, CombatResult = false, Status = 1, }; _teamList.Add(teamId, team); AddTeam(teamId); return(teamId); }
/// <summary> /// 加载数据 /// </summary> public static void InitBoss(UserGuild userGuild) { try { if (_userGuildList.ContainsKey(userGuild.GuildID)) { _userGuildList[userGuild.GuildID] = userGuild; } else { _userGuildList.Add(userGuild.GuildID, userGuild); } CombatGeneral general = CreateBossGeneral(userGuild); if (!_bossGeneralList.ContainsKey(userGuild.GuildID)) { _bossGeneralList.Add(userGuild.GuildID, new BossDictionary { BossGeneral = general }); } else { _bossGeneralList[userGuild.GuildID].BossGeneral = general; } } catch (Exception ex) { new BaseLog().SaveLog(ex); } }
void OnAdd() { var key = m_PropertyElement.GetTarget <NewDictionaryKey>().Key; m_Dictionary.Add(key, default); m_ShowAddKeyContainerButton.Show(); m_AddKeyContainer.Hide(); m_Reload.Reload(); }
/// <summary> /// 被克制属相 /// </summary> /// <param name="zodiacType">玩家属相</param> /// <param name="typeID">类型 1.克制 2 被克制 3.全部属相</param> /// <returns></returns> public static TDictionary <short, decimal> ZodiacRestraint(ZodiacType zodiacType, int typeID) { TDictionary <short, decimal> zodiacTDList = new TDictionary <short, decimal>(); string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (typeID == 1) { if (zodiacStr.Length > 2 && zodiacType == zodiacStr[0].ToEnum <ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { zodiacTDList.Add(s1.ToShort(), zodiacStr[2].ToDecimal()); } } } if (typeID == 2) { if (zodiacStr.Length > 2) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1 != ZodiacType.NoZodiac.ToString() && s1.ToEnum <ZodiacType>() == zodiacType) { zodiacTDList.Add(s1.ToShort(), zodiacStr[0].ToDecimal()); } } } } if (typeID == 3) { if (zodiacStr.Length > 2 && zodiacStr[0].ToEnum <ZodiacType>() != zodiacType) { zodiacTDList.Add(s.ToShort(), zodiacStr[2].ToDecimal()); } } } return(zodiacTDList); }
/// <summary> /// 增加索引器 /// </summary> /// <param name="propertyValues"></param> /// <param name="indexValue"></param> internal void Add(object[] propertyValues, string indexValue) { EntityIndex entityIndex = new EntityIndex(propertyValues); string indexItemKey = entityIndex.GetKeyCode(); if (_entityIndexDict.ContainsKey(indexItemKey)) { entityIndex = _entityIndexDict[indexItemKey]; } entityIndex.Add(indexValue); if (_entityIndexDict.ContainsKey(indexItemKey)) { _entityIndexDict[indexItemKey] = entityIndex; } else { _entityIndexDict.Add(indexItemKey, entityIndex); } }
/// <summary> /// 增加到参战队列 /// </summary> /// <param name="user"></param> public void Append(GameUser user) { TDictionary <string, BossUser> userGeneralList = BossDict.UserGeneralList; if (!userGeneralList.ContainsKey(user.UserID)) { userGeneralList.Add(user.UserID, new BossUser { UserId = user.UserID, NickName = user.NickName }); } }
public void CreateIndex(string indexKey, object[] propertyValues, string indexValue) { if (_entityIndexDict == null) { throw new NullReferenceException(string.Format("索引{0}异常,索引字典对象为空!", indexKey)); } EntityIndexList indexList = new EntityIndexList(); if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null) { indexList = _entityIndexDict[indexKey]; } indexList.Add(propertyValues, indexValue); if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey)) { _entityIndexDict[indexKey] = indexList; } else if (_entityIndexDict != null) { _entityIndexDict.Add(indexKey, indexList); } }
/// <summary> /// 法宝全部开启的技能 /// </summary> /// <returns></returns> public static TDictionary <int, short> GetSkillList() { TDictionary <int, short> skillList = new TDictionary <int, short>(); TrumpInfo[] trumpInfoArray = new ConfigCacheSet <TrumpInfo>().FindAll(m => m.TrumpID == TrumpInfo.CurrTrumpID && m.SkillID > 0).ToArray(); foreach (TrumpInfo info in trumpInfoArray) { if (!skillList.ContainsKey(info.SkillID.ToInt())) { skillList.Add(info.SkillID.ToInt(), info.TrumpLv); } } return(skillList); }
private TDictionary <int, short> GetEmbattle(string[] generals, string[] locations) { var generalPos = new TDictionary <int, short>(); for (int i = 0; i < generals.Length; i++) { int generalId = generals[i].ToInt(); short pos = locations.Length > i ? locations[i].ToShort() : (short)0; if (!generalPos.ContainsKey(generalId)) { generalPos.Add(generalId, pos); } } return(generalPos); }
/// <summary> /// 法宝全部开启的属性 /// </summary> /// <returns></returns> public static TDictionary <int, short> GetPropertyList() { TDictionary <int, short> propertyList = new TDictionary <int, short>(); WorshipInfo[] worshipInfoInfoArray = new ConfigCacheSet <WorshipInfo>().FindAll(m => m.TrumpID == TrumpInfo.CurrTrumpID && m.IsOpen).ToArray(); int skID = 0; foreach (WorshipInfo info in worshipInfoInfoArray) { skID++; if (!propertyList.ContainsKey(skID)) { propertyList.Add(skID, info.WorshipLv); } } return(propertyList); }
/// <summary> /// 设置赢的次数 /// </summary> /// <param name="userId"></param> /// <param name="plotId"></param> public void SetWinNum(string userId, int plotId) { if (_userTimesList == null) { return; } string key = userId + plotId; lock (ThisLock) { if (_userTimesList.ContainsKey(key)) { _userTimesList[key] = _userTimesList[key] + 1; } else { _userTimesList.Add(key, 1); } } }
/// <summary> /// 加载数据 /// </summary> public static void InitBoss(GameActive gameActive) { if (_gameActiveList.ContainsKey(gameActive.ActiveId)) { _gameActiveList[gameActive.ActiveId] = gameActive; } else { _gameActiveList.Add(gameActive.ActiveId, gameActive); } CombatGeneral general = CreateBossGeneral(gameActive); if (!_bossGeneralList.ContainsKey(gameActive.ActiveId)) { _bossGeneralList.Add(gameActive.ActiveId, new BossDictionary { BossGeneral = general }); } else { _bossGeneralList[gameActive.ActiveId].BossGeneral = general; } }
/// <summary> /// 法宝全部开启的技能 /// </summary> /// <returns></returns> public static TDictionary<int, short> GetSkillList() { TDictionary<int, short> skillList = new TDictionary<int, short>(); TrumpInfo[] trumpInfoArray = new ConfigCacheSet<TrumpInfo>().FindAll(m => m.TrumpID == TrumpInfo.CurrTrumpID && m.SkillID > 0).ToArray(); foreach (TrumpInfo info in trumpInfoArray) { if (!skillList.ContainsKey(info.SkillID.ToInt())) { skillList.Add(info.SkillID.ToInt(), info.TrumpLv); } } return skillList; }
public override bool TakeAction() { string publicUserID = string.Empty; if (string.IsNullOrEmpty(toUserID)) { publicUserID = ContextUser.UserID; } else { publicUserID = toUserID; UserCacheGlobal.LoadOffline(publicUserID); } user = new GameDataCacheSet <GameUser>().FindKey(publicUserID); if (user == null) { return(false); } if (user.UserExtend == null) { user.UserExtend = new GameUserExtend(); } if (new GameDataCacheSet <UserFunction>().FindKey(publicUserID, FunctionEnum.Fengling) == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_NoFun; return(false); } CheckUserPlotLayerNum(user); _lingshiNum = user.UserExtend.LingshiNum; _userGeneralArray = new GameDataCacheSet <UserGeneral>().FindAll(publicUserID, u => u.GeneralStatus == GeneralStatus.DuiWuZhong && u.GeneralType != GeneralType.Soul); int generalId = 0; foreach (var userGeneral in _userGeneralArray) { if (userGeneral != null && !userItemDict.ContainsKey(userGeneral.GeneralID)) { var package = UserItemPackage.Get(publicUserID); var userItemArray = package.ItemPackage.FindAll(u => !u.IsRemove && u.GeneralID.Equals(userGeneral.GeneralID) && u.ItemStatus == ItemStatus.YongBing); userItemDict.Add(userGeneral.GeneralID, userItemArray); if (generalId == 0) { generalId = userGeneral.GeneralID; } } } if (generalId > 0) { //首个是武器的灵件列表 var package = UserItemPackage.Get(publicUserID); var userItems = package.ItemPackage.FindAll( u => !u.IsRemove && u.GeneralID.Equals(generalId) && new UserItemHelper(u).EquPartsID.Equals((int)EquParts.WuQi) && u.ItemStatus == ItemStatus.YongBing ); if (userItems.Count > 0) { var tempPartList = user.SparePartList.FindAll(m => m.UserItemID.Equals(userItems[0].UserItemID)); for (int i = 0; i < tempPartList.Count; i++) { var part = tempPartList[i]; if (part != null && part.Position > 0 && part.Position - 1 < _sparePartList.Length) { part.UpdateNotify(obj => { _sparePartList[part.Position - 1] = part; return(true); }); } else if (part != null && part.Position == 0 && !string.IsNullOrEmpty(part.UserItemID)) { //修正灵石在装备上位置为同一的 part.UpdateNotify(obj => { part.UserItemID = string.Empty; return(true); }); } } // ContextUser.UpdateSparePart(); } } return(true); }
public override bool TakeAction() { List <PlotNPCInfo> plotNPCInfoList = new ConfigCacheSet <PlotNPCInfo>().FindAll(m => m.PlotID == plotID); npcCount = (short)plotNPCInfoList.Count; var cacheSet = new GameDataCacheSet <UserQueue>(); List <UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang); if (userQueueList.Count > 0) { UserQueue userQueue = userQueueList[0]; coldTime = userQueue.DoRefresh(); if (coldTime == 0) { cacheSet.Delete(userQueue); ContextUser.ResetSweepPool(0); ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); } int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1; if (npcCount > 0) { turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum); timesNum = PlotHelper.GetTimesNum(npcCount, tempNum); } //PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum); //if (battleNum >= npcCount) //{ // turnsNum = turnsNum + 1; //} //else //{ // battleNum = battleNum + 1; //} } userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count; plotInfo = new ConfigCacheSet <PlotInfo>().FindKey(plotID); if (plotInfo == null) { return(false); } foreach (PlotNPCInfo npcInfo in plotNPCInfoList) { if (npcInfo == null) { continue; } List <PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet <PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID); foreach (PlotEmbattleInfo embattleInfo in embattleInfoList) { if (monsterDict.ContainsKey(embattleInfo.MonsterID)) { if (monsterNumDict.ContainsKey(embattleInfo.MonsterID)) { monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1; } } else { MonsterInfo monsterInfo = new ConfigCacheSet <MonsterInfo>().FindKey(embattleInfo.MonsterID); if (monsterInfo != null) { monsterDict.Add(embattleInfo.MonsterID, monsterInfo); monsterNumDict.Add(embattleInfo.MonsterID, 1); } } } } return(true); }
public override bool TakeAction() { TraceLog.ReleaseWriteFatal(_orderInfo); //string AppUrl = ConfigUtils.GetSetting("AppStoreUrl"); if (AppUrl == string.Empty || _orderInfo.IndexOf("Sandbox") > 0) { AppUrl = "https://sandbox.itunes.apple.com/verifyReceipt"; } HttpWebRequest req = (HttpWebRequest)WebRequest.Create(AppUrl); req.Method = "POST"; byte[] ReceiptData = Encoding.UTF8.GetBytes(_orderInfo); TDictionary <string, string> dict = new TDictionary <string, string>(); dict.Add("receipt-data", Convert.ToBase64String(ReceiptData)); byte[] content = Encoding.UTF8.GetBytes(JsonUtils.Serialize(dict)); req.ContentLength = content.Length; Stream stream = req.GetRequestStream(); stream.Write(content, 0, content.Length); stream.Close(); WebResponse resp = req.GetResponse(); stream = resp.GetResponseStream(); StreamReader reader = new StreamReader(stream); string response = reader.ReadToEnd(); req.Abort(); resp.Close(); TraceLog.ReleaseWriteFatal(response); AppStoreInfo appStoreInfo = new AppStoreInfo(); try { appStoreInfo = JsonUtils.Deserialize <AppStoreInfo>(response); } catch (Exception ex) { this.SaveLog(ex); ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().LoadDataError; return(false); } if (appStoreInfo.status != 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1066_PayError; return(false); } //int silver = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID); //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, appStoreInfo.receipt.transaction_id, _deviceId); AppStoreHelper appStore = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID); PaymentService.GetAppStore(_gameID, _serviceID, _passportId, appStore.SilverPiece, appStore.RMB, appStoreInfo.receipt.transaction_id, _deviceId); // TraceLog.ReleaseWriteFatal("appstore完成"); //TraceLog.ReleaseWriteFatal("GameID" + _gameID + "ServerID" + _serviceID); //int silver = 10; //string test = "1234567894561111111"; //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, test, _deviceId); return(true); }
public override bool TakeAction() { TraceLog.ReleaseWriteFatal(_orderInfo); //string AppUrl = ConfigUtils.GetSetting("AppStoreUrl"); if (AppUrl == string.Empty || _orderInfo.IndexOf("Sandbox") > 0) { AppUrl = "https://sandbox.itunes.apple.com/verifyReceipt"; } HttpWebRequest req = (HttpWebRequest)WebRequest.Create(AppUrl); req.Method = "POST"; byte[] ReceiptData = Encoding.UTF8.GetBytes(_orderInfo); TDictionary<string, string> dict = new TDictionary<string, string>(); dict.Add("receipt-data", Convert.ToBase64String(ReceiptData)); byte[] content = Encoding.UTF8.GetBytes(JsonUtils.Serialize(dict)); req.ContentLength = content.Length; Stream stream = req.GetRequestStream(); stream.Write(content, 0, content.Length); stream.Close(); WebResponse resp = req.GetResponse(); stream = resp.GetResponseStream(); StreamReader reader = new StreamReader(stream); string response = reader.ReadToEnd(); req.Abort(); resp.Close(); TraceLog.ReleaseWriteFatal(response); AppStoreInfo appStoreInfo = new AppStoreInfo(); try { appStoreInfo = JsonUtils.Deserialize<AppStoreInfo>(response); } catch (Exception ex) { this.SaveLog(ex); ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().LoadDataError; return false; } if (appStoreInfo.status != 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1066_PayError; return false; } //int silver = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID); //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, appStoreInfo.receipt.transaction_id, _deviceId); AppStoreHelper appStore = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID); PaymentService.GetAppStore(_gameID, _serviceID, _passportId, appStore.SilverPiece, appStore.RMB, appStoreInfo.receipt.transaction_id, _deviceId); // TraceLog.ReleaseWriteFatal("appstore完成"); //TraceLog.ReleaseWriteFatal("GameID" + _gameID + "ServerID" + _serviceID); //int silver = 10; //string test = "1234567894561111111"; //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, test, _deviceId); return true; }
/// <summary> /// 被克制属相 /// </summary> /// <param name="zodiacType">玩家属相</param> /// <param name="typeID">类型 1.克制 2 被克制 3.全部属相</param> /// <returns></returns> public static TDictionary<short, decimal> ZodiacRestraint(ZodiacType zodiacType, int typeID) { TDictionary<short, decimal> zodiacTDList = new TDictionary<short, decimal>(); string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (typeID == 1) { if (zodiacStr.Length > 2 && zodiacType == zodiacStr[0].ToEnum<ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { zodiacTDList.Add(s1.ToShort(), zodiacStr[2].ToDecimal()); } } } if (typeID == 2) { if (zodiacStr.Length > 2) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1 != ZodiacType.NoZodiac.ToString() && s1.ToEnum<ZodiacType>() == zodiacType) { zodiacTDList.Add(s1.ToShort(), zodiacStr[0].ToDecimal()); } } } } if (typeID == 3) { if (zodiacStr.Length > 2 && zodiacStr[0].ToEnum<ZodiacType>() != zodiacType) { zodiacTDList.Add(s.ToShort(), zodiacStr[2].ToDecimal()); } } } return zodiacTDList; }
private TDictionary<int, short> GetEmbattle(string[] generals, string[] locations) { var generalPos = new TDictionary<int, short>(); for (int i = 0; i < generals.Length; i++) { int generalId = generals[i].ToInt(); short pos = locations.Length > i ? locations[i].ToShort() : (short)0; if (!generalPos.ContainsKey(generalId)) { generalPos.Add(generalId, pos); } } return generalPos; }
/// <summary> /// 法宝全部开启的属性 /// </summary> /// <returns></returns> public static TDictionary<int, short> GetPropertyList() { TDictionary<int, short> propertyList = new TDictionary<int, short>(); WorshipInfo[] worshipInfoInfoArray = new ConfigCacheSet<WorshipInfo>().FindAll(m => m.TrumpID == TrumpInfo.CurrTrumpID && m.IsOpen).ToArray(); int skID = 0; foreach (WorshipInfo info in worshipInfoInfoArray) { skID++; if (!propertyList.ContainsKey(skID)) { propertyList.Add(skID, info.WorshipLv); } } return propertyList; }