Exemplo n.º 1
0
    IEnumerator SendTxAsync()
    {
        var address = ConvertHexStringToByteArray(Address.text.ToLower());

        switch (Method.value)
        {
        case 0:
            var req1 = new BalanceOfRequest(address);
            yield return(req1.BalanceOf(ConvertHexStringToByteArray(Arg1.text.ToLower())));

            ProcessResult(req1);
            break;

        case 1:
            var req2 = new TransferRequest(address);
            yield return(req2.Transfer(ConvertHexStringToByteArray(Arg1.text.ToLower()), int.Parse(Arg2.text)));

            ProcessResult(req2);
            break;

        case 2:
            var req3 = new EmitRequest(address);
            yield return(req3.Emit(ConvertHexStringToByteArray(Arg1.text.ToLower()), int.Parse(Arg2.text)));

            ProcessResult(req3);
            break;

        default:
            Log.text += "\n";
            Log.text += "Wrong method!";
            break;
        }
    }
 public void RequestEmitBullet(Vector2 spawnPosition, Quaternion rotation)
 {
     if (_freeEmitRequests.Count > 0)
     {
         var cachedRequest = _freeEmitRequests.Pop();
         cachedRequest.SpawnPosition = spawnPosition;
         cachedRequest.Rotation      = rotation;
         _currentEmitRequests.Enqueue(cachedRequest);
     }
     else
     {
         var newRequest = new EmitRequest()
         {
             SpawnPosition = spawnPosition,
             Rotation      = rotation,
         };
         _currentEmitRequests.Enqueue(newRequest);
     }
 }