private MoveResult CreateSwapResult(SwapData swapData) { var movesData = new MoveElementData[] { new MoveElementData(swapData.First, swapData.Second), new MoveElementData(swapData.Second, swapData.First), }; return(new MoveResult(movesData)); }
public async Task <OnchainResponse> SwapAsyncTransaction(SwapData data) { var request = new SwapRequest(data.TransactionId, data.Multisig1, (decimal)data.Amount1, data.AssetId1, data.Multisig2, (decimal)data.Amount2, data.AssetId2); var response = await _apiClient.ApiEnqueueTransactionSwapPostAsync(request); return(PrepareOnchainResult(response)); }
private void ToggleCameraType(SwapData swapData) { if (swapData.isFollowCam == false) { swapData.topDownCamera.gameObject.SetActive(true); swapData.followCamera.gameObject.SetActive(false); } else { swapData.topDownCamera.gameObject.SetActive(false); swapData.followCamera.gameObject.SetActive(true); } }
private byte[] StoreCache(string fileName, long offset) { using (var bw = new BinaryReader(File.Open(fileName, FileMode.Open))) { bw.BaseStream.Seek(offset, SeekOrigin.Begin); var sd = new SwapData(); sd.HotCount = 0; sd.Office = offset; sd.FileName = fileName; sd.Data = bw.ReadBytes(sd.BlockSize); _swapData.Add(sd); return sd.Data; } }
public List <MoveResult> SwapElements(SwapData swapData) { if (!IsValidCoordinate(swapData.First) || !IsValidCoordinate(swapData.Second) || !AreCoordinateNeighbours(swapData.First, swapData.Second)) { return(null); } board.SwapFields(swapData.First, swapData.Second); var matches = board.GetMatches(minimalElementsCountMatch); if (matches.Count == 0) { board.SwapFields(swapData.First, swapData.Second); return(null); } var moveResults = new List <MoveResult> { CreateSwapResult(swapData) }; while (matches.Count != 0) { var movedByGravityElements = board.RemoveBlocks(matches); var emptyFields = board.GetEmptyFields(); var spawnedBlocks = new List <Block>(); foreach (var field in emptyFields) { var blockData = GetNewBlockData(); board[field] = blockData; spawnedBlocks.Add(new Block(field, blockData)); } moveResults.Add(CreateMatchDestroyResult(movedByGravityElements, matches, spawnedBlocks)); matches = board.GetMatches(minimalElementsCountMatch); } return(moveResults); }
private async Task ProcessSwapAsync(SwapCommand cmd) { var request = new SwapData { Amount1 = cmd.Amount1, Amount2 = cmd.Amount2, AssetId1 = cmd.Asset1, AssetId2 = cmd.Asset2, Multisig1 = cmd.MultisigCustomer1, Multisig2 = cmd.MultisigCustomer2, TransactionId = cmd.TransactionId }; var response = await _bitcoinApiClient.SwapAsyncTransaction(request); var reqMsg = $"{BitCoinCommands.Swap}:{request.ToJson()}"; await ProcessBitcoinApiResponse(reqMsg, BitCoinCommands.Swap, response, null); }
public void App(string key, string v) { var tag = SafeTag(key); var fil = TagFile(tag); var SW = Map[tag]; if (SW == null) { if (File.Exists(fil)) { SW = new SwapData(QuickStream.LoadString(fil)); } else { SW = new SwapData(""); } Map[tag] = SW; } SW.App(v); Update(); }
public void OnBlockClicked(Element element) { if (null == selectedElement) { selectedElement = element; selectedElement.Select(); return; } if (selectedElement == element) { selectedElement.Deselect(); selectedElement = null; return; } var swapData = new SwapData(selectedElement.Coordinate, element.Coordinate); if (gameController.PerformSwap(swapData)) { selectedElement.Deselect(); selectedElement = null; } }
public string this[string key] { get { var tag = SafeTag(key); var fil = TagFile(tag); var SW = Map[tag]; MD(); if (SW == null) { if (!File.Exists(fil)) { return(""); } SW = new SwapData(QuickStream.LoadString(fil)); Map[tag] = SW; } Update(); return(SW.ToString()); } set { var tag = SafeTag(key); var fil = TagFile(tag); var SW = Map[tag]; MD(); if (SW == null) { Chat($"Creating new entry: {tag}"); Map[tag] = new SwapData(value, true); } else { Chat($"Rewrite existing entry: {tag}"); SW.Def(value); } Update(); } }
private void SetDataState(SwapData swapData, bool active) { swapData.cameraParent.SetActive(active); swapData.input.enabled = active; }