public void SetData(TrafficMessage data) { StartTime.text = data.StartTime; StartLocation.text = data.StartLocation; Time.text = data.Time; Number.text = data.Number; EndTime.text = data.EndTime; EndLocation.text = data.EndLocation; Money.text = "¥" + data.Money; id = data.id; Delay.gameObject.SetActive(data.isDelay); if (!data.buy) { Type.gameObject.SetActive(true); if (data.trafficType == TrafficType.Plane) { Type.sprite = SpriteManager.Instance.GetSprite(Sprites.ticket_airplane); } else { Type.sprite = SpriteManager.Instance.GetSprite(Sprites.ticket_train); } } else { Type.gameObject.SetActive(false); } btn.onClick.RemoveAllListeners(); btn.onClick.AddListener(Popup); }
public void Popup() { TrafficMessage tdata = m_Data as TrafficMessage; if (tdata.buy) { if (Convert.ToSingle(tdata.Money) <= UserTicketsModel.Instance.money) { if (TimeManager.instance.isTicketBuy(tdata.id)) { InfoView.Show(new InfoMessage("您已购买此行程,请勿重复购买", "提示!")); } else { GameObject go = PopUpManager.Instance.AddUiLayerPopUp(Prefabs.BuyTicketPopup); BuyTicketPopupView btpv = go.GetComponent <BuyTicketPopupView>(); btpv.traffic = m_Data as TrafficMessage; PopUpManager.Instance.SetPopupPanelAutoClose(go); } } else { InfoView.Show(new InfoMessage("您的余额不足,支付失败", "提示!")); } } else { GameObject go = PopUpManager.Instance.AddUiLayerPopUp(Prefabs.BuyTicketPopup); BuyTicketPopupView btpv = go.GetComponent <BuyTicketPopupView>(); btpv.traffic = m_Data as TrafficMessage; PopUpManager.Instance.SetPopupPanelAutoClose(go); } }
private IEnumerator DeleteTickets(int id) { MultiYield my = TicketsController.Instance.DeleteTickets(trafficMessage.id); yield return(my); if (my.result != null) { float money = Convert.ToSingle(trafficMessage.Money); MessageBus.Post(new UseMoney(money)); MessageBus.Post(new DeleteTicketsMsg()); string traffic = ""; string title = ""; if (trafficMessage.trafficType == TrafficType.Train) { traffic = "列车"; title = "12306铁路管家"; } else { traffic = "航班"; title = "航班公司"; } string content = "尊敬的旅客,您已成功退订" + trafficMessage.StartTime + "出发的" + trafficMessage.Number + traffic; MessageBus.Post(new MessageObject(new ItemMessage(title, content))); } Dispose(); }
protected override void UpdateView() { if (m_Data != null) { TrafficMessage tdata = m_Data as TrafficMessage; SetData(tdata); } base.UpdateView(); }
public void UpdateToNearestStreet(string location, TrafficMessage trafficMessage) { string url = string.Format("https://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=true&key={1}", location, GoogleApiKey); MakeCallAndGetJsonResponse(url, false, (string jsonString, string time) => { string channel = CreateAddress(jsonString); if (!string.IsNullOrWhiteSpace(channel)) { PostToChannel(channel, trafficMessage); } } ); Console.WriteLine(""); }
public void GetStreetAddress(string location, TrafficMessage trafficMessage) { Console.WriteLine("Validating location"); if (String.IsNullOrWhiteSpace(location)) { Console.WriteLine("Missing location"); AddressUpdate("", "", "", false, "", TrafficDialogViewController.GetLocationActions.None); } else { Console.WriteLine("Loading..."); StringBuilder sbUrl = new StringBuilder(); UpdateToNearestStreet(location, trafficMessage); } }
public void GetStreetAddress(string location, string nextStreet, TrafficMessage trafficMessage) { Console.WriteLine("Validating locations..."); if ((String.IsNullOrWhiteSpace(location)) || (String.IsNullOrWhiteSpace(nextStreet))) { Console.WriteLine("Missing location or next street"); } else { Console.WriteLine("Loading..."); StringBuilder sbUrl = new StringBuilder(); UpdateToNearestStreet(location, trafficMessage); UpdateToNearestStreet(nextStreet, trafficMessage); } }
private void SetData(TrafficMessage data) { StartTime.text = data.StartTime; StartLocation.text = data.StartLocation; Time.text = data.Time; Number.text = data.Number; EndTime.text = data.EndTime; EndLocation.text = data.EndLocation; if (data.buy) { Title.text = "购票"; yes.onClick.AddListener(BuyTickets); } else { Title.text = "退票"; yes.onClick.AddListener(DeleteTickets); } no.onClick.AddListener(Dispose); }
public void PublishMessage (string channel, TrafficMessage message) { pn.Publish (channel, message.ToString(), resultPublish => { Console.WriteLine (string.Format ("Message {0} to channel {1} published.", message, channel)); }, DisplayErrorMessage); }
public void UpdateToNearestStreet (string location, bool isOrigin, TrafficMessage trafficMessage){ Console.WriteLine ("Validating locations..."); string url = string.Format ("https://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=true&key={1}", location, GoogleApiKey); MakeCallAndGetJsonResponse (url, false, (string jsonString, string time) => { string channel = CreateAddress(jsonString); if(!string.IsNullOrWhiteSpace(channel)){ PostToChannel(channel, trafficMessage); } } ); Console.WriteLine (""); }
public void GetStreetAddress(string location, TrafficMessage trafficMessage){ Console.WriteLine ("Validating location"); if (String.IsNullOrWhiteSpace (location)) { Console.WriteLine ("Missing location"); AddressUpdate ("", "", "", false, "", TrafficDialogViewController.GetLocationActions.None); } else { Console.WriteLine ("Loading..."); StringBuilder sbUrl = new StringBuilder (); UpdateToNearestStreet (location, trafficMessage); } }
public void GetStreetAddress(string location, string nextStreet, TrafficMessage trafficMessage){ Console.WriteLine ("Validating locations..."); if ((String.IsNullOrWhiteSpace (location)) || (String.IsNullOrWhiteSpace (nextStreet))) { Console.WriteLine ("Missing location or next street"); } else { Console.WriteLine ("Loading..."); StringBuilder sbUrl = new StringBuilder (); UpdateToNearestStreet (location, trafficMessage); UpdateToNearestStreet (nextStreet, trafficMessage); } }
public void PublishMessage(string channel, TrafficMessage message) { pn.Publish(channel, message.ToString(), resultPublish => { Console.WriteLine(string.Format("Message {0} to channel {1} published.", message, channel)); }, DisplayErrorMessage); }