public void uploadIntakeLogs(IntakeLogs mIntakeLogs, string current_child_sn, Action <UpLoadIntakeLogsResponseData> callBack, Action <ResponseErroInfo> errCallBack) { GuLog.Info("UploadChildIntakeLogsService uploadIntakeLogs"); Dictionary <string, string> head = new Dictionary <string, string>(); string body = mJsonUtils.Json2String(mIntakeLogs); // mGululuNetwork.sendRequest(mUrlProvider.getChildIntakeLogUrl(current_child_sn,CupBuild.getCupSn()), head, body, (result) => // { // UpLoadIntakeLogsResponseData info = mJsonUtils.String2Json<UpLoadIntakeLogsResponseData>(result); // mUploadChildIntakeLogsModel.mUpLoadIntakeLogsResponseData = info; // callBack(info); // }, (ecb) => // { // errCallBack(ecb); // }, HTTPMethods.Post); mNativeOkHttpMethodWrapper.post(mUrlProvider.getChildIntakeLogUrl(current_child_sn, CupBuild.getCupSn()), "", body, (result) => { GuLog.Info("UploadChildIntakeLogsService onresponse"); UpLoadIntakeLogsResponseData info = mJsonUtils.String2Json <UpLoadIntakeLogsResponseData>(result); mUploadChildIntakeLogsModel.mUpLoadIntakeLogsResponseData = info; callBack(info); }, (errorResult) => { GuLog.Info("UploadChildIntakeLogsService faliure"); errCallBack(errorResult); }); }
void onConnected() { GuLog.Info("<><InCharging><>onConnected<><>"); RepeatBatteryUppdate(); SoundPlayer.GetInstance().PlaySoundType("system_charging_start"); }
public void upload(Action <UpLoadIntakeLogsResponseData> callBack, Action <ResponseErroInfo> errCallBack) { GuLog.Info("IntakeLogDataManager upload"); string currentChildSN = mLocalChildInfoAgent.getChildSN(); if (currentChildSN == string.Empty) { errCallBack(ResponseErroInfo.GetErrorInfo(0, "upload resource is empty")); return; } List <LogItem> info = mLocalIntakeLogsData.getAllIntakeLogsInfo(currentChildSN); if (info != null && info.Count > 0) { GuLog.Info("IntakeLogDataManager havedata"); IntakeLogs mIntakeLogs = new IntakeLogs(); mIntakeLogs.logs = info; mUploadChildIntakeLogsService.uploadIntakeLogs(mIntakeLogs, currentChildSN, (cb) => { mLocalIntakeLogsData.deleteIntakeLogsInfo(currentChildSN); callBack(cb); }, (ecb) => { errCallBack(ecb); }); } else { errCallBack(ResponseErroInfo.GetErrorInfo(0, "upload resource is empty")); } }
private void ProcessNextState() { if (bHoldStatus) { return; } if (CurrentPresent == null || CurrentPresent.IsFinish()) { UIState state = GetNextState(); CurrentPresent = GetPresentByEnum(state.state); if (CurrentPresent != null) { GuLog.Debug("<><DrinkWaterUIPresentManager> StateProcessing:" + state.state.ToString()); if (state.state != UIStateEnum.eSleepMode && state.state != UIStateEnum.eSchoolMode) { CurrentPresent.ProcessState(state); } if (!state.needWait) { CurrentPresent = null; } ProcessNextState(); } } }
private void AfterLoadAudio(WWW www) { currCoroutine = null; if (www.isDone && string.IsNullOrEmpty(www.error)) { GuLog.Debug("<><AudioDownloadManager>AfterLoadAudio ok Start "); if (GetCurrentRequirment().sourceTarget != null) { GetCurrentRequirment().sourceTarget.clip = www.GetAudioClip(false, true); GetCurrentRequirment().sourceTarget.Play(); this.OnStartPlay(); } if (GetCurrentRequirment().downLoadResultCB != null) { GetCurrentRequirment().downLoadResultCB(GetCurrentRequirment().infoUrl, true); } GuLog.Debug("<><AudioDownloadManager>AfterLoadAudio ok: " + www.url); ProcessNext(); } else { GuLog.Debug("<><AudioDownloadManager>AfterLoadAudio fail: " + www.error); currCoroutine = wWWSupport.StartWWW(GetCurrentRequirment().infoUrl.url, AfterDownFromHttp); } }
public void Play(string strAni) { if (string.IsNullOrEmpty(PetName) || string.IsNullOrEmpty(strAni)) { return; } AniAndSound info = ActionConifg.GetAniAndSound(PetName, strAni); GuLog.Debug("<><BasePlayer>Play Pet:" + PetName + " Ani:" + strAni); if (info != null) { GuLog.Debug("<><BasePlayer>Play Action:" + info.AniName); if (animator) { animator.Play(info.AniName); } Debug.LogFormat("<><BasePlayer.Play>Sound: {0}, HasModulePageOpened: {1}, InGuideView: {2}", info.SoundType, TopViewHelper.Instance.HasModulePageOpened(), TopViewHelper.Instance.IsInGuideView()); if (!string.IsNullOrEmpty(info.SoundType) && this.PlayerDataManager.LanguageInitialized() && (!TopViewHelper.Instance.HasModulePageOpened() || TopViewHelper.Instance.IsInGuideView())) {//设置过语言且没有打开任何功能模块,或正在引导才能播放此声音 Debug.LogFormat("<><BasePlayer.Play>Sound: {0} ==== Playing", info.SoundType); SoundPlayer.GetInstance().PlayRoleSound(info.SoundType); } } }
private void OnP2PSuccess(P2PInfo info) { FlurryUtil.LogEvent("Friending_Search_Success_Event"); viewMainScene.MakeFriend(info.pet_type, (info.role == "1")); GuLog.Debug("<><MainSceneMediator><MakeFriend>_P2PSuccess!"); }
//设置防打扰时间(此脚本中的net代表闹钟,other代表防打扰时间,包括学习时间和睡眠时间) public void setOtherClock(string childsn, string silenceDatasString, Action success, Action error) { GuLog.Debug("<><CupClockManager> setOtherClock-New"); GuLog.Debug(string.Format("----CupClockManager.setOtherClock-New---->childSN: {0}, originData: {1}", childsn, silenceDatasString)); AllSilenceTimeSectionFromServer silenceDatas = mJsonUtils.String2Json <AllSilenceTimeSectionFromServer>(silenceDatasString); ClocksInfo clocksInfo = this.SilenceDatas2ClockInfos(childsn, silenceDatas);//将网络下发的防打扰数据的格式转为本地格式 string localClockInfo = mJsonUtils.Json2String(clocksInfo); mLocalClockInfoAgent.saveOtherClockInfo(childsn, localClockInfo);//将转型后的防打扰数据存入本地 GuLog.Debug(string.Format("----CupClockManager.setOtherClock-New---->childSN: {0}, formatedData: {1}", childsn, localClockInfo)); string netClockInfo = mLocalClockInfoAgent.getNetClockInfo(childsn); if (string.IsNullOrEmpty(netClockInfo)) {//如果此时水杯中没有此孩子的闹钟数据,则用转型后的防打扰时间覆盖 mAlarmManager.replaceAlarmList(localClockInfo, success, error); } else {//如果此时水杯中有此孩子的闹钟数据,则与防打扰数据拼接起来一并推送给底层 ClocksInfo netinfo = mJsonUtils.String2Json <ClocksInfo>(netClockInfo); netinfo.clocks.AddRange(clocksInfo.clocks); string allData = mJsonUtils.Json2String(netinfo); mAlarmManager.replaceAlarmList(allData, success, error); GuLog.Debug(string.Format("----CupClockManager.setOtherClock-New---->childSN: {0}, allData: {1}", childsn, allData)); } }
/************************************************私 有 方 法************************************************/ //读取语言配置文件 private void Parser(WWW www) { m_LoadOk = true; GuLog.Debug("LanConfigPath WWW::" + www.error); if (www.isDone && (www.error == null || www.error.Length == 0)) { SecurityParser xmlDoc = new SecurityParser(); GuLog.Debug("LanConfigPath" + www.text); xmlDoc.LoadXml(www.text); ArrayList allNodes = xmlDoc.ToXml().Children; foreach (SecurityElement xeLanguages in allNodes) { if (xeLanguages.Tag == "Languages") { ArrayList languageNodes = xeLanguages.Children; foreach (SecurityElement xeLanguage in languageNodes) { if (xeLanguage.Tag == "Language") { Language language = new Language() { Name = xeLanguage.Attribute("Name"), Text = xeLanguage.Attribute("Text"), Default = Convert.ToBoolean(xeLanguage.Attribute("Default")) }; languages.Add(language.Name, language); } } } } } }
public void setNetClock(string childsn, string netClockInfo, Action success, Action error) { GuLog.Debug("<><CupClockManager> setNetClock"); string otherClockInfo = mLocalClockInfoAgent.getOtherClockInfo(childsn); mLocalClockInfoAgent.saveNetClockInfo(childsn, netClockInfo); UnityEngine.Debug.LogFormat("----{0}----CupClockManager.setNetClock: {1}, {2}", System.DateTime.Now.ToString("HH:mm:ss:fff"), childsn, netClockInfo); if (string.IsNullOrEmpty(otherClockInfo)) { UnityEngine.Debug.LogFormat("----{0}----CupClockManager.replaceAlarmList_1", System.DateTime.Now.ToString("HH:mm:ss:fff")); mAlarmManager.replaceAlarmList(netClockInfo, success, error); } else { ClocksInfo otherinfo = mJsonUtils.String2Json <ClocksInfo>(otherClockInfo); ClocksInfo netinfo = mJsonUtils.String2Json <ClocksInfo>(netClockInfo); netinfo.clocks.AddRange(otherinfo.clocks); string allinfoStr = mJsonUtils.Json2String(netinfo); mAlarmManager.replaceAlarmList(allinfoStr, success, error); UnityEngine.Debug.LogFormat("----{0}----CupClockManager.replaceAlarmList_2: {1}, {2}, {3}", System.DateTime.Now.ToString("HH:mm:ss:fff"), allinfoStr, otherinfo, netinfo); } }
public void setOtherClock(string childsn, List <ClocksItem> clocks, Action success, Action error) { GuLog.Debug("<><CupClockManager> setOtherClock"); string netClockInfo = mLocalClockInfoAgent.getNetClockInfo(childsn); ClocksInfo localinfo = new ClocksInfo(); localinfo.clocks = clocks; string localClockInfo = mJsonUtils.Json2String(localinfo); mLocalClockInfoAgent.saveOtherClockInfo(childsn, localClockInfo); if (string.IsNullOrEmpty(netClockInfo)) { mAlarmManager.replaceAlarmList(localClockInfo, success, error); } else { ClocksInfo netinfo = mJsonUtils.String2Json <ClocksInfo>(netClockInfo); netinfo.clocks.AddRange(clocks); string allinfoStr = mJsonUtils.Json2String(netinfo); mAlarmManager.replaceAlarmList(allinfoStr, success, error); } }
/************************************************私 有 方 法************************************************/ //读取语言配置文件 private void Parser(WWW www) { m_LoadOk = true; GuLog.Debug("FontConfig WWW::" + www.error); if (www.isDone && (www.error == null || www.error.Length == 0)) { SecurityParser xmlDoc = new SecurityParser(); GuLog.Debug("FontConfig" + www.text); xmlDoc.LoadXml(www.text); ArrayList allNodes = xmlDoc.ToXml().Children; foreach (SecurityElement xeLanguages in allNodes) { if (xeLanguages.Tag == "Fonts") { ArrayList languageNodes = xeLanguages.Children; foreach (SecurityElement xeLanguage in languageNodes) { if (xeLanguage.Tag == "Font") { fonts.Add(xeLanguage.Attribute("Name"), xeLanguage.Attribute("FullName")); } } } } } }
public void put(string url, string headerStr, string body, Action <string> result, Action <ResponseErroInfo> faile) { #if UNITY_ANDROID && (!UNITY_EDITOR) GuLog.Debug(string.Format("<><NativeOkHttpMethodWrapper.put>url: {0}, headerStr: {1}, body: {2}", url, headerStr, body)); if (nativeOkHttpMethodWrapper == null) { nativeOkHttpMethodWrapper = getOkHttpMethodWrapper(); } NativeOkHttpMethodWrapperCallBack callBack = new NativeOkHttpMethodWrapperCallBack(); callBack.setCallback((resultInfo) => { GuLog.Debug(string.Format("<><NativeOkHttpMethodWrapper.put>put back: {0}", resultInfo)); result(resultInfo); }, (faileInfo) => { GuLog.Debug(string.Format("<><NativeOkHttpMethodWrapper.put>put back error: {0}", faileInfo != null ? faileInfo.ErrorInfo : "empty or null")); faile(faileInfo); }); nativeOkHttpMethodWrapper.Call("put", url, headerStr, body, callBack); #elif UNITY_EDITOR mGululuNetwork.sendRequest(url, mNetUtils.transforDictionarHead(headerStr), body, (response) => { result(response); }, faile, HTTPMethods.Put); #endif }
// Update is called once per frame void Update() { if (Time.deltaTime > 0.3f) { GuLog.Info("<><HeartBeatView>Long Frame:" + Time.deltaTime.ToString()); } }
private const string POP_SLEEP_STATUS = "Remove current status"; //出栈操作 /************************************************构 造 函 数************************************************/ /************************************************自 定 义 方 法************************************************/ //息屏时间压栈 public void AddSleepStatus(int sleepTimeout) { GuLog.Info("<><SleepTimeManager>AddSleepStatus: " + sleepTimeout); this.SetSleepTimeout(ADD_SLEEP_STATUS, sleepTimeout); topViewList.Add(sleepTimeout); this.PrintTrack(sleepTimeout); }
public void InitialSilenceTimeSection(List <SilenceTimeSectionFromServer> listSilenceTimeSectionFromServer, bool needSave = true) { DumpSilenceTimeData(listSilenceTimeSectionFromServer); SaveSilenceTimeSection(listSilenceTimeSectionFromServer); List <SilenceTimeSection> listSilenceTimeSection = new List <SilenceTimeSection>(); foreach (var section in listSilenceTimeSectionFromServer) { listSilenceTimeSection.Add(new SilenceTimeSection(section)); } InitialSilenceTimeSection(listSilenceTimeSection); FillClocksItemList(); if (listClocksItemSection.Count > 0) { GuLog.Debug("<><SilenceTimeDataManager>listClocksItemSection[0] hour:" + listClocksItemSection[0].clock_hour + "minute:" + listClocksItemSection[0].clock_min); DumpClocksItemSection(); } mCupClockManager.setOtherClock(mLocalChildInfoAgent.getChildSN(), listClocksItemSection, () => { GuLog.Info("<><SilenceTimeDataManager>set other alrm success !"); }, () => { GuLog.Error("<SilenceTimeDataManager><>set other alrm error !"); }); }
//重设息屏时间 public void ResetSleepStatus() { this.topViewList.Clear(); this.topViewList.Add(DEFAULT_SLEEP_TIME); Screen.sleepTimeout = int.MaxValue; GuLog.Info("<><SleepTimeManager>ResetSleepStatus"); }
//当电量变化时 private void OnBatteryLevelChange(int batteryCapacity) { GuLog.Debug(string.Format("----BattaryStatusListenerView.OnBatteryLevelChange----Battery: {0}, InCharging: {1}", batteryCapacity, this.inCharging)); if (batteryCapacity >= 20) { this.percent20 = false; this.percent10 = false; GuLog.Debug(string.Format("----BattaryStatusListenerView.OnBatteryLevelChange.More than 20%----Battery: {0}, {1}", batteryCapacity, DateTime.Now.ToString("HH:mm:ss:fff"))); } else if (batteryCapacity >= 10 && batteryCapacity < 20) { this.percent10 = false;//只要电量处在10和20之间,percent10就应该恢复成false,一个可能的场景是:低电10%以下的时候充电,冲到10%以上拔掉电源线,再次低于10%时,应该再次亮屏 if (!this.inCharging && !this.percent20) { this.percent20 = true; this.TurnOnScreen(); GuLog.Debug(string.Format("----BattaryStatusListenerView.OnBatteryLevelChange.TurnOnScreen----Battery: {0}, {1}", batteryCapacity, DateTime.Now.ToString("HH:mm:ss:fff"))); } } else if (batteryCapacity < 10) { if (!this.inCharging && !this.percent10) { this.percent10 = true; this.TurnOnScreen(); GuLog.Debug(string.Format("----BattaryStatusListenerView.OnBatteryLevelChange.TurnOnScreen----Battery: {0}, {1}", batteryCapacity, DateTime.Now.ToString("HH:mm:ss:fff"))); } } }
public void CrossFade(string animation, float fadeTime = 0.2f, System.Action complete = null) { AniAndSound info = ActionConifg.GetAniAndSound(PetName, animation); GuLog.Debug("<><BasePlayer>CrossFade Pet:" + PetName + " Ani:" + animation); if (info != null) { GuLog.Debug("<><BasePlayer>Play Action:" + info.AniName); if (animator) { animator.CrossFade(info.AniName, fadeTime); if (this.coroutine != null) { this.StopCoroutine(this.coroutine); } this.coroutine = StartCoroutine(WaitAnimationPlayComplete(animation, complete)); } if (!string.IsNullOrEmpty(info.SoundType)) { this.lastSoundType = info.SoundType; SoundPlayer.GetInstance().PlayRoleSound(info.SoundType); } } }
private void TurnOnScreen() { #if (UNITY_ANDROID) && (!UNITY_EDITOR) GuLog.Debug("----BattaryStatusListenerView.TurnOnScreen----"); ScreenManager.turnOnScreen(); #endif }
private void OnP2PFail() { FlurryUtil.LogEvent("Friending_Search_Failed_Event"); viewMainScene.MakeFriendFail(); GuLog.Debug("<><MainSceneMediator><MakeFriend>_P2PFail!"); }
/// <summary> /// 设置字体 /// </summary> /// <param name="textComponent">Text组件</param> /// <param name="text">要显示的文本的键</param> public void SetFont(Text textComponent, string text) { if (textComponent == null || string.IsNullOrEmpty(text)) { GuLog.Error(string.Format("----AnimationUtils.SetText.SetFont----textComponent is null: {0}, text is null or empty: {1}", textComponent == null, string.IsNullOrEmpty(text))); return; } string language = this.PlayerDataManager.GetLanguage(); TextElement textElement = this.I18NConfig.GetTextElement(text); if (textElement != null && this.FontConfig.IsValid(textElement.FontShortName)) {//使用配置文件中的字体设置 string fontFullName = this.FontConfig.GetFontFullName(textElement.FontShortName); GuLog.Debug(string.Format("----AnimationUtils.SetText----Font: {0}, Language: {1}", fontFullName, language)); textComponent.font = Resources.Load <Font>(string.Format("Font/{0}", fontFullName)); } else {//使用默认字体设置 string fontFullName = Gululu.Config.FontConfig.DEFAULT_FONT; GuLog.Debug(string.Format("----AnimationUtils.SetText----Font: {0}, Language: {1}", fontFullName, language)); textComponent.font = Font.CreateDynamicFontFromOSFont(fontFullName, textComponent.fontSize); } }
public void SetCurrentVolume() { int currentVolume = this.GetVolumeLevel(); GuLog.Debug("<><VolumeSetting>SetCurrentVolume<><>: " + currentVolume); this.SetVolume(currentVolume); }
//加载场景 private IEnumerator LoadScene() { int loadSceneProgress = 0; AsyncOperation op = SceneManager.LoadSceneAsync(this.sceneName); op.allowSceneActivation = false; while (op.progress < 0.9f) { loadSceneProgress = (int)(op.progress * 100); Debug.LogFormat("<><MainSceneLoader.LoadScene>loading......[{0}]", op.progress.ToString()); while (displayProgress < loadSceneProgress) { ++displayProgress; imageProgress.fillAmount = displayProgress / (float)100; yield return(new WaitForEndOfFrame()); } } loadSceneProgress = 100; while (this.displayProgress < loadSceneProgress) { GuLog.Debug("<><MainSceneLoader.LoadScene>In loading!"); this.displayProgress += 3; imageProgress.fillAmount = this.displayProgress / (float)100; yield return(new WaitForEndOfFrame()); } FlurryUtil.LogEvent("Hank_Openani_View"); GuLog.Debug("<><Preload>LoadOk!"); this.objProgress.SetActive(false); this.videoPlayer.Play(); this.bMovieEnd = false; yield return(new WaitUntil(() => bMovieEnd)); op.allowSceneActivation = true; }
public void onBatteryLevelChange(int level) { Loom.QueueOnMainThread(() => { GuLog.Info("<><InCharging>onBatteryLevelChange<><>" + level); }); }
public void sendAck(string url, ActionPostBody body) { Dictionary <string, string> head = new Dictionary <string, string>(); string strbody = mJsonUtils.Json2String(body); // mGululuNetwork.sendRequest(url, head, strbody, (r) => // { // GuLog.Debug("ackRet:" + r); // serviceSendAckBackSignal.Dispatch(r); // mSendAckModel.result = r; // }, (e) => // { // serviceSendAckErrBackSignal.Dispatch(e); // }, HTTPMethods.Post); mNativeOkHttpMethodWrapper.post(url, "", strbody, (result) => { GuLog.Debug("ackRet:" + result); serviceSendAckBackSignal.Dispatch(result); mSendAckModel.result = result; }, (errorResult) => { serviceSendAckErrBackSignal.Dispatch(errorResult); }); }
public void saveToken(string token) { GuLog.Debug("save token : " + token); AndroidJavaObject mainActiviry = AndroidContextHolder.GetAndroidContext(); mainActiviry.Call <bool>("saveToken", token); }
public void startP2P(P2PSendInfo sendInfo, P2PSuccess success, P2PFail fail) { string childsn = sendInfo.childsn; string cupSn = sendInfo.cupSn; string petType = sendInfo.petType; int scanTimeOut = sendInfo.scanTimeOut; int waitTimeOut = sendInfo.waitTimeOut; if (!ValidSendInfo(sendInfo)) { fail(); return; } mP2PManager = new P2PManager((info) => { GuLog.Info("p2p info:" + "child_sn:" + info.child_sn + " cup_sn:" + info.cup_sn); mAddFriendsInfoManager.addFriend(info.cup_sn, DateUtil.GetTimeStamp()); success(info); }, fail); mP2PManager.startP2P(childsn, cupSn, petType, scanTimeOut, waitTimeOut); }
private void _ProcessSilenceTime(DateTime time) { GuLog.Info("<><ProcessSilenceTime> time:" + time.ToShortTimeString()); StopAllCoroutines(); ProcessSilenceTime(SilenceTimeSection.SectionType.Study, time); ProcessSilenceTime(SilenceTimeSection.SectionType.Sleep, time); }
public void sendRegisterCupRequest(Dictionary <string, string> head, string strbody) { Header headerentity = new Header(); headerentity.headers = new List <HeaderData>(); if (head != null) { foreach (KeyValuePair <string, string> headr in head) { HeaderData data = new HeaderData(); data.key = headr.Key; data.value = headr.Value; headerentity.headers.Add(data); } } string strHeader = mJsonUtils.Json2String(headerentity); mNativeOkHttpMethodWrapper.post(mUrlProvider.getRegisterUrl(AppData.GetAppName(), CupBuild.getCupSn()), strHeader, strbody, (result) => { try { GuLog.Info("Register response data :" + result); RegisterResponseData info = mJsonUtils.String2Json <RegisterResponseData>(result); modelRegisterCup.responseRegisterCup = info; Loom.QueueOnMainThread(() => { if (mValidateResponseData.isValidRegisterResponseData(info)) { //Debug.LogFormat("--------SaveSN--------RegisterCupService.sendRegisterCupRequest: {0}", info.x_child_sn); saveData(info); serviceRegisterCupBackSignal.Dispatch(info); } else { Debug.LogError("response data is invalid:" + result); serviceRegisterCupErrBackSignal.Dispatch(ResponseErroInfo.GetErrorInfo(GululuErrorCode.RESPONSE_DATA_ERROR, "response data is invalid")); } }); } catch { Loom.QueueOnMainThread(() => { Debug.LogError("response data is error:" + result); serviceRegisterCupErrBackSignal.Dispatch(ResponseErroInfo.GetErrorInfo(GululuErrorCode.RESPONSE_DATA_ERROR, "response data is error")); }); } }, (errorResult) => { Loom.QueueOnMainThread(() => { serviceRegisterCupErrBackSignal.Dispatch(errorResult); }); }); }