Beispiel #1
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);
    }
Beispiel #2
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);
    }
Beispiel #3
0
    public static void GetListTableByGameID(short _gameId, short _indexBegin, short _numberTableGet, 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 (messageGetListTableByGameId == null)
        {
            messageGetListTableByGameId = new MessageSending(CMD_ONEHIT.Game_RoomTable_GetListTable_By_gameid);
        }
        else
        {
            messageGetListTableByGameId.ClearData();
        }

        messageGetListTableByGameId.writeshort(_gameId);
        messageGetListTableByGameId.writeshort(_indexBegin);
        messageGetListTableByGameId.writeshort(_numberTableGet);

                #if TEST
        string _tmp = string.Empty;
        _tmp += _gameId + "|" + _indexBegin + "|" + _numberTableGet;
        Debug.Log(">>>CMD GetListTableByGameID : " + messageGetListTableByGameId.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(messageGetListTableByGameId, _serverDetail, _onFinished);
    }
Beispiel #4
0
    public static void SendMessageJoinToTable(short _gameId, short _tableid, string _passwordTable = "")
    {
        if (messageJoinToTable == null)
        {
            messageJoinToTable = new MessageSending(CMD_REALTIME.C_TABLE_JOIN_TO_TABLE);
        }
        else
        {
            messageJoinToTable.ClearData();
        }

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

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

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

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

        NetworkGlobal.instance.SendMessageRealTime(messageJoinToTable);
    }
Beispiel #5
0
    public static void InviteFriend_SearchParentInfo(SubServerDetail _serverDetail, short _parentSessionId, 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 (messageInviteFriend_SearchParentInfo == null)
        {
            messageInviteFriend_SearchParentInfo = new MessageSending(CMD_ONEHIT.GameGlobal_GetMiniInfo_BySessionid);
        }
        else
        {
            messageInviteFriend_SearchParentInfo.ClearData();
        }
        messageInviteFriend_SearchParentInfo.writeshort(_parentSessionId);

                #if TEST
        string _tmp = _parentSessionId.ToString();
        Debug.Log(">>>CMD InviteFriend_SearchParentInfo : " + messageInviteFriend_SearchParentInfo.getCMD() + "|" + _tmp);
                #endif

        if (_serverDetail == null)
        {
            NetworkGlobal.instance.StartOnehit(messageInviteFriend_SearchParentInfo, _onFinished);
        }
        else
        {
            NetworkGlobal.instance.StartOnehit(messageInviteFriend_SearchParentInfo, _serverDetail, _onFinished);
        }
    }
Beispiel #6
0
    public static void SendMessageSetParent(short _parentSessionId)
    {
        if (messageSetParent == null)
        {
            messageSetParent = new MessageSending(CMD_REALTIME.C_GAMEPLAY_SET_PARENT);
        }
        else
        {
            messageSetParent.ClearData();
        }

        messageSetParent.writeshort(_parentSessionId);

                #if TEST
        string _tmp = string.Empty;
        _tmp += _parentSessionId;
        Debug.Log(">>>CMD SendMessageSetParent : " + messageSetParent.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.SendMessageRealTime(messageSetParent);
    }
Beispiel #7
0
    public static void GetSplashData_IOS(short _languageId, 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 (messageGetSplashData_IOS == null)
        {
            messageGetSplashData_IOS = new MessageSending(CMD_ONEHIT.SPLASH_IOS);
        }
        else
        {
            messageGetSplashData_IOS.ClearData();
        }

        messageGetSplashData_IOS.writeshort(_languageId);
        messageGetSplashData_IOS.writeString(_packageName);

                #if TEST
        string _tmp = string.Empty;
        _tmp += _languageId + "|" + _packageName;
        Debug.Log(">>>CMD GetSplashData_IOS : " + messageGetSplashData_IOS.getCMD() + "|" + _tmp);
                #endif
        NetworkGlobal.instance.StartOnehit(messageGetSplashData_IOS, _onFinished);
    }
Beispiel #8
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);
    }
Beispiel #9
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);
    }
    public void SendDATA(List <HeroInfomation> listhero, 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 (SetDataInfo == null)
        {
            SetDataInfo = new MessageSending(CMD_ONEHIT.TEST_SETUP_BOL);
        }
        else
        {
            SetDataInfo.ClearData();
        }
        Debug.Log("read " + listhero.Count);
        for (int i = 0; i < listhero.Count; i++)
        {
            SetDataInfo.writeshort(listhero[i].damgeAttack1);      //damge1
            SetDataInfo.writeshort(listhero[i].damgeAttack2);      //damge2
            SetDataInfo.writeshort(listhero[i].max_hp);            //maxHp
            SetDataInfo.writeshort(listhero[i].max_mana);          //maxMana
            SetDataInfo.writeshort(listhero[i].max_shield);        //maxShield
            SetDataInfo.writeshort(listhero[i].manaOfSkill1);      //manaofskill1
            SetDataInfo.writeshort(listhero[i].manaOfSkill2);      //manaofskill2
            SetDataInfo.writeshort(listhero[i].manaOfUltimate);    //manaofultimate
            SetDataInfo.writeshort(listhero[i].delayOfSkill1);     //delayskill1
            SetDataInfo.writeshort(listhero[i].delayOfSkill2);     //delayskill2
            SetDataInfo.writeshort(listhero[i].delayOfUltimate);   //delayultimate
            Debug.Log(
                listhero[i].damgeAttack1 + "|" +
                listhero[i].damgeAttack2 + "|" +
                listhero[i].max_hp + "|" +
                listhero[i].max_mana + "|" +
                listhero[i].max_shield + "|" +
                listhero[i].manaOfSkill1 + "|" +
                listhero[i].manaOfSkill2 + "|" +
                listhero[i].manaOfUltimate + "|" +
                listhero[i].delayOfSkill1 + "|" +
                listhero[i].delayOfSkill2 + "|" +
                listhero[i].delayOfUltimate
                );
        }
#if TEST
        Debug.Log(">>>CMD Register : " + SetDataInfo.getCMD());
        Debug.Log(Debugs.ColorString("Send Sucessfull", Color.red));
#endif
        NetworkGlobal.instance.StartOnehit(SetDataInfo, _onFinished);
    }