Exemple #1
0
    void onClick_Btnhead_Btn(GameObject caster)
    {
        BShowEnemyList = !BShowEnemyList;
        Client.IEntity entity = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
        if (entity != null)
        {
            if (entity.GetEntityType() == EntityType.EntityType_Player)
            {
                DataManager.Instance.Sender.RequestPlayerInfoForOprate(entity.GetID(), PlayerOpreatePanel.ViewType.Normal);
            }
            else if (entity.GetEntityType() == EntityType.EntityTYpe_Robot)
            {
                ShowRobotOpreate((uint)entity.GetID(), (uint)entity.GetProp((int)RobotProp.Job),
                                 (uint)entity.GetProp((int)CreatureProp.Level), entity.GetName(), (uint)entity.GetProp((int)RobotProp.Sex));
            }
            else
            {
            }
        }

        if (BShowEnemyList)
        {
            if (entity != null)
            {
                NetService.Instance.Send(new GameCmd.stEnmityDataUserCmd_CS()
                {
                    npcid = entity.GetID()
                });
            }
        }
        else
        {
            m_transHateList.gameObject.SetActive(false);
        }
    }
Exemple #2
0
    public void OnTimer(uint uTimerID)
    {
        if (uTimerID == MAIN_TIMER_ID)
        {
            RefreshTime();
            if (ClientGlobal.Instance().MainPlayer == null)
            {
                return;
            }

            //Vector3 pos = ClientGlobal.Instance().MainPlayer.GetPos();

            //m_label_coordinate.text = string.Format("{0},{1}", (int)(pos.x + 0.5f), (int)(-pos.z + 0.5f));
            //ping值要被动触发 时间60s更新一次 不然 DateTime.Now.ToShortTimeString()频繁触发gc modify by dianyu


            if (m_effctSelect != null)
            {
                if (m_effctSelect.GetNode() == null)
                {
                    return;
                }
                if (m_effctSelect.GetNode().GetTransForm() == null)
                {
                    return;
                }
                if (m_effctSelect.GetNode().GetTransForm().gameObject.activeSelf)
                {
                    SetSelectTargetEffectPos();
                }
            }
        }
        if (uTimerID == m_uUseSkillTimerID)
        {
            UseSkill(nPrePareSkillID);
        }
        else if (uTimerID == m_uSkillLongPressTimerID)
        {
            Log.LogGroup("ZDY", "long attack ......");
            //长按事件
            //Debug.LogError("long attack");
            ReqUseSkill(m_uCommonAttackSkillID);
        }
        else if (uTimerID == m_uRefreshEnemyTimerID)
        {
            Client.IEntity entity = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
            if (entity != null)
            {
                NetService.Instance.Send(new GameCmd.stEnmityDataUserCmd_CS()
                {
                    npcid = entity.GetID()
                });
            }
        }
    }
Exemple #3
0
    void EventCallBack(int nEventID, object param)
    {
        if (nEventID == (int)GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            Client.stPropUpdate prop = (Client.stPropUpdate)param;
            //传过来的是Long型参数ID  强制转换不知道会不会有问题
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }
            Client.IEntity entity = es.FindEntity(prop.uid);
            if (entity != null)
            {
                if (entity.GetEntityType() != EntityType.EntityType_Player)
                {
                    return;
                }
                if (m_currShowUID == entity.GetID())
                {
                    ShowByPlayer(entity as Client.IPlayer);
                }
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_WEAR)
        {
            Client.stTitleWear data = (Client.stTitleWear)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(data.uid))
            {
                SetWearTitleItem(data.titleId);

                RefreshTitleGrids(data.titleId);
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_ACTIVATE)
        {
            uint titleId = (uint)param;
            SetActivateTitleItem(titleId);
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_TIMEOUT)
        {
            uint titleId = (uint)param;
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_NEWTITLE)
        {
            uint titleId = (uint)param;
            CreateTopTabs();
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_DELETE)
        {
            uint titleId = (uint)param;
            CreateTopTabs();
            if (m_lstTitleData.Exists((data) => { return(data == titleId ? true : false); }))
            {
                RefreshTitleGrids(titleId);
                //InitTitleGridListUI();
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_USETIMES)
        {
            uint titleId = (uint)param;
            //刷新界面使用次数
            UpdateUseTimes(titleId);
            //刷新左侧的grid  (次数为0,取消佩戴激活)
            RefreshTitleGrids(titleId);
        }
    }
        // 同步技能消息
        public void SyncSkill(uint uSkillID, Client.IEntity target, Vector3 targetPos)
        {
 
            if(uSkillID == 0)
            {
                Log.Error("SyncSkill skillid is 0");
                return;
            }
            // 填充数据
            Vector3 pos = m_Master.GetPos();

            SkillDatabase database = GetSkillDataBase(uSkillID);

            Client.IControllerSystem ctrlSys = m_ClientGlobal.GetControllerSystem();
            if (ctrlSys == null)
            {
                return;
            }

            Client.IController ctrl = ctrlSys.GetActiveCtrl();
            if (ctrl == null)
            {
                return;
            }
            if (targetPos == Vector3.zero)
            {
                int skillerror = 0;
                bool bCanUse = ctrl.FindTargetBySkillID(CurSkillID, ref targetPos, ref target, out skillerror);
                if (!bCanUse)
                {
                    Log.LogGroup("ZDY", "不符合规则 不能放技能");
                    return;
                }
            }


            var cmd = new GameCmd.stMultiAttackUpMagicUserCmd_C();
            cmd.dwAttackerID = (uint)m_ClientGlobal.MainPlayer.GetID();
            cmd.wdSkillID = uSkillID;
            cmd.byEntryType = SceneEntryType.SceneEntry_Player;

            cmd.srcx = (uint)(pos.x);
            cmd.srcy = (uint)(-pos.z);
            Vector3 rot = m_Master.GetRotate();
            cmd.byDirect = (uint)rot.y;

            Vector3 sendTargetPos = GetSendTargetPos(database, targetPos);
            cmd.x = (uint)(sendTargetPos.x * 100);
            cmd.y = (uint)(-sendTargetPos.z * 100);

            if (target != null)
            {
                stMultiAttackUpMagicUserCmd_C.Item item = new stMultiAttackUpMagicUserCmd_C.Item();
                if (target != null)
                {
                    item.byEntryType = (target.GetEntityType() == EntityType.EntityType_Player ? SceneEntryType.SceneEntry_Player : SceneEntryType.SceneEntry_NPC);
                    item.dwDefencerID = (uint)target.GetID();
                }
                else
                {
                    item.dwDefencerID = 0;
                }

                cmd.data.Add(item);
               
            }
            m_uDamageID++;
            cmd.tmpid = m_uDamageID;

            // 填充数据
            m_ClientGlobal.netService.Send(cmd);
        }
Exemple #5
0
        private void OnEvent(int nEventID, object param)
        {
            GameEventID eventId = (GameEventID)nEventID;

            switch (eventId)
            {
            case GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE:
            {
                SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                SetTimer(ATONCE_TIMERID, ATONCE_LEN);
            }
            break;

            case GameEventID.ENTITYSYSTEM_RELIVE:
            {
                stEntityRelive er = (stEntityRelive)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(er.uid))
                {
                    SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                    SetTimer(ATONCE_TIMERID, ATONCE_LEN);
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_ENTITYDEAD:
            {
                stEntityDead ed = (stEntityDead)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(ed.uid))
                {
                    KillTimer(MEDICAL_TIMEID);
                    KillTimer(ATONCE_TIMERID);
                }
            }
            break;

            case GameEventID.SKILLSYSTEM_SKILLLISTCHANE:
            case GameEventID.SKILLSYSTEM_ADDSKILL:
                InitSkill();
                break;

            case GameEventID.SKILLNONESTATE_ENTER:
            {
                NextSkill = 0;
                OnCombat();
            }
            break;

            //case GameEventID.ROBOTCOMBAT_NEXTCMD:
            //    {
            //        if (param != null)
            //        {
            //            Client.stSkillDoubleHit skillDhHit = (Client.stSkillDoubleHit)param;
            //            OnUseDoubleHitSkill(skillDhHit);
            //        }
            //    }
            //    break;
            case GameEventID.SKILLSYSTEM_STIFFTIMEOVER:
            {        //挂机状态下 硬直结束(并且没有插入技能)只处理普攻前两招,第三招释放时如果有插入 就不播放收招
                stNextSkill st = (stNextSkill)param;
                NextSkill = st.nextSkillID;
                if (m_status == CombatRobotStatus.RUNNING && NextSkill != 0)
                {
                    DoAttack();
                }
                if (m_status == CombatRobotStatus.RUNNING && NextSkill == 0 && InsertSkillID != 0)
                {
                    DoAttack();
                }
            }
            break;

            case GameEventID.SKILLGUIDE_PROGRESSBREAK:
            {
                if (param != null)
                {
                    stGuildBreak skillFailed = (stGuildBreak)param;
                    if (skillFailed.action == GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ)
                    {
                        if (ControllerSystem.m_ClientGlobal.IsMainPlayer(skillFailed.uid))
                        {
                            m_nIgnoreSkillid = skillFailed.skillid;

                            // AddTips(string.Format("使用技能失败id:{0} ret{1}", skillFailed.skillid, skillFailed.msg));
                        }
                        ChangeRoleAction(RoleAction.NONE);
                    }
                }
                //ChangeRoleAction(RoleAction.USESKILL);
                //DoNextCMD();
            }
            break;

            case GameEventID.JOYSTICK_UNPRESS:
                m_fStopTime = UnityEngine.Time.realtimeSinceStartup;

                break;

            case GameEventID.JOYSTICK_PRESS:
                m_fStopTime = 0;
                OnPause(true);
                break;

            case GameEventID.ENTITYSYSTEM_CREATEENTITY:
            {
                Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
                Client.IEntitySystem  es           = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity       = es.FindEntity(createEntity.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        ShowBoxTips(entity.GetID());
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_REMOVEENTITY:
            {
                Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
                Client.IEntitySystem  es          = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity      = es.FindEntity(removeEntiy.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ROBOTCOMBAT_COPYKILLWAVE:
            {
                if (param != null)
                {
                    stCopySkillWave copyWave = (stCopySkillWave)param;
                    if (m_bInCopy)
                    {
                        m_nLaskKillWave     = copyWave.waveId;
                        m_nLaskMovePosIndex = copyWave.posIndex;
                        //  AddTips(string.Format("副本wave{0} posIndex{1}", m_nLaskKillWave, m_nLaskMovePosIndex));
                        if (m_nLaskMovePosIndex != 0)
                        {
                            // SetTimer(COPYCOMBAT_TIMEID, 1600);
                            //OnPause(false);
                        }
                        //DoNextCMD();
                    }
                }
            }
            break;

            case GameEventID.NETWORK_CONNECTE_CLOSE:
            {
                m_disconnectStatus = m_status;
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Stop();
                    Engine.Utility.Log.Error("掉线了 挂机停止!!!");
                }
            }
            break;

            case GameEventID.RECONNECT_SUCESS:
            {
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Start();
                    if (m_disconnectStatus == CombatRobotStatus.PAUSE)
                    {
                        Pause();
                    }
                    m_disconnectStatus = CombatRobotStatus.STOP;
                }
            }
            break;

            default:
                break;
            }
        }