Esempio n. 1
0
    void StopMove()
    {
        //移动摇杆打断自动寻路,角色会滑步
        Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer;
        if (player == null)
        {
            return;
        }
        bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);

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

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)(int)Client.GameEventID.JOYSTICK_PRESS, null);
    }
Esempio n. 2
0
        private IEntity GetNearestMonster()
        {
            Client.IPlayer mainplayer = ControllerSystem.m_ClientGlobal.MainPlayer;
            if (mainplayer == null)
            {
                return(null);
            }
            IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem();

            if (es == null)
            {
                return(null);
            }

            IMapSystem ms = ControllerSystem.m_ClientGlobal.GetMapSystem();

            if (ms == null)
            {
                return(null);
            }

            IEntity monster = null;

            if (m_nTargetID != 0)
            {
                monster = es.FindNPCByBaseId(m_nTargetID, true);
            }
            else
            {
                PLAYERPKMODEL     pkmodel = (PLAYERPKMODEL)mainplayer.GetProp((int)PlayerProp.PkMode);
                MapAreaType       atype   = ms.GetAreaTypeByPos(mainplayer.GetPos());
                IControllerHelper ch      = GetControllerHelper();
                if (ch != null)
                {
                    uint attackPriority = ch.GetAttackPriority();
                    monster = es.FindEntityByArea_PkModel(atype, pkmodel, m_centerPos, m_nSearchRang, attackPriority);
                }
            }

            return(monster);
        }
Esempio n. 3
0
    void onClick_Deliver_queidng_Btn(GameObject caster)
    {
        string[]   name   = caster.name.Split("_".ToCharArray());
        GameObject target = m_widget_MissionContent.transform.Find(name[0]).gameObject;

        UIInput[]   input     = target.transform.GetComponentsInChildren <UIInput>();
        List <uint> paramings = new List <uint>();

        foreach (var inp in input)
        {
            UILabel l      = inp.GetComponentInChildren <UILabel>();
            UILabel parent = inp.GetComponentInParent <UILabel>();
            if (this.isNumber(l.text))
            {
                uint number = uint.Parse(l.text);
                paramings.Add(number);
            }
            else
            {
                Engine.Utility.Log.Error("{0}数值输入不规范!", parent.name);
            }
        }
        Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer;
        if (player == null)
        {
            return;
        }
        bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null);

        if (moving)
        {
            player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos());
        }
        string msg = string.Format("//goto map={0} pos={1},{2}", paramings[0], paramings[1], paramings[2]);

        DataManager.Manager <ChatDataManager>().SendChatText(msg);
        Debug.Log(msg);
    }
Esempio n. 4
0
        public bool GetClienNpcPos(int baseid, out Vector2 pos)
        {
            pos = Vector2.zero;
            List <NPCInfo> lstInfo = null;

            if (m_dicNpcInfo.TryGetValue(baseid, out lstInfo))
            {
                if (lstInfo == null)
                {
                    Engine.Utility.Log.Error("xml表格没有找到npc id {0}的位置", baseid);
                    return(false);
                }

                Client.IPlayer player = MapSystem.m_ClientGlobal.MainPlayer;
                if (player == null)
                {
                    return(false);
                }

                Vector3 playerPos = player.GetPos();
                Vector2 pp        = new Vector3(playerPos.x, -playerPos.z);
                float   fDistance = 1000000.0f;
                for (int i = 0; i < lstInfo.Count; ++i)
                {
                    float fDis = Vector2.Distance(lstInfo[i].pos, pp);
                    if (fDis < fDistance)
                    {
                        fDistance = fDis;
                        pos       = lstInfo[i].pos;
                    }
                }

                return(true);
            }
            Engine.Utility.Log.Error("xml表格没有找到npc id {0}的位置", baseid);
            return(false);
        }