private void Awake() { if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action1) => { TextVersion.text = json; }, (int)NativeAction.Version); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.GetSomethingFromIPhone(res => { TextVersion.text = res; }, 2); } }
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); } }
private void Awake() { if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty()) { BtnUnbind.gameObject.SetActive(true); } else { TextID.text = PlayerPrefsUtil.GetDeviceId(); StartResquestForCheckDeviceVersion(); StartResquestForGetDeviceStatus(); BtnUnbind.gameObject.SetActive(true); } if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action1) => { TextAppVersion.text = json; }, (int)NativeAction.Version); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.GetSomethingFromIPhone(res => { TextAppVersion.text = res; }, 2); } BtnUnbind.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.Unbind, message = "确定解除绑定 Dola 设备吗?\n解绑后,将删除此设备的历史学习记录", strTitle = "解绑提示" }); }); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.Unbind) { StartResquestForUnbind(); } }).AddTo(this); }
protected override void OnInit(QFramework.IUIData uiData) { if (Application.platform == RuntimePlatform.Android) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); AndroidForUnity.CallAndroidHideSplash(); } 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.MainPanelOnInit); param.Add("params", subParam); IOSClientUtil.CommonMethodCallIOSClient(param.ToJson()); if (App.IsFirstInitialize == 1) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } } else { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } mTexture2DHBoy = mResLoader.LoadSync <Texture2D>("ic_head_boy"); mTexture2DHGirl = mResLoader.LoadSync <Texture2D>("ic_head_girl"); mMainAnimationGo = mResLoader.LoadSync <GameObject>("MainAnimation") .Instantiate() .transform .LocalScale(1.4f, 1.4f, 1.4f) .Position(-11.0f, -5.0f, 0) .gameObject; mData = uiData as MainPanelData ?? new MainPanelData(); BtnGift.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <GiftListPanel>(new GiftListPanelData(), UITransitionType.CLOUD, this); }); BtnSetting.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <SettingPanel>(new SettingPanelData(), UITransitionType.CLOUD, this); }); BtnListen.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); StartRequestForGetResourcePageUrl(); }); BtnMessage.onClick.AddListener(() => { // UIMgr.OpenPanel<AttendanceAddAudioPanel>(); }); BtnRobot.OnClickAsObservable().Subscribe((unit => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <DeviceStatusPanel>(new DeviceStatusPanelData(), UITransitionType.CLOUD, this); })).AddTo(this); BtnIntegral.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Debug.Log("每日任务"); UIMgr.OpenPanel <DailyTaskPanel>(new DailyTaskPanelData(), UITransitionType.CLOUD, this); }); BtnMedal.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Debug.Log("勋章"); UIMgr.OpenPanel <DailyTaskPanel>(new DailyTaskPanelData() { showMedal = 2, }, UITransitionType.CLOUD, this); }); BtnScan.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { if (result == (int)NativeGallery.Permission.Granted) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN); param.Add("params", subParam); AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CLOUD); } }, (int)NativeAction.Camera); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN_IOS); param.Add("params", subParam); IOSClientUtil.CallIOSClient(param.ToJson()); } }); BtnChineseShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.chPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.chPlanId, 0); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.PlanScan, message = "该计划未解锁\n需扫描盒子二维码进行解锁!", strConfirm = "去扫描", strTitle = "解锁提示" }); LoadingManager.GetInstance().DismissLoading(); } }); BtnEnglishShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.enPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.enPlanId, 0); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.PlanScan, message = "该计划未解锁\n需扫描盒子二维码进行解锁!", strConfirm = "去扫描", strTitle = "解锁提示" }); LoadingManager.GetInstance().DismissLoading(); } }); BtnLearningShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.qgPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.qgPlanId, 0); } else { StartRequestForDrawPowerSpecialPlan(); } }); BtnPhotoWall.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <WorksWallPanel>(new WorksWallPanelData(), UITransitionType.CLOUD, this); }); BtnAddRobot.onClick.AddListener(() => { UIMgr.OpenPanel <BindConfirmBootPanel>(new BindConfirmBootPanelData() { }, UITransitionType.CLOUD, this); }); SimpleEventSystem.GetEvent <ScanQRResult>() .Subscribe(_ => { if (_.ScanResult.IsNotNullAndEmpty()) { StartRequestForScanQR(_.ScanResult); } }).AddTo(this); //扫码动画关闭监听 SimpleEventSystem.GetEvent <CollectGiftBoxPanelClosed>() .Subscribe(_ => { if (_.CollectGiftBoxType == CollectGiftBoxType.ChineseLearningPlan || _.CollectGiftBoxType == CollectGiftBoxType.EnglishLearningPlan) { StartRequestForGetPlanInfo(ScanQrCodePlanId, ScanQrCodeMonth); } }).AddTo(this); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.PlanScan) { if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { if (result == (int)NativeGallery.Permission.Granted) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN); param.Add("params", subParam); AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CLOUD); } }, (int)NativeAction.Camera); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN_IOS); param.Add("params", subParam); IOSClientUtil.CallIOSClient(param.ToJson()); } } }).AddTo(this); /** * 展示完引导页 的事件 */ SimpleEventSystem.GetEvent <MainPanelGuideDismiss>().Subscribe(_ => { this.gameObject.SetActive(true); }).AddTo(this); SimpleEventSystem.GetEvent <LottieAnimationFinish>().Subscribe(_ => { if (Application.platform == RuntimePlatform.IPhonePlayer) { if (App.IsFirstInitialize == 1) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } } }).AddTo(this); /** * 勋章领取成功 */ SimpleEventSystem.GetEvent <MedalDrawSuccess>() .Subscribe(_ => { string medalCount = TvMedal.text; TvMedal.text = (medalCount.ToInt() + 1).ToString(); if (mMedalList.Count > 0) { mMedalList.RemoveAt(0); } ShowMedalAnimationPanel(); }).AddTo(this); setUserInfoData(); StartResquestForGetUserInfo(); RequestBabyMedalFindList(); if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action1) => { if (json.IsNotNullAndEmpty()) { AppInfo model = SerializeHelper.FromJson <AppInfo>(json); StartResquestForFindReleaseInfo("2", model.build); } }, (int)NativeAction.VersionJson); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.GetSomethingFromIPhone(result => { Debug.Log("IOS - build = " + result); StartResquestForFindReleaseInfo("1", result.ToInt()); }, 4); } if (mData.ShopAction >= 1) { LoadingManager.GetInstance().CreatLoading(); StartCoroutine(WaitMainPanelAnimationCompleted(mData.ShopAction)); } }
private void Awake() { BtnConfirm.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action1) => { if (json.IsNotNullAndEmpty()) { AppInfo model = SerializeHelper.FromJson <AppInfo>(json); StartResquestForAddFeedBack(model.version, model.build, "2"); } else { StartResquestForAddFeedBack("未知", 0, "2"); } }, (int)NativeAction.VersionJson); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { string version = Application.version; NativeGallery.GetSomethingFromIPhone(res => { StartResquestForAddFeedBack(version, res.ToInt(), "1"); }, 4); } else { StartResquestForAddFeedBack("未知", 0, "0"); } }); BtnDel.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (mPhotoPath.IsNotNullAndEmpty()) { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.FeedBackDel, message = "确定要删除当前图片吗?" }); } }); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.FeedBackDel) { mPhotoPath = ""; ImgPhoto.sprite = Sprite.Create(texture2DAddPhoto, new Rect(0, 0, texture2DAddPhoto.width, texture2DAddPhoto.height), Vector2.one * 0.5f); BtnDel.gameObject.SetActive(false); } }).AddTo(this); BtnAddPhoto.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); ChoosePic(ChoosePhotoAction.FeedBack); }); InputContent.onValueChange.AddListener(ChangeInput); SimpleEventSystem.GetEvent <ChoosePhotoClick>() .Subscribe(_ => { Log.I("_.GetPhotoAction: " + _.GetPhotoAction + " _.GetAction: " + _.GetAction); if (_.GetPhotoAction == ChoosePhotoAction.FeedBack) { PickImage(_.GetAction); } }).AddTo(this); texture2DSel = mResLoader.LoadSync <Texture2D>("btn_code_sel"); texture2DNor = mResLoader.LoadSync <Texture2D>("btn_code_nor"); texture2DAddPhoto = mResLoader.LoadSync <Texture2D>("btn_add_photo"); BtnConfirm.image.sprite = Sprite.Create(texture2DSel, new Rect(0, 0, texture2DSel.width, texture2DSel.height), Vector2.one * 0.5f); BtnConfirm.enabled = false; }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as BindWIFIMessagePanelData ?? new BindWIFIMessagePanelData(); if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { isSendMessage = true; Log.I("RequestPermission: " + result); if (result == (int)NativeGallery.Permission.Granted) { // InvokeRepeating("GetWifiInfo",1,1); 可以实时更新wifi,但无法修改wifi密码,暂时舍弃 NativeGallery.GetSomethingFromNative((json, action1) => { if (json.IsNotNullAndEmpty()) { isSSIDContains5G(json); InputFieldSSID.text = json; string pwd = PlayerPrefsUtil.GetWiFiPWD(json); if (pwd.IsNotNullAndEmpty()) { InputFieldPWD.text = pwd; } else { InputFieldPWD.text = string.Empty; } } Log.I("GetSomethingFromNative: " + json); }, (int)NativeAction.Location); } }, (int)NativeAction.Location); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { if (NativeGallery.RequestIPhonePermission(2) == NativeGallery.Permission.Granted) { NativeGallery.GetSomethingFromIPhone(result => { if (result.IsNotNullAndEmpty()) { InputFieldSSID.text = result; isSSIDContains5G(result); string pwd = PlayerPrefsUtil.GetWiFiPWD(result); if (pwd.IsNotNullAndEmpty()) { InputFieldPWD.text = pwd; } else { InputFieldPWD.text = String.Empty; } } }, 1); } } var submit = Observable.Merge( InputFieldSSID.OnEndEditAsObservable().Where(_ => Input.GetKeyDown(KeyCode.Return)), BtnCommit.OnClickAsObservable().Select(_ => InputFieldSSID.text) ); submit.Where(s => s != "") .Subscribe(s => { AudioManager.PlaySound("Button_Audio"); isSendMessage = false; if (saveWiFipwd) { // 保存 WiFi ssid 和 pwd 到本地 PlayerPrefsUtil.SetWiFiSSIDPWD(InputFieldSSID.text, InputFieldPWD.text); } else { PlayerPrefsUtil.SetWiFiSSIDPWD(InputFieldSSID.text, String.Empty); } Debug.Log("submit-确定 " + "ssid=" + s + " pwd=" + InputFieldPWD.text); UIMgr.OpenPanel <BindDevicePanel>(new BindDevicePanelData() { pwdStr = InputFieldPWD.text, ssidStr = InputFieldSSID.text }, UITransitionType.CIRCLE, this); }).AddTo(this); BtnClearPWD.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); InputFieldPWD.text = String.Empty; }).AddTo(this); BtnSSIDList.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); #if UNITY_ANDROID NativeGallery.RequestPermission((result, action) => { Log.I("RequestPermission: " + result); if (result == (int)NativeGallery.Permission.Granted) { NativeGallery.OpenWifiSettings(); } }, (int)NativeAction.Location); #elif UNITY_IOS NativeGallery.OpenSettings(); #else #endif }); InputFieldSSID.OnValueChangedAsObservable().Subscribe((s => { var texture2D = mResLoader.LoadSync <Texture2D>("ic_bindDetermine"); if (s.Length > 0) { texture2D = mResLoader.LoadSync <Texture2D>("ic_bindDetermine"); } else { texture2D = mResLoader.LoadSync <Texture2D>("btn_code_sel"); } ImgDetermine.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); })).AddTo(this); BtnShow.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); var texture2D = mResLoader.LoadSync <Texture2D>("ic_savepwd"); showWiFipwd = !showWiFipwd; if (showWiFipwd) { texture2D = mResLoader.LoadSync <Texture2D>("btn_show_pwd"); InputFieldPWD.contentType = InputField.ContentType.EmailAddress; } else { texture2D = mResLoader.LoadSync <Texture2D>("btn_hide_pwd"); InputFieldPWD.contentType = InputField.ContentType.Password; } var image = BtnShow.transform.Find("Image").GetComponent <Image>(); image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); InputFieldPWD.MyUpdateLabel(); }).AddTo(this); BtnConnectTips.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <BindCheckWIFIPanel>(new BindCheckWIFIPanelData(), UITransitionType.NULL); }).AddTo(this); BtnBack.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); Debug.Log("WiFi 返回"); Back(); }).AddTo(this); BtnSavepwd.OnClickAsObservable().Subscribe(_ => { AudioManager.PlaySound("Button_Audio"); Debug.Log("记住密码"); saveWiFipwd = !saveWiFipwd; var texture2D = mResLoader.LoadSync <Texture2D>("ic_savepwd"); if (saveWiFipwd) { texture2D = mResLoader.LoadSync <Texture2D>("ic_savepwd"); } else { texture2D = mResLoader.LoadSync <Texture2D>("ic_unsavepwd"); } ImageSavePWD.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); }).AddTo(this); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.Contains5GAlter) { if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.RequestPermission((result, action) => { Log.I("RequestPermission: " + result); if (result == (int)NativeGallery.Permission.Granted) { NativeGallery.OpenWifiSettings(); } }, (int)NativeAction.Location); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.OpenSettings(); } } }).AddTo(this); // please add init code here }