Exemplo n.º 1
0
 void OnSkillGridUIEvent(UIEventType eventType, object data, object param)
 {
     switch (eventType)
     {
     case UIEventType.Click:
         UISkillGrid grid = data as UISkillGrid;
         if (grid != null)
         {
             if (grid.Data != null && grid.Data.skillid != 0)
             {
                 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.PlayerSkillTipsPanel, panelShowAction: (pb) =>
                 {
                     if (null != pb && pb is PlayerSkillTipsPanel)
                     {
                         PlayerSkillTipsPanel panel = pb as PlayerSkillTipsPanel;
                         if (panel != null)
                         {
                             table.SkillDatabase skilldb = GameTableManager.Instance.GetTableItem <table.SkillDatabase>((uint)grid.Data.skillid, grid.Data.level);
                             panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Pet, skilldb, grid.Data.level);
                             panel.InitParentTransform(grid.transform, new Vector2(0, 80));
                         }
                     }
                 });
             }
         }
         break;
     }
 }
Exemplo n.º 2
0
    public void ShowDamage(uint damageValue, uint damType, uint roleid, EntityType type, uint curHp, uint skillid = 1, uint attackerid = 0)
    {//伤害包
        // Log.LogGroup("ZDY", "show damage damagevalue is {0}", damageValue);
        Client.IEntity entity = GetEntity(roleid, type);
        if (entity == null)
        {
            Engine.Utility.Log.Error("找不到实体roleid:{0},type :{1}", roleid, type);
            return;
        }
        SetEntityCurHP(entity, curHp);
        table.SkillDatabase skillData = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillid);
        uint damageTimes  = 1;
        uint hurtinterval = 0;

        if (skillData != null)
        {
            damageTimes  = skillData.damagetimes;
            hurtinterval = skillData.hurtinterval;
        }


        DamageType dt = GetDamageType(damType);

        if (testType != DamageType.None)
        {
            dt = testType;
        }
        if (entity != null)
        {
            //if (damageTimes == 1 || dt == DamageType.Doge)
            {
                FlyFont font = GetFlyFont(dt);
                if (font == null)
                {
                    return;
                }
                font.InitDamageType(dt);
                AddFlyFont(entity, type, dt, font, damageValue);
            }
            //else
            //{
            //    uint damage = damageValue / damageTimes;
            //    List<int> damageList = new List<int>();
            //    int totalHurt = 0;
            //    uint averageValue = damage - damage / 4;
            //    for (int i = 0; i < damageTimes - 1; i++)
            //    {
            //        int hurt = UnityEngine.Random.Range((int)averageValue, (int)damage);
            //        damageList.Add(hurt);
            //        totalHurt += hurt;
            //    }

            //    int lastHurt = (int)damageValue - totalHurt;
            //    damageList.Add(lastHurt);
            //    StartCoroutine(AddDamage(roleid, damType, type, damageList, hurtinterval));
            //}
        }
    }
Exemplo n.º 3
0
    public void OnUseSkill(uint uSkillID)
    {
        if (uSkillID == 0)
        {
            return;
        }
        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null");
            return;
        }

        ICombatRobot combot = cs.GetCombatRobot();

        if (combot.Status == CombatRobotStatus.RUNNING)
        {
            //解除普攻连击
            stSkillLongPress longPress = new stSkillLongPress();
            longPress.bLongPress = false;
            EventEngine.Instance().DispatchEvent((int)GameEventID.SKLL_LONGPRESS, longPress);
            combot.InsertSkill(uSkillID);

            return;
        }
        bool canuse = EventEngine.Instance().DispatchVote((int)GameVoteEventID.SKILL_CANUSE, uSkillID);

        if (canuse)
        {
            table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(uSkillID, 1);
            if (db != null)
            {
                IControllerSystem ctrl = ClientGlobal.Instance().GetControllerSystem();
                if (ctrl != null)
                {
                    MessageCode code = MessageCode.MessageCode_ButtonX;

                    ctrl.OnMessage(code, uSkillID);
                }
            }
        }
        else
        {
            IPlayer mainPlayer = MainPlayerHelper.GetMainPlayer();
            if (mainPlayer != null)
            {
                ISkillPart skillPart = mainPlayer.GetPart(EntityPart.Skill) as ISkillPart;
                if (skillPart != null)
                {
                    Client.stTipsEvent en = skillPart.GetSkillNotUseReason(uSkillID);
                    if (en.errorID != 0)
                    {
                        EventEngine.Instance().DispatchEvent((int)GameEventID.TIPS_EVENT, en);
                    }
                }
            }

            AddSkillCommond(uSkillID);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// 设置长按
    /// </summary>
    /// <param name="bSet">true是设置 false是清空</param>
    void SetLongPressEvent(bool bSet)
    {
        //暂时去除长按tips功能
        return;

        LongPress lp = this.gameObject.GetComponent <LongPress>();

        if (lp == null)
        {
            lp = this.gameObject.AddComponent <LongPress>();
        }
        if (bSet)
        {
            lp.InitLongPress(() =>
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.PlayerSkillTipsPanel, panelShowAction: (pb) =>
                {
                    if (null != pb && pb is PlayerSkillTipsPanel)
                    {
                        PlayerSkillTipsPanel panel = pb as PlayerSkillTipsPanel;
                        Client.IPlayer mainPlayer  = ClientGlobal.Instance().MainPlayer;
                        if (mainPlayer == null)
                        {
                            return;
                        }
                        panel.InitParentTransform(transform, new Vector2(m_nSprwidth, m_nSprheight));

                        //bool bRide = DataManager.Manager<RideManager>().IsRide;
                        //if (!bRide)
                        {
                            table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>((uint)m_skillid, 1);
                            if (db != null)
                            {
                                if (m_skillBtnIndex == 9)//宠物技能
                                {
                                    panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Pet, db);
                                }
                                else
                                {
                                    panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Player, db);
                                }
                            }
                        }
                        //else
                        //{
                        //    table.RideSkillDes rideSkill = GameTableManager.Instance.GetTableItem<table.RideSkillDes>((uint)m_skillid);
                        //    if (rideSkill != null)
                        //    {
                        //        panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Ride, rideSkill);
                        //    }
                        //}
                    }
                });
            },
                             () =>
            {
                DataManager.Manager <UIPanelManager>().HidePanel(PanelID.PlayerSkillTipsPanel);
            }, 500);
        }
        else
        {
            lp.InitLongPress(null, null);
        }
    }
Exemplo n.º 5
0
    void SetSkills()
    {
        LearnSkillDataManager skilldata = DataManager.Manager <LearnSkillDataManager>();
        uint skillid = 0;

        if (skilldata.TryGetLocationSkillId(m_skillState, m_skillBtnIndex, out skillid))
        {
            m_skillid = skillid;
            if (skillid == 0)
            {
                if (IsShowLock((int)m_skillBtnIndex))
                {
                    ShowLock();
                }
            }
            else
            {
                table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillid, 1);
                if (db != null)
                {
                    if (skillIcon != null)
                    {
                        skillIcon.alpha = 1f;
                        UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, db.iconPath, true), ref iuiIconAtlas
                                                 , () =>
                        {
                            if (null != skillIcon)
                            {
                                skillIcon.mainTexture = null;
                            }
                        }, skillIcon
                                                 , false);
                        SetLongPressEvent(true);
                        m_transLock.gameObject.SetActive(false);
                    }
                }
                ResetBtn();
                RunCD();
            }
        }
        else
        {
            m_skillid = skillid;

            if (m_skillBtnIndex < 5)
            {
                if (IsShowLock((int)m_skillBtnIndex))
                {
                    ShowLock();
                }
                else
                {
                    m_transLock.gameObject.SetActive(false);
                    SetLongPressEvent(false);
                }
            }
        }
        if (m_skillid == 0)
        {
            skillIcon.mainTexture = null;
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// 设置切换技能
    /// </summary>
    void SetChangeStateSkill()
    {
        Client.IPlayer    player    = ClientGlobal.Instance().MainPlayer;
        int               level     = player.GetProp((int)CreatureProp.Level);
        int               job       = player.GetProp((int)PlayerProp.Job);
        string            secondKey = job.ToString();
        SkillSettingState curState  = DataManager.Manager <LearnSkillDataManager>().CurState;

        if (curState == SkillSettingState.StateTwo)
        {
            secondKey = (10 + job).ToString();
        }
        m_skillid = GameTableManager.Instance.GetGlobalConfig <uint>("ChangeStateSkillID", secondKey);
        int needLevel = GameTableManager.Instance.GetGlobalConfig <int>("ChangeStateLevel");

        if (level < needLevel)
        {
            ResetBtn();
            //skillIcon.spriteName = "icon_lock";
            skillIcon.mainTexture = null;
            if (skillName != null)
            {
                skillName.text = needLevel.ToString();
            }
            SetBtnEnable(false);
            SetLongPressEvent(false);
            return;
        }
        else
        {
            if (skillBtn != null)
            {
                ResetBtn();
            }
            table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>((uint)m_skillid, 1);
            if (db != null)
            {
                UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, db.iconPath, true), ref iuiIconAtlas, () =>
                {
                    if (null != skillIcon)
                    {
                        skillIcon.mainTexture = null;
                    }
                }, skillIcon, false);
            }
        }
        if (skillIcon != null)
        {
            skillIcon.width  = overlay.width;
            skillIcon.height = overlay.height;
            skillIcon.alpha  = 1f;
        }

        if (skillBtn != null)
        {
            SetLongPressEvent(true);
            SetBtnEnable(true);
        }

        RunCD();
    }