internal void OnChangeName(int roleid, string oldName, string newName) { WanMotaInfo info = this.getWanMoTaData(roleid); if (info != null) { info.strRoleName = newName; } WanMoTaDBController.getInstance().OnChangeName(roleid, oldName, newName); }
private void initData() { List<WanMotaInfo> playerWanMoTaDataList = WanMoTaDBController.getInstance().getPlayerWanMotaDataList(); if (null != playerWanMoTaDataList) { foreach (WanMotaInfo data in playerWanMoTaDataList) { this.playerWanMoTaDatas.Add(data.nRoleID, data); this.rankingDatas.Add(data.getPlayerWanMoTaRankingData()); } } }
public int createWanMoTaData(WanMotaInfo data) { lock (this.playerWanMoTaDatas) { if (this.playerWanMoTaDatas.ContainsKey(data.nRoleID)) { return 0; } this.playerWanMoTaDatas.Add(data.nRoleID, data); } this.ModifyWanMoTaPaihangData(data, true); return WanMoTaDBController.getInstance().insertWanMoTaData(TCPManager.getInstance().DBMgr, data); }
/// <summary> /// 初始化数据 /// </summary> private void initData() { // 初始化万魔塔数据,排行榜数据 List <WanMotaInfo> playerWanMoTaDataList = WanMoTaDBController.getInstance().getPlayerWanMotaDataList(); if (null == playerWanMoTaDataList) { return; } foreach (WanMotaInfo data in playerWanMoTaDataList) { playerWanMoTaDatas.Add(data.nRoleID, data); rankingDatas.Add(data.getPlayerWanMoTaRankingData()); } }
/// <summary> /// 创建万魔塔数据 /// </summary> /// <param name="data"></param> /// <returns></returns> public int createWanMoTaData(WanMotaInfo data) { lock (playerWanMoTaDatas) { if (playerWanMoTaDatas.ContainsKey(data.nRoleID)) { return(0); } playerWanMoTaDatas.Add(data.nRoleID, data); } // 添加更新万魔塔排行榜数据 ModifyWanMoTaPaihangData(data, true); return(WanMoTaDBController.getInstance().insertWanMoTaData(TCPManager.getInstance().DBMgr, data)); }
/// <summary> /// 玩家上线初始化时获取玩家万魔塔数据 /// </summary> /// <param name="roleId"></param> /// <returns></returns> public void onPlayerLogin(int roleId, string strRoleName) { WanMotaInfo data = null; lock (playerWanMoTaDatas) { if (playerWanMoTaDatas.TryGetValue(roleId, out data)) { return; } } if (null == data) { data = WanMoTaDBController.getInstance().getPlayerWanMoTaDataById(roleId); if (null == data) { // 数据库中没有万魔塔数据,插入相应的数据 WanMotaInfo newData = new WanMotaInfo(); newData.nRoleID = roleId; newData.strRoleName = strRoleName; newData.lFlushTime = TimeUtil.NOW(); newData.nSweepLayer = -1; createWanMoTaData(newData); } else { // 添加更新万魔塔排行榜数据 ModifyWanMoTaPaihangData(data, true); lock (playerWanMoTaDatas) { playerWanMoTaDatas.Add(data.nRoleID, data); } } } }
public void onPlayerLogin(int roleId, string strRoleName) { WanMotaInfo data = null; lock (this.playerWanMoTaDatas) { if (this.playerWanMoTaDatas.TryGetValue(roleId, out data)) { if (null != data) { return; } } } if (null == data) { data = WanMoTaDBController.getInstance().getPlayerWanMoTaDataById(roleId); if (null == data) { this.createWanMoTaData(new WanMotaInfo { nRoleID = roleId, strRoleName = strRoleName, lFlushTime = TimeUtil.NOW(), nSweepLayer = -1 }); } else { this.ModifyWanMoTaPaihangData(data, true); lock (this.playerWanMoTaDatas) { this.playerWanMoTaDatas.Add(data.nRoleID, data); } } } }
public int updateWanMoTaData(int nRoleID, string[] fields, int startIndex) { return WanMoTaDBController.updateWanMoTaData(TCPManager.getInstance().DBMgr, nRoleID, fields, 1); }