Exemple #1
0
    void PlayAni(uint uid, string entityAction)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        Client.IPlayer player = es.FindPlayer(uid);

        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);
    }
Exemple #2
0
    /// <summary>
    /// true 上马了发送请求 false 没有上马
    /// </summary>
    /// <param name="callback"></param>
    /// <param name="param"></param>
    /// <returns></returns>
    public bool TryUnRide(Action <object> callback = null, object param = null)
    {
        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            if (!m_bIsRide)
            {
                if (callback != null)
                {
                    callback(param);
                }
                return(false);
            }
            else
            {
                UnRideCallback      = callback;
                UnRideCallbackParam = param;
                NetService.Instance.Send(new GameCmd.stDownRideUserCmd_C()
                {
                });
            }
        }

        return(true);
    }
Exemple #3
0
    public void OnSelectTitle(stSelectTitlePropertyUserCmd_CS cmd)
    {
        //如果是玩家自己
        if (Client.ClientGlobal.Instance().IsMainPlayer(cmd.dwUserID))
        {
            this.WearTitleId = cmd.wdTitleID;

            TitleDataBase titleDataBase = GameTableManager.Instance.GetTableItem <TitleDataBase>(this.WearTitleId);
            if (titleDataBase != null)
            {
                TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Title_Commond_peidaichenghao, titleDataBase.strName);//佩戴称号{0}
            }
        }


        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es != null)
        {
            //设置人物身上称号
            Client.IPlayer player = es.FindPlayer(cmd.dwUserID);
            if (player != null)
            {
                player.SetProp((int)PlayerProp.TitleId, (int)cmd.wdTitleID);
            }
        }


        //处理文字特效
        Client.stTitleWear data = new Client.stTitleWear {
            uid = cmd.dwUserID, titleId = cmd.wdTitleID
        };
        EventEngine.Instance().DispatchEvent((int)GameEventID.TITLE_WEAR, data);//抛出现在佩戴的称号
    }
Exemple #4
0
    // 进入场景
    public void Enter()
    {
        HomeSceneID = GameTableManager.Instance.GetGlobalConfig <uint>("HomeSceneID");
        IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }

        mapSys.EnterMap(HomeSceneID, Vector3.zero);

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            return;
        }

        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            mainPlayer.SendMessage(EntityMessage.EntityCommand_SetVisible, false);
        }
        cs.GetActiveCtrl().SetClickSink(this);

        m_AnimalManager.Init();
    }
Exemple #5
0
    /// <summary>
    /// 获得玩家的心法ID list
    /// </summary>
    /// <returns></returns>
    List <uint> GetHeartSkillIdList()
    {
        //int lvLimit = GameTableManager.Instance.GetClientGlobalConst<int>("HeartSkill", "HeartSkillUnlockLv");
        int lvLimit = GameTableManager.Instance.GetGlobalConfig <int>("GodOpenLevel"); //100级开放心法

        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        int            playerLv   = mainPlayer.GetProp((int)Client.CreatureProp.Level);
        int            playerJob  = mainPlayer.GetProp((int)Client.PlayerProp.Job);

        List <HeartSkillDataBase> heartSkillList = GameTableManager.Instance.GetTableList <HeartSkillDataBase>();

        heartSkillList = heartSkillList.FindAll((d) => { return(d.profession == playerJob); });//职业

        heartSkillList.Sort((x, y) => x.orderId.CompareTo(y.orderId));

        //heartSkillList = new List<HeartSkillDataBase>(orderList);

        List <uint> idList = new List <uint>();

        if (playerLv >= lvLimit)
        {
            for (int i = 0; i < heartSkillList.Count; i++)
            {
                if (idList.Contains(heartSkillList[i].id) == false)
                {
                    idList.Add(heartSkillList[i].id);
                    //Engine.Utility.Log.LogGroup(GameDefine.LogGroup.User_LCY, "--->>> 顺序为: {0}", heartSkillList[i].orderId);
                }
            }
        }

        return(idList);
    }
Exemple #6
0
    public void RunCD()
    {
        if (IsCDing)
        {
            Log.LogGroup("ZDY", "run cd and is cding ");
            return;
        }


        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer == null)
        {
            Log.Error("main player is null");
            return;
        }

        SkillCDInfo cdInfo = DataManager.Manager <SkillCDManager>().GetSkillCDBySkillId((uint)m_skillid);

        if (cdInfo != null)
        {
            IsCDing = true;
            SetBtnEnable(false);
            if (!TimerAxis.Instance().IsExist(m_uSkillUseTimeID, this))
            {
                //   Log.LogGroup("ZDY", "start cd " );
                TimerAxis.Instance().SetTimer(m_uSkillUseTimeID, 30, this);
            }
        }
        else
        {
            SetBtnEnable(true);
            //Log.LogGroup("ZDY", "run cd info is null " + m_skillid);
        }
    }
Exemple #7
0
 public bool TryUnRide(Action <object> callback, object param)
 {
     Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
     if (mainPlayer != null)
     {
         return(DataManager.Manager <RideManager>().TryUnRide(callback, param));
     }
     return(false);
 }
Exemple #8
0
    //-------------------------------------------------------------------------------------------------------

    /**
     * @brief 添加玩家(木偶)
     * @param strName 名称
     * @param nJob 职业
     * @param nSex 性别
     * @param propList 外观属性
     * @param bMainHost 是否是主角对象
     */
    public IPuppet AddPuppet(string strName, int nJob, int nSex, EntityViewProp[] propList, bool bMainHost = false)
    {
        EntityCreateData data = new EntityCreateData();

        data.ID      = ++m_uEntityID;
        data.strName = strName;

        int speed = 0;

        Client.IPlayer player = ClientGlobal.Instance().MainPlayer;
        if (player != null)
        {
            speed = player.GetProp((int)WorldObjProp.MoveSpeed);
        }


        data.PropList = new EntityAttr[(int)PuppetProp.End - (int)EntityProp.Begin];
        int index = 0;

        data.PropList[index++] = new EntityAttr((int)PuppetProp.Job, nJob);
        data.PropList[index++] = new EntityAttr((int)PuppetProp.Sex, nSex);
        data.PropList[index++] = new EntityAttr((int)EntityProp.BaseID, 0);
        data.PropList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, speed);
        data.ViewList          = propList;

        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return(null);
        }

        IPuppet entity = es.CreateEntity(EntityType.EntityType_Puppet, data) as IPuppet;

        if (entity == null)
        {
            Engine.Utility.Log.Error("AddEntity:创建家园对象失败!");
            return(null);
        }

        if (bMainHost)
        {
            IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();
            if (cs == null)
            {
                return(null);
            }

            cs.GetActiveCtrl().SetHost(entity);
            CameraFollow.Instance.target = entity;
        }

        m_dicPuppet.Add((int)entity.GetID(), entity);

        return(entity);
    }
Exemple #9
0
    /// <summary>
    /// 使用瞬药
    /// </summary>
    public void UseAtOnceMedicine()
    {
        bool canRunning = Engine.Utility.EventEngine.Instance().DispatchVote((int)GameVoteEventID.AUTORECOVER, null);

        if (!canRunning)
        {
            Engine.Utility.Log.LogGroup("ZCX", "canRunning false");
            return;
        }

        //是否可以使用瞬药
        bool canUseAtOnce = Engine.Utility.EventEngine.Instance().DispatchVote((int)GameVoteEventID.AUTOAtOnceRECOVER, null);

        if (!canUseAtOnce)
        {
            Engine.Utility.Log.LogGroup("ZCX", "canUseAtOnce false");
            return;
        }

        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (mainPlayer == null || mainPlayer.IsDead())
        {
            Engine.Utility.Log.LogGroup("ZCX", "player dead");
            return;
        }
        Dictionary <AutoRecoverGrid.MedicalType, UseMedicalInfo> .Enumerator iter = m_dicMedical.GetEnumerator();
        while (iter.MoveNext())
        {
            UseMedicalInfo medical = iter.Current.Value;
            if (medical != null && medical.select)
            {
                AutoRecoverGrid.MedicalType mtype = medical.Type;
                float rate = 1f;
                if (AutoRecoverGrid.MedicalType.HpAtOnce == mtype)
                {//瞬药 单独处理
                    rate = mainPlayer.GetProp((int)CreatureProp.Hp) * 1f / mainPlayer.GetProp((int)CreatureProp.MaxHp);

                    if (rate < medical.triggerValue)
                    {
                        uint itemid = medical.itemid;
                        if (itemid != 0 && CanUse(itemid))
                        {
                            List <BaseItem> itemdataList = DataManager.Manager <ItemManager>().GetItemByBaseId(itemid);
                            if (itemdataList.Count > 0)
                            {
                                DataManager.Instance.Sender.UseItem(
                                    mainPlayer.GetID(),
                                    (uint)GameCmd.SceneEntryType.SceneEntry_Player,
                                    itemdataList[0].QWThisID, 1);
                            }
                        }
                    }
                }
            }
        }
    }
Exemple #10
0
 void MainPlayStop()
 {
     Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer;
     if (player != null)
     {
         player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos());
         Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); //关闭自动寻路中
     }
     Controller.CmdManager.Instance().Clear();                                                                       //清除寻路
 }
Exemple #11
0
    public void AddSkillCD(uint skillid, int cd)
    {
        if (m_dictskill == null)
        {
            Client.IPlayer    player      = Client.ClientGlobal.Instance().MainPlayer;
            Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            m_dictskill = m_skillPart.GetCurSkills();
        }
        table.SkillDatabase skillTable = null;
        if (m_dictskill.ContainsKey(skillid))
        {
            skillTable = m_dictskill[skillid];
        }
        if (skillTable == null)
        {
            skillTable = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillid);
        }

        if (skillTable != null)
        {
            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            if (cd == -1)
            {
                m_dictSkillCD[skillid].totalTime = skillTable.dwIntervalTime;
            }
            else
            {
                m_dictSkillCD[skillid].totalTime = cd;
            }
            m_dictSkillCD[skillid].skillid  = (int)skillid;
            m_dictSkillCD[skillid].currTime = m_dictSkillCD[skillid].totalTime;
        }
        else
        {
            table.RideSkillDes rideskill = GameTableManager.Instance.GetTableItem <table.RideSkillDes>(skillid);
            if (rideskill == null)
            {
                return;
            }
            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            m_dictSkillCD[skillid].totalTime = rideskill.skillCD;
            m_dictSkillCD[skillid].skillid   = (int)skillid;
            m_dictSkillCD[skillid].currTime  = rideskill.skillCD;
        }
    }
Exemple #12
0
 public void OnContrllerEvent(int nEventID, object param)
 {
     if (m_Host == null)
     {
         Engine.Utility.Log.Error("MoveController.OnContrllerEvent: host is null");
         return;
     }
     if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (m_bJoystick && stopEntity.uid == m_Host.GetUID() && !stopEntity.bExternal) // 自行移动停止才需要继续向前预测
         {
             // 继续向前预测
             MoveByDir(m_fCalcRotate);
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKLL_LONGPRESS)
     {
         stSkillLongPress st = (stSkillLongPress)param;
         m_bSkillLongPress = st.bLongPress;
     }
     else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         stEntityDead ed = (stEntityDead)param;
         if (m_ClientGlobal.IsMainPlayer(ed.uid))
         {
             m_bJoystick = false;
             m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, m_ClientGlobal.MainPlayer.GetPos());
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKILL_FORBIDDENJOYSTICK)
     {
         Client.stForbiddenJoystick info   = (Client.stForbiddenJoystick)param;
         Client.IPlayer             player = m_ClientGlobal.MainPlayer;
         if (player == null)
         {
             return;
         }
         if (info.playerID == player.GetUID())
         {
             //bForbiddenJoystick = info.bFobidden;
             //if(bForbiddenJoystick)
             //{
             //   // Log.LogGroup( "ZDY" , "摇杆禁用" );
             //}
             //else
             //{
             //  //  Log.LogGroup( "ZDY" , "摇杆回复" );
             //}
         }
     }
 }
Exemple #13
0
 public bool TryRide(Action <object> callback, object param)
 {
     Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
     if (mainPlayer != null)
     {
         bool bRide = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
         if (!bRide)
         {
             return(DataManager.Manager <RideManager>().TryUsingRide(callback, param));
         }
     }
     return(false);
 }
Exemple #14
0
    public bool IsRecommend(uint lvMin, uint lvMax)
    {
        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            uint lv = (uint)mainPlayer.GetProp((int)CreatureProp.Level);
            if (lv >= lvMin && lv <= lvMax)
            {
                return(true);
            }
        }

        return(false);
    }
Exemple #15
0
 private void AddAttackCmd(IEntity target, uint skillid)
 {
     Client.IPlayer player = ControllerSystem.m_ClientGlobal.MainPlayer;
     if (target != null && skillid != 0)
     {
         if (m_CombatRobotMono != null)
         {
             m_CombatRobotMono.AddLog(string.Format("添加攻击命令 技能id:{0} {1}", skillid, UnityEngine.Time.realtimeSinceStartup));
         }
         CmdManager.Instance().AddCmd(Cmd.Attack, player.GetUID(), target.GetUID(), skillid);
     }
     else
     {
         ChangeRoleAction(RoleAction.NONE);
     }
 }
Exemple #16
0
    /// <summary>
    /// 根据玩家等级判断是否开放心法
    /// </summary>
    /// <returns></returns>
    public bool IsHeartSkillOpen()
    {
        int lvLimit = GameTableManager.Instance.GetGlobalConfig <int>("GodOpenLevel");

        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        int            playerLv   = mainPlayer.GetProp((int)Client.CreatureProp.Level);

        if (playerLv >= lvLimit)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemple #17
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);
    }
Exemple #18
0
    private void OnTitleWear(uint uid)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        Client.IPlayer entity = es.FindPlayer(uid);
        if (entity != null)
        {
            RoleStateBar bar = GetRoleBarByUID(entity.GetUID());
            if (bar != null)
            {
                bar.UpdateWidget(new HeadTipData(entity, HeadTipType.Title, m_bPlayerTitleVisible));
            }
        }
    }
Exemple #19
0
    /// <summary>
    /// 点心法按钮
    /// </summary>
    void OnClickHeartSkillBtn()
    {
        int lvLimit = GameTableManager.Instance.GetGlobalConfig <int>("GodOpenLevel");

        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        int            playerLv   = mainPlayer.GetProp((int)Client.CreatureProp.Level);

        if (playerLv >= lvLimit)
        {
            m_trans_LearnSkillContent.gameObject.SetActive(false);
            m_trans_HeartSkillContent.gameObject.SetActive(true);

            InitHeartSkillUI();  //初始化心法界面
        }
        else
        {
            string des = string.Format("需要玩家等级达到{0}级才开放心法", lvLimit);
            TipsManager.Instance.ShowTips(des);
        }
    }
Exemple #20
0
    public void Refresh()
    {
        IsCDing = false;

        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer == null)
        {
            return;
        }
        //bool bRide = DataManager.Manager<RideManager>().IsRide;
        //if (bRide)
        //{
        //    //SetRideSkills();
        //}
        //else
        {
            SetPlayerSkills();
        }
        SetCommonSkill();
    }
Exemple #21
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);
        }
Exemple #22
0
    //-------------------------------------------------------------------------------------------------------
    public bool Create(Client.IPlayer player, int nSize, GameObject parentObj, Client.SkillSettingState eState = Client.SkillSettingState.StateOne)
    {
        if (player == null)
        {
            return(false);
        }

        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            Engine.Utility.Log.Error("获取RenderSystem失败!");
            return(false);
        }

        // 对象创建
        if (m_Root == null)
        {
            m_Root = new GameObject("RTObj");
            if (parentObj != null)
            {
                m_Root.transform.parent = parentObj.transform;
            }
        }

        //
        m_RenderObj = null;

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

        List <GameCmd.SuitData> lstSuit = null;

        player.GetSuit(out lstSuit);

        return(Create(lstSuit, player.GetProp((int)PlayerProp.Job), player.GetProp((int)PlayerProp.Sex), nSize, parentObj, eState));
    }
Exemple #23
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);
    }
Exemple #24
0
    //-------------------------------------------------------------------------------------------------------
    public void Clear()
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        Dictionary <int, IEntity> .Enumerator iter = m_dicEntity.GetEnumerator();
        while (iter.MoveNext())
        {
            if (iter.Current.Value != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = iter.Current.Value.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(iter.Current.Value);
            }
        }

        Dictionary <int, IPuppet> .Enumerator itPuppet = m_dicPuppet.GetEnumerator();
        while (itPuppet.MoveNext())
        {
            if (itPuppet.Current.Value != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = itPuppet.Current.Value.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(itPuppet.Current.Value);
            }
        }
        Client.IPlayer player = ClientGlobal.Instance().MainPlayer;
        if (player != null)
        {
            CameraFollow.Instance.target = player;
        }
    }
Exemple #25
0
    // 离开场景
    public void Leave()
    {
        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            return;
        }

        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            mainPlayer.SendMessage(EntityMessage.EntityCommand_SetVisible, false);
            cs.GetActiveCtrl().SetHost(mainPlayer);
            mainPlayer.SendMessage(EntityMessage.EntityCommand_SetVisible, true);
        }

        cs.GetActiveCtrl().SetClickSink(null);

        m_AnimalManager.Clear();
        HomeSceneUIRoot.Instance.ReleaseUI();
        Clear();
    }
Exemple #26
0
    //public void AddSkillCD(uint skillid)
    //{
    //    if (m_dictskill == null)
    //    {
    //        Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer;
    //        Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
    //        m_dictskill = m_skillPart.GetCurSkills();
    //    }
    //    table.SkillDatabase skillTable = null;
    //    if (m_dictskill.ContainsKey(skillid))
    //    {
    //        skillTable =  m_dictskill[skillid];
    //    }
    //    if (skillTable == null)
    //    {
    //        skillTable = GameTableManager.Instance.GetTableItem<table.SkillDatabase>(skillid);
    //    }

    //    if (skillTable != null)
    //    {
    //        if (!m_dictSkillCD.ContainsKey(skillid))
    //        {
    //            m_dictSkillCD.Add(skillid, new SkillCDInfo());
    //            cdkeys.Add(skillid);
    //        }
    //        m_dictSkillCD[skillid].totalTime = skillTable.dwIntervalTime;
    //        m_dictSkillCD[skillid].skillid = (int)skillid;
    //        m_dictSkillCD[skillid].currTime = skillTable.dwIntervalTime;
    //    }
    //    else
    //    {
    //        table.RideSkillDes rideskill = GameTableManager.Instance.GetTableItem<table.RideSkillDes>(skillid);
    //        if (rideskill == null)
    //        {
    //            return;
    //        }
    //        if (!m_dictSkillCD.ContainsKey(skillid))
    //        {
    //            m_dictSkillCD.Add(skillid, new SkillCDInfo());
    //            cdkeys.Add(skillid);
    //        }
    //        m_dictSkillCD[skillid].totalTime = rideskill.skillCD;
    //        m_dictSkillCD[skillid].skillid = (int)skillid;
    //        m_dictSkillCD[skillid].currTime = rideskill.skillCD;
    //    }
    //}

    public void AddCommonSkillCD(uint skillid)
    {
        if (m_dictskill == null)
        {
            Client.IPlayer    player      = Client.ClientGlobal.Instance().MainPlayer;
            Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            m_dictskill = m_skillPart.GetCurSkills();
        }
        table.SkillDatabase skillTable = null;
        if (m_dictskill.ContainsKey(skillid))
        {
            skillTable = m_dictskill[skillid];

            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            m_dictSkillCD[skillid].totalTime = skillTable.dwCommonCDTime;
            m_dictSkillCD[skillid].skillid   = (int)skillid;
            m_dictSkillCD[skillid].currTime  = skillTable.dwCommonCDTime;
        }
    }
Exemple #27
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);
        }
Exemple #28
0
    private static uint s_uSceneid = 15;  // 战斗场景id

    public void Enter()
    {
        IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }

        mapSys.EnterMap(s_uSceneid, Vector3.zero);

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            return;
        }

        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            mainPlayer.SendMessage(EntityMessage.EntityCommand_SetVisible, false);
        }
    }
Exemple #29
0
    /// <summary>
    /// 设置长按
    /// </summary>
    /// <param name="bSet">true是设置 false是清空</param>
    void SetLongPressEvent(bool bSet)
    {
        //暂时去除长按tips功能
        return;

        LongPress lp = this.gameObject.GetComponent <LongPress>();

        if (lp == null)
        {
            lp = this.gameObject.AddComponent <LongPress>();
        }
        if (bSet)
        {
            lp.InitLongPress(() =>
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.PlayerSkillTipsPanel, panelShowAction: (pb) =>
                {
                    if (null != pb && pb is PlayerSkillTipsPanel)
                    {
                        PlayerSkillTipsPanel panel = pb as PlayerSkillTipsPanel;
                        Client.IPlayer mainPlayer  = ClientGlobal.Instance().MainPlayer;
                        if (mainPlayer == null)
                        {
                            return;
                        }
                        panel.InitParentTransform(transform, new Vector2(m_nSprwidth, m_nSprheight));

                        //bool bRide = DataManager.Manager<RideManager>().IsRide;
                        //if (!bRide)
                        {
                            table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>((uint)m_skillid, 1);
                            if (db != null)
                            {
                                if (m_skillBtnIndex == 9)//宠物技能
                                {
                                    panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Pet, db);
                                }
                                else
                                {
                                    panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Player, db);
                                }
                            }
                        }
                        //else
                        //{
                        //    table.RideSkillDes rideSkill = GameTableManager.Instance.GetTableItem<table.RideSkillDes>((uint)m_skillid);
                        //    if (rideSkill != null)
                        //    {
                        //        panel.ShowUI(PlayerSkillTipsPanel.SkillTipsType.Ride, rideSkill);
                        //    }
                        //}
                    }
                });
            },
                             () =>
            {
                DataManager.Manager <UIPanelManager>().HidePanel(PanelID.PlayerSkillTipsPanel);
            }, 500);
        }
        else
        {
            lp.InitLongPress(null, null);
        }
    }
Exemple #30
0
    private void UseMedicine()
    {
        bool canRunning = Engine.Utility.EventEngine.Instance().DispatchVote((int)GameVoteEventID.AUTORECOVER, null);

        if (!canRunning)
        {
            Engine.Utility.Log.LogGroup("ZCX", "canRunning false");
            return;
        }

        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (mainPlayer == null || mainPlayer.IsDead())
        {
            Engine.Utility.Log.LogGroup("ZCX", "player dead");
            return;
        }
        Dictionary <AutoRecoverGrid.MedicalType, UseMedicalInfo> .Enumerator iter = m_dicMedical.GetEnumerator();
        while (iter.MoveNext())
        {
            UseMedicalInfo medical = iter.Current.Value;
            if (medical != null && medical.select)
            {
                AutoRecoverGrid.MedicalType mtype = medical.Type;
                float rate = 1f;
                if (AutoRecoverGrid.MedicalType.HpAtOnce == mtype)
                {//瞬药 单独处理
                    continue;
                }
                if (AutoRecoverGrid.MedicalType.Hp == mtype || (AutoRecoverGrid.MedicalType.HpAtOnce == mtype))
                {
                    rate = mainPlayer.GetProp((int)CreatureProp.Hp) * 1f / mainPlayer.GetProp((int)CreatureProp.MaxHp);
                }
                else if (AutoRecoverGrid.MedicalType.Mp == mtype)
                {
                    rate = mainPlayer.GetProp((int)CreatureProp.Mp) * 1f / mainPlayer.GetProp((int)CreatureProp.MaxMp);
                    // string log = string.Format("rate = {0} trigger = {1} mp = {2} max= {3}", rate, medical.triggerValue, mainPlayer.GetProp((int)CreatureProp.Mp), mainPlayer.GetProp((int)CreatureProp.MaxMp));
                    //UnityEngine.Debug.LogError(log);
                }
                else if (AutoRecoverGrid.MedicalType.PetHp == mtype)
                {
                    if (DataManager.Manager <PetDataManager>().CurFightingPet == 0)
                    {
                        continue;
                    }
                    Client.INPC pet = DataManager.Manager <PetDataManager>().GetNpcByPetID(DataManager.Manager <PetDataManager>().CurFightingPet);
                    if (pet != null)
                    {
                        int a = pet.GetProp((int)CreatureProp.Hp);
                        rate = pet.GetProp((int)CreatureProp.Hp) * 1f / pet.GetProp((int)CreatureProp.MaxHp);
                    }
                }

                if (rate < medical.triggerValue)
                {
                    uint itemid = medical.itemid;
                    if (AutoRecoverGrid.MedicalType.Hp == mtype)
                    {
                        if (UnityEngine.Time.realtimeSinceStartup - m_nhpsendTime < 5f)
                        {
                            continue;
                        }
                        itemid = GetUseItemId(mtype);
                    }
                    else if (AutoRecoverGrid.MedicalType.Mp == mtype)
                    {
                        if (UnityEngine.Time.realtimeSinceStartup - m_nmpsendTime < 5f)
                        {
                            continue;
                        }
                        itemid = GetUseItemId(mtype);
                    }
                    if (itemid != 0 && CanUse(itemid))
                    {
                        List <BaseItem> itemdataList = DataManager.Manager <ItemManager>().GetItemByBaseId(itemid);
                        if (itemdataList.Count > 0)
                        {
                            if (AutoRecoverGrid.MedicalType.PetHp == mtype)
                            {
                                uint petID = DataManager.Manager <PetDataManager>().GetNpcIDByPetID(DataManager.Manager <PetDataManager>().CurFightingPet);
                                DataManager.Instance.Sender.UseItem(
                                    petID,
                                    (uint)GameCmd.SceneEntryType.SceneEntry_NPC,
                                    itemdataList[0].QWThisID, 1);
                            }
                            else
                            {
                                DataManager.Instance.Sender.UseItem(
                                    mainPlayer.GetID(),
                                    (uint)GameCmd.SceneEntryType.SceneEntry_Player,
                                    itemdataList[0].QWThisID, 1);

                                if (AutoRecoverGrid.MedicalType.Hp == mtype)
                                {
                                    m_nhpsendTime = UnityEngine.Time.realtimeSinceStartup;
                                }
                                else if (AutoRecoverGrid.MedicalType.Mp == mtype)
                                {
                                    m_nmpsendTime = UnityEngine.Time.realtimeSinceStartup;
                                }
                            }

                            //                            if (UnityEngine.Application.isEditor)
                            //                           {
                            //                               UnityEngine.Debug.Log(string.Format("使用物品 {0}" , itemid));
                            //                          }
                        }
                    }
                }
            }
        }
    }