public override bool OnReceive(int subCode, object value) { switch (subCode) { case ReqEventType.invest_info: investInfos = value as InvestList; if (investInfos != null && investInfos.playerId == PlayerPrefs.GetString("playerId")) { investInfoResponse(investInfos); } else { investFriendInfoResponse(investInfos); } break; case ReqEventType.invest_req: Dictionary <string, object> investInfo = value as Dictionary <string, object>; investResponse(investInfo); break; case ReqEventType.Extract: Dictionary <string, object> extractInfo = value as Dictionary <string, object>; extractInfoResponse(extractInfo); break; default: break; } return(false); }
/// <summary> /// 好友投资信息 /// </summary> /// <param name="msg"></param> /// <returns></returns> private bool investFriendInfoResponse(InvestList msg) { if (msg == null) { return(false); } Dispatch(AreaCode.UI, UIEvent.THUMBUP_PANEL_ACTVATE, msg.investList.Count); return(true); }
/// <summary> /// 投资信息 /// </summary> /// <param name="msg"></param> /// <returns></returns> private bool investInfoResponse(InvestList msg) { if (msg == null) { return(false); } foreach (var itemInvestInfo in msg.investList) { if (!CacheData.Instance().InvestData.ContainsKey(itemInvestInfo.inType.ToString())) { CacheData.Instance().InvestData.Add(itemInvestInfo.inType.ToString(), itemInvestInfo); } } Dispatch(AreaCode.UI, UIEvent.SELECCTINVEST_PANEL_VIEW, null); Dispatch(AreaCode.UI, UIEvent.EARNINGS_PANEL_ACTVTE, null); return(true); }
protected internal override void Execute(int eventCode, object message) { switch (eventCode) { case UIEvent.THUMBUP_PANEL_ACTVATE: Dispatch(AreaCode.NET, UIEvent.LOADING_ACTIVE, true); setPanelActive(true); InvestList msg = message as InvestList; friendId = msg.playerId; foreach (var item in msg.investList) { int random = Random.Range(0, 7); if (!randomArray[random]) { randomArray[random] = true; GvieLikes[random].SetActive(true); } else { for (int i = randomArray.Length - 1; i >= 0; i--) { if (!randomArray[i]) { GvieLikes[random].SetActive(true); break; } } } } //置空 for (int i = 0; i < randomArray.Length; i++) { randomArray[i] = false; } break; default: break; } }
/// <summary> /// 处理回应远程请求,接受添加,不接受删除 /// </summary> /// <param name="message"></param> public void HandleMessage(ResRemoteAuscultateCode message) { //过期回应 if (message.Guid != this.Guid) { return; } Invoke(new MethodInvoker(() => { if (message.isAccept) { foreach (DataRow dr in InvestList.Select("dgvYCTZMAC='" + message.SrcMac + "'")) { List <object> list = new List <object>(); for (int i = 0; i < InvestList.Columns.Count; i++) { list.Add(dr[i]); } dgvRemote.Rows.Add(list.ToArray()); } } Mediator.ShowMsg(message.Comment); })); }