private void OnMsg_propviewUseEffectItem(MobaMessage msg) { if (msg.Param != null) { int[] array = (int[])msg.Param; if (array.Count <int>() != 2) { return; } long num = 0L; if (!string.IsNullOrEmpty(this.heroNPC)) { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData != null) { num = heroInfoData.HeroId; } } SendMsgManager.SendMsgParam param = new SendMsgManager.SendMsgParam(true, "正在使用道具...", true, 15f); SendMsgManager.Instance.SendMsg(MobaGameCode.WearPrivateEffect, param, new object[] { num, array[0], array[1] }); } }
private void OnMsg_propviewDemountRunes(MobaMessage msg) { if (msg.Param != null) { string text = string.Empty; long num = 0L; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData != null) { num = heroInfoData.HeroId; } RunesOperaInfo runesOperaInfo = default(RunesOperaInfo); runesOperaInfo = (RunesOperaInfo)msg.Param; if (runesOperaInfo.runesPosition <= 0) { return; } text = runesOperaInfo.modelID; int runesPosition = runesOperaInfo.runesPosition; SendMsgManager.SendMsgParam param = new SendMsgManager.SendMsgParam(true, "正在卸下符文...", true, 15f); SendMsgManager.Instance.SendMsg(MobaGameCode.DischargeRune, param, new object[] { text, runesPosition.ToString(), num.ToString(), 1 }); } }
private void OnMsg_propviewDemountAll(MobaMessage msg) { if (msg != null) { if (ModelManager.Instance.IsRunesEquipNull(this.heroNPC)) { Singleton <TipView> .Instance.ShowViewSetText("没有可卸下的符文", 1f); return; } string text = "0"; int num = 0; long num2 = 0L; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData != null) { num2 = heroInfoData.HeroId; } SendMsgManager.SendMsgParam param = new SendMsgManager.SendMsgParam(true, "正在卸下符文...", true, 15f); SendMsgManager.Instance.SendMsg(MobaGameCode.DischargeRune, param, new object[] { text, num.ToString(), num2.ToString(), 2 }); } }
public static void Set_HeroRunes(this ModelManager mmng, string heroName, int position, int modelid) { HeroInfoData heroInfoData = mmng.Get_heroInfo_item_byModelID(heroName); if (heroInfoData != null) { switch (position) { case 1: heroInfoData.Ep_1 = modelid; break; case 2: heroInfoData.Ep_2 = modelid; break; case 3: heroInfoData.Ep_3 = modelid; break; case 4: heroInfoData.Ep_4 = modelid; break; case 5: heroInfoData.Ep_5 = modelid; break; case 6: heroInfoData.Ep_6 = modelid; break; } } }
private void InitGroove(bool isTrue = true) { if (isTrue) { this.runesList.Clear(); UserData userData = ModelManager.Instance.Get_userData_X(); if (userData != null) { this.summonerLevel = CharacterDataMgr.instance.GetUserLevel(userData.Exp); } HeroInfoData heroinfodata = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroinfodata == null) { return; } this.Rank = this.CheckRank(this.summonerLevel); Dictionary <string, SysHeroRunsUnlockVo> runes_info = BaseDataMgr.instance.GetTypeDicByType <SysHeroRunsUnlockVo>(); GridHelper.FillGrid <RunesItem>(this.gridRunes, this.runesItem, this.Num, delegate(int idx, RunesItem comp) { comp.name = "Level" + runes_info[(idx + 1).ToString()].unlock_level; comp.Init(this.Rank, idx, runes_info.Keys.ToList <string>(), heroinfodata); comp.ClickCallBack = new Callback <GameObject>(this.RunesExtension); if (comp.LimitLock == Limit_lock.unlocked) { this.runesList.Add(comp); } }); this.gridRunes.Reposition(); this.ChangeAttributeDisplay(); } }
public override void OnInspectorGUI() { characterInfoData = (HeroInfoData)target; var texture = AssetPreview.GetAssetPreview(characterInfoData.Icon); GUILayout.Label(texture); base.OnInspectorGUI(); }
private void GetRunesTypes() { this.dicValueTypeRunes.Clear(); this.dicGrowthTypeRunes.Clear(); List <int> list = new List <int>(); HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData != null) { if (heroInfoData.Ep_1 != 0) { list.Add(heroInfoData.Ep_1); } if (heroInfoData.Ep_2 != 0) { list.Add(heroInfoData.Ep_2); } if (heroInfoData.Ep_3 != 0) { list.Add(heroInfoData.Ep_3); } if (heroInfoData.Ep_4 != 0) { list.Add(heroInfoData.Ep_4); } if (heroInfoData.Ep_5 != 0) { list.Add(heroInfoData.Ep_5); } if (heroInfoData.Ep_6 != 0) { list.Add(heroInfoData.Ep_6); } } int num = 0; for (int i = 0; i < list.Count; i++) { num += list[i]; } if (num == 0) { this.btnAllDemount.GetComponent <UISprite>().alpha = 0.4862745f; this.btnAllDemount.GetComponent <UIButton>().defaultColor = this.alphaBtn; this.btnAllDemount.GetComponent <UIButton>().hover = this.alphaBtn; this.btnAllDemount.GetComponent <UIButton>().pressed = this.alphaBtn; } else { this.btnAllDemount.GetComponent <UISprite>().alpha = 1f; this.btnAllDemount.GetComponent <UIButton>().defaultColor = this.nonAlphaBtn; this.btnAllDemount.GetComponent <UIButton>().hover = this.nonAlphaBtn; this.btnAllDemount.GetComponent <UIButton>().pressed = this.nonAlphaBtn; } this.ParseData(list); }
private static HeroInfoData Get_heroInfo_item_byModelID(this ModelManager mmng, string modelID) { HeroInfoData result = null; List <HeroInfoData> list = mmng.Get_heroInfo_list(); if (list != null) { result = list.Find((HeroInfoData obj) => obj.ModelId.ToString() == modelID); } return(result); }
public static HeroData GetHeroData(string heroID) { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(heroID); return(new HeroData { Quality = heroInfoData.Grade, Stars = heroInfoData.Level, LV = CharacterDataMgr.instance.GetLevel(heroInfoData.Exp), HeroID = heroID }); }
private void OnMsg_sacriviewChangeHero(MobaMessage msg) { if (msg.Param != null) { string modelID = string.Empty; modelID = (string)msg.Param; this.heroNPC = modelID; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(modelID); this.heroID = ((heroInfoData != null) ? heroInfoData.HeroId : 0L); this.skinID = ((heroInfoData != null) ? heroInfoData.CurrSkin : 0); this.ShowSkinPanel(this.heroNPC, this.toggleType == PropertyType.Info); } }
private void OnMsg_sacriviewChangeHero(MobaMessage msg) { if (msg.Param != null) { string modelID = string.Empty; modelID = (string)msg.Param; this.heroNPC = modelID; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(modelID); this.purchase.gameObject.SetActive(null == heroInfoData); this.ShowPrice(null == heroInfoData); SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(this.heroNPC); this.CheckBtnState(heroInfoData == null && heroMainData != null && heroMainData.source != "1"); } }
public static void Set_HeroRunes(this ModelManager mmng, string heroName) { HeroInfoData heroInfoData = mmng.Get_heroInfo_item_byModelID(heroName); if (heroInfoData != null) { heroInfoData.Ep_1 = 0; heroInfoData.Ep_2 = 0; heroInfoData.Ep_3 = 0; heroInfoData.Ep_4 = 0; heroInfoData.Ep_5 = 0; heroInfoData.Ep_6 = 0; } }
public static EntityVo GetMyHero(string heroId) { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(heroId); EntityVo result; if (heroInfoData != null) { result = new EntityVo(EntityType.Hero, heroId, CharacterDataMgr.instance.GetLevel(heroInfoData.Exp), heroInfoData.Level, heroInfoData.Grade, 0f, 0f, 0, 0); } else { result = new EntityVo(EntityType.Hero, heroId, 1, 1, 1, 0f, 0f, 0, 0); } return(result); }
public static List <EntityVo> ConvertFromHeroInfo(List <HeroInfoData> infos) { List <EntityVo> list = new List <EntityVo>(); if (infos != null) { for (int i = 0; i < infos.Count; i++) { HeroInfoData heroInfoData = infos[i]; EntityVo item = new EntityVo(EntityType.Hero, heroInfoData.ModelId, CharacterDataMgr.instance.GetLevel(heroInfoData.Exp), heroInfoData.Level, heroInfoData.Grade, 0f, 0f, 0, 0); list.Add(item); } } return(list); }
private void OnGetMsg_UseSoulstone(OperationResponse res) { base.LastError = (int)res.Parameters[1]; int soulId = Convert.ToInt32(res.Parameters[100]); int num = Convert.ToInt32(res.Parameters[103]); byte[] array = res.Parameters[88] as byte[]; byte[] array2 = res.Parameters[90] as byte[]; if (base.LastError == 0) { List <EquipmentInfoData> collection = null; if (array2 != null) { collection = SerializeHelper.Deserialize <List <EquipmentInfoData> >(array2); } HeroInfoData data = null; if (array != null) { data = SerializeHelper.Deserialize <HeroInfoData>(array); } bool check = false; ModelManager.Instance.Get_heroInfo_list_X().ForEach(delegate(HeroInfoData obj) { if (obj.HeroId == data.HeroId) { obj = data; check = true; } }); if (!check) { ModelManager.Instance.Get_heroInfo_list_X().Add(data); } else { EquipmentInfoData equipmentInfoData = ((List <EquipmentInfoData>)base.Data).Find((EquipmentInfoData obj) => obj.EquipmentId == (long)soulId); equipmentInfoData.Count -= num; } base.Data = new List <EquipmentInfoData>(collection); base.DebugMessage = "====>OK " + res.OperationCode; } else { base.DebugMessage = "====>UseSoulstone" + res.OperationCode; } base.Valid = (base.LastError == 0); }
public void AddItem(HeroInfoData hero) { this.Init(); SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(hero.ModelId); this.HeroID = hero; this.Name.text = CharacterDataMgr.instance.ShowHeroName(hero.Grade, heroMainData); this.ShowSlider(hero.Exp, 0); HeroData herosData = new HeroData { Quality = hero.Grade, LV = CharacterDataMgr.instance.GetLevel(hero.Exp), Stars = hero.Level, HeroID = hero.ModelId }; this.newHeroData.Init(herosData, NewHeroItem.CardType.HeroAvator, true, true); }
public override void CollectGameItemAttr() { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.self.npc_id); if (heroInfoData == null) { return; } Dictionary <AttrType, float> dictionary = new Dictionary <AttrType, float>(); Dictionary <AttrType, float> dictionary2 = new Dictionary <AttrType, float>(); if (heroInfoData.Ep_1 > 0) { this.GetGameItemAttr(heroInfoData.Ep_1.ToString(), ref dictionary, ref dictionary2); } if (heroInfoData.Ep_2 > 0) { this.GetGameItemAttr(heroInfoData.Ep_2.ToString(), ref dictionary, ref dictionary2); } if (heroInfoData.Ep_3 > 0) { this.GetGameItemAttr(heroInfoData.Ep_3.ToString(), ref dictionary, ref dictionary2); } if (heroInfoData.Ep_4 > 0) { this.GetGameItemAttr(heroInfoData.Ep_4.ToString(), ref dictionary, ref dictionary2); } if (heroInfoData.Ep_5 > 0) { this.GetGameItemAttr(heroInfoData.Ep_5.ToString(), ref dictionary, ref dictionary2); } if (heroInfoData.Ep_6 > 0) { this.GetGameItemAttr(heroInfoData.Ep_6.ToString(), ref dictionary, ref dictionary2); } foreach (KeyValuePair <AttrType, float> current in dictionary) { base.SetAttr(DataManager.DataPoolType.AddDataBefore, current.Key, current.Value); } foreach (KeyValuePair <AttrType, float> current2 in dictionary2) { base.SetAttr(DataManager.DataPoolType.MulDataBefore, current2.Key, current2.Value); } }
private void OnChangeNPC(MobaMessage msg) { if (msg.Param != null) { this.coroutine.StopAllCoroutine(); string text = string.Empty; text = (string)msg.Param; this.heroNPC = text; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData != null) { this.heroID = heroInfoData.HeroId; } else { this.heroID = 0L; } } }
private void OnMsg_sacriviewChangeHero(MobaMessage msg) { if (msg.Param != null) { string modelID = string.Empty; modelID = (string)msg.Param; this.heroNPC = modelID; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(modelID); if (heroInfoData != null) { this.heroID = heroInfoData.HeroId; this.GenerateUnit(); if (null != this.currEffectItem) { MobaMessageManagerTools.SendClientMsg(ClientV2C.propviewClickCollectionItem, this.currEffectItem, false); } } } }
protected override void OnConnectServer(MobaPeerType type) { string curLevelId = LevelManager.CurLevelId; base.OnConnectServer(type); if (type == MobaPeerType.C2PvpServer) { List <EntityVo> heroes = LevelManager.GetHeroes(TeamType.LM); int battleId = int.Parse(curLevelId); List <PvePlayerInfo> list = new List <PvePlayerInfo>(); foreach (EntityVo current in heroes) { HeroInfoData hero = new HeroInfoData { EpMagic = string.Empty, ModelId = current.npc_id, SkillList = null, Skins = string.Empty }; HeroInfo heroInfo = new HeroInfo { heroId = current.npc_id, Hero = hero }; PvePlayerInfo item = new PvePlayerInfo { heroInfo = heroInfo, heroSkinId = string.Empty, selfDefSkillId = string.Empty, talentInfo = null, userName = current.npc_id }; list.Add(item); } SendMsgManager.Instance.SendPvpLoginMsgBase <C2PLoginPve>(PvpCode.C2P_LoginPve, new C2PLoginPve { battleId = battleId, pvePlayer = list, roomId = this._roomId }, this._roomId); } }
private int IsExchangeEffect() { int result = 0; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byHeroID_X(this.heroID); if (heroInfoData == null) { } SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(this.currEffectItem.ModelID.ToString()); switch (dataById.hero_decorate_type) { case 1: result = heroInfoData.petId; break; case 2: result = heroInfoData.tailEffectId; break; case 3: result = heroInfoData.levelEffectId; break; case 4: result = heroInfoData.backEffectId; break; case 5: result = heroInfoData.birthEffectId; break; case 6: result = heroInfoData.deathEffectId; break; case 7: result = heroInfoData.eyeUnitSkinId; break; } return(result); }
private void OnGetMsg_UseProps(OperationResponse res) { base.LastError = (int)res.Parameters[1]; int equip = (int)res.Parameters[93]; int num = (int)res.Parameters[131]; int num2 = Convert.ToInt32(res.Parameters[101]); int num3 = (int)res.Parameters[130]; string value = res.Parameters[102] as string; long exp = (long)res.Parameters[67]; List <EquipmentInfoData> list = new List <EquipmentInfoData>(); if (base.Data != null) { list = (base.Data as List <EquipmentInfoData>); } if (base.LastError == 0) { if (num3 == 1) { long tId = Convert.ToInt64(value); HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_list_X().Find((HeroInfoData obj) => obj.HeroId == tId); heroInfoData.Exp = exp; } EquipmentInfoData equipmentInfoData = list.Find((EquipmentInfoData obj) => obj.EquipmentId == (long)equip); if (equipmentInfoData.Count > num) { equipmentInfoData.Count -= num; } else { list.Remove(equipmentInfoData); } MobaMessage message = MobaMessageManager.GetMessage((ClientMsg)23052, num, 0f); MobaMessageManager.ExecuteMsg(message); base.DebugMessage = "====>OK " + res.OperationCode; } else { base.DebugMessage = "====>UseProps" + res.OperationCode; } base.Valid = (base.LastError == 0); }
private void OnMsg_propviewReplaceSkin(MobaMessage msg) { if (msg.Param != null) { int num = (int)msg.Param; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(this.heroNPC); if (heroInfoData == null) { Singleton <TipView> .Instance.ShowViewSetText("请先购买该英雄!!!", 1f); return; } long heroId = heroInfoData.HeroId; SendMsgManager.SendMsgParam param = new SendMsgManager.SendMsgParam(false, "正在穿戴...", true, 15f); SendMsgManager.Instance.SendMsg(MobaGameCode.ChangeSkin, param, new object[] { heroId.ToString(), num.ToString() }); } }
public void ReRefreshUISkinPanel(string name) { if (name == null) { return; } if (this._skins.Count == 0) { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(name); if (heroInfoData == null) { this.setHeroName(name, 0L, 0, false); } else { this.setHeroName(name, heroInfoData.HeroId, heroInfoData.CurrSkin, false); } } NGUITools.SetActive(this._buyBtn, !this.IsPossess(this._skins[0].getSkinInfo().skinId) && !this.SourceState(this._skins[0].getSkinInfo().skinId)); this._skins[0].setSkinInfo(this._skins[0].getSkinInfo(), this.IsPossess(this._skins[0].getSkinInfo().skinId), this.IsWear(this.heroid, this._skins[0].getSkinInfo().skinId)); this.wearLabel.SetActive(CharacterDataMgr.instance.OwenHeros.Contains(name) && this.IsWear(this.heroid, this._skins[0].getSkinInfo().skinId)); this.source.gameObject.SetActive(this.SourceState(this._skins[0].getSkinInfo().skinId)); }
public void CollectionIsUsing(long heroid) { HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byHeroID_X(heroid); if (heroInfoData != null) { if (heroInfoData.petId == this.modelID) { this.isUsing = true; } else if (heroInfoData.tailEffectId == this.modelID) { this.isUsing = true; } else if (heroInfoData.levelEffectId == this.modelID) { this.isUsing = true; } else if (heroInfoData.backEffectId == this.modelID) { this.isUsing = true; } else if (heroInfoData.birthEffectId == this.modelID) { this.isUsing = true; } else if (heroInfoData.deathEffectId == this.modelID) { this.isUsing = true; } else if (heroInfoData.eyeUnitSkinId == this.modelID) { this.isUsing = true; } } }
private void OnMsg_sacriviewChangeHero(MobaMessage msg) { this.coroutine.StopAllCoroutine(); if (msg.Param != null) { string modelID = string.Empty; modelID = (string)msg.Param; this.heroNPC = modelID; HeroInfoData heroInfoData = ModelManager.Instance.Get_heroInfo_item_byModelID_X(modelID); this.skinID = ((heroInfoData != null) ? heroInfoData.CurrSkin : 0); if (null != this.smodel) { UnityEngine.Object.Destroy(this.smodel); } if (null != this.animator) { UnityEngine.Object.Destroy(this.animator); } if (this.skinID == 0) { SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(this.heroNPC); if (heroMainData != null) { this.task_loadModel = this.coroutine.StartCoroutine(this.LoadModel(heroMainData.smodel_id), true); } } else { SysHeroSkinVo dataById = BaseDataMgr.instance.GetDataById <SysHeroSkinVo>(this.skinID.ToString()); if (dataById != null) { this.task_loadModel = this.coroutine.StartCoroutine(this.LoadModel(dataById.smodel_id), true); } } } }
public void ShowHero(string hero_id, bool showframe) { if (hero_id != string.Empty) { this.Panel.gameObject.SetActive(true); this.Level.gameObject.SetActive(true); HeroInfoData heroData = CharacterDataMgr.instance.GetHeroData(hero_id); SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(hero_id); this.ShowStar((heroData == null) ? 1 : heroData.Level); this.UIAvatar.mainTexture = ResourceManager.Load <Texture>(heroMainData.avatar_icon, true, true, null, 0, false); this.UILevel.text = CharacterDataMgr.instance.GetLevel((heroData == null) ? 0L : heroData.Exp).ToString(); this.UIQuality.spriteName = CharacterDataMgr.instance.GetFrame_HeroIcon((heroData == null) ? 1 : heroData.Grade); if (this.battletype == BattleType.YZ) { if (!Singleton <SelectView> .Instance.TBCCheckLive(hero_id, this)) { this.UIAvatar.color = new Color(0.5f, 0.5f, 0.5f); } else { this.UIAvatar.color = new Color(1f, 1f, 1f); } } else { this.ShowHpValue(false, 0f); this.ShowMpValue(false, 0f); } } else { this.Panel.gameObject.SetActive(false); this.Level.gameObject.SetActive(false); } this.ShowFrame(showframe); }
public void Init(int rank, int idx, List <string> list_key, HeroInfoData heroinfodata) { Dictionary <string, SysHeroRunsUnlockVo> typeDicByType = BaseDataMgr.instance.GetTypeDicByType <SysHeroRunsUnlockVo>(); this.level_frame_hightlight.gameObject.SetActive(false); switch (idx + 1) { case 1: this.modelID = heroinfodata.Ep_1; break; case 2: this.modelID = heroinfodata.Ep_2; break; case 3: this.modelID = heroinfodata.Ep_3; break; case 4: this.modelID = heroinfodata.Ep_4; break; case 5: this.modelID = heroinfodata.Ep_5; break; case 6: this.modelID = heroinfodata.Ep_6; break; } EquipmentInfoData equipmentInfoData = ModelManager.Instance.Get_equipmentList_X().Find((EquipmentInfoData obj) => obj.ModelId == this.modelID); this.equipID = ((equipmentInfoData != null) ? equipmentInfoData.EquipmentId : 0L); if (idx + 1 <= rank) { this.level_rune.gameObject.SetActive(true); this.level_num.gameObject.SetActive(false); this.level_icon.spriteName = "Hero_rune_icon_sword"; this.level_icon.MakePixelPerfect(); this.limit_lock = Limit_lock.unlocked; if (this.modelID > 0) { SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(this.modelID.ToString()); this.level_rune.spriteName = dataById.icon; } else { this.level_rune.spriteName = string.Empty; } } else { this.level_rune.gameObject.SetActive(false); this.level_num.gameObject.SetActive(true); this.level_num.spriteName = "Hero_rune_level_" + typeDicByType[list_key[idx]].unlock_level; this.level_num.MakePixelPerfect(); this.rank_rune = typeDicByType[list_key[idx]].unlock_level; this.limit_lock = Limit_lock.locked; } this.rune_position = (Rune_Position)int.Parse(list_key[idx]); UIEventListener.Get(base.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickRune); }
public virtual void Initialize(HeroInfoData heroData) { }
private static int QueryHeroData(int server_id , int limit , int offset , string search , string sort , string order ) { gmt.Server server = gmt.Server.GetServerAt(server_id); #region 查询总数 string sqlCnt = "select count(uid) from heroinfo_ where 1 " + search; DatabaseAssistant.Execute(reader => { if (reader.Read()) { queryInfo.resTotal = reader.GetInt32(0); } }, server.LogDatabaseAddress, server.LogDatabasePort, server.LogDatabaseCharSet, server.LogDatabase, server.LogDatabaseUserId, server.LogDatabasePassword, sqlCnt ); #endregion if (queryInfo.resTotal != 0) { string orderSql = ""; #region 排序 if (!string.IsNullOrEmpty(sort)) { if (!string.IsNullOrEmpty(sort)) { if (sort == "type_name") { sort = "type"; } orderSql = string.Format("order by {0} {1}", sort, order); } } #endregion #region 查找id集合 string sql = string.Format("SELECT id FROM heroinfo_ where 1 {0} {1} limit {2}, {3}" , search , orderSql , offset , limit ); StringBuilder sbIds = new StringBuilder(); DatabaseAssistant.Execute(reader => { while (reader.Read()) { sbIds.Append(reader.GetString(0)); sbIds.Append(","); } if (sbIds.Length != 0) { sbIds.Remove(sbIds.Length - 1, 1); } }, server.LogDatabaseAddress, server.LogDatabasePort, server.LogDatabaseCharSet, server.LogDatabase, server.LogDatabaseUserId, server.LogDatabasePassword, sql ); #endregion #region 根据id集合查找数据 sql = string.Format("select date, uid, cyuid, channel_id, team_level, type, hero_id, target_id, value_bf, value_af, zdl_bf, zdl_af, team_zdl_bf, team_zdl_af, vip from heroinfo_ where id in ({0}) {1}", sbIds.ToString(), orderSql); DatabaseAssistant.Execute(reader => { while (reader.Read()) { try { HeroInfoData hero = new HeroInfoData(); hero.date = reader.GetDateTime(0).ToString("yyyy-MM-dd HH:mm:ss"); hero.uid = reader.GetUInt32(1); hero.channel_id = reader.GetString(3); hero.team_level = reader.GetInt32(4); hero.type = reader.GetInt32(5); if (-1 != hero.type) { if (HeroInfoTypeDic.ContainsKey(hero.type)) { hero.type_name = HeroInfoTypeDic[hero.type]; } else { hero.type_name = string.Format("Unknown(type: {0})", hero.type); } } hero.hero_id = reader.GetInt32(6); if (-1 != hero.hero_id) { if (itemNameDic.ContainsKey(hero.hero_id)) { hero.hero_name = itemNameDic[hero.hero_id]; } else { hero.hero_name = string.Format("Unknown(id: {0})", hero.hero_id); } } hero.target_id = reader.GetInt32(7); //if (itemNameDic.ContainsKey(hero.target_id)) //{ // hero.target_name = itemNameDic[hero.target_id]; //} //else //{ // hero.target_name = string.Format("Unknown(id: {0})", hero.target_id); //} hero.value_bf = reader.GetInt32(8); hero.value_af = reader.GetInt32(9); hero.zdl_bf = reader.GetInt32(10); hero.zdl_af = reader.GetInt32(11); hero.team_zdl_bf = reader.GetInt32(12); hero.team_zdl_af = reader.GetInt32(13); hero.vip = reader.GetInt32(14); heroInfoList.Add(hero); } catch (Exception e) { Log.AddLog(e.ToString()); } } }, server.LogDatabaseAddress, server.LogDatabasePort, server.LogDatabaseCharSet, server.LogDatabase, server.LogDatabaseUserId, server.LogDatabasePassword, sql); #endregion } return(queryInfo.resTotal); }