예제 #1
0
    /// <summary>
    /// 全局UI事件处理器
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    public void GlobalEventHandler(int eventType, object data)
    {
        switch (eventType)
        {
        case (int)Client.GameEventID.SYSTEM_LOADSCENECOMPELETE:
        {
            Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)data;
            if (loadScene.nMapID == 159)
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CampFightingPanel);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP:
        {
            CaculateCampSectionIndex();
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //             if (isEnterScene == false)
            //             {
            //                 return;
            //             }

            Client.stCreateEntity npcEntity = (Client.stCreateEntity)data;

            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            Client.IEntity npc = es.FindEntity(npcEntity.uid);
            if (npc == null)
            {
                return;
            }

            int npcBaseId = npc.GetProp((int)Client.EntityProp.BaseID);
            //采集物
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId);
            if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT)        //采集物
            {
                GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp);
                if (m_CampCombatResultInfo != null && m_CampCombatResultInfo.m_MyCampCombatInfo.camp != camp)
                {
                    CampNpcOnTrigger callback = new CampNpcOnTrigger();
                    npc.SetCallback(callback);
                }
            }
        }
        break;
        }
    }
예제 #2
0
    private void ClearSequencerTempObject()
    {
        for (int i = 0; i < m_SequencerTempObject.Count; i++)
        {
            GameObject temp = m_SequencerTempObject[i];
            if (temp != null)
            {
                GameObject.DestroyObject(temp);
            }
        }
        m_SequencerTempObject.Clear();


        for (int i = 0; i < m_SequencerTempRender.Count; i++)
        {
            Engine.IRenderObj temp = m_SequencerTempRender[i];
            if (temp != null)
            {
                m_RenderSystem.RemoveRenderObj(temp);
            }
        }
        m_SequencerTempRender.Clear();


        for (int i = 0; i < m_SequencerTempEffect.Count; i++)
        {
            Engine.IEffect temp = m_SequencerTempEffect[i];
            if (temp != null)
            {
                m_RenderSystem.RemoveEffect(temp);
            }
        }
        m_SequencerTempEffect.Clear();


        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }
        for (int i = 0; i < m_SequencerTempEntity.Count; i++)
        {
            Client.IEntity entity = m_SequencerTempEntity[i];
            if (entity != null)
            {
                es.RemoveEntity(entity);
            }
        }
        m_SequencerTempEntity.Clear();
    }
예제 #3
0
    void AddNpcTip(Client.IEntity entity, uint effectId, uint nTaskId, GameCmd.TaskProcess process)
    {
        NpcTips tips;

        if (m_DictNpceffect.TryGetValue(entity.GetID(), out tips))
        {
            if (tips.process == process)
            {
                return;
            }
        }

        table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(effectId);
        if (edb != null)
        {
            Client.AddLinkEffect   node  = new Client.AddLinkEffect();
            table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("找不到特效资源路径配置{0}", edb.resPath);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            node.nFollowType   = (int)edb.flowType;
            node.rotate        = new UnityEngine.Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset       = new UnityEngine.Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int eId = (int)entity.SendMessage(Client.EntityMessage.EntityCommand_AddLinkEffect, node);
                if (m_DictNpceffect.ContainsKey(entity.GetID()))
                {
                    entity.SendMessage(Client.EntityMessage.EntityCommand_RemoveLinkEffect, m_DictNpceffect[entity.GetID()].effectid);
                    m_DictNpceffect[entity.GetID()].effectid = eId;
                    m_DictNpceffect[entity.GetID()].process  = process;
                }
                else
                {
                    m_DictNpceffect.Add(entity.GetID(), new NpcTips()
                    {
                        effectid = eId, npcid = entity.GetID(), taskid = nTaskId, process = process
                    });
                }
            }
        }
    }
예제 #4
0
    public void OnSetCampUser(GameCmd.stSetCampUserCmd_S cmd)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }
        //0是玩家,1是npc
        Client.IEntity entity = null;
        if (cmd.entry_type == 0)
        {
            entity = es.FindPlayer(cmd.entry_id);
        }
        else if (cmd.entry_type == 1)
        {
            entity = es.FindNPC(cmd.entry_id);
        }

        if (entity != null)
        {
            Client.stPropUpdate prop = new Client.stPropUpdate();
            prop.uid        = entity.GetUID();
            prop.nPropIndex = (int)Client.CreatureProp.Camp;
            prop.oldValue   = entity.GetProp((int)Client.CreatureProp.Camp);
            prop.newValue   = (int)cmd.camp;
            entity.SetProp((int)Client.CreatureProp.Camp, (int)cmd.camp);
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
        }



        if (Client.ClientGlobal.Instance().IsMainPlayer(cmd.entry_id))
        {
            if (cmd.camp == eCamp.CF_Green || cmd.camp == eCamp.CF_Red)
            {
                DataManager.Manager <CampCombatManager>().OnSetCamp();
            }
            //进去就请求刷行数据
            DataManager.Instance.Sender.RequestCampInfoCamp(0, 0, DataManager.Manager <CampCombatManager>().FightingIndex);
        }
    }
예제 #5
0
    public GameObject GetGameObject(string strName)
    {
        GameObject result = null;

        for (int i = 0; i < m_SequencerTempRender.Count; i++)
        {
            Engine.IRenderObj renderObj = m_SequencerTempRender[i];
            if (renderObj != null)
            {
                if (renderObj.GetNode().GetTransForm().gameObject.name == strName)
                {
                    result = renderObj.GetNode().GetTransForm().gameObject;
                    return(result);
                }
            }
        }

        for (int i = 0; i < m_SequencerTempEntity.Count; i++)
        {
            Client.IEntity entity = m_SequencerTempEntity[i];
            if (entity != null)
            {
                Engine.IRenderObj renderObj = entity.renderObj;
                if (renderObj != null)
                {
                    if (renderObj.GetNode().GetTransForm().gameObject.name == strName)
                    {
                        result = renderObj.GetNode().GetTransForm().gameObject;
                        return(result);
                    }
                }
            }
        }


        return(null);
    }
예제 #6
0
    public void Execute(stBroadCastRideUserCmd_S cmd)
    {//广播的发的是坐骑的baseid
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }

        Client.IEntity entity = es.FindPlayer(cmd.user_id);
        if (entity != null)
        {
            if (Client.ClientGlobal.Instance().IsMainPlayer(entity))
            {//主角不处理 通过stStatusRideUserCmd_S 唯一决定
                return;
            }
            if (cmd.type == 0)//下马
            {
                bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
                if (bRide)
                {
                    entity.SendMessage(Client.EntityMessage.EntityCommond_UnRide, null);
                }
                entity.SetProp((int)Client.PlayerProp.RideBaseId, 0);
                #region 主角废弃
                //if (Client.ClientGlobal.Instance().IsMainPlayer(entity))
                //{
                //    RideMgr.UsingRide = 0;
                //    if (RideMgr.UnRideCallback != null)
                //    {
                //        RideMgr.UnRideCallback(RideMgr.UnRideCallbackParam);
                //        RideMgr.UnRideCallback = null;
                //        RideMgr.UnRideCallbackParam = null;
                //    }
                //}
                #endregion
            }
            else if (cmd.type == 1)//上马
            {
                bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
                if (bRide)
                {
                    return;
                }

                entity.SetProp((int)Client.PlayerProp.RideBaseId, (int)cmd.ride_id);
                entity.SendMessage(Client.EntityMessage.EntityCommond_Ride, (int)cmd.ride_id);

                #region 主角废弃
                //if (Client.ClientGlobal.Instance().IsMainPlayer(entity))
                //{
                //    RideMgr.UsingRide = RideMgr.Auto_Ride;

                //    Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                //    if (cs != null)
                //    {
                //        Client.ICombatRobot robot = cs.GetCombatRobot();
                //        if (robot != null && robot.Status != Client.CombatRobotStatus.STOP)
                //        {
                //            robot.Stop();
                //        }
                //    }
                //}
                #endregion
            }
        }
    }