Example #1
0
    bool HandleGameNetMsg(uint _msgType, UMessage _ms)
    {
        if (GameMain.hall_.m_Bulletin == null)
        {
            return(false);
        }

        GameCity.EMSG_ENUM eMsg = (GameCity.EMSG_ENUM)_msgType;
        switch (eMsg)
        {
        case GameCity.EMSG_ENUM.CrazyCityMsg_BACKANNOUNCEMENTDATA:
        {
            ResetAnnouncement();
            NeedUpdate = false;

            AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);
            if (bundle == null)
            {
                return(false);
            }

            byte num = _ms.ReadByte();
            for (int i = 0; i < num; i++)
            {
                string name = _ms.ReadString();
                string url  = _ms.ReadString();
                AddPage(bundle, name, PageType.ePT_Activity, url);
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_ANNOUNCEMENTNEEDUPDATE:
        {
            NeedUpdate = true;
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_BACKWEEKOROLDREWORD:
        {
            byte sign    = _ms.ReadByte();     //1:签到或累计登陆 2:老用户
            long coin    = _ms.ReadLong();
            long addCoin = _ms.ReadLong();

            byte state1  = _ms.ReadByte();       //0:成功 1:已领取
            byte reward1 = _ms.ReadByte();

            if (sign == 1)
            {
                m_SignBtn.interactable = (state1 != 0);
                m_SignToggle.transform.Find("ImageSpot").
                gameObject.SetActive(m_SignBtn.interactable);
                GameMain.hall_.GetPlayerData().NeedSign = state1;
                if (state1 == 0)
                {
                    NeedClick--;
                }
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SendContestData:    //发送玩家创建比赛数据
        case GameCity.EMSG_ENUM.CrazyCityMsg_UpdateContestData:
        {
            byte        ContestNumber = 1; //比赛数量
            List <long> ContestIDList = null;
            if (eMsg == GameCity.EMSG_ENUM.CrazyCityMsg_SendContestData)
            {
                ContestNumber = _ms.ReadByte();
                ContestIDList = new List <long>();
            }

            for (byte index = 0; index < ContestNumber; ++index)
            {
                long ConstestID       = _ms.ReadLong(); //排行榜ID
                uint ContestPlayerNum = _ms.ReadUInt(); //比赛人数
                byte GameId           = _ms.ReadByte(); //游戏ID
                byte ReadState        = _ms.ReadByte(); //当前记录是否读取
                if (ContestIDList != null)
                {
                    ContestIDList.Add(ConstestID);
                }
                AddGameRankingPage(ConstestID, GameId, ReadState == 1, ContestPlayerNum);
            }
            if (ContestIDList != null)
            {
                CGameContestRankingTifings.GetChessRankingInstance().LoadContestRankingData(ContestIDList);
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SendContestRankData:
        {
            bool retValue = CGameContestRankingTifings.GetChessRankingInstance().UpdateGameRankingData(_ms);
            if (retValue && m_CurContestRankingToggle != null)
            {
                GameObject SpotObject = m_CurContestRankingToggle.transform.Find("ImageSpot").gameObject;
                if (SpotObject.activeSelf)
                {
                    NeedClick--;
                    SpotObject.SetActive(false);
                }
            }
        }
        break;

        default:
            break;
        }

        return(true);
    }
Example #2
0
    bool HandleGameNetMsg(uint _msgType, UMessage _ms)
    {
        if (m_nDeskNum == 0)
        {
            return(false);
        }

        GameCity.EMSG_ENUM eMsg = (GameCity.EMSG_ENUM)_msgType;
        switch (eMsg)
        {
        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATEENTERROOMANDSITTOREADYALL:
        {
            byte   sit    = _ms.ReadByte();
            uint   userId = _ms.ReadUInt();
            int    faceId = _ms.ReadInt();
            string url    = _ms.ReadString();
            string name   = _ms.ReadString();
            ushort desk   = _ms.ReaduShort();
            m_dictIndexDesks[desk].ShowPlayer(sit, true, name, url, userId, faceId);
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_APPLYLEAVEROOMANDSIT:
        {
            sbyte state = _ms.ReadSByte();
            if (state == 0)
            {
                long diamond = _ms.ReadLong();
                OnEnd(diamond);
            }
            else
            {
                CCustomDialog.CloseCustomWaitUI();
                CCustomDialog.OpenCustomConfirmUI(2206);
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATELEAVEROOMANDSIT:
        {
            byte   sit    = _ms.ReadByte();
            uint   userId = _ms.ReadUInt();
            string name   = _ms.ReadString();
            if (sit < m_ChairList.Count)
            {
                m_ChairList[sit].Show(false);
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATELEAVEROOMANDSITTOREADYALL:
        {
            byte sit    = _ms.ReadByte();
            uint deskId = _ms.ReadByte();
            m_dictIndexDesks[deskId].ShowPlayer(sit, false);
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_APPLYREADY:
        {
            byte state = _ms.ReadByte();
            if (state == 0)
            {
                byte sit = _ms.ReadByte();
                if (sit < m_ChairList.Count)
                {
                    m_ChairList[sit].SetReady(true);
                }
                ShowKickTip(false);
            }
            else
            {
                TableTfm.Find("bottom/Button_Ready").GetComponent <Button>().interactable = true;
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_UPDATEAPPLYREADY:
        {
            byte sit = _ms.ReadByte();
            if (sit < m_ChairList.Count)
            {
                m_ChairList[sit].SetReady(true);
            }
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_SM_KICKOUTROOM:
        {
            byte state  = _ms.ReadByte();       //1 长时间不点准备 2 不够入场钱  3 不够台费
            uint tipsID = 2601;
            switch (state)
            {
            case 1:
                tipsID = 1647;
                break;

            case 2:
                tipsID = 1652;
                break;

            case 3:
                tipsID = 1664;
                break;
            }

            CCustomDialog.CloseCustomWaitUI();
            CCustomDialog.OpenCustomConfirmUI(tipsID, (obj) => { OnEnd(); });
        }
        break;

        case GameCity.EMSG_ENUM.CrazyCityMsg_UPDATERECHARGETOROOMSER:
        {
            uint userId  = _ms.ReadUInt();
            uint diamond = _ms.ReadUInt();
            UpdateDiamond(diamond);
        }
        break;

        default:
            break;
        }

        return(true);
    }