Exemplo n.º 1
0
    /// <summary>
    /// 点击事件
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    /// <param name="param"></param>
    private void OnReliveGridEventDlg(UIEventType eventType, object data, object param)
    {
        if (eventType == UIEventType.Click)
        {
            UIReliveGrid grid = data as UIReliveGrid;
            if (grid == null)
            {
                return;
            }

            if (grid.m_info.reliveId == 1)
            {
                IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();
                if (mapSys == null)
                {
                    return;
                }
                uint uCurMapID = mapSys.GetMapID();

                table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(uCurMapID);
                if (mapDB == null)
                {
                    return;
                }

                uint rebackMapID = mapDB.rebackMapID;

                if (!KHttpDown.Instance().SceneFileExists(rebackMapID))
                {
                    // 复活点复活
                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                    HideSelf();
                    return;
                }
            }


            GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
            cmd.byType       = grid.m_info.reliveId;
            cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
            cmd.dwNpcID      = 0;
            NetService.Instance.Send(cmd);
        }
    }
Exemplo n.º 2
0
    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;
            }
        }
    }