Beispiel #1
0
 private static void OnLocation(Message msg)
 {
     LocationEvent?.Invoke(new SystemMsgEventArgs()
     {
         msg = msg
     });
 }
Beispiel #2
0
        public void GetLocation(int gp)
        {
#if FULLLOG
            MoreDebug.Log(".");
#endif
            OnGetLocation.Invoke(gp);
#if FULLLOG
            if (NextLocation == null)
            {
                MoreDebug.Log("Next location is null.");
            }
            else
            {
                MoreDebug.Log(NextLocation.ToString());
            }
#endif
            // return NextLocation;
        }
Beispiel #3
0
 internal void InvokeLocationEvent(LocationEvent arg)
 {
     LocationEvent?.Invoke(this, arg);
 }
Beispiel #4
0
 public void GetData(string data)
 {
     lastResponse = JsonUtility.FromJson <NavigationApiResponse>(data);
     onDataChange?.Invoke(lastResponse);
     onLocationChange?.Invoke(lastResponse.data.location);
 }
Beispiel #5
0
 void RaiseLocationEvent()
 {
     LocationEvent?.Invoke(this, new LocationEventArgs(LocationType));
 }
Beispiel #6
0
        /// <summary>
        /// 初始化微信消息处理事件
        /// </summary>
        private void InitEventsHandle()
        {
            #region 普通消息
            //文本消息
            handlerList.Add(MessageType.Text, ReceiveEventType.None, (data) =>
            {
                ReceiveTextMessage?.Invoke(data.ConvertBodyTo <TextMessage>(), Replier.Create(data));
            });

            //图片消息
            handlerList.Add(MessageType.Image, ReceiveEventType.None, (data) =>
            {
                ReceiveImageMessage?.Invoke(data.ConvertBodyTo <ImageMessage>(), Replier.Create(data));
            });

            //语音消息
            handlerList.Add(MessageType.Voice, ReceiveEventType.None, (data) =>
            {
                ReceiveVoiceMessage?.Invoke(data.ConvertBodyTo <VoiceMessage>(), Replier.Create(data));
            });

            //视频消息
            handlerList.Add(MessageType.Video, ReceiveEventType.None, (data) =>
            {
                ReceiveVideoMessage?.Invoke(data.ConvertBodyTo <VideoMessage>(), Replier.Create(data));
            });

            //小视频消息
            handlerList.Add(MessageType.ShortVideo, ReceiveEventType.None, (data) =>
            {
                ReceiveShortVideoMessage?.Invoke(data.ConvertBodyTo <ShortVideoMessage>(), Replier.Create(data));
            });

            //地理位置消息
            handlerList.Add(MessageType.Location, ReceiveEventType.None, (data) =>
            {
                ReceiveLocationMessage?.Invoke(data.ConvertBodyTo <LocationMessage>(), Replier.Create(data));
            });

            //链接消息
            handlerList.Add(MessageType.Link, ReceiveEventType.None, (data) =>
            {
                ReceiveLinkMessage?.Invoke(data.ConvertBodyTo <LinkMessage>(), Replier.Create(data));
            });
            #endregion

            #region 事件消息
            //关注事件
            handlerList.Add(MessageType.Event, ReceiveEventType.Subscribe, (data) =>
            {
                var _event = data.ConvertBodyTo <ScanEventArgs>();
                if (string.IsNullOrEmpty(_event.EventKey))
                {
                    SubscribeEvent?.Invoke(_event, Replier.Create(data));
                }
                else
                {
                    _event.EventKey = _event.EventKey.Substring("qrscene_".Length);
                    ScanEvent?.Invoke(_event, Replier.Create(data));
                }
            });

            //取消关注事件
            handlerList.Add(MessageType.Event, ReceiveEventType.UnSubscribe, (data) =>
            {
                PassReply(data);
                UnSubscribeEvent?.Invoke(data.ConvertBodyTo <EventArgsBase>());
            });

            //扫描带参数二维码事件
            handlerList.Add(MessageType.Event, ReceiveEventType.Scan, (data) =>
            {
                ScanEvent?.Invoke(data.ConvertBodyTo <ScanEventArgs>(), Replier.Create(data));
            });

            //上报地理位置事件
            handlerList.Add(MessageType.Event, ReceiveEventType.Location, (data) =>
            {
                PassReply(data);
                LocationEvent?.Invoke(data.ConvertBodyTo <LocationEventArgs>());
            });

            //点击菜单拉取消息事件
            handlerList.Add(MessageType.Event, ReceiveEventType.Click, (data) =>
            {
                MenuClickEvent?.Invoke(data.ConvertBodyTo <WithKeyEventArgs>(), Replier.Create(data));
            });

            //点击菜单跳转链接事件
            handlerList.Add(MessageType.Event, ReceiveEventType.View, (data) =>
            {
                PassReply(data);
                ViewEvent?.Invoke(data.ConvertBodyTo <WithKeyEventArgs>());
            });

            //群发任务完成事件
            handlerList.Add(MessageType.Event, ReceiveEventType.MessageEndJobFinish, (data) =>
            {
                PassReply(data);
                MessageEndJobFinishEvent?.Invoke(data.ConvertBodyTo <MessageEndJobFinishEventArgs>());
            });

            //模板消息发送完成事件
            handlerList.Add(MessageType.Event, ReceiveEventType.TemplateSendJobFinish, (data) =>
            {
                PassReply(data);
                TemplateSendJobFinishEvent?.Invoke(data.ConvertBodyTo <TemplateSendJobFinishEventArgs>());
            });

            //买单事件推送
            handlerList.Add(MessageType.Event, ReceiveEventType.user_pay_from_pay_cell, (data) =>
            {
                PassReply(data);
                UserPayFromPayCellEvent?.Invoke(data.ConvertBodyTo <UserPayFromPayCellEventArgs>(), Replier.Create(data));
            });

            //卡券审核事件
            handlerList.Add(MessageType.Event, ReceiveEventType.card_pass_check, (data) =>
            {
                PassReply(data);
                CardPassCheckEvent?.Invoke(data.ConvertBodyTo <CardPassCheckEventArgs>(), Replier.Create(data));
            });

            //卡券领取事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_get_card, (data) =>
            {
                PassReply(data);
                UserGetCardEvent?.Invoke(data.ConvertBodyTo <UserGetCardEventArgs>(), Replier.Create(data));
            });

            //卡券转赠事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_gifting_card, (data) =>
            {
                PassReply(data);
                UserGiftingCardEvent?.Invoke(data.ConvertBodyTo <UserGiftingCardEventArgs>(), Replier.Create(data));
            });

            //卡券删除事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_del_card, (data) =>
            {
                PassReply(data);
                UserDelCardEvent?.Invoke(data.ConvertBodyTo <UserDelCardEventArgs>(), Replier.Create(data));
            });

            //卡券核销事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_consume_card, (data) =>
            {
                PassReply(data);
                UserConsumeCardEvent?.Invoke(data.ConvertBodyTo <UserConsumeCardEventArgs>(), Replier.Create(data));
            });

            //进入会员卡事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_view_card, (data) =>
            {
                PassReply(data);
                UserViewCardEvent?.Invoke(data.ConvertBodyTo <UserViewCardEventArgs>(), Replier.Create(data));
            });

            //从卡券进入公众号会话事件
            handlerList.Add(MessageType.Event, ReceiveEventType.user_enter_session_from_card, (data) =>
            {
                PassReply(data);
                UserEnterSessionFromCardEvent?.Invoke(data.ConvertBodyTo <UserEnterSessionFromCardEventArgs>(), Replier.Create(data));
            });

            //会员卡内容更新事件
            handlerList.Add(MessageType.Event, ReceiveEventType.update_member_card, (data) =>
            {
                PassReply(data);
                UpdateMemberCardEvent?.Invoke(data.ConvertBodyTo <UpdateMemberCardEventArgs>(), Replier.Create(data));
            });

            //会员卡激活事件推送
            handlerList.Add(MessageType.Event, ReceiveEventType.submit_membercard_user_info, (data) =>
            {
                PassReply(data);
                SubmitMemberCardUserInfoEvent?.Invoke(data.ConvertBodyTo <SubmitMemberCardUserInfoEventArgs>(), Replier.Create(data));
            });

            //库存报警事件
            handlerList.Add(MessageType.Event, ReceiveEventType.card_sku_remind, (data) =>
            {
                PassReply(data);
                CardSkuRemindEvent?.Invoke(data.ConvertBodyTo <CardSkuRemindEventArgs>(), Replier.Create(data));
            });

            //券点流水详情事件
            handlerList.Add(MessageType.Event, ReceiveEventType.card_pay_order, (data) =>
            {
                PassReply(data);
                CardPayOrderEvent?.Invoke(data.ConvertBodyTo <CardPayOrderEventArgs>(), Replier.Create(data));
            });

            #endregion
        }
Beispiel #7
0
 internal void InvokeLocationEvent(LocationEvent arg) => LocationEvent?.Invoke(null, arg);