static public UISkillCD Create() { UISkillCD self = UIManager.Singleton.LoadUI <UISkillCD>("UI/UISkillCD", UIManager.Anchor.TopLeft); return(self); }
public override void OnInit() { base.OnInit(); string temp = "UI/Interface/BattleBtn/battleBtn.mat"; WorldParamInfo worldParamInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enbattleBtnNormal); if (null != worldParamInfo) { temp = worldParamInfo.StringTypeValue; } m_normalMaterial = PoolManager.Singleton.LoadWithoutInstantiate <Material>(temp); temp = "UI/Interface/BattleBtn/battleBtn_disable.mat"; worldParamInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enbattleBtnDisable); if (null != worldParamInfo) { temp = worldParamInfo.StringTypeValue; } m_diableMaterial = PoolManager.Singleton.LoadWithoutInstantiate <Material>(temp); AddPropChangedNotify((int)MVCPropertyID.enMainPlayer, OnPropertyChanged); m_markAutoAttack = FindChildComponent <UISprite>("MarkAutoAttack"); m_markAutoSkill = FindChild("MarkAutoUseSkill"); m_spriteFrame = FindChildComponent <UISprite>("skillFramework"); m_grid = FindChildComponent <UIGrid>("SkillGrid"); m_addActorLevel = FindChildComponent <UIButton>("ActorLevelButton"); m_yellowPointLabel = FindChildComponent <UILabel>("yelloPointLabel"); m_skillInfoTips = FindChild("SkillInfoTips"); m_tipsSkillName = FindChildComponent <UILabel>("SkillName"); m_skillGetTips = FindChildComponent <UILabel>("SkillGetTips"); m_tipsSkillDes = FindChildComponent <UILabel>("SkillDes"); m_tipsSkillCD = FindChildComponent <UILabel>("SkillCD"); m_tipsSkillLevel = FindChildComponent <UILabel>("SkillLevel"); m_switchSkillTips = FindChild("SwitchSkillTips"); m_comboItem = FindChild("Combo"); m_tipsSkillType = FindChild("SkillType"); m_autoAttack = FindChild("AutoAttack"); for (int i = 0; i < AllSkillCount; ++i) { string str = "Skill" + (i + 1).ToString(); GameObject skill = FindChild(str, WindowRoot); GameObject bk = FindChild("Background", skill); UISkillCD uiCd = UISkillCD.Create(); uiCd.Init(bk, UISkillCD.EnShape.enSquare_Samall); uiCd.HideWindow(); //UIQTETimeLeft uiQteTimeLeft = UIQTETimeLeft.Create(); //uiQteTimeLeft.Init(bk); //uiQteTimeLeft.HideWindow(); SameInfo info = new SameInfo(); info.m_objSkill = skill; info.m_uiSkillCD = uiCd; //info.m_uiQteTimeLeft = uiQteTimeLeft; m_sameInfoList[i] = info; } GameObject lastSkill = m_sameInfoList[SwitchSkillIndex].m_objSkill; if (ActorManager.Singleton.Support != null && ActorManager.Singleton.Support.SkillBag.Count != 0) { lastSkill.SetActive(true); SkillInfo skillInfo = ActorManager.Singleton.Support.SkillBag[0].SkillTableInfo; IconInfomation info = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); FindChildComponent <UITexture>("skill", lastSkill).mainTexture = PoolManager.Singleton.LoadIcon <Texture>(info.dirName); UISkillCD cd = m_sameInfoList[SwitchSkillIndex].m_uiSkillCD; cd.SkillID = skillInfo.ID; cd.RemoveMainRegister(); cd.RegisterActor(ActorManager.Singleton.Support); SwitchSkillChanged(); } else { lastSkill.SetActive(false); } //m_connectionTime = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enSkillConnectionTime).FloatTypeValue; //m_specialTime = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enSkillSpecialTime).FloatTypeValue; PoolManager.Singleton.LoadResourceAsyncCallback(GameData.GetUIPath("UISkillHighlight"), Coroutine_LoadHightlightObjCallback); }
void SkillChange() { int index = 0; bool isNormaled = false; foreach (var item in m_mainPlayer.SkillBag) { SkillInfo skillInfo = item.SkillTableInfo; if (skillInfo.SkillType != (int)ENSkillType.enSkill && skillInfo.SkillType != (int)ENSkillType.enSkillNormalType && skillInfo.SkillType != (int)ENSkillType.enDodge) { if (skillInfo.SkillType == (int)ENSkillType.enOpenBox) {//开宝箱技能 m_openBoxSkillID = skillInfo.ID; } continue; } if (skillInfo.SkillType == (int)ENSkillType.enSkillNormalType) { continue; } if (skillInfo.SkillType == (int)ENSkillType.enDodge) { if (isNormaled) { continue; } isNormaled = true; } GameObject skill = m_sameInfoList[index].m_objSkill; skill.SetActive(true); UITexture sprite = FindChildComponent <UITexture>("skill", skill); //设置技能等级 UILabel skillLabel = FindChildComponent <UILabel>("SkillLevel", skill); if (null != skillLabel) { skillLabel.text = "LV." + item.SkillLevel; } //icon IconInfomation info = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); if (info == null) { Debug.LogWarning("load icon fail,id:" + skillInfo.Icon); } else { sprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(info.dirName); } sprite.material = m_normalMaterial; //cd UISkillCD cd = m_sameInfoList[index].m_uiSkillCD; cd.Reset(); cd.SkillID = skillInfo.ID; if (m_mainPlayer.SkillControl.IsSkillCDRunning(skillInfo.ID, m_mainPlayer)) { cd.ShowSkillCDBtn(); } //uiQteTimeLeft //UIQTETimeLeft qteCD = m_sameInfoList[index].m_uiQteTimeLeft; //qteCD.Reset(); ++index; } for (int i = index; i < MaxSkillNumber; ++i) { m_sameInfoList[i].m_objSkill.SetActive(false); } //设置frame的width m_spriteFrame.width = index * (int)m_grid.cellWidth; if (ActorManager.Singleton.Support != null) { m_spriteFrame.width += (int)m_grid.cellWidth; } //设置grid m_grid.repositionNow = true; //qte /*if (m_isQteVisible) * { * SetQteVisible(m_isQteVisible); * }*/ //更新是否需要显示加点按钮 UpdateAddSkillLevel(); DelHighlight(); SkillEnabledChanged(); }
void SkillEnabledChanged() { bool targetIsBox = false; bool targetIsTrap = false; if (!m_mainPlayer.CurrentTargetIsDead) { if (m_mainPlayer.CurrentTarget.Type == ActorType.enNPC) { NPC npc = m_mainPlayer.CurrentTarget as NPC; if (npc.GetNpcType() == ENNpcType.enBoxNPC) { targetIsBox = true; } } if (m_mainPlayer.CurrentTarget.Type == ActorType.enNPCTrap) { targetIsTrap = true; } } for (int i = 0; i < MaxSkillNumber; ++i) { GameObject skill = m_sameInfoList[i].m_objSkill; if (!skill.activeSelf) { continue; } GameObject enabled = FindChild("Enabled", skill); UITexture sprite = FindChildComponent <UITexture>("skill", skill); UISkillCD uiSkillCD = m_sameInfoList[i].m_uiSkillCD; Actor.ActorSkillInfo info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID); if (info == null) { Debug.LogWarning("skill table is null, index:" + i); continue; } if (info.SkillTableInfo.SkillType == (int)ENSkillType.enSkillNormalType || info.SkillTableInfo.SkillType == (int)ENSkillType.enOpenBox) {//普通技能 if (targetIsBox || targetIsTrap) { if (uiSkillCD.SkillID != m_openBoxSkillID) { uiSkillCD.Reset(); uiSkillCD.SkillID = m_openBoxSkillID; info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID); } } else { if (uiSkillCD.SkillID == m_openBoxSkillID) { uiSkillCD.SkillID = m_mainPlayer.NormalSkillList[0]; info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID); } } continue; } IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(info.SkillTableInfo.Icon); if (iconInfo == null) { Debug.LogWarning("icon is null, id:" + info.SkillTableInfo.Icon); return; } else { sprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } Material curMaterial = sprite.material; // List<int> list = (m_mainPlayer.SelfAI as AIPlayer).SkillIDListForFire; // if (!info.IsSilence && list.Contains(info.SkillTableInfo.ID)) { enabled.SetActive(false); curMaterial = m_normalMaterial; } // else // { // enabled.SetActive(true); // curMaterial = m_diableMaterial; // } //if (curMaterial != sprite.material) { sprite.material = curMaterial; } } }
public void UpdateAddSkillLevel() { int levelUpPoint = m_mainPlayer.Props.GetProperty_Int32(ENProperty.LevelUpPoint); //判断黄点是否达到满级 MainPlayer mainPlayer = ActorManager.Singleton.MainActor; int yellowPoint = mainPlayer.Props.GetProperty_Int32(ENProperty.YellowPointLevel); YellowPointInfo nextYellowInfo = GameTable.yellowPointParamAsset.LookUp((yellowPoint + 1)); //如果为空则达到最大黄点等级 if (null == nextYellowInfo) { if (null != m_yellowPointLabel) { m_yellowPointLabel.text = "LV.MAX"; } } else { if (null != m_yellowPointLabel) { m_yellowPointLabel.text = "LV." + yellowPoint; } } if (levelUpPoint > 0 && null != nextYellowInfo) { m_addActorLevel.gameObject.SetActive(true); } else { m_addActorLevel.gameObject.SetActive(false); } int skillLeveLIndex = 1; for (int i = 0; i < MaxSkillNumber; ++i) { GameObject skill = m_sameInfoList[i].m_objSkill; if (!skill.activeSelf) { continue; } UISkillCD uiSkillCD = m_sameInfoList[i].m_uiSkillCD; Actor.ActorSkillInfo info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID); if (info == null) { Debug.LogWarning("skill table is null, index:" + i); continue; } UILabel skillLabel = FindChildComponent <UILabel>("SkillLevel", skill); if (null != skillLabel) { if (info.SkillLevel >= info.SkillTableInfo.MaxLevel) { skillLabel.text = "LV.MAX"; } else { skillLabel.text = "LV." + info.SkillLevel; } } //技能升级按钮 UIButton addLevel = FindChildComponent <UIButton>("AddLevel" + skillLeveLIndex, skill); if (null != addLevel) { if (levelUpPoint > 0 && info.SkillLevel < info.SkillTableInfo.MaxLevel) { addLevel.gameObject.SetActive(true); } else { addLevel.gameObject.SetActive(false); } } ++skillLeveLIndex; } }