Esempio n. 1
0
    private void ShowSkill()
    {
        RegisterGlobalEvent(true);

        SetSkillIcon();
        LearnSkillDataManager skillData = DataManager.Manager <LearnSkillDataManager>();

        if (skillData.CurState == SkillSettingState.StateTwo)
        {
            m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 125), rotTime);
        }

        InitShortcutUIAndData();

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

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

        //Client.ICombatRobot robot = cs.GetCombatRobot();
        //if (robot != null)
        //{
        //    m_btn_BtnAI.GetComponent<UIToggle>().value = robot.Status != CombatRobotStatus.STOP;
        //}
    }
Esempio n. 2
0
    /// <summary>
    /// 设置宠物技能
    /// </summary>
    void SetPetSkill()
    {
        LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>();

        gameObject.SetActive(data.bShowPetSkill);

        PetDataManager petData = DataManager.Manager <PetDataManager>();

        if (petData != null)
        {
            IPet pet = petData.GetPetByThisID(petData.CurFightingPet);
            if (pet != null)
            {
                List <PetSkillObj> list = pet.GetPetSkillList();
                if (list.Count == 0)
                {
                    skillIcon.mainTexture = null;
                    SetLongPressEvent(false);
                    ShowAdd(true);
                    return;
                }


                for (int i = 0; i < list.Count; i++)
                {
                    var           skill   = list[i];
                    uint          skillID = (uint)skill.id;
                    SkillDatabase db      = GameTableManager.Instance.GetTableItem <SkillDatabase>(skillID, skill.lv);
                    if (db != null)
                    {
                        if (db.petType == (int)PetSkillType.Initiative)
                        {
                            m_skillid = skillID;
                            UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, db.iconPath, true), ref iuiIconAtlas, () =>
                            {
                                if (null != skillIcon)
                                {
                                    skillIcon.mainTexture = null;
                                }
                            }, skillIcon, false);
                            ShowAdd(false);
                            SetLongPressEvent(true);
                            break;
                        }
                        else
                        {
                            SetLongPressEvent(false);
                            ShowAdd(true);
                            skillIcon.mainTexture = null;
                        }
                    }
                }
            }
        }
        if (data.bShowPetSkill)
        {
            RunCD();
        }
    }
Esempio n. 3
0
    public void ChangeSkill(GameObject caster)
    {
        int tempState = 0;
        LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>();

        tempState = (int)data.CurState;

        int job = MainPlayerHelper.GetMainPlayer().GetProp((int)PlayerProp.Job);

        job = tempState == 1 ? job : job + 10;
        uint changeSkill = GameTableManager.Instance.GetGlobalConfig <uint>("ChangeStateSkillID", job.ToString());

        ReqUseSkill((uint)changeSkill);
    }
Esempio n. 4
0
    /// <summary>
    /// 1-8
    /// </summary>
    /// <param name="skillBtnIndex"></param>
    public void Init(int skillBtnIndex)
    {
        m_skillBtnIndex = skillBtnIndex;
        m_skillState    = SkillSettingState.StateOne;
        if (skillBtnIndex >= 5)
        {
            m_skillState = SkillSettingState.StateTwo;
        }

        if (m_skillBtnIndex == 0)//0 是普工  9是坐骑技能 10在未骑乘下是切换 骑乘下是坐骑技能
        {
        }
        if (m_skillBtnIndex == 10)
        {
            m_skillState = DataManager.Manager <LearnSkillDataManager>().CurState;
        }
        LearnSkillDataManager dm        = DataManager.Manager <LearnSkillDataManager>();
        List <uint>           levelList = dm.GetUnLockLevelList();

        if (levelList == null)
        {
            return;
        }
        int index = skillBtnIndex - 1;

        if (index >= 0)
        {
            if (index < levelList.Count)
            {
                uint lev = levelList[index];
                if (m_labelUnLockLevel != null)
                {
                    m_labelUnLockLevel.text = lev.ToString();
                }
            }
        }
    }
Esempio n. 5
0
    private void SetRideSkills()
    {
        RideData rideData = DataManager.Manager <RideManager>().GetCurrRideData();

        if (rideData == null)
        {
            return;
        }
        ResetBtn();
        bool canuse     = false;
        int  skillIndex = 0;

        int offset = 0;
        LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>();

        if (data.CurState == SkillSettingState.StateTwo)
        {
            offset = 4;
        }
        if (m_skillBtnIndex == 9)//第一个技能
        {
            gameObject.SetActive(true);
            skillIndex = 0;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else if (m_skillBtnIndex == 1 + offset)
        {
            skillIndex = 1;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else if (m_skillBtnIndex == 2 + offset)
        {
            skillIndex = 2;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else if (m_skillBtnIndex == 3 + offset)
        {
            skillIndex = 3;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else if (m_skillBtnIndex == 4 + offset)
        {
            skillIndex = 4;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else if (m_skillBtnIndex == 10)
        {
            skillIndex = 5;
            canuse     = rideData.skill_ids.Count > skillIndex;
        }
        else
        {
            return;
        }
        ShowAdd(!canuse);
        if (canuse)
        {
            m_skillid = (uint)rideData.skill_ids[skillIndex];
            SetLongPressEvent(true);

            table.RideSkillDes rideSkill = GameTableManager.Instance.GetTableItem <table.RideSkillDes>((uint)m_skillid);
            if (rideSkill != null)
            {
                if (skillIcon != null)
                {
                    bool bAdjust = m_skillBtnIndex == 9 ? false : true;
                    UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, rideSkill.skillIcon, true), ref iuiIconAtlas, () =>
                    {
                        if (null != skillIcon)
                        {
                            skillIcon.mainTexture = null;
                        }
                    }, skillIcon, false);
                }
            }
            RunCD();
        }
        else
        {
            SetLongPressEvent(false);

            m_skillid = 0;
        }
        SetBtnEnable(canuse);
        if (skillIcon != null)
        {
            skillIcon.alpha = canuse ? 1f : 0f;
        }
    }
Esempio n. 6
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;
        }
    }
Esempio n. 7
0
    void OnSkillUse(GameObject go)
    {
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.MAINBTN_ONTOGGLE, new Client.stMainBtnSet()
        {
            pos = 1, isShow = false
        });

        if (parent != null)
        {
            Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
            if (mainPlayer == null)
            {
                Log.Error("mainPlayer is null");
                return;
            }

            if (IsCDing)
            {
                Log.Error("IsCDing");
                return;
            }

            bool bRide = DataManager.Manager <RideManager>().IsRide;
            if (bRide)
            {//使用任何一个技能都下马
                if (m_skillBtnIndex != 0)
                {
                    parent.ReqUseSkill((uint)m_skillid);
                }
                else
                {
                    DataManager.Instance.Sender.RideDownRide();
                    parent.ReqUseSkill((uint)m_skillid);
                }
            }
            else
            {
                if (m_skillBtnIndex != 10)
                {
                    LearnSkillDataManager skilldata = DataManager.Manager <LearnSkillDataManager>();
                    uint commonSkill = skilldata.GetCommonSkillIDByJob();
                    if (commonSkill != m_skillid)
                    {//普工不走cd
                        if (m_skillBtnIndex == 9)
                        {
                            if (CheckItem())
                            {
                                var cmd = new GameCmd.stMultiAttackUpMagicUserCmd_C();
                                cmd.wdSkillID = (uint)m_skillid;
                                Client.IController cs = GetController();
                                if (cs != null)
                                {
                                    IEntity target = cs.GetCurTarget();
                                    if (target != null)
                                    {
                                        stMultiAttackUpMagicUserCmd_C.Item item = new stMultiAttackUpMagicUserCmd_C.Item();
                                        item.byEntryType  = (target.GetEntityType() == EntityType.EntityType_Player ? SceneEntryType.SceneEntry_Player : SceneEntryType.SceneEntry_NPC);
                                        item.dwDefencerID = target.GetID();
                                        cmd.data.Add(item);
                                        ReqUsePetSkill(cmd);
                                    }
                                    else
                                    {
                                        SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(m_skillid);
                                        if (db != null)
                                        {
                                            if (db.targetType != 0)
                                            {
                                                ReqUsePetSkill(cmd);
                                            }
                                            else
                                            {
                                                if (db.targetParam == 4 || db.targetParam == 7 || db.targetParam == 8)
                                                {
                                                    ReqUsePetSkill(cmd);
                                                }
                                                else
                                                {
                                                    TipsManager.Instance.ShowTips("该技能需要目标");
                                                }
                                            }
                                        }
                                    }
                                }

                                //宠物技能使用
                            }
                        }
                        else
                        {
                            parent.ReqUseSkill((uint)m_skillid);
                        }
                    }
                }
                else
                {
                    parent.ChangeSkill(this.gameObject);
                }
            }
            parent.OnClickSkillBtn(go, 50010);
        }
        else
        {
            Log.Error("parent is null");
        }
    }
Esempio n. 8
0
    public override bool OnMsg(UIMsgID msgid, object param)
    {
        if (msgid == UIMsgID.eSetRoleProperty)//添加主角的时候刷新界面
        {
            // Client.IEntity entity = (Client.IEntity)param;
            Client.IEntity entity = param as Client.IEntity;
            if (entity != null)
            {
                //SetRoleHp(entity);
                //SetRoleMp(entity);
                //SetRoleExp(entity);
                //SetRolePkModel(entity);
                //if (m_label_lablePower != null)
                //{
                //    m_label_lablePower.text = entity.GetProp((int)FightCreatureProp.Power).ToString();
                //}

                SetRoleHpMpExpPkPower(entity);
            }
        }
        else if (msgid == UIMsgID.stShowBuff)
        {
            stShowBuffInfo info = (stShowBuffInfo)param;

            if (info.IsMainRole)
            {
                ArrayList list = DataManager.Manager <BuffDataManager>().MainRoleBuffList;
                RefreshBuffIcon(m_trans_MainRoleBUffContainer, list);
                ShowBuffInfo(m_trans_MainRoleBUffContainer, true);
            }
            else
            {
                ArrayList list = DataManager.Manager <BuffDataManager>().TargetBuffList;
                RefreshBuffIcon(m_trans_TargetBUffContainer, list);
                ShowBuffInfo(m_trans_TargetBUffContainer, false);
            }
        }
        else if (msgid == UIMsgID.eRefreshEnemyList)
        {
            GameCmd.stEnmityDataUserCmd_S cmd = (GameCmd.stEnmityDataUserCmd_S)param;
            OnEnemyList(cmd);
        }
        else if (msgid == UIMsgID.eShowCopyInfo)
        {
            stCopyInfo info = (stCopyInfo)param;
            ShowFBWidgetUI(info.bShow, info.bShowBattleInfoBtn);
        }
        else if (msgid == UIMsgID.eSkillBtnRefresh)
        {//走新手引导 OnUIEvent
            SetSkillIcon();
        }
        else if (msgid == UIMsgID.eSkillChangeState)
        {
            LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>();
            if (m_widget_SkillBtns != null)
            {
                Quaternion rotation = m_widget_SkillBtns.transform.localRotation;
                if (data.CurState == SkillSettingState.StateTwo)
                {
                    m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 125), rotTime);
                }
                else
                {
                    m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 0), rotTime);
                }
                SetPlayerSkillIcon();
                uint stateSkill = data.GetCurStateSkillIDByJob();
                ExecutePublicCD(stateSkill);
            }
            data.SetCurStateSkillList();
        }
        else if (msgid == UIMsgID.eSkillShowPetSkill)
        {
            if (m_lstSkillBtns.Count > 9)
            {
                m_lstSkillBtns[9].Refresh();
            }
        }
        else if (msgid == UIMsgID.eShortcutList)
        {
            InitShortcutGrid();//快捷使用道具
        }
        else if (msgid == UIMsgID.eShortcutRect)
        {
            Vector3 pos = (Vector3)param;
            PointInRectEvent(pos);
        }
        else if (msgid == UIMsgID.eShortcutRect)
        {
            Vector3 pos = (Vector3)param;
            PointInRectEvent(pos);
        }
        else if (msgid == UIMsgID.eRefreshNpcBelong)
        {
            stRefreshNPCBelongParam data = (stRefreshNPCBelongParam)param;
            UpdateTargetStatus(data.npcid, data.teamid, data.ownerid, data.clanid, data.ownerName);
        }
        else if (msgid == UIMsgID.eAnswerState)
        {
            InitAnswerUI();
        }

        return(true);
    }