Example #1
0
    private async void OnReadyMatchButtonClick(GameEntity entity)
    {
        var readyMatch = new CSReadyMatch
        {
            ready = true
        };
        var strReadyMatch = Utilities.ToJson(readyMatch);
        var rpcPayload    = await _context.networkService.instance.RpcCall("rpc_ready_match", strReadyMatch);

        if (rpcPayload == null)
        {
            return;
        }

        foreach (var e in _context.GetEntitiesWithName("WaitOtherPlayerReady"))
        {
            e.ReplaceActive(true);
        }
        foreach (var e in _context.GetEntitiesWithName("ReadyMatchButton"))
        {
            e.ReplaceActive(false);
        }
        foreach (var e in _context.GetEntitiesWithName("CancelMatchButton"))
        {
            e.ReplaceActive(false);
        }
    }
Example #2
0
 private async void OnCancelMatchButtonClick(GameEntity entity)
 {
     var readyMatch = new CSReadyMatch
     {
         ready = false
     };
     var strReadyMatch = Utilities.ToJson(readyMatch);
     await _context.networkService.instance.RpcCall("rpc_ready_match", strReadyMatch);
 }
    private async void LeaveMatch()
    {
        var readyMatch = new CSReadyMatch
        {
            ready = false
        };
        var strReadyMatch = Utilities.ToJson(readyMatch);
        var rpcPayload    = await _context.networkService.instance.RpcCall("rpc_ready_match", strReadyMatch);

        if (rpcPayload == null)
        {
            return;
        }

        foreach (var e in _context.GetEntitiesWithName("SearchBattleWindow"))
        {
            e.isUiClose = true;
        }

        _context.isGameMatched     = false;
        _context.isSearchingBattle = false;
        _context.isAllPlayerJoined = false;
        _context.RemoveCurrentMatchData();
    }