private void SimpleCallback(string callKey, string pluginResponse) { CallbackTuple callback = callbacks[callKey]; if (pluginResponse == null || pluginResponse.Equals("")) { string err = "ArbiterBinding Parse Error: Was expecting a non-null/non-empty string response from native plugin. Recieved:" + pluginResponse; Debug.LogError(err); callback.Failure(new List <string>() { err }); } else { JSONNode json = JSON.Parse(pluginResponse); if (wasSuccess(json)) { callback.Success(); } else { callback.Failure(getErrors(json)); callback.FriendlyFailure(getErrors(json), getDescriptions(json)); } } }
private static void SetSimpleCallback(string key, SuccessHandler callback) { if (callback == null) { callback = () => {} } ; callbacks[key] = new CallbackTuple(callback, (e) => {}, (e, d) => {}); }
public static void FetchWallet(SuccessHandler success, ErrorHandler failure) { callbacks[FETCH_WALLET] = new CallbackTuple(success, failure, (e, d) => {}); #if UNITY_EDITOR ReportIgnore("FetchWallet"); Arbiter.wallet = new Wallet(); Arbiter.wallet.Balance = "12345"; success(); #elif UNITY_IOS _fetchWallet(); #endif }
public void Unhook(IVisualElement elt, IClassMethod vmMethod) { if (m_Hook != null) { var key = new CallbackTuple(elt, vmMethod); Action callback; if (m_CallbackRegistered != null && m_CallbackRegistered.TryGetValue(key, out callback)) { m_Hook.Remove((TOwner)elt, callback); } } }
private static void SetCallbacksWithErrors(string key, SuccessHandler success, ErrorHandler failure) { if (success == null) { success = () => {} } ; if (failure == null) { failure = (e) => {} } ; callbacks[key] = new CallbackTuple(success, failure, (e, d) => {}); }
public void Hook(IVisualElement elt, IClassMethod vmMethod) { if (m_Hook != null) { var key = new CallbackTuple(elt, vmMethod); if (m_CallbackRegistered == null) { m_CallbackRegistered = new Dictionary <CallbackTuple, Action>(); } if (!m_CallbackRegistered.ContainsKey(key)) { var callback = GetCallbackFor(elt, vmMethod); m_CallbackRegistered[key] = callback; m_Hook.Add((TOwner)elt, callback); } } }