コード例 #1
0
ファイル: Player.cs プロジェクト: zuojiashun/src
        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="nPropID">属性ID</param>
        /// <param name="nValue">属性值</param>
        public override void SetProp(int nPropID, int nValue)
        {
            base.SetProp(nPropID, nValue);

            if (nPropID < (int)PlayerProp.Begin || nPropID >= (int)PlayerProp.End)
            {
                return;
            }
            if (nPropID == (int)PlayerProp.StateBit)
            {
                if ((nValue & (int)GameCmd.MainUserStateBit.MainUserStateBit_SkillPreRelive) == (int)GameCmd.MainUserStateBit.MainUserStateBit_SkillPreRelive)
                {
                    stSkillRelive relive = new stSkillRelive();
                    relive.id = GetID();
                    if (GetProp((int)PlayerProp.StateBit) != (int)GameCmd.MainUserStateBit.MainUserStateBit_SkillPreRelive)
                    {
                        Engine.Utility.EventEngine.Instance().DispatchEvent((int)(int)GameEventID.SKILL_RELIVE, relive);
                    }
                }
                else if ((nValue & (int)GameCmd.MainUserStateBit.MainUserStateBit_UnableMove) == (int)GameCmd.MainUserStateBit.MainUserStateBit_UnableMove)
                {
                    SendMessage(EntityMessage.EntityCommand_StopMove, GetPos());
                }
                else if ((nValue & (int)GameCmd.MainUserStateBit.MainUserStateBit_SerUnableMove) == (int)GameCmd.MainUserStateBit.MainUserStateBit_SerUnableMove)
                {
                    SendMessage(EntityMessage.EntityCommand_StopMove, GetPos());
                }
            }
            else if (nPropID == (int)PlayerProp.SkillStatus)
            {
                if (nValue != 0)
                {
                    int oldValue = GetProp((int)PlayerProp.SkillStatus);
                    if (oldValue != 0 && oldValue != nValue)
                    {
                        uint delay = GameTableManager.Instance.GetGlobalConfig <uint>("SkillChangeDelayTime");
                        TimerAxis.Instance().SetTimer(m_uChangePlayerModelTimer, delay, this, 1);
                    }
                }
            }
            m_PlayerProp[nPropID - (int)PlayerProp.Begin].Number = nValue;
        }
コード例 #2
0
ファイル: ReLiveDataManager.cs プロジェクト: zuojiashun/src
    void DoGameEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.ENTITYSYSTEM_RELIVE)
        {
            stEntityRelive stRelive = (stEntityRelive)param;
            if (ClientGlobal.Instance().IsMainPlayer(stRelive.uid))
            {
                PanelID panelId = UIFrameManager.Instance.CurrShowPanelID;
                DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel);
            }
        }
        else if (eventID == (int)GameEventID.SKILL_RELIVE)
        {
            stSkillRelive skillRe = (stSkillRelive)param;
            if (!ClientGlobal.Instance().IsMainPlayer(skillRe.id))
            {
                return;
            }

            //武斗场不使用技能复活
            if (DataManager.Manager <ArenaManager>().EnterArena)
            {
                return;
            }

            DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel);

            //如果人是活的
            if (false == Client.ClientGlobal.Instance().MainPlayer.IsDead())
            {
                return;
            }

            uint time = GameTableManager.Instance.GetGlobalConfig <uint>("ReliveCountdown");
            TipsManager.Instance.ShowTipWindow(0, time, TipWindowType.CancelOk, "是否复活", () =>
            {
                GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
                cmd.byType       = (uint)GameCmd.ReliveType.ReliveType_Skill;
                cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
                cmd.dwNpcID      = 0;
                NetService.Instance.Send(cmd);
            }, () =>
            {
                GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
                cmd.byType       = (uint)GameCmd.ReliveType.ReliveType_Home;
                cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
                cmd.dwNpcID      = 0;
                NetService.Instance.Send(cmd);
            });
        }
        else if (eventID == (int)GameEventID.RECONNECT_SUCESS)
        {
            stReconnectSucess reconnectSucess = (stReconnectSucess)param;
            if (reconnectSucess.isLogin)
            {
                MainPlayerRelive();
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ClientGlobal.Instance().IsMainPlayer(ed.uid))
            {
                this.m_deadTime = Time.realtimeSinceStartup;
            }
        }
    }