示例#1
0
        public bool UpdateItemState(GameItem gameItem, Profile profile)
        {
            ERC721GameItemMockContract contract = (ERC721GameItemMockContract)BCComm.GetGameItemContract(gameItem.Game, ItemContracts[gameItem.Symbol].Address, typeof(ERC721GameItemMockContract));

            if (contract != null)
            {
                contract.SetTokenState(((ERC721GameItemContract.Metadata)gameItem.Metadata).ItemId, gameItem.State, profile).Wait();
                return(true);
            }
            return(false);
        }
        private async Task <GameItemContract> GetGameItemContractByInterface(string contractAddress)
        {
            SupportsInterfaceWithLookupContract interfaceContract = (SupportsInterfaceWithLookupContract)BCComm.GetContract(typeof(SupportsInterfaceWithLookupContract), contractAddress);

            ContractInterfaceID currentInterfaceId = null;

            if (await interfaceContract.SupportsInterface(supportsInterfaceWithLookup.InterfaceID))
            {
                foreach (ContractInterfaceID interfaceId in interfaceIDs)
                {
                    if (await interfaceContract.SupportsInterface(interfaceId.InterfaceID))
                    {
                        currentInterfaceId = interfaceId;
                    }
                }
            }

            if (currentInterfaceId != null)
            {
                return(BCComm.GetGameItemContract(Game, contractAddress, currentInterfaceId.ContractType));
            }

            return(null);
        }