コード例 #1
0
    public void SetChoiceHeroAnhSpell(int hero, int spell)
    {
        MessageSending changecharacter = new MessageSending(CMD_REALTIME.C_XHCD_CHANGE_CHARACTER);

        changecharacter.writeByte((byte)hero);
        changecharacter.writeByte((byte)spell);
        NetworkGlobal.instance.SendMessageRealTime(changecharacter);
    }
コード例 #2
0
    public void CheatBai()
    {
        MessageSending _messageSending = new MessageSending(CMD_REALTIME.C_GAMEPLAY_ADMIN_CHEAT);

        for (int i = 0; i < cheatCard_Global.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Global[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_00.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_00[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_01.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_01[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_02.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_02[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_03.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_03[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_04.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_04[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_05.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_05[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_06.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_06[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_07.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_07[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }
        for (int i = 0; i < cheatCard_Player_08.Count; i++)
        {
            CardDetail _cardDetail = GetCardDetail(cheatCard_Player_08[i]);
            _messageSending.writeByte((byte)_cardDetail.cardId);
        }

        NetworkGlobal.instance.SendMessageRealTime(_messageSending);
    }
コード例 #3
0
    public static void IAP_Android(SubServerDetail _serverDetail, byte _screenPurchase, string _productId, string _tokenPurchase, System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (messageIAP_Android == null)
        {
            messageIAP_Android = new MessageSending(CMD_ONEHIT.GamePurchase_inapp_android);
        }
        else
        {
            messageIAP_Android.ClearData();
        }

        messageIAP_Android.writeByte((byte)DataManager.instance.userData.databaseId);
        messageIAP_Android.writeLong(DataManager.instance.userData.userId);
        messageIAP_Android.writeByte(_screenPurchase);
        messageIAP_Android.writeString(Application.identifier);
        messageIAP_Android.writeString(_productId);
        messageIAP_Android.writeString(_tokenPurchase);

                #if TEST
        string _tmp = DataManager.instance.userData.databaseId + "|"
                      + DataManager.instance.userData.userId + "|"
                      + _screenPurchase + "|"
                      + Application.identifier + "|"
                      + _productId + "|"
                      + _tokenPurchase;
        Debug.Log(">>>CMD IAP_Android : " + messageIAP_Android.getCMD() + "|" + _tmp);
                #endif

        if (_serverDetail == null)
        {
            NetworkGlobal.instance.StartOnehit(messageIAP_Android, _onFinished);
        }
        else
        {
            NetworkGlobal.instance.StartOnehit(messageIAP_Android, _serverDetail, _onFinished);
        }
    }
コード例 #4
0
    public void SendMessageAddBet(byte _indexBet, short _indexChip, long _goldAdd)
    {
        if (messageSendingAddBet == null)
        {
            messageSendingAddBet = new MessageSending(CMD_REALTIME.C_GAMEPLAY_ADDBET);
        }
        else
        {
            messageSendingAddBet.ClearData();
        }

        messageSendingAddBet.writeByte(_indexBet);
        messageSendingAddBet.writeshort(_indexChip);
        messageSendingAddBet.writeLong(_goldAdd);

        string _tmp = string.Empty;

        _tmp += _indexBet + "|" + _indexChip + "|" + _goldAdd;

                #if TEST
        Debug.Log(">>>CMD AddBet : " + messageSendingAddBet.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messageSendingAddBet);
    }
コード例 #5
0
    public static void ChooseAvatar(UserData.DatabaseType _databaseid, long _userid, sbyte _avatarId, System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (messageChooseAvatar == null)
        {
            messageChooseAvatar = new MessageSending(CMD_ONEHIT.Game_Change_Avatarid);
        }
        else
        {
            messageChooseAvatar.ClearData();
        }
        messageChooseAvatar.writeByte((byte)_databaseid);
        messageChooseAvatar.writeLong(_userid);
        messageChooseAvatar.writeByte((byte)_avatarId);
        string _tmp = _databaseid + "|" + _userid + "|" + _avatarId;

                #if TEST
        Debug.Log(">>>CMD ChooseAvatar : " + messageChooseAvatar.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(messageChooseAvatar, _onFinished);
    }
コード例 #6
0
    public static void GetUserDetail(sbyte _databaseid, long _userid, List <short> _listGameId, System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (messageGetUserDetail == null)
        {
            messageGetUserDetail = new MessageSending(CMD_ONEHIT.Game_Global_Get_BasePlayerInfo_And_FullAchievement_ByUserid);
        }
        else
        {
            messageGetUserDetail.ClearData();
        }
        string _tmp = string.Empty;

        messageGetUserDetail.writeByte((byte)_databaseid);
        messageGetUserDetail.writeLong(_userid);
        messageGetUserDetail.writeshort((short)_listGameId.Count);
        _tmp += _databaseid + "|" + _userid + "|" + _listGameId.Count + "|";
        for (int i = 0; i < _listGameId.Count; i++)
        {
            messageGetUserDetail.writeshort(_listGameId[i]);
            _tmp += _listGameId [i] + "_";
            if (i + 1 < _listGameId.Count)
            {
                _tmp += "_";
            }
        }

                #if TEST
        Debug.Log(">>>CMD GetUserDetail : " + messageGetUserDetail.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(messageGetUserDetail, _onFinished);
    }
コード例 #7
0
    public static void TESTIAP(SubServerDetail _serverDetail, System.Action <MessageReceiving, int> _onFinished)
    {
        // gửi sbyte databaseid
        // long userid
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (messageTestIAP_Android == null)
        {
            messageTestIAP_Android = new MessageSending(CMD_ONEHIT.TEST_ADD_GOLD);
        }
        else
        {
            messageTestIAP_Android.ClearData();
        }

        messageTestIAP_Android.writeByte((byte)DataManager.instance.userData.databaseId);
        messageTestIAP_Android.writeLong(DataManager.instance.userData.userId);

                #if TEST
        string _tmp = DataManager.instance.userData.databaseId + "|"
                      + DataManager.instance.userData.userId;
        Debug.Log(">>>CMD IAP_Android : " + messageTestIAP_Android.getCMD() + "|" + _tmp);
                #endif

        if (_serverDetail == null)
        {
            NetworkGlobal.instance.StartOnehit(messageTestIAP_Android, _onFinished);
        }
        else
        {
            NetworkGlobal.instance.StartOnehit(messageTestIAP_Android, _serverDetail, _onFinished);
        }
    }
コード例 #8
0
    public void Sitdown(byte positionChair)
    {
        if (Time.time >= timeDelay)
        {
            timeDelay = Time.time + timeBetween;
            MessageSending mgs = new MessageSending(CMD_REALTIME.C_GAMEPLAY_SITDOWN);
            mgs.writeByte(positionChair);
            NetworkGlobal.instance.SendMessageRealTime(mgs);
        }
        else
        {
#if TEST
            Debug.Log("chưa den lúc nhấn" + Time.time);
#endif
        }
    }
コード例 #9
0
    public static void GetGoldSubsidy(SubServerDetail _serverDetail, System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (messageGetGoldSubsidy == null)
        {
            messageGetGoldSubsidy = new MessageSending(CMD_ONEHIT.GameBonus_Get_Gold_Subsidy);
        }
        else
        {
            messageGetGoldSubsidy.ClearData();
        }
        messageGetGoldSubsidy.writeByte((byte)DataManager.instance.userData.databaseId);
        messageGetGoldSubsidy.writeLong(DataManager.instance.userData.userId);

                #if TEST
        string _tmp = DataManager.instance.userData.databaseId + "|" + DataManager.instance.userData.userId;
        Debug.Log(">>>CMD GetGoldSubsidy : " + messageGetGoldSubsidy.getCMD() + "|" + _tmp);
                #endif

        if (_serverDetail == null)
        {
            NetworkGlobal.instance.StartOnehit(messageGetGoldSubsidy, _onFinished);
        }
        else
        {
            NetworkGlobal.instance.StartOnehit(messageGetGoldSubsidy, _serverDetail, _onFinished);
        }
    }
コード例 #10
0
    public static void Forward_Bonus_AndroidInstall_Commit(string _packageName, System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (message_Forward_Bonus_AndroidInstall_Commit == null)
        {
            message_Forward_Bonus_AndroidInstall_Commit = new MessageSending(CMD_ONEHIT.GameMission_AndroidInstall_Commit);
        }
        else
        {
            message_Forward_Bonus_AndroidInstall_Commit.ClearData();
        }
        message_Forward_Bonus_AndroidInstall_Commit.writeByte((byte)DataManager.instance.userData.databaseId);
        message_Forward_Bonus_AndroidInstall_Commit.writeLong(DataManager.instance.userData.userId);
        message_Forward_Bonus_AndroidInstall_Commit.writeString(_packageName);

                #if TEST
        string _tmp = DataManager.instance.userData.databaseId + "|"
                      + DataManager.instance.userData.userId + "|"
                      + _packageName;
        Debug.Log(">>>CMD Forward_Bonus_AndroidInstall_Commit : " + message_Forward_Bonus_AndroidInstall_Commit.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(message_Forward_Bonus_AndroidInstall_Commit, _onFinished);
    }
コード例 #11
0
    public static void SendMessageCreatePassAndJoinTable(short _gameId, string _passwordTable)
    {
        if (messageCreatePassAndJoinTable == null)
        {
            messageCreatePassAndJoinTable = new MessageSending(CMD_REALTIME.C_TABLE_CREATE_PASSWORD_TABLE);
        }
        else
        {
            messageCreatePassAndJoinTable.ClearData();
        }

        messageCreatePassAndJoinTable.writeshort(_gameId);
        messageCreatePassAndJoinTable.writeString(_passwordTable);
        messageCreatePassAndJoinTable.writeByte((byte)DataManager.instance.userData.databaseId);
        messageCreatePassAndJoinTable.writeLong(DataManager.instance.userData.userId);

        switch (DataManager.instance.userData.databaseId)
        {
        case UserData.DatabaseType.DATABASEID_DEVICE:
            messageCreatePassAndJoinTable.writeString(DataManager.instance.userData.deviceId);
            messageCreatePassAndJoinTable.writeString(SystemInfo.deviceModel);
            break;

        case UserData.DatabaseType.DATABASEID_BIGXU:
            messageCreatePassAndJoinTable.writeString(DataManager.instance.userData.username);
            messageCreatePassAndJoinTable.writeString(DataManager.instance.userData.password);
            break;

        case UserData.DatabaseType.DATABASEID_FACEBOOK:
            messageCreatePassAndJoinTable.writeString(DataManager.instance.userData.tokenFBIdOfBusiness);
            break;
        }

                #if TEST
        string _tmp = string.Empty;
        _tmp += _gameId + "|" + "|" + _passwordTable;
        Debug.Log(">>>CMD CreatePassAndJoinTable : " + messageCreatePassAndJoinTable.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messageCreatePassAndJoinTable);
    }
コード例 #12
0
    public static void SendMessageCallBotUno(byte _numBot)
    {
        if (messageCallBotUno == null)
        {
            messageCallBotUno = new MessageSending(CMD_REALTIME.C_GAMEPLAY_INVITE_ROBOT);
        }
        else
        {
            messageCallBotUno.ClearData();
        }

        messageCallBotUno.writeByte(_numBot);

                #if TEST
        string _tmp = string.Empty;
        _tmp += _numBot;
        Debug.Log(">>>CMD SendMessageCallBotUno : " + messageCallBotUno.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messageCallBotUno);
    }
コード例 #13
0
    public void SendMessageSitDown(byte _indexChair)
    {
        if (messageSendingSitDown == null)
        {
            messageSendingSitDown = new MessageSending(CMD_REALTIME.C_GAMEPLAY_SITDOWN);
        }
        else
        {
            messageSendingSitDown.ClearData();
        }

        messageSendingSitDown.writeByte(_indexChair);

                #if TEST
        string _tmp = string.Empty;
        _tmp += _indexChair;
        Debug.Log(">>>CMD SitDown : " + messageSendingSitDown.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messageSendingSitDown);
    }
コード例 #14
0
    public static void SendMessagePlayNowMiniGame(short _gameId)
    {
        if (messagePlayNowMiniGame == null)
        {
            messagePlayNowMiniGame = new MessageSending(CMD_REALTIME.C_TABLE_JOIN_TO_MINIGAME_STATE);
        }
        else
        {
            messagePlayNowMiniGame.ClearData();
        }

        messagePlayNowMiniGame.writeshort(_gameId);
        messagePlayNowMiniGame.writeByte((byte)DataManager.instance.userData.databaseId);
        messagePlayNowMiniGame.writeLong(DataManager.instance.userData.userId);
        switch (DataManager.instance.userData.databaseId)
        {
        case UserData.DatabaseType.DATABASEID_DEVICE:
            messagePlayNowMiniGame.writeString(DataManager.instance.userData.deviceId);
            messagePlayNowMiniGame.writeString(SystemInfo.deviceModel);
            break;

        case UserData.DatabaseType.DATABASEID_BIGXU:
            messagePlayNowMiniGame.writeString(DataManager.instance.userData.username);
            messagePlayNowMiniGame.writeString(DataManager.instance.userData.password);
            break;

        case UserData.DatabaseType.DATABASEID_FACEBOOK:
            // messagePlayNowMiniGame.writeString (Facebook.Unity.AccessToken.CurrentAccessToken.TokenString);
            messagePlayNowMiniGame.writeString(DataManager.instance.userData.tokenFBIdOfBusiness);
            break;
        }

                #if TEST
        string _tmp = string.Empty;
        _tmp += _gameId;
        Debug.Log(">>>CMD PlayNowMiniGame : " + messagePlayNowMiniGame.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messagePlayNowMiniGame);
    }
コード例 #15
0
    public static void BetToWin(long _bet
                                , List <BetToWinValueDetail> _listBetToWinInfo
                                , List <long> _listBetToWinValue
                                , System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (message_BetToWin == null)
        {
            message_BetToWin = new MessageSending(CMD_ONEHIT.Game_BetToWin_NoAchievement);
        }
        else
        {
            message_BetToWin.ClearData();
        }
        message_BetToWin.writeLong(_bet);
        message_BetToWin.writeshort((short)_listBetToWinInfo.Count);
        for (int i = 0; i < _listBetToWinInfo.Count; i++)
        {
            message_BetToWin.writeInt(_listBetToWinInfo[i].weight);
            message_BetToWin.writeLong(_listBetToWinValue[i]);
        }
        message_BetToWin.writeByte((byte)DataManager.instance.userData.databaseId);
        message_BetToWin.writeLong(DataManager.instance.userData.userId);
        switch (DataManager.instance.userData.databaseId)
        {
        case UserData.DatabaseType.DATABASEID_DEVICE:
            message_BetToWin.writeString(DataManager.instance.userData.deviceId);
            // message_BetToWin.writeString (SystemInfo.deviceModel);
            break;

        case UserData.DatabaseType.DATABASEID_BIGXU:
            message_BetToWin.writeString(DataManager.instance.userData.username);
            message_BetToWin.writeString(DataManager.instance.userData.password);
            break;

        case UserData.DatabaseType.DATABASEID_FACEBOOK:
            message_BetToWin.writeString(DataManager.instance.userData.tokenFBIdOfBusiness);
            break;

        default:
                        #if TEST
            Debug.LogError(">>> Lỗi databaseId: " + DataManager.instance.userData.databaseId);
                        #endif
            break;
        }

                #if TEST
        string _tmp = _bet + "|"
                      + DataManager.instance.userData.databaseId + "|"
                      + DataManager.instance.userData.userId + "|";
        Debug.Log(">>>CMD BetToWin : " + message_BetToWin.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(message_BetToWin, _onFinished);
    }