public void Init() { // 测试用, 先把技能全部 放进去 HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(IDInTable); if (null != heroInfo) { if (GameSettings.Singleton.m_isSingle) { foreach (int skillId in heroInfo.AllSkillIDList) { HeroCardSkill info = new HeroCardSkill(); info.m_skillID = skillId; AddSkill(info); } foreach (var item in heroInfo.PassiveSkillIDList) {//被动技能 HeroCardSkill info = new HeroCardSkill(); info.m_skillID = item; AddSkill(info); } } SwitchSkillID = heroInfo.SwitchSkillID; } }
// 获得技能 public HeroCardSkill GetSkillInfo(int skillId) { HeroCardSkill temp = new HeroCardSkill(); for (int i = 0; i < SkillItemInfoList.Length; i++) { if (skillId == SkillItemInfoList[i].m_skillID) { return(SkillItemInfoList[i]); } } return(temp); }
public void OnClickDemoButton(GameObject obj) { int floorId = 20101; SM.RandomRoomLevel.Singleton.m_curFloorId = floorId; CSItem item = null; Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid); if (null != helper) { item = new CSItem(); item.m_guid = helper.m_cardGuid; item.IDInTable = (short)helper.m_cardId; item.Level = helper.m_cardLevel; item.BreakCounts = helper.m_cardBreakCounts; item.Init(); // 测试用 HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId); if (null != heroInfo) { List <int> skillIDList = heroInfo.GetAllSkillIDList(); foreach (int skillId in skillIDList) { HeroCardSkill info = new HeroCardSkill(); info.m_skillID = skillId; item.AddSkill(info); } foreach (var item1 in heroInfo.PassiveSkillIDList) {//被动技能 HeroCardSkill info = new HeroCardSkill(); info.m_skillID = item1; item.AddSkill(info); } } } Team.Singleton.Comrade = item; BattleArena.Singleton.PrepareEnterDungeons(); // MainGame.Singleton.CurrentState.SwitchNexted = true; // StageMenu.Singleton.m_isReqHelpData = true; }
// 进入战斗准备界面 void OnHelperConfirm(object sender) { HideHelper(); CSItem item = null; Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid); if (null != helper) { item = new CSItem(); item.m_guid = helper.m_cardGuid; item.IDInTable = (short)helper.m_cardId; item.Level = helper.m_cardLevel; item.BreakCounts = helper.m_cardBreakCounts; item.Init(); // 测试用 HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId); if (null != heroInfo) { List <int> skillIDList = heroInfo.GetAllSkillIDList(); foreach (int skillId in skillIDList) { HeroCardSkill info = new HeroCardSkill(); info.m_skillID = skillId; item.AddSkill(info); } foreach (var item1 in heroInfo.PassiveSkillIDList) {//被动技能 HeroCardSkill info = new HeroCardSkill(); info.m_skillID = item1; item.AddSkill(info); } } } Team.Singleton.Comrade = item; BattleArena.Singleton.PrepareEnterDungeons(); //UpdateBattlePreparation(); }
// 添加技能 public void AddSkill(HeroCardSkill info) { // 更新 for (int i = 0; i < SkillItemInfoList.Length; i++) { if (info.m_skillID == SkillItemInfoList[i].m_skillID) { SkillItemInfoList[i].m_skillExp = info.m_skillExp; return; } } // 如果没有则添加 for (int i = 0; i < SkillItemInfoList.Length; i++) { if (SkillItemInfoList[i].m_skillID == 0) { SkillItemInfoList[i] = info; return; } } }
// 更新TIPS 信息 void UpdateTipsInfo(int skillId) { CSItem card = null; if (CardBag.Singleton.m_curOptinGuid.Equals(CSItemGuid.Zero)) { card = CardBag.Singleton.m_cardForDetail; } else { card = CardBag.Singleton.itemBag.GetItemByGuid(CardBag.Singleton.m_curOptinGuid); } if (null == card) { return; } HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.m_id); if (null == heroInfo) { return; } SkillInfo info = GameTable.SkillTableAsset.Lookup(skillId); if (null == info) { return; } HeroCardSkill heroSkillInfo = card.GetSkillInfo(skillId); CDInfo cdInfo = GameTable.CDTableAsset.Lookup(info.CoolDown); if (cdInfo == null) { m_tipsSkillCD.text = GetTimeString(0f); } else { m_tipsSkillCD.text = GetTimeString(cdInfo.CDTime); } // Debug.Log("m_tipsSkillDes:" + m_tipsSkillDes.height); int needLevel = 0; // tips 位置 int offset = 50; needLevel = heroInfo.GetSkillNeedLevel(skillId); // 主动技能类型 if (info.SkillType == (int)ENSkillType.enSkill) { offset = 100; } else { offset = 200; } // 是否有此技能 if (!card.HaveSkill(skillId)) { m_skillGetTips.text = string.Format(Localization.Get("SkillUnlockLevel"), needLevel); m_skillGetTips.gameObject.SetActive(true); } else { m_skillGetTips.gameObject.SetActive(false); } // 设置内容 m_tipsSkillName.text = info.Name; m_tipsSkillDes.text = info.Description; m_tipsSkillLevel.text = heroSkillInfo.m_skillLevel.ToString(); int height = 100; height = height + m_tipsSkillDes.height; int switchTipsHeight = 100; switchTipsHeight = switchTipsHeight + m_tipsSkillDes.height; m_comboItem.SetActive(false); for (int i = 0; i < m_comboList.Count; i++) { if (null != m_comboList[i]) { GameObject.Destroy(m_comboList[i]); } } string strSkillType = ""; // 终结技 if (info.SkillConnectionType == (int)ENSkillConnectionType.enFinal) { strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enFinalSkill).StringTypeValue; m_comboItem.SetActive(true); int minCombo = info.MinComboRequir + (int)(info.ComboRequirementParam * heroSkillInfo.m_skillLevel); m_comboItem.GetComponent <UILabel>().text = minCombo.ToString(); WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enActiveSkill); m_comboItem.transform.Find("ComboDes").GetComponent <UILabel>().text = Localization.Get(worldInfo.StringTypeValue); height = height + 60; Dictionary <int, string> list = GetComboList(skillId); int comboMax = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enMaxCombo).IntTypeValue; if (list != null) { int i = 1; foreach (KeyValuePair <int, string> item in list) { if (i >= comboMax) { break; } GameObject copy = GameObject.Instantiate(m_comboItem) as GameObject; copy.SetActive(true); copy.transform.parent = m_switchSkillTips.transform; copy.name = copy.name + i; copy.transform.localScale = Vector3.one; copy.transform.localPosition = Vector3.zero; copy.GetComponent <UILabel>().text = item.Key.ToString(); copy.transform.Find("ComboDes").GetComponent <UILabel>().text = item.Value; height = height + 60; i++; m_comboList.Add(copy); } } } else if (info.SkillConnectionType == (int)ENSkillConnectionType.enConnect) { strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enConectSkill).StringTypeValue; } else if (info.SkillConnectionType == (int)ENSkillConnectionType.enSpecial) { strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enSpecialSkill).StringTypeValue; } m_tipsSkillType.GetComponent <UILabel>().text = Localization.Get(strSkillType); // 设置tips的 大小 主要是高度 m_tips.GetComponent <UISprite>().height = height; // 设置位置 m_tips.GetComponent <UISprite>().topAnchor.absolute = -offset; m_switchSkillTips.GetComponent <UILabel>().topAnchor.absolute = -switchTipsHeight; m_switchSkillTips.GetComponent <UIGrid>().Reposition(); }