/// <summary> /// 玩家上线初始化时获取玩家翅膀数据 /// </summary> /// <param name="roleId"></param> /// <returns></returns> public void onPlayerLogin(int roleId, string strRoleName) { WingRankingInfo data = null; lock (playerWingDatas) { if (playerWingDatas.TryGetValue(roleId, out data)) { return; } } if (null == data) { data = WingPaiHangDBController.getInstance().getWingDataById(roleId); if (null != data) { // 添加更新翅膀排行榜数据 ModifyWingPaihangData(data, true); lock (playerWingDatas) { playerWingDatas.Add(data.nRoleID, data); } } } }
internal void OnChangeName(int roleid, string oldName, string newName) { WingRankingInfo info = this.getWingData(roleid); if (info != null) { info.strRoleName = newName; } WingPaiHangDBController.getInstance().OnChangeName(roleid, oldName, newName); }
private void initData() { List <WingRankingInfo> playerWingDataList = WingPaiHangDBController.getInstance().getPlayerWingDataList(); if (null != playerWingDataList) { foreach (WingRankingInfo data in playerWingDataList) { this.playerWingDatas.Add(data.nRoleID, data); this.rankingDatas.Add(data.getPlayerWingRankingData()); } } }
public WingRankingInfo getWingData(int nRoleID) { WingRankingInfo data = null; lock (this.playerWingDatas) { if (this.playerWingDatas.TryGetValue(nRoleID, out data)) { return(data); } } return(WingPaiHangDBController.getInstance().getWingDataById(nRoleID)); }
/// <summary> /// 初始化数据 /// </summary> private void initData() { // 初始化翅膀数据,排行榜数据 List <WingRankingInfo> playerWingDataList = WingPaiHangDBController.getInstance().getPlayerWingDataList(); if (null == playerWingDataList) { return; } foreach (WingRankingInfo data in playerWingDataList) { playerWingDatas.Add(data.nRoleID, data); rankingDatas.Add(data.getPlayerWingRankingData()); } }
/// <summary> /// 创建翅膀数据 /// </summary> /// <param name="data"></param> /// <returns></returns> public WingRankingInfo getWingData(int nRoleID) { WingRankingInfo data = null; lock (playerWingDatas) { if (playerWingDatas.TryGetValue(nRoleID, out data)) { return(data); } } // 没有找到的话直接返回空 // 因为在登录时有处理,这里不找重复处理 return(WingPaiHangDBController.getInstance().getWingDataById(nRoleID)); }