private IEnumerator submitTaskIEnumerator() { if (!Input.location.isEnabledByUser) { Debug.Log("位置服务不可用"); yield break; } Input.location.Start(); int maxWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { yield return(new WaitForSeconds(1)); maxWait--; } // 服务初始化超时 if (maxWait < 1) { Debug.Log("服务初始化超时"); yield break; } // 连接失败 if (Input.location.status == LocationServiceStatus.Failed) { Debug.Log("无法确定设备位置"); yield break; } latitude = Input.location.lastData.latitude.ToString(); longitude = Input.location.lastData.longitude.ToString(); Input.location.Stop(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Cookie", PlayerPrefs.GetString("COOKIE")); string data = "latitude=" + latitude + "&longitude=" + longitude + "&_tokenpasswd=" + PlayerPrefs.GetString("_tokenpasswd"); byte[] bs = System.Text.UTF8Encoding.UTF8.GetBytes(data); WWW www = new WWW(ip + submitMethod, bs, headers); yield return(www); if (wwwError(www)) { MethodMessage methodMessage = LitJson.JsonMapper.ToObject <MethodMessage>(www.text); if (methodMessage.status != "200") { Debug.Log(methodMessage.status); yield return(methodMessage.status); } else { TaskText1.text = methodMessage.message; } } }
/// <summary> /// 建立消息 /// </summary> /// <param name="messageID"></param> /// <returns></returns> public override Message Create(int messageID) { if (!Enum.IsDefined(typeof(RemotingMessageType), messageID)) return null; RemotingMessageType rmt = (RemotingMessageType)messageID; RemotingMessage message = null; switch (rmt) { case RemotingMessageType.Method: message = new MethodMessage(); break; case RemotingMessageType.Entity: message = new EntityMessage(); break; default: break; } return message; }
public void ReceiveMessage(MethodMessage message, MessageHandle handle) { messageCallback(new AddressedMessage(connectionId, message), handle).Ignore(); }
public async Task AcceptMessageAsync(MethodMessage message, GrainCancellationToken cancellationToken) { var handle = await rewoundMessagesGrain.PushMessageAsync(message); observers.Notify(x => x.ReceiveMessage(message, handle)); }
void ProcessMethod(MethodMessage message, Stream stream) { }