// 英雄升星 public void RequestHeroUpgradeStar(long heroID) { HeroInfo info = GetHeroInfo(heroID); if (info == null) { return; } if (info.StarLevel >= GameConfig.MAX_HERO_STAR) { // 已经最高星了,无法继续升级 UIUtil.ShowMsgFormat("MSG_HERO_STAR_MAX"); return; } if (!CheckHeroUpgradeStarItem(info)) { UIUtil.ShowMsgFormat("MSG_HERO_UPGRADE_STAR_LIMIT"); return; } PCMLong builder = new PCMLong(); builder.arg = heroID; NetworkManager.Instance.Send(eCommand.HERO_UPGRADE_STAR, builder, (buffer) => { PHeroAttr ret = Net.Deserialize <PHeroAttr>(buffer); Log.Info("英雄升星成功"); if (!Net.CheckErrorCode(ret.errorCode, eCommand.HERO_UPGRADE_STAR)) { return; } HeroInfo heroInfo = GetHeroInfo(heroID); if (heroInfo == null) { return; } int starCost = GetHeroStarUpgradeCost(heroInfo.ConfigID, heroInfo.StarLevel); ItemInfo itemInfo = GetItemByConfigID(heroInfo.Cfg.Cost); if (itemInfo == null || itemInfo.Number < starCost) { Log.Error("碎片不足"); return; } HeroInfo oriHeroInfo = heroInfo.Clone(); // 同步服务器数据 主要是获取新的技能 heroInfo.Deserialize(ret, false); UseItemByConfigID(heroInfo.Cfg.Cost, starCost); UIManager.Instance.RefreshWindow <UINewHeroView>(); UIManager.Instance.RefreshWindow <UINewHeroListView>(); UIManager.Instance.OpenWindow <UIHeroStarRisingSuccView>(oriHeroInfo, heroInfo); }); }