예제 #1
0
        // 根据服务器类型和id获取实体对象
        public static IEntity GetEntity(GameCmd.SceneEntryType type, uint id)
        {
            Client.EntityType t = GetEntityEtype(type);

            Client.IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem();
            if (es == null)
            {
                return(null);
            }

            switch (t)
            {
            case EntityType.EntityType_Player:
            {
                return(es.FindPlayer(id));
            }

            case EntityType.EntityType_NPC:
            {
                IEntity en = es.FindNPC(id);
                if (en == null)
                {
                    en = es.FindRobot(id);
                }
                return(en);
            }

            case EntityType.EntityType_Monster:
            {
                return(es.FindMonster(id));
            }

            case EntityType.EntityType_Item:
            {
                return(es.FindItem(id));
            }
            }

            return(null);
        }
예제 #2
0
    void SkillEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
        {
            Client.stUninterruptMagic evenparam = (Client.stUninterruptMagic)param;
            if (ClientGlobal.Instance().IsMainPlayer(evenparam.uid))
            {
                if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.SliderPanel) == false)
                {
                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.SliderPanel, panelShowAction: (panel) =>
                    {
                        DispatchValueUpdateEvent(new ValueUpdateEventArgs()
                        {
                            key = SliderDataEnum.Begin.ToString()
                        });
                    });
                }
                float dur = (float)(evenparam.time * 1f / 1000);
                if (dur > 0)
                {
                    DataManager.Manager <SliderDataManager>().StartSliderByEvent(dur, evenparam.type);
                }
                else
                {
                    Log.Error("进度条时间小于 0");
                }
            }

            if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CJ ||
                evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ ||
                evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ)
            {
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

                if (es == null)
                {
                    return;
                }

                Client.IEntity player = es.FindEntity(evenparam.uid);

                if (player == null)
                {
                    return;
                }
                bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);
                if (moving)
                {
                    player.SendMessage(EntityMessage.EntityCommand_StopMove);
                }

                Client.INPC npc = es.FindNPC(evenparam.npcId);
                if (npc != null)
                {
                    player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos());
                }
                PlayAni(player, EntityAction.Collect);
            }
            else if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ)
            {
                //采集
                Log.Info("开始挖宝...");
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

                if (es == null)
                {
                    return;
                }
                Client.IEntity player = es.FindEntity(evenparam.uid);

                if (player == null)
                {
                    return;
                }
                bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);
                if (moving)
                {
                    player.SendMessage(EntityMessage.EntityCommand_StopMove);
                }

                Client.INPC npc = es.FindNPC(evenparam.npcId);
                if (npc != null)
                {
                    player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos());
                }
                //                PlayAni(player, EntityAction.Collect);
                //播放挖宝动作
                PlayAni(player, EntityAction.Mining);

                //更换武器模型
                DataManager.Manager <SuitDataManager>().OnMiningTreasureMapToChangeWeapon(player);
            }
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
        {
            if (param != null)
            {
                stGuildBreak guildBreak = (stGuildBreak)param;
                if (ClientGlobal.Instance().IsMainPlayer(guildBreak.uid))
                {
                    DataManager.Manager <SliderDataManager>().HideSlider(guildBreak.action);
                    DataManager.Manager <SliderDataManager>().IsBreak         = true;
                    DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
                    //DataManager.Manager<TaskDataManager>().IsShowSlider = false;
                }

                if (guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CJ ||
                    guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ)
                {
                    //打断采集
                    Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
                    if (es == null)
                    {
                        return;
                    }
                    Client.IEntity entity = es.FindPlayer(guildBreak.uid);
                    if (entity != null)
                    {
                        bool moving = (bool)entity.SendMessage(EntityMessage.EntityCommand_IsMove, null);
                        if (!moving)
                        {
                            PlayAni(guildBreak.uid, EntityAction.Stand);
                        }
                    }
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
        {
            DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
            //DataManager.Manager<TaskDataManager>().IsShowSlider = false;
            stGuildEnd guildEnd = (stGuildEnd)param;
            if (ClientGlobal.Instance().IsMainPlayer(guildEnd.uid))
            {
                //坐骑读条完毕后上马
                if (guildEnd.action == GameCmd.UninterruptActionType.UninterruptActionType_DEMON)
                {
                    DataManager.Instance.Sender.RideUsingRide();
                }
                else
                {
                    if (guildEnd.action != GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ)
                    {
                        PlayStand();
                    }
                }
            }
            else
            {
                //播站立动作
                PlayAni(guildEnd.uid, EntityAction.Stand);
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ClientGlobal.Instance().IsMainPlayer(ed.uid))
            {
                // HideSprite();
                DispatchValueUpdateEvent(new ValueUpdateEventArgs()
                {
                    key = SliderDataEnum.End.ToString(), oldValue = m_UninterruptActionType
                });
                DataManager.Manager <SliderDataManager>().IsBreak         = true;
                DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
            }
        }
    }
예제 #3
0
    void ShowItemInfo(MainUsePanelData data)
    {
        /*
         * List<BaseItem> lstItems = DataManager.Manager<ItemManager>().GetItemByBaseId(itemBaseid);
         * if (lstItems.Count <= 0)
         * {
         *  m_nitemThisId = 0;
         *  m_nitemBaseId = 0;
         *  return;
         * }
         * m_nitemThisId = lstItems[0].QWThisID;
         * m_nitemBaseId = itemBaseid;
         */

        //npc
        if (data.type == 1)
        {
            m__icon.gameObject.SetActive(false);
            m_sprite_iconCollect.gameObject.SetActive(true);
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            INPC npc = es.FindNPC(data.Id);
            if (npc == null)
            {
                return;
            }

            //this.name = npc.GetName();
            this.name = "采集";
            m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME);
        }
        //item
        else if (data.type == 2)
        {
            m__icon.gameObject.SetActive(true);
            m_sprite_iconCollect.gameObject.SetActive(false);
            table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(data.Id);
            if (itemdata != null)
            {
                UIManager.GetTextureAsyn(itemdata.itemIcon, ref m_iconCASD, () =>
                {
                    if (null != m__icon)
                    {
                        m__icon.mainTexture = null;
                    }
                }, m__icon);

                //this.name = itemdata.itemName;
                this.name = "使用";
                m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME);
            }
        }

        //特效
        UIParticleWidget wight = m_sprite_iconBg.GetComponent <UIParticleWidget>();

        if (null == wight)
        {
            wight       = m_sprite_iconBg.gameObject.AddComponent <UIParticleWidget>();
            wight.depth = 100;
        }

        if (wight != null)
        {
            UIParticleWidget p = wight.GetComponent <UIParticleWidget>();
            if (p == null)
            {
                p       = wight.gameObject.AddComponent <UIParticleWidget>();
                p.depth = 20;
            }
            if (p != null)
            {
                p.SetDimensions(1, 1);
                p.ReleaseParticle();
                p.AddParticle(50019);
            }
        }

        StartCoroutine(WaitToClose());
    }