public void MergeCards() { Debug.Log("Merge Begin"); // Create Card1 Card card1 = CreateCard("card1", "CrazyKnight"); // Create Card2 Card card2 = CreateCard("card2", "FloppyInfantry"); object[] paras = new object[3]; paras[0] = card1.id; paras[1] = card2.id; paras[2] = "SharpArchery"; NuTP.Response response = NuContract.InvokeWithResp("", "cardMerge", paras); if (response.header.code == NuTP.Code.Success) { Card cardNew = Contract.Bytes2Card(response.body); Debug.Log("New card's ID:\t" + cardNew.id); Debug.Log("New card's name:\t" + cardNew.name); Debug.Log("New card's birthBlock:\t" + cardNew.birthBlock); } else { Debug.Log("failed to merge card"); } }
private Card CreateCard(string id, string cardName) { object[] paras = new object[3]; paras[0] = myID; paras[1] = Op.String2Bytes(id); paras[2] = cardName; NuTP.Response response = NuContract.InvokeWithResp("", "randomCard", paras); if (response.header.code == NuTP.Code.Success) { return(Contract.Bytes2Card(response.body)); } else { Debug.LogError(response.header.code + ":" + response.header.description); paras = new object[1]; paras[0] = Op.String2Bytes(id); NuTP.Response respGetCard = NuContract.InvokeWithResp("", "getCard", paras); if (respGetCard.header.code == NuTP.Code.Success) { return(Contract.Bytes2Card(respGetCard.body)); } else { return(null); } } }