Exemplo n.º 1
0
    //接收到服务器发送的 技能升级
    public void OnMsgRecoverLevelUpSucc_BS2C(PacketReader p, object state)
    {
        int        levelPointNum  = p.ReadInt32();
        bool       isSkill        = (p.ReadInt32() == 1) ? true : false;
        int        skillId        = p.ReadInt32();
        int        yellowPointNum = p.ReadInt32();
        MainPlayer mainPlayer     = ActorManager.Singleton.MainActor;

        mainPlayer.Props.SetProperty_Int32(ENProperty.LevelUpPoint, levelPointNum);
        if (isSkill)
        {
            int skillIndex = UIBattleBtn_D.Singleton.GetSkillIndexBySkillId(skillId);
            PropertyValueIntListView skillLevelList = mainPlayer.Props.GetProperty_Custom(ENProperty.SkillLevelList) as PropertyValueIntListView;
            skillLevelList.m_list[skillIndex]++;
            mainPlayer.Props.SetProperty_Custom(ENProperty.SkillLevelList, skillLevelList);
            Actor.ActorSkillInfo info = mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == skillId);
            if (null != info)
            {
                info.SkillLevel++;
            }
        }
        else
        {
            mainPlayer.Props.SetProperty_Int32(ENProperty.YellowPointLevel, yellowPointNum);
        }


        mainPlayer.UpDataSkillLevelUp();
    }
Exemplo n.º 2
0
    public bool ActionTryAttack(int skillID, Actor skillTarget, bool isSyncPosValidate, Vector3 syncPos)
    {
        AttackAction action = Owner.ActionControl.AddAction(ActorAction.ENType.enAttackAction) as AttackAction;

        if (null == action)
        {
            return(false);
        }
        Owner.SkillControl.AddSkill(skillID, Owner);
        int targetID = 0;

        if (skillTarget != null && !skillTarget.IsDead)
        {
            targetID = skillTarget.ID;
        }
        action.InitImpl(skillID, targetID, isSyncPosValidate, syncPos);
        //添加怒气值
        Actor.ActorSkillInfo info = Owner.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
        if (info != null)
        {
            Owner.CurrentRage += info.SkillTableInfo.GenerateRagePoint;
            Owner.CurrentRage -= info.SkillTableInfo.CostRagePoint;
        }
        return(true);
    }
Exemplo n.º 3
0
    bool LookupSkill(int skillID, out int skillIDForTarget, out Actor skillTarget)
    {
        skillIDForTarget = 0;
        skillTarget      = null;

        float closestDistance = float.MaxValue;
        Actor closestActor    = null;
        int   closestSkillID  = 0;

        foreach (var item in Owner.SkillBag)
        {
            SkillInfo info = item.SkillTableInfo;
            if (skillID != 0 && skillID != info.ID)
            {
                continue;
            }
            if (!item.IsCanFire(Owner, skillID != 0))
            {
                continue;
            }
            Actor temp     = null;
            float distance = 0;
            if (LookupTarget(info, out temp, out distance))
            {     //找到此技能的最近释放目标
                if (distance <= closestDistance)
                { //跟其它技能的最近的目标作比对
                    closestDistance = distance;
                    closestActor    = temp;
                    closestSkillID  = info.ID;
                }
                break;
            }
        }
        if (closestDistance <= float.MaxValue && closestSkillID != 0)
        {
            if (closestActor == null)
            {//目标为空,判断是否为无目标技能
                Actor.ActorSkillInfo info = Owner.SkillBag.Find(item => item.SkillTableInfo.ID == closestSkillID);
                if (info == null)
                {
                    Debug.LogWarning("skill id is not exist! id is " + closestSkillID.ToString() + " self id is " + Owner.ID.ToString());
                    return(false);
                }
                if (info.SkillTableInfo.TargetType != (int)ENTargetType.enNullTarget)
                {
                    Debug.LogWarning("target is null, skill target is not null target, TargetType is " + info.SkillTableInfo.TargetType);
                    return(false);
                }
            }
            skillTarget      = closestActor;
            skillIDForTarget = closestSkillID;
        }
        return(skillIDForTarget != 0);
    }
Exemplo n.º 4
0
    public bool ActionTryFireSkill(int skillID)
    {
        if (skillID == 0)
        {     //自动查找技能
            if (Owner.ActionControl.IsActionRunning(AttackAction.SGetActionType()))
            { //正在攻击,暂时返回
                return(false);
            }
        }
        int   skillIDForTarget = 0;
        Actor skillTarget      = null;

        if (!LookupSkill(skillID, out skillIDForTarget, out skillTarget))
        {
            //Debug.LogWarning("LookupSkill failed! id is " + skillIDForTarget.ToString() + " self id is "+Owner.ID.ToString());
            return(false);
        }
        Actor.ActorSkillInfo info = Owner.SkillBag.Find(item => item.SkillTableInfo.ID == skillIDForTarget);
        if (info == null)
        {
            Debug.LogWarning("skill id is not exist! id is " + skillIDForTarget.ToString() + " self id is " + Owner.ID.ToString());
            return(false);
        }
        if (skillID == 0 && Owner.ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction))
        {//攻击中并且不是技能命令, 不释放
            return(false);
        }
        if (skillTarget == null)
        {//无目标技能
            //释放技能
            return(ActionTryAttack(skillIDForTarget, skillTarget));
        }
        else
        {
            Vector3 distance = Owner.RealPos - skillTarget.RealPos;
            distance.y = 0;
            if (distance.magnitude > info.SkillTableInfo.AttackDistance)
            {//不在攻击范围内
                //向技能目标移动
                ActionMoveTo(skillTarget.RealPos);
            }
            else
            {//在攻击范围内
                //释放技能
                if (ActionTryAttack(skillIDForTarget, skillTarget))
                {
                    m_curTargetID = skillTarget.ID;
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 5
0
 //玩家操作
 public bool PlayerCMD()
 {
     if (Self.CurrentCmd == null)
     {
         return(false);
     }
     if (Self.CurrentCmd.m_type == Player.ENCmdType.enSkill)
     {
         int skillID = Self.CurrentCmd.m_skillID;
         Actor.ActorSkillInfo info = Self.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
         if (IsFireSkill(skillID))
         {
             GetRangeTargetList((ENTargetType)info.SkillTableInfo.TargetType, Self.CurrentTableInfo.AttackRange);
             if (Self.CurrentTarget != null)
             {
                 m_curTargetID = Self.CurrentTarget.ID;
             }
             if (ActionTryFireSkill(skillID))
             {
                 DelSkillHighlight();
                 Self.CurrentCmd = null;
             }
             else
             {
                 if (m_targetIDList.Count == 0)
                 {
                     DelSkillHighlight();
                     Self.CurrentCmd = null;
                 }
             }
         }
         else
         {
             GetRangeTargetList((ENTargetType)info.SkillTableInfo.TargetType, Self.CurrentTableInfo.AttackRange);
             if (m_targetIDList.Count != 0 && skillID != m_highlightSkillID)
             {//技能高亮的通知
                 AddSkillHighlight();
                 m_highlightSkillID = skillID;
             }
         }
         return(true);
     }
     else if (Self.CurrentCmd.m_type == Player.ENCmdType.enSwitchActor)
     {
         if (ActorManager.Singleton.SwitchMainActor(false, false))
         {
             Self.CurrentCmd = null;
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
    public void RemoveSkillPreCD(int skillID, Actor actor)
    {
        Actor.ActorSkillInfo info = actor.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
        if (null == info || info.SkillTableInfo.PreCoolDown == 0)
        {
            return;
        }
        CDInfo cdInfo = GameTable.CDTableAsset.Lookup(info.SkillTableInfo.PreCoolDown);

        if (null != cdInfo)
        {
            actor.CDControl.CDList.RemoveAll(item => item.CDID == cdInfo.ID);
        }
    }
Exemplo n.º 7
0
    public void AddSkill(int skillID, Actor actor)
    {
        Actor.ActorSkillInfo info = actor.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
        if (null == info)
        {
            return;
        }
        CDInfo cdInfo = GameTable.CDTableAsset.Lookup(info.SkillTableInfo.CoolDown);

        if (null != cdInfo)
        {
            actor.CDControl.AddCD(cdInfo.ID, actor.ID, skillID);
        }
    }
Exemplo n.º 8
0
    //切入技改变
    void SwitchSkillChanged()
    {
        if (ActorManager.Singleton.Support == null || ActorManager.Singleton.Support.SkillBag.Count == 0)
        {
            return;
        }
        GameObject skill   = m_sameInfoList[SwitchSkillIndex].m_objSkill;
        GameObject enabled = FindChild("Enabled", skill);
        UITexture  sprite  = FindChildComponent <UITexture>("skill", skill);

        Actor.ActorSkillInfo info     = ActorManager.Singleton.Support.SkillBag[0];
        IconInfomation       iconInfo = GameTable.IconInfoTableAsset.Lookup(info.SkillTableInfo.Icon);

        sprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);

        Material curMaterial = sprite.material;

        if (info.IsSilence)
        {//技能被沉默
            enabled.SetActive(true);
            curMaterial = m_diableMaterial;
        }
        else
        {
            if (m_mainPlayer.CurrentTargetIsDead)
            {//无目标
                enabled.SetActive(true);
                curMaterial = m_diableMaterial;
            }
            else
            {
                if (!ActorTargetManager.IsEnemy(m_mainPlayer, m_mainPlayer.CurrentTarget))
                {//当前目标不是敌人
                    enabled.SetActive(true);
                    curMaterial = m_diableMaterial;
                }
                else
                {
                    enabled.SetActive(false);
                    curMaterial = m_normalMaterial;
                }
            }
        }
        //if (sprite.material != curMaterial)
        {
            sprite.material = curMaterial;
        }
    }
Exemplo n.º 9
0
    public virtual void OnEnter(Actor actor)
    {
        int   skillLevel  = 0;
        float cdGrowParma = 0;

        Actor.ActorSkillInfo info = actor.SkillBag.Find(item => item.SkillTableInfo.ID == m_skillID);
        if (info != null)
        {//获得技能等级和cd成长
            skillLevel  = info.SkillLevel;
            cdGrowParma = info.SkillTableInfo.CoolDownParam;
        }
        CDInfo cdinfo = GameTable.CDTableAsset.Lookup(CDID);
        float  timer  = cdinfo.CDTime + skillLevel * cdGrowParma;

        m_cdTime    = timer * (1 + actor.SkillCDModifyPercent) + actor.SkillCDModifyValue;
        m_startTime = Time.time;
    }
Exemplo n.º 10
0
    public bool IsSkillCDRunning(int skillID, Actor actor)
    {
        Actor.ActorSkillInfo info = actor.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
        if (null == info)
        {
            return(false);
        }
        CDInfo cdInfo = GameTable.CDTableAsset.Lookup(info.SkillTableInfo.CoolDown);

        if (null != cdInfo)
        {
            if (null == actor.CDControl.CDList.Find(item => item.CDID == cdInfo.ID))
            {
                if (info.SkillTableInfo.PreCoolDown != 0)
                {
                    cdInfo = GameTable.CDTableAsset.Lookup(info.SkillTableInfo.PreCoolDown);
                    if (null == actor.CDControl.CDList.Find(item => item.CDID == cdInfo.ID))
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 11
0
 public override bool OnFireSkill(int skillID)
 {
     if (IsDead)
     {
         return(false);
     }
     Actor.ActorSkillInfo info = SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
     if (info == null)
     {
         Debug.LogError("skill bag is not contains,skillID:" + skillID + ",actorID:" + ID + ",type:" + Type);
         return(false);
     }
     if (!info.IsCanFire(this, skillID != 0))
     {
         return(false);
     }
     if (info.SkillTableInfo.SkillType == (int)ENSkillType.enSkillNormalType)
     {
         return(FireNormalSkill());
     }
     this.CurrentCmd = new Player.Cmd(skillID);
     return(true);
 }
Exemplo n.º 12
0
    public override void Update()
    {
        base.Update();
        if (Self.IsActorExit)
        {
            return;                  //当前角色离场
        }
        //TimeToRelive();
        ReliveUI();
        #region Unlock
        if (!Self.CurrentTargetIsDead)
        {//判断距离 清除目标
            float distance = ActorTargetManager.GetTargetDistance(Self.MainPos, Self.CurrentTarget.MainPos);
            if (distance > Self.CurrentTableInfo.UnlockRange)
            {
                Self.CurrentTarget = null;
                Self.DamageSource  = null;
            }
        }
        #endregion
        CheckAllSkill(); //检测可释放技能
        if (Self.CurrentCmd == null)
        {                //当前没有命令
            MoveAction action = Self.ActionControl.LookupAction(ActorAction.ENType.enMoveAction) as MoveAction;
            if ((action == null || action.IsStopMove) &&
                !Self.ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction) &&
                !Self.ActionControl.IsActionRunning(ActorAction.ENType.enRollAction))
            {     //不在移动、攻击、翻滚等位移动作中
                if (!Self.CurrentTargetIsDead)
                { //当前目标没死
                    float distance = ActorTargetManager.GetTargetDistance(Self.RealPos, Self.CurrentTarget.RealPos);
                    if (Self.CurrentTableInfo.AutoAttackRange > distance)
                    {//当前目标在自动攻击范围内
                        //Self.FireNormalSkill();
                        return;
                    }
                }
                else
                {
                    if (m_isAutoAttack)
                    {
                        m_autoAttackInterval -= Time.deltaTime;
                        if (m_autoAttackInterval < 0)
                        {
                            GetRangeTargetList(ENTargetType.enEnemy, Self.CurrentTableInfo.AutoAttackRange);
                            if (m_targetIDList.Count > 0)
                            {
                                Self.TargetManager.CurrentTarget = m_minActor;
                                Self.CurrentCmd           = new Player.Cmd(Player.ENCmdType.enLoopNormalAttack);
                                Self.CurrentCmd.m_skillID = Self.NormalSkillList[0];
                                return;
                            }
                        }
                    }
                }
                //自动反击
                if (m_lastActionTime == 0)
                {
                    m_lastActionTime = Time.time;
                }
                if (!m_isCounterattack && Time.time - m_lastActionTime > GameSettings.Singleton.m_autoCounterattack)
                {//距离最后一次位移动作 已超过3秒 可以反击
                    m_isCounterattack = false;
                }
            }
            if (m_isCounterattack)
            {//可以反击
                if (Self.DamageTime > m_lastActionTime + GameSettings.Singleton.m_autoCounterattack)
                {
                    if (Self.DamageSource != null && !Self.DamageSource.IsDead && ActorTargetManager.IsEnemy(Self, Self.DamageSource))
                    {
                        if (m_counterSkillRange == 0)
                        {
                            SkillInfo info = GameTable.SkillTableAsset.Lookup(Self.NormalSkillList[0]);
                            m_counterSkillRange = info.AttackDistance;
                        }
                        Vector3 distance = Owner.RealPos - Self.DamageSource.RealPos;
                        distance.y = 0;
                        if (distance.magnitude > m_counterSkillRange)
                        {//不在攻击范围内
                            //向技能目标移动
                            ActionMoveTo(Self.DamageSource.RealPos);
                        }
                        else
                        {//在攻击范围内
                            //释放技能
                            if (ActionTryAttack(Self.NormalSkillList[0], Self.DamageSource))
                            {
                                m_curTargetID      = Self.DamageSource.ID;
                                Self.CurrentTarget = ActorManager.Singleton.Lookup(m_curTargetID);
                                m_lastActionTime   = 0;
                                m_isCounterattack  = false;
                                return;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            MainPlayer.Cmd cmd = Self.CurrentCmd;
            if (cmd.m_type != Player.ENCmdType.enSkill && cmd.m_type != Player.ENCmdType.enLoopNormalAttack)
            {//取消自动攻击
                m_isAutoAttack = false;
            }
            //最后一次动作的时间
            m_lastActionTime = 0;
            //清除自动反击
            m_isCounterattack = false;
            if (cmd.m_type != Player.ENCmdType.enSkill)
            {//取消技能高亮
                DelSkillHighlight();
            }

            m_autoAttackInterval = GameSettings.Singleton.m_autoAttackInterval;
            if (!IsCmdExecute())
            {//命令不允许执行
                Self.CurrentCmd = null;
                return;
            }

            m_curTargetID = 0;
            if (!Self.CurrentTargetIsDead)
            {
                m_curTargetID = Self.CurrentTarget.ID;
            }
            switch (cmd.m_type)
            {
            case Player.ENCmdType.enMove:
            {
                //  [8/3/2015 tgame]
                if (cmd.m_isMoveByNoAStar)
                {
                    if (ActionMoveToNotAStar(cmd.m_moveTargetPos))
                    {
                        //点击地面特效
                        Self.IsMoveAfterSwitch = false;
                        Self.CurrentCmd        = null;
                    }
                }
                else
                {
                    if (ActionMoveTo(cmd.m_moveTargetPos))
                    {
                        //点击地面特效
                        Self.IsMoveAfterSwitch = false;
                        Self.CurrentCmd        = null;
                    }
                }
            }
            break;

            case Player.ENCmdType.enStopMove:
            {
                MoveAction ac = Self.ActionControl.LookupAction(ActorAction.ENType.enMoveAction) as MoveAction;
                if (ac != null)
                {
                    Self.ActionControl.RemoveAction(ActorAction.ENType.enMoveAction);
                }
            }
            break;

            case Player.ENCmdType.enRoll:
            {
                RollAction rollAction = Self.ActionControl.AddAction(ActorAction.ENType.enRollAction) as RollAction;
                if (rollAction != null)
                {
                    rollAction.Init(cmd.m_moveTargetPos);
                    Self.CurrentCmd = null;
                }
            }
            break;

            case Player.ENCmdType.enSwitchActor:
            {
                if (!m_isAttacking)
                {
                    if (Self.ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction))
                    {
                        if (ActorManager.Singleton.m_switchCDTotal > 0)
                        {        //cd中,继续攻击
                            Self.FireNormalSkill();
                            return;
                        }
                        m_isAttacking = true;
                    }
                }
                if (ActorManager.Singleton.SwitchMainActor(false, m_isAttacking))
                {
                    Self.CurrentCmd = null;
                    m_isAttacking   = false;
                }
            }
            break;

            case Player.ENCmdType.enSkill:
            {
                int skillID = cmd.m_skillID;
                Actor.ActorSkillInfo info = Self.SkillBag.Find(item => item.SkillTableInfo.ID == skillID);
                if (IsFireSkill(skillID))
                {
                    GetRangeTargetList((ENTargetType)info.SkillTableInfo.TargetType, Self.CurrentTableInfo.AttackRange, Self.m_firstTargetType);
                    if (ActionTryFireSkill(skillID))
                    {
                        m_isAutoAttack = false;
                        m_lastSkillID  = skillID;
                        DelSkillHighlight();

                        Actor target = ActorManager.Singleton.Lookup(m_curTargetID);
                        if (target != null && ActorTargetManager.IsEnemy(Self, target))
                        {        //只对仇人进行循环普攻
                            Self.CurrentTarget        = target;
                            Self.CurrentCmd.m_skillID = Self.NormalSkillList[0];
                            Self.CurrentCmd.m_type    = Player.ENCmdType.enStop;     //enLoopNormalAttack;
                        }
                        else
                        {
                            Self.CurrentCmd = null;
                        }
                    }
                    else
                    {
                        if (m_targetIDList.Count == 0)
                        {
                            DelSkillHighlight();
                            Self.CurrentCmd = null;
                        }
                    }
                }
                else
                {
                    GetRangeTargetList((ENTargetType)info.SkillTableInfo.TargetType, Self.CurrentTableInfo.AttackRange);
                    if (m_targetIDList.Count != 0 && skillID != m_highlightSkillID)
                    {        //技能高亮的通知
                        AddSkillHighlight();
                        m_highlightSkillID = skillID;
                    }
                }
            }
            break;

            case Player.ENCmdType.enLoopNormalAttack:
            {
                int skillID = Self.CurrentCmd.m_skillID;
                if (Self.CurrentTargetIsDead)
                {        //循环攻击时 必须要有目标 目标不能死亡
                    Self.CurrentCmd = null;
                    return;
                }
                if (IsFireSkill(skillID))
                {
                    if (ActionTryFireSkill(skillID))
                    {
                        m_lastSkillID = skillID;
                    }
                }
            }
            break;

            default:
                break;
            }
        }
    }
Exemplo n.º 13
0
    private void OnShowSkillTips(SkillInfo skillInfo, int lvl)
    {
        int skillId = skillInfo.ID;

        SkillInfo info = GameTable.SkillTableAsset.Lookup(skillId);

        if (null == info)
        {
            return;
        }

        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;

        // 主动技能类型
        if (info.SkillType == (int)ENSkillType.enSkill)
        {
            offset = 100;
        }
        else
        {
            offset = 200;
        }

        m_skillGetTips.gameObject.SetActive(false);



        // 设置内容
        m_tipsSkillName.text  = info.Name;
        m_tipsSkillDes.text   = info.Description;
        m_tipsSkillLevel.text = lvl.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);
            Actor.ActorSkillInfo actroSkillInfo = this.m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == info.ID);
            m_comboItem.GetComponent <UILabel>().text = actroSkillInfo.MinComboRequir.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_skillInfoTips.GetComponent <UISprite>().height = height;

        // 设置位置
        m_skillInfoTips.GetComponent <UISprite>().topAnchor.absolute = -offset;

        m_switchSkillTips.GetComponent <UILabel>().topAnchor.absolute = -switchTipsHeight;

        m_switchSkillTips.GetComponent <UIGrid>().Reposition();
    }
Exemplo n.º 14
0
    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;
            }
        }
    }
Exemplo n.º 15
0
    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;
        }
    }