protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as ChoosePhotoPanelData ?? new ChoosePhotoPanelData(); // please add init code here BtnCancel.onClick.AddListener(() => { Back(); }); BtnAlbum.onClick.AddListener(() => { SimpleEventSystem.Publish(new ChoosePhotoClick(mData.action, NativeAction.Album)); Back(); }); BtnCamera.onClick.AddListener(() => { SimpleEventSystem.Publish(new ChoosePhotoClick(mData.action, NativeAction.Camera)); Back(); }); if (mData.showTip) { TextTip.gameObject.SetActive(true); TextCamera.text = "拍摄"; } else { TextTip.gameObject.SetActive(false); TextCamera.text = "拍照"; } }
private void StartResquestForDelBabyAddress() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("inviteId", PlayerPrefsUtil.GetUserId()); paramDict.Add("inviteeMobile", InputMobile.text); paramDict.Add("inviteeBabyRelation", relation); HttpUtil.PostWithSign <int>(UrlConst.DoCheckInviteValid, paramDict) .Subscribe(response => { if (response == 1) { Dictionary <string, object> message = new Dictionary <string, object>(); message.Add("mobile", InputMobile.text); message.Add("content", "【环球少儿app】邀请你加入,快来跟我一起读绘本吧!"); NativeGallery.GetSomethingFromNative((json, action) => { }, (int)NativeAction.SendSMS, message.ToJson()); } CommonUtil.toast("邀请成功"); SimpleEventSystem.Publish(new UpdateBaseInfoDate(true)); Back(); } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as CollectGiftBoxPanelData ?? new CollectGiftBoxPanelData(); BtnCheck.onClick.AddListener(() => { SimpleEventSystem.Publish(new CollectGiftBoxPanelClosed(mData.Type)); Back(); }); if (mData.Type == CollectGiftBoxType.Exchange) { var texture2D = mResLoader.LoadSync <Texture2D>("text_exchange_succee"); ImgSuccess.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); var giftTexture2D = mResLoader.LoadSync <Texture2D>("text_baby_exclusive_gift"); ImgName.sprite = Sprite.Create(giftTexture2D, new Rect(0, 0, giftTexture2D.width, giftTexture2D.height), Vector2.one * 0.5f); } else if (mData.Type == CollectGiftBoxType.ChineseLearningPlan) { var texture2D = mResLoader.LoadSync <Texture2D>("text_received_succee"); ImgSuccess.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); var giftTexture2D = mResLoader.LoadSync <Texture2D>("text_chinese_learning_plan"); ImgName.sprite = Sprite.Create(giftTexture2D, new Rect(0, 0, giftTexture2D.width, giftTexture2D.height), Vector2.one * 0.5f); } else if (mData.Type == CollectGiftBoxType.EnglishLearningPlan) { var texture2D = mResLoader.LoadSync <Texture2D>("text_received_succee"); ImgSuccess.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); var giftTexture2D = mResLoader.LoadSync <Texture2D>("text_english_learning_plan"); ImgName.sprite = Sprite.Create(giftTexture2D, new Rect(0, 0, giftTexture2D.width, giftTexture2D.height), Vector2.one * 0.5f); } }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as SettingPanelData ?? new SettingPanelData(); // please add init code here if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty()) { ToggleDevice.gameObject.SetActive(false); } else { ToggleDevice.gameObject.SetActive(true); } BtnBack.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Back(); }); BtnLogout.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.Logout, message = "确定退出登录吗?", strTitle = "dola提示" }); }); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.Logout) { // 弹窗提示,确定后,清除本地用户信息、清空list,打开login CommonUtil.logout(); } }).AddTo(this); BtnShare.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (Application.platform == RuntimePlatform.Android) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.Share); param.Add("params", subParam); AndroidForUnity.CallAndroidStartActivity(param.ToJson()); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> paramDic = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); paramDic.Add("method", IOSClientUtil.SettingShare); paramDic.Add("params", subParam); IOSClientUtil.CommonMethodCallIOSClient(paramDic.ToJson()); } }); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as MessageMaskPanelData ?? new MessageMaskPanelData(); SimpleEventSystem.Publish(new CanvasDotMove()); TvContent.text = mData.Content; TvTitle.text = mData.Title; BtnClick.onClick.AddListener(() => { Back(); }); }
public void ScanQR(string msg) { Log.I("ScanQR: " + msg); if (msg.IsNotNullAndEmpty()) { SimpleEventSystem.Publish(new ScanQRResult(msg)); } }
public void UpdateVol(string msg) { Log.I("UpdateVol: " + msg); if (msg.IsNotNullAndEmpty()) { SimpleEventSystem.Publish(new UpdateVol(msg)); } }
// Use this for initialization void Start() { SimpleEventSystem.GetEvent <A>() .Subscribe(a => Log.I("a message")); SimpleEventSystem.GetEvent <B>() .Subscribe(b => Log.I("b message")); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as DeviceStatusPanelData ?? new DeviceStatusPanelData(); Meteors.transform.DOLocalMoveX(-2370, 5f).SetLoops(-1, LoopType.Restart); Meteors.transform.DOLocalMoveY(-470, 5f).SetLoops(-1, LoopType.Restart); ResquestDeviceStatus(-1); BtnConnect.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <BindConfirmBootPanel>(new BindConfirmBootPanelData(), UITransitionType.CIRCLE, this); }).AddTo(this); BtnBack.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); Back(); }).AddTo(this); SimpleEventSystem.GetEvent <UpdateVol>() .Subscribe(_ => { if (_.Message.IsNotNullAndEmpty()) { DeviceConnectStatus(true); DeviceVolModel model = SerializeHelper.FromJson <DeviceVolModel>(_.Message); if (model.isUpdate) { SliderDeviceVoice.Slider.value = model.progress; TextProgress.text = string.Format("{0}%", model.progress); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.DeviceLostControl, message = "家庭组内" + model.babyRelation + "正在控制此设备", isHideCancelButton = true, removeConfirmCallback = true, strConfirm = "知道了" }); } } }).AddTo(this); if (Application.platform == RuntimePlatform.Android) { AndroidForUnity.CallAndroidForQueryVol(); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("method", IOSClientUtil.QueryDeviceVolume); param.Add("params", subParam); Debug.Log("params ========" + subParam); IOSClientUtil.CommonMethodCallIOSClient(param.ToJson()); } SliderDeviceVoice.setIOnValueChange(this); }
public void UpdateMonth() { SimpleEventSystem.Publish(new CanvasCanMove()); var boxMonthIndex = PlayerPrefsUtil.GetBoxMonthIndex(); BoxModel = PlayerPrefsUtil.ContentModel.boxList[boxMonthIndex]; TvTitle.text = BoxModel.name; mPlayer.GetComponent <MasterController>().SetData(BoxModel); }
/** * 视频压缩 */ public void VideoCompress(string json) { Log.I("VideoCompress: " + json); VideoCompressModel model = SerializeHelper.FromJson <VideoCompressModel>(json); if (model != null) { SimpleEventSystem.Publish(new VideoCompressResult(model)); } }
/** * 设备绑定配网 * {deviceId,"xx",state:"1"} */ public void BindDevice(string msg) { Log.I("BindDevice: " + msg); BindDeviceModel model = SerializeHelper.FromJson <BindDeviceModel>(msg); if (model != null) { SimpleEventSystem.Publish(new BindDeviceResult(model)); } }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as FamilySettingPanelData ?? new FamilySettingPanelData(); // please add init code here StartRequestForFindMemberInfo(); BtnConfirm.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Log.I("mFamilyId: " + mFamilyModel.id); if (mFamilyModel.IsNull()) { CommonUtil.toast("请选择成员"); } else { if (mData.type == 0) { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.FamilySubtract, message = "确定移除该家长?" }); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.FamilyTransfer, message = "确定将管理员转让给所选对象?" }); } } }); BtnCancel.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Back(); }); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.FamilySubtract) { StartRequestForDoRejectMember(); } }).AddTo(this); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.FamilyTransfer) { StartRequestForDoTransferManager(); } }).AddTo(this); }
public A() { SimpleEventSystem.GetEvent <OnAnimationDone>() .Subscribe(_ => { // ... }); var b = new B(); b.PlayAnimation(); }
private void ConnectResult(bool isSuccess) { SimpleEventSystem.Publish(new CloseBindCheckWIFI()); if (isSuccess) { ModifyConnectImageStatueSuccess(); } else { ModifyConnectImageStatusFail(); } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonUp(0)) { SimpleEventSystem.Publish(new A()); } if (Input.GetMouseButtonUp(1)) { SimpleEventSystem.Publish(new B()); } }
private void Awake() { MainCamera = transform.Find("MainCamera").GetComponent <CameraMove>(); MasterCamera = transform.Find("MasterCamera").GetComponent <CameraMove>(); Master = transform.Find("Master"); MasterAnimation = Master.GetComponent <MasterAnimation>(); InitItemPosition(); SimpleEventSystem.GetEvent <CanvasCanMove>() .Subscribe(_ => { SetItemActive(true); }).AddTo(this); SimpleEventSystem.GetEvent <CanvasDotMove>() .Subscribe(_ => { SetItemActive(false); }).AddTo(this); }
private void Awake() { SimpleEventSystem.GetEvent <UpdateAddressDate>() .Subscribe(_ => { Log.I("_.GetDate: " + _.GetIsUpdate); if (_.GetIsUpdate) { StartRequestForGetAddress(); } }).AddTo(this); StartRequestForGetAddress(); }
// Use this for initialization void Start() { SimpleEventSystem.GetEvent <A> () .Subscribe(a => Log.I("a message")) .AddTo(this); // 可以与 MonoBehavour 绑定生命周期,即 MonoBehaviour 销毁时,自动取消订阅。 SimpleEventSystem.GetEvent <B> () .Subscribe(b => { if (b.Key == "say") { Log.I("b message"); } }); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as BindCheckWIFIPanelData ?? new BindCheckWIFIPanelData(); BtnBack.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); Back(); }).AddTo(this); BtnDetermineWiFi.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); Back(); }).AddTo(this); SimpleEventSystem.GetEvent <CloseBindCheckWIFI>().Subscribe(_ => { Back(); }).AddTo(this); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as AddressListPanelData ?? new AddressListPanelData(); // please add init code here BtnBack.onClick.AddListener(() => { Back(); }); StartRequestForGetAddress(); SimpleEventSystem.GetEvent <UpdateAddressDate>() .Subscribe(_ => { Log.I("_.GetDate: " + _.GetIsUpdate); if (_.GetIsUpdate) { StartRequestForGetAddress(); } }).AddTo(this); }
void Start() { GetComponent <Button>().onClick.AddListener(ButtonClick); mAnimator = GetComponent <Animator>(); IsBig.Subscribe(_ => { if (IsBig.Value) { mAnimator.Play("ItemClickAnimation", 0, 0f); } else { mAnimator.Play("NarrowAnimation", 0, 0f); } }); SimpleEventSystem.GetEvent <ListItemButton>().Subscribe(_ => { IsBig.Value = false; }).AddTo(this); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as DatePickerPanelData ?? new DatePickerPanelData(); // please add init code here // PickerPanel.Init(DateTime.Now, delegate // { // Log.I(PickerPanel._selectDate.ToString()); // } ); PickerPanel.Init(DateTime.Parse(mData.birthday)); BtnCancel.onClick.AddListener(() => { Back(); }); BtnConfirm.onClick.AddListener(() => { SimpleEventSystem.Publish(new SelectPickDate(PickerPanel._selectDate.ToString("yyyy-MM-dd"))); Back(); }); }
void StartRequestForPunch(string filePath) { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("relBoxId", mData.BoxId); paramDict.Add("boxDay", mData.BoxDay); if (mData.Action == AttendanceAdd.Audio) { paramDict.Add("duration", (int)(MicrophoneManager.GetInstance().GetClipLength() * 1000)); } paramDict.Add("punchText", InputContent.text); paramDict.Add("punchType", (int)mData.Action); paramDict.Add("punchPath", filePath); HttpUtil.PostWithSign <AttendanceModel>(UrlConst.Punch, paramDict) .Subscribe(response => { LoadingManager.GetInstance().DismissLoading(); if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.IsNull()) { PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList = new List <int>(); } if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList .Contains(mData.BoxDay)) { PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Remove(mData.BoxDay); } PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Add(mData.BoxDay); Log.I("发布:" + mData.Action); BtnPush.enabled = true; SimpleEventSystem.Publish(new AttendanceSuccess(true)); UIMgr.OpenPanel <AttendanceSharePanel>(new AttendanceSharePanelData() { AttendanceModel = response }, UITransitionType.CIRCLE); Close(); } , e => { BtnPush.enabled = true; if (e is HttpException) { HttpException http = e as HttpException; } }).AddTo(this); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as AddressPickerPanelData ?? new AddressPickerPanelData(); Dictionary <string, object> paramDict = new Dictionary <string, object>(); if (PlayerPrefsUtil.ProvinceModels.IsNull()) { HttpUtil.GetWithSign <List <ProvinceModel> >(UrlConst.ProvinceCityAreaList, paramDict) .Subscribe(response => { PlayerPrefsUtil.ProvinceModels = response; if (mData.selectAddress != null) { PickerPanel.Init(response, mData.selectAddress); } else { PickerPanel.Init(response); } } , e => { }).AddTo(this); } else { if (mData.selectAddress != null) { PickerPanel.Init(PlayerPrefsUtil.ProvinceModels, mData.selectAddress); } else { PickerPanel.Init(PlayerPrefsUtil.ProvinceModels); } } BtnCancel.onClick.AddListener(() => { Back(); }); BtnConfirm.onClick.AddListener(() => { SimpleEventSystem.Publish(new SelectAddressDate(PickerPanel.selectAddress)); Back(); }); }
private void Awake() { helpPanelTween = transform.DOLocalMoveY(0, 0.5f).SetEase(Ease.InOutCubic); helpPanelTween.SetAutoKill(false); helpPanelTween.Pause(); IsShow.Subscribe(IsShow => { if (IsShow) { SimpleEventSystem.Publish(new CanvasDotMove()); helpPanelTween.PlayForward(); } else { SimpleEventSystem.Publish(new CanvasCanMove()); helpPanelTween.PlayBackwards(); } }); }
private void Awake() { BtnClearCache.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.ClearCache, message = "本操作将会清除下载的图片视频音频内容", strTitle = "清除缓存提示" }); }); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.ClearCache) { if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action) => { TextCache.text = "0KB"; CommonUtil.toast("清除缓存成功"); }, (int)NativeAction.ClearCache); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { IOSClientUtil.ClearCacheCallIOSClient(); TextCache.text = "0KB"; CommonUtil.toast("清除缓存成功"); } } }).AddTo(this); if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action) => { TextCache.text = json; }, (int)NativeAction.Cache); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.GetSomethingFromIPhone(res => { TextCache.text = res; }, 5); } }
void StartResquestForDoSetRelation() { BtnUserConfirm.enabled = false; Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("relation", mRelation); paramDict.Add("userId", PlayerPrefsUtil.GetUserId()); HttpUtil.PostWithSign <UserInfoModel>(UrlConst.DoSetRelation, paramDict, "userHead.jpg", mUserHead) .Subscribe(response => { BtnUserConfirm.enabled = true; response.deviceId = PlayerPrefsUtil.GetDeviceId(); response.token = PlayerPrefsUtil.GetToken(); PlayerPrefsUtil.UserInfo = response; if (mData.IsEdit) { SimpleEventSystem.Publish(new UpdateUserDate(true)); Back(); } else { if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty()) { UIMgr.OpenPanel <BindGuidePanel>(new BindGuidePanelData(), UITransitionType.CIRCLE, this); } else { CommonUtil.OpenCloudMain(this); } } } , e => { BtnUserConfirm.enabled = true; if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
private void StartResquestForDelBabyAddress() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("id", mData.AddressInfo.id); HttpUtil.PostWithSign <object>(UrlConst.DelBabyAddress, paramDict) .Subscribe(response => { CommonUtil.toast("删除地址成功"); SimpleEventSystem.Publish(new UpdateAddressDate(true)); Back(); } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
private void StartRequestForDoTransferManager() { Dictionary <string, object> param = new Dictionary <string, object>(); param.Add("userId", mFamilyModel.id); param.Add("deviceId", PlayerPrefsUtil.GetDeviceId()); HttpUtil.PostWithSign <int>(UrlConst.DoTransferManager, param) .Subscribe(response => { CommonUtil.toast("转让成功"); SimpleEventSystem.Publish(new UpdateBaseInfoDate(true)); Back(); }, e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }