void AssetImplementer <AssetType> .ImplementAsset(AssetImplementParam param, SimpleProcessListener listener) { param.auInterface.referer.PickContent("", new PrvtContentColl { customzier = customizer, externalTaker = null, sourceRequest = param.assetRrequest, sourceAUInfo = param.auInterface.baseAssetInfo }); listener.OnFinish(true); }
void SimpleTrigger.Trigger(SimpleProcessListener simpleListener) { refListener.interfaceTaker = new PrvtAssetCollListener { interfaceTaker = refListener.interfaceTaker, simpleListener = simpleListener }; client.remoteAssetReferer.ReferAsset(assetUnitInfo, refListener); }
// Use this for initialization void AssetRequestPublisher.PublishAssetRequest(AssetRequest assetReq, SimpleProcessListener listener) { RequiredFuncs.ProcessHTTP( "https://api.taiga.io/api/v1/auth", (response) => { var auth = RequiredFuncs.FromJson <TaigaIOUserInfo>(response); var headerWithAuth = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Content-Type", "application/json"), new KeyValuePair <string, string>("Authorization", "Bearer " + auth.auth_token) }; RequiredFuncs.ProcessHTTP( "https://api.taiga.io/api/v1/userstories?project=" + projectID, (storiesJson) => { var stories = RequiredFuncs.FromJsonToArray <TaigaIOUserStory>(storiesJson); foreach (var reqUnit in assetReq.units) { if (reqUnit.attributes.Count == 0) { continue; } var storySubjForReq = "Asset Wanted: " + reqUnit.attributes[0] + " " + reqUnit.assettype; bool shouldPublishAssetReq = true; foreach (var story in stories) { if (story.subject == storySubjForReq) { shouldPublishAssetReq = false; break; } } if (shouldPublishAssetReq) { RequiredFuncs.ProcessHTTP( "https://api.taiga.io/api/v1/userstories", (addStoryResponseText) => { RequiredFuncs.Log(RequiredFuncs.ToJsonString(new TaigaIOUserStoryAdd { subject = storySubjForReq, project = projectID })); }, headerWithAuth, RequiredFuncs.ToJson(new TaigaIOUserStoryAdd { subject = storySubjForReq, project = projectID }) ); } } listener.OnFinish(true); }, headerWithAuth ); }, new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Content-Type", "application/json") }, RequiredFuncs.ToJson(new TaigaIOAuth { username = username, password = password, type = "normal" }) ); }
public void SendNCSRequest(SimpleProcessListener listener) { if (pendingNCSReq.units.Count == 0) { return; } var reqInJson = RequiredFuncs.ToJsonString(pendingNCSReq); pendingNCSReq = new NounCommonSenseRequest { units = new List <NounCommonSenseRequestUnit>() }; var copiedTakers = pendingNCSTakers; pendingNCSTakers = new Dictionary <string, List <Taker <NounCommonSenseUnit> > >(); var wwwForm = new WWWForm(); wwwForm.AddField("ncsReqInJson", reqInJson); Debug.Log("CommonSenseReq: " + reqInJson); UnityWebRequest www = UnityWebRequest.Post(serverURL + "GetNounCommonSense", wwwForm); NetworkUtil.ProcessWebRequest(www, (givenWebReq) => { if (www.error != null) { listener.OnFinish(false); return; } var ncs = RequiredFuncs.FromJson <StoredNounCommonSense>(www.downloadHandler.text); Debug.Log(www.downloadHandler.text); foreach (var ncsUnit in ncs.units) { foreach (var pair in copiedTakers) { if (pair.Key.Equals(ncsUnit.noun, StringComparison.CurrentCultureIgnoreCase)) { foreach (var collector in pair.Value) { cachedNCS.Add(ncsUnit); collector.Take(ncsUnit); } } else { foreach (var collector in pair.Value) { collector.None(); } } } } }); }