示例#1
0
    void MainUsePanelItemOnClick()
    {
        Client.IEntity player = Client.ClientGlobal.Instance().MainPlayer;
        if (player == null)
        {
            return;
        }

        bool ismoving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);

        if (ismoving)
        {
            player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos());
        }

        List <BaseItem> lstItems = DataManager.Manager <ItemManager>().GetItemByBaseId(this.usecommitItemID);

        if (lstItems.Count > 0)
        {
            uint m_nitemThisId = lstItems[0].QWThisID;

            DataManager.Manager <RideManager>().TryUnRide(
                (obj) =>
            {
                Protocol.Instance.RequestUseItem(m_nitemThisId);
            },
                null);
        }
    }
示例#2
0
        private bool IsMoving()
        {
            Client.IEntity player = ControllerSystem.m_ClientGlobal.MainPlayer;
            if (player == null)
            {
                return(false);
            }
            bool moving = (bool)player.SendMessage(EntityMessage.EntityCommand_IsMove, null);

            return(moving);
        }
示例#3
0
        private void FindMonsterAddAttack()
        {
            IEntity target = GetNearestMonster();

            if (target != null)
            {
                //目标没死亡
                ICreature c = (target as ICreature);
                if (c != null && !c.IsDead())
                {
                    m_ActiveCtrl.UpdateTarget(target);

                    uint skillid = GetNextSkillID();
                    if (skillid != 0 && m_skillPart.IsSkillCanUse(skillid))
                    {
                        AddAttackCmd(target, skillid);
                    }
                    else
                    {
                        ChangeRoleAction(RoleAction.NONE);
                        //  AddTips(string.Format("CombatRobot->FindMonsterAddAttack 技能{0} 不可使用 {1}", skillid, UnityEngine.Time.realtimeSinceStartup));
                    }
                }
            }
            else
            {
                if (m_RoleAction != RoleAction.NONE)
                {
                    if (m_bInCopy)
                    {
                        MoveToWavePos();
                    }
                    else
                    {
                        Engine.Utility.Log.LogGroup("ZCX", "找不到攻击目标");
                        Client.IEntity player = ControllerSystem.m_ClientGlobal.MainPlayer;
                        if (player != null)
                        {
                            PlayAni anim_param = new PlayAni();
                            anim_param.strAcionName = EntityAction.Stand;
                            anim_param.fSpeed       = 1;
                            anim_param.nStartFrame  = 0;
                            anim_param.nLoop        = -1;
                            anim_param.fBlendTime   = 0.2f;
                            player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                        }
                        ChangeRoleAction(RoleAction.NONE);
                    }
                }
            }
        }
示例#4
0
    void MainUsePanelItemOnClick()
    {
        Client.IEntity player = Client.ClientGlobal.Instance().MainPlayer;
        if (player == null)
        {
            return;
        }
        bool ismoving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);

        if (ismoving)
        {
            player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos());
        }
        if (curTreasureMap != null)
        {
            DataManager.Manager <RideManager>().TryUnRide(
                (obj) =>
            {
                VerifyPlayAni();
            },
                null);
        }
    }
示例#5
0
    void PlayAni(Client.IEntity player, string entityAction)
    {
        if (player == null)
        {
            return;
        }

        //处理
        PlayAni anim_param = new PlayAni();

        anim_param.strAcionName = entityAction;
        anim_param.fSpeed       = 1;
        anim_param.nStartFrame  = 0;
        anim_param.nLoop        = -1;
        anim_param.fBlendTime   = 0.2f;
        player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
    }
示例#6
0
    public void Excute(stUnTransfigurationScriptUserCmd_S cmd)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }

        Client.IEntity player = es.FindPlayer(cmd.userid);
        if (player != null)
        {
            player.SetProp((int)Client.PlayerProp.TransModelResId, 0);
            player.SendMessage(Client.EntityMessage.EntityCommand_Restore, new Client.ChangeBody()
            {
                param      = cmd.taskid,
                callback   = null,
                modleScale = 1
            });
        }
    }
示例#7
0
    uint CreateEffect()
    {
        Client.IEntity target = ClientGlobal.Instance().GetEntitySystem().FindNPC(treeEntityID);
        if (target == null)
        {
            Engine.Utility.Log.Error("摇钱树实体查找不到,id为{0}", treeEntityID);
            return(0);
        }
        FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(10001);

        if (edb != null && target != null)
        {
            AddLinkEffect node = new AddLinkEffect();
            node.nFollowType = (int)edb.flowType;
            node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return(0);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);

                return((uint)id);
            }
        }

        return(0);
    }
示例#8
0
    public void Excute(stTransfigurationScriptUserCmd_S cmd)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }

        Client.IEntity player = es.FindPlayer(cmd.userid);
        if (player != null)
        {
            DataManager.Manager <RideManager>().TryUnRide((obj) =>
            {
                player.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody()
                {
                    resId      = (int)cmd.modelid,
                    param      = cmd.taskid,
                    callback   = null,
                    modleScale = 1
                });
            },
                                                          null);
        }
    }
示例#9
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;
            }
        }
    }
示例#10
0
    /// <summary>
    /// 更新位置
    /// </summary>
    public void UpdatePositon()
    {
        if (!Visible)
        {
            return;
        }
        if (UID == 0)
        {
            return;
        }
        Client.IEntity entity = RoleStateBarManager.GetEntity(UID);
        if (entity == null)
        {
            return;
        }

        RoleStateBarManager mgr = DataManager.Manager <RoleStateBarManager>();
        Vector3             pos = Vector3.zero;

        if (entity.GetEntityType() == EntityType.EntityType_Player)
        {
            bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
            if (bRide)
            {
                pos = mgr.GetNodeWorldPos(UID, "MountName", offsetY);
            }
            else
            {
                pos = mgr.GetNodeWorldPos(UID, "Name", offsetY);
            }
        }
        else
        {
            pos = mgr.GetNodeWorldPos(UID, "Name", offsetY);
        }

        Camera mainCamera = Util.MainCameraObj.GetComponent <Camera>();
        Camera uiCamera   = Util.UICameraObj.GetComponent <Camera>();

        if (null == uiCamera || null == mainCamera)
        {
            return;
        }
        pos = mainCamera.WorldToViewportPoint(pos);
        //bool isVisible = (mainCamera.orthographic || pos.z > 0f) && (/*!disableIfInvisible || */(pos.x > 0f && pos.x < 1f && pos.y > 0f && pos.y < 1f));
        //if (Visible != isVisible)
        //{
        //    SetVisible(isVisible);
        //    if (Visible)
        //    {
        //        AdjustStatusPos();
        //    }
        //}
        pos = uiCamera.ViewportToWorldPoint(pos);
        m_tsTran.position = pos;
        pos   = m_tsTran.localPosition;
        pos.x = Mathf.FloorToInt(pos.x);
        pos.y = Mathf.FloorToInt(pos.y);
        pos.z = 0f;
        m_tsTran.localPosition = pos;
    }
示例#11
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            Client.IEntitySystem  es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }
            Client.IEntity en = es.FindEntity(ce.uid);
            if (en != null)
            {
                int rideId = en.GetProp((int)Client.PlayerProp.RideBaseId);
                if (rideId != 0)
                {
                    //if (Client.ClientGlobal.Instance().IsMainPlayer(en))
                    //{
                    //    UsingRide = (uint)rideId;
                    //}
                    bool isride = (bool)en.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
                    if (!isride)
                    {
                        en.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
                    }
                    //                    Engine.Utility.Log.LogGroup("ZCX", "EntityCommond_Ride {0}",en.GetID());
                }

                //int transModelId = en.GetProp((int)Client.PlayerProp.TransModelResId);
                //if (transModelId != 0)
                //{
                //    en.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody() {  resId = transModelId});
                //}
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_RIDE)
        {
            Client.stEntityRide ride = (Client.stEntityRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UsingRideCallback != null)
                {
                    UsingRideCallback(UsingRideCallbackParam);
                    UsingRideCallback      = null;
                    UsingRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            Client.stEntityUnRide ride = (Client.stEntityUnRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UnRideCallback != null)
                {
                    UnRideCallback(UnRideCallbackParam);
                    UnRideCallback      = null;
                    UnRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE)
        {
            Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
            if (mainPlayer == null)
            {
                return;
            }
            //int rideId = mainPlayer.GetProp((int)Client.PlayerProp.RideBaseId);
            //if (rideId != 0)
            //{

            //    UsingRide = (uint)rideId;
            //    bool isride = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
            //    if (!isride)
            //    {
            //        mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
            //    }
            //}
        }
        else if (eventID == (int)Client.GameEventID.UIEVENT_UPDATEITEM)
        {
            List <string> tempIDList = GameTableManager.Instance.GetGlobalConfigKeyList("Knight_ExpItem");


            uint breakItemID = GameTableManager.Instance.GetGlobalConfig <uint>("KngithRankItem");

            ItemDefine.UpdateItemPassData data = (ItemDefine.UpdateItemPassData)param;
            if (data != null)
            {
                if (data.BaseId == breakItemID || tempIDList.Contains(data.BaseId.ToString()))
                {
                    DisPatchRideRedPoint();
                }
            }
        }
    }