private void step2FindStorables() { NuggetaQuery nuggetaQuery = new NuggetaQuery(); nuggetaQuery.setDomain(nameSpace); nuggetaQuery.setQuery("$WHERE content $LIKE '%RawMessage%' "); sampleIO.log("Step 2 : Find Storables "); gameApi.findStorablesRequest(nuggetaQuery, (FindStorablesResponse response)=> { if (response.getFindStorablesStatus() == FindStorablesStatus.SUCCESS) { List<Storable> storables = response.getStorables(); if (storables.Count != 0) { sampleIO.log("Step 2 : Find Storables successfull : found " + storables.Count + " storables\r\n"); storable = ((NRawMessage) storables[0]); step3SaveStorable(); } else { sampleIO.log("Step 2 :Error Find Storables return no result \r\n"); onExit(); } } else { sampleIO.log("Step 2 : Fail to Find Storables\r\n"); onExit(); } }); }
private void step1SaveStorable() { storable = new NRawMessage(); storable.setContent("this is the RawMessage content"); sampleIO.log("Step 1 : Saving Storable "); gameApi.saveStorableRequest(storable, nameSpace, (SaveStorableResponse response)=> { if (response.getSaveStorableStatus() == SaveStorableStatus.SUCCESS) { sampleIO.log("Step 1 : Save storable successfull\r\n"); step2FindStorables(); } else { sampleIO.log("Step 1 : Fail to update storable\r\n"); onExit(); } }); }
private void invite() { NInvitation invitation = new NInvitation(); NRawMessage nRawMessage = new NRawMessage(); nRawMessage.setContent("Invitation message of choice"); invitation.setContent(nRawMessage); gameApi.invitePlayerRequest("player id to invite", invitation, (InvitePlayerResponse invitePlayerResponse)=> { InvitePlayerStatus invitePlayerStatus = invitePlayerResponse.getInvitePlayerStatus(); if (invitePlayerStatus == InvitePlayerStatus.SUCCESS) { sampleIO.log("Invitation sent"); } else { sampleIO.log("Invitation failed" + invitePlayerStatus.ToString()); } }); }