Ejemplo n.º 1
0
 protected void CloseSchoolMode()
 {
     if (gameObject.activeInHierarchy)
     {
         clockWithAmPm.updateTime();
         GuLog.Debug("<><SchoolMode><>CloseSchoolMode:");
         if (myCoroutine != null)
         {
             StopCoroutine(myCoroutine);
         }
         myCoroutine = StartCoroutine(DelayOneFrameForEnd());
     }
     RoleManager.Instance.CurrentRole.ResetStatus();
 }
Ejemplo n.º 2
0
 public void Close()
 {
     --nTopCount;
     if (nTopCount == 0)
     {
         autoCloseCallBack = null;
         gameObject.SetActive(false);
     }
     else if (nTopCount < 0)
     {
         nTopCount = 0;
         GuLog.Debug("Logic error in TopUI");
     }
 }
Ejemplo n.º 3
0
        /************************************************Unity方法与事件***********************************************/
        protected override void Start()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            int batteryCapacity = BatteryUtils.getBatteryCapacity(AndroidContextHolder.GetAndroidContext());
            this.inCharging = BatteryUtils.isCharging(AndroidContextHolder.GetAndroidContext());
#else
            int batteryCapacity = 15;
#endif
            this.InvokeRepeating("UpdateBatteryLevel", 0, 5);
            this.OnBatteryLevelChange(batteryCapacity);
            BatteryUtils.registerPowerConnectionListener(this.OnConnected, this.OnDisconnected);
            BatteryUtils.registerBatteryLevelListener(null, null, this.OnBatteryLevelChange);
            GuLog.Debug(string.Format("----BattaryStatusListenerView.Start----unSafe: {0}", true));
        }
Ejemplo n.º 4
0
 //仅仅用于需要及时下载的好友头像,
 public void PlayAudio(AudioSource audioSource, UrlInfo url, Action <UrlInfo, bool> downLoadResult)
 {
     if (url == null || url.filename == null || url.filename.Length == 0)
     {
         return;
     }
     if (GetCurrentRequirment() != null && audioSource != null && GetCurrentRequirment().sourceTarget == audioSource)
     {
         GuLog.Debug("<><AudioDownloadManager>StopCurrentReq");
         StopCurrentReq();
     }
     if (currCoroutine == null)
     {
         currentRequirment = new SRequirment
         {
             sourceTarget     = audioSource,
             infoUrl          = url,
             downLoadResultCB = downLoadResult
         };
         GuLog.Debug("<><AudioDownloadManager>PlayAudio ProcessCurrentReq");
         ProcessCurrentReq();
     }
     else
     {
         bool bFind = false;
         if (audioSource != null)
         {
             for (int i = 0; i < listRequirment.Count; ++i)
             {
                 SRequirment requirment = listRequirment[i] as SRequirment;
                 if (requirment.sourceTarget == audioSource)
                 {
                     requirment.infoUrl          = url;
                     requirment.downLoadResultCB = downLoadResult;
                     bFind = true;
                     break;
                 }
             }
         }
         if (!bFind)
         {
             listRequirment.Add(new SRequirment
             {
                 sourceTarget     = audioSource,
                 infoUrl          = url,
                 downLoadResultCB = downLoadResult
             });
         }
     }
 }
Ejemplo n.º 5
0
        public void PlayMusic(string type)
        {
            if (soundConifg == null)
            {
                return;
            }
            SoundClip soundClip = soundConifg.GetSoundClip(type);

            if (!string.IsNullOrEmpty(soundClip.SoundPath))
            {
                GuLog.Debug("<><SoundPlayer> MusicName:   " + soundClip);
                PlaySoundWithChannel(soundClip, musicSource);
            }
        }
Ejemplo n.º 6
0
 public void SetOldNews(LocalNewsEvent news)
 {
     foreach (var newsEvent in GetNewsEventList())
     {
         if (newsEvent.newsEvent.event_id == news.newsEvent.event_id)
         {
             Assert.AreEqual(newsEvent.eState, NewsEventState.InPlaying);
             newsEvent.eState = NewsEventState.OldNews;
             GuLog.Debug("<><NewsEventManager>SetOldNews event_id:" + news.newsEvent.event_id);
             break;
         }
     }
     SaveNewsEvent();
 }
Ejemplo n.º 7
0
        public void PlayRoleSound(string type)
        {//rolesource to play only one role sound at the same time
            if (!bActive || soundConifg == null || roleSource.isPlaying)
            {
                return;
            }

            SoundClip soundClip = soundConifg.GetSoundClip(type);

            if (soundClip != null && !string.IsNullOrEmpty(soundClip.SoundPath))
            {
                GuLog.Debug("<><SoundPlayer> PlayRoleSound:   " + soundClip);
                PlaySoundWithChannel(soundClip, roleSource);
            }
        }
        private string CheckPetName(string operate, string petName)
        {
            if (petName.EndsWith("2"))
            {
                GuLog.Error(string.Format("----LocalPetInfoAgent.{0}----Petname ends with '2': {1}", operate, petName));
                petName = petName.Replace("2", "");
                GuLog.Error(string.Format("----LocalPetInfoAgent.{0}----Petname removed '2' {1}", operate, petName));
            }
            else
            {
                GuLog.Debug(string.Format("----LocalPetInfoAgent.{0}----Petname is correct: {1}", operate, petName));
            }

            return(petName);
        }
Ejemplo n.º 9
0
        private void Parser(WWW www)
        {
            float rate = 0;

            m_LoadOk = true;
            GuLog.Debug("SoundConfigPath WWW::" + www.error);

            if (www.isDone && (www.error == null || www.error.Length == 0))
            {
                SecurityParser xmlDoc = new SecurityParser();
                GuLog.Debug("SoundConfigPath" + www.text);

                xmlDoc.LoadXml(www.text);
                ArrayList rootXmlList = xmlDoc.ToXml().Children;

                foreach (SecurityElement xeSounds in rootXmlList)
                {
                    if (xeSounds.Tag == "Sounds")
                    {
                        ArrayList soundsXmlList = xeSounds.Children;
                        foreach (SecurityElement xeSound in soundsXmlList)
                        {
                            if (xeSound.Tag == "Sound")
                            {
                                SoundInfo sound = new SoundInfo();
                                sound.Type    = xeSound.Attribute("Type");
                                sound.Storage = xeSound.Attribute("Storage");
                                sound.Module  = "Common";

                                ArrayList clipXmlList = xeSound.Children;
                                foreach (SecurityElement xeClip in clipXmlList)
                                {
                                    if (xeClip.Tag == "Clip")
                                    {
                                        SoundClip clip = new SoundClip();
                                        clip.SoundPath = xeClip.Attribute("SoundPath");
                                        clip.Rate      = float.TryParse(xeClip.Attribute("Rate"), out rate) ? rate : 100;
                                        clip.Storage   = sound.Storage;
                                        sound.sounds.Add(clip);
                                    }
                                }
                                soundLists.Add(sound.Type, sound);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void PlayActionSound(string strAni)
        {
            AniAndSound info = ActionConifg.GetAniAndSound(PetName, strAni);

            GuLog.Debug("<><BasePlayer>Play Pet:" + PetName + "  Ani:" + strAni);
            if (info != null)
            {
                Debug.LogFormat("<><BasePlayer.PlayActionSound>Sound: {0}, HasModulePageOpened: {1}, InGuideView: {2}",
                                info.SoundType, TopViewHelper.Instance.HasModulePageOpened(), TopViewHelper.Instance.IsInGuideView());
                if (!string.IsNullOrEmpty(info.SoundType) && (!TopViewHelper.Instance.HasModulePageOpened() || TopViewHelper.Instance.IsInGuideView()))
                {//没有打开任何功能模块,或正在引导才能播放此声音
                    Debug.LogFormat("<><BasePlayer.PlayActionSound>Sound: {0} ==== Playing", info.SoundType);
                    SoundPlayer.GetInstance().PlayRoleSound(info.SoundType);
                }
            }
        }
 MainPresentBase GetPresentByEnum(UIStateEnum state)
 {
     if (allIPresents == null)
     {
         return(null);
     }
     foreach (var ret in allIPresents)
     {
         if (state == ret.GetStateEnum())
         {
             GuLog.Debug("<><DrinkWaterUIPresentManager> NextState:" + state.ToString());
             return(ret);
         }
     }
     return(null);
 }
Ejemplo n.º 12
0
        IEnumerator DelayForSilenceTime(int second, SilenceTimeSection timeSection)
        {
            GuLog.Debug("<><ProcessSilenceTime>: WaitForSeconds:" + second + "    type:" + timeSection.sectionType.ToString());

            yield return(new WaitForSeconds(second));

            DateTime time       = DateTime.Now;
            DateTime beginTime  = new DateTime(time.Year, time.Month, time.Day, timeSection.beginHour, timeSection.beginMinute, 0);
            DateTime endTime    = new DateTime(time.Year, time.Month, time.Day, timeSection.endHour, timeSection.endMinute, 0);
            double   escapeTime = (endTime - beginTime).TotalSeconds;

            PushNewState(timeSection, escapeTime, true);
            DateTime oneSecondAfterEndTime = new DateTime(time.Year, time.Month, time.Day, timeSection.endHour, timeSection.endMinute, 0);

            ProcessSilenceTime(timeSection.sectionType, oneSecondAfterEndTime);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取Spine动画中的动画名称
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        public string GetAnimationName(string key)
        {
            string languageShortName = this.GetLanguage();

            if (this.resConfigs != null && this.resConfigs.ContainsKey(languageShortName) &&
                this.resConfigs[languageShortName].AnimationElements != null)
            {
                AnimationElement animationElement = this.resConfigs[languageShortName].AnimationElements.Find(t => t.Key == key);
                GuLog.Debug(string.Format("<><I18NConfig.GetAnimationName>Key: {0}, FoundAnimationName: {1}", key, animationElement != null ? animationElement.Value : key));
                return(animationElement != null ? animationElement.Value : key);
            }
            else
            {
                GuLog.Debug(string.Format("<><I18NConfig.GetAnimationName>Key: {0}, DefaultAnimationName: {1}", key, key));
                return(key);
            }
        }
Ejemplo n.º 14
0
        private void PlaySound(string type, bool bloop = false)
        {
            if (soundConifg == null)
            {
                return;
            }
            SoundClip soundClip = soundConifg.GetSoundClip(type);

            if (soundClip != null && !string.IsNullOrEmpty(soundClip.SoundPath))
            {
                GuLog.Debug("<><SoundPlayer> SoundName:   " + soundClip);
                if (this.audioClipBuffer.ContainsKey(soundClip.SoundPath))
                {
                    this.Play(this.GetAudioSource(), this.audioClipBuffer[soundClip.SoundPath].AudioClip, bloop);
                    this.audioClipBuffer[soundClip.SoundPath].LastAccessTime = DateTime.Now;
                }
                else
                {
                    switch (soundClip.Storage.ToUpper())
                    {
                    case "LOCAL":
                        AudioClip localAudioClip = mPrefabRoot.GetObjectNoInstantiate <AudioClip>("Audio/Common", soundClip.SoundPath);
                        this.audioClipBuffer.Add(soundClip.SoundPath, new AudioClipData()
                        {
                            AudioClip = localAudioClip, LastAccessTime = DateTime.Now
                        });
                        this.Play(this.GetAudioSource(), localAudioClip, bloop);
                        break;

                    case "REMOTE":
                        this.StartCoroutine(this.ResourceUtils.LoadAudio(string.Format("Audio/Common/{0}.mp3", this.I18NConfig.GetAudioPath(soundClip.SoundPath)), (remoteAudioClip) =>
                        {
                            if (!this.audioClipBuffer.ContainsKey(soundClip.SoundPath))
                            {
                                this.audioClipBuffer.Add(soundClip.SoundPath, new AudioClipData()
                                {
                                    AudioClip = remoteAudioClip, LastAccessTime = DateTime.Now
                                });
                            }
                            this.Play(this.GetAudioSource(), remoteAudioClip, bloop);
                        }));
                        break;
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public void NewDay(int currDay)
        {
            GuLog.Debug("<><PlayerData>playerData_NewDay");
            date               = currDay;
            currIntake         = 0;
            todayCrownGotCount = 0;
            TodayDrinkTimes    = 0;

            if (missionPercent >= 1)
            {
                int nextMissionId = missionConfig.GetNextMissionId(missionId);
                if (nextMissionId != -1)
                {
                    missionId = nextMissionId;
                    missionDataManager.AddMissionState(missionId, MissionState.eUnderway);
                }
            }
        }
 public bool IsInRunning()
 {
     if (CurrentPresent != null)
     {
         GuLog.Debug("<><DrinkWaterUIPresentManager>currentPresent:" + CurrentPresent.GetStateEnum().ToString());
         return(true);
     }
     if (bHoldStatus)
     {
         GuLog.Debug("<><DrinkWaterUIPresentManager>bHoldStatus:true");
         return(true);
     }
     if (listState.Count != 0)
     {
         GuLog.Debug("<><DrinkWaterUIPresentManager>listState.Count" + listState.Count);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 17
0
        public T GetObjectNoInstantiate <T>(string strResourcePre, string name) where T : UnityEngine.Object
        {
            string strNewObjectHierachy = strResourcePre + "/" + name;

            if (typeof(T) == typeof(AudioClip) && this.I18NConfig != null)
            {
                strNewObjectHierachy = strResourcePre + "/" + this.I18NConfig.GetAudioPath(name);//如果是音频文件,则根据语言去国际化配置表中查找路径
            }
            GuLog.Debug(string.Format("----PrefabRoot.GetObjectNoInstantiate----Type: {0}, Name: {1}, ResPath: {2}, DesPath: {3}", typeof(T).Name, name, strResourcePre, strNewObjectHierachy));

            T newGameObject = Resources.Load <T>(strNewObjectHierachy) as T;

            //AudioClip prefab = Resources.Load(strNewObjectHierachy) as AudioClip;
            //if (prefab != null)
            //{
            //    newGameObject = GameObject.Instantiate(prefab) as AudioClip;
            //}

            return(newGameObject);
        }
Ejemplo n.º 18
0
        public void LoadMissionData()
        {
            missionInfo.Clear();
            List <MisssionInfo> listInfos = gameDataHelper.GetObject <List <MisssionInfo> >(missionKey);

            if (listInfos != null)
            {
                foreach (var info in listInfos)
                {
                    missionInfo.Add(info.missionId, info.eState);
                    GuLog.Debug("<><MissionData>missionId:" + info.missionId + "    State:" + info.eState.ToString());
                }
            }
            MissionState missionState;

            if (!missionInfo.TryGetValue(PlayerData.startMission, out missionState))
            {
                missionInfo.Add(PlayerData.startMission, MissionState.eUnderway);
            }
        }
Ejemplo n.º 19
0
        public float GetAnimationTime(string animationName)
        {
            float       length = 0;
            AniAndSound info   = ActionConifg.GetAniAndSound(PetName, animationName);

            GuLog.Debug("<><BasePlayer>GetAnimationTime Pet:" + PetName + "  Ani:" + animationName);
            if (info != null)
            {
                AnimationClip[] clips = this.animator.runtimeAnimatorController.animationClips;
                foreach (AnimationClip clip in clips)
                {
                    if (clip.name.ToLower().Contains(info.AniName.ToLower()))
                    {
                        length = clip.length;
                        break;
                    }
                }
            }
            return(length);
        }
Ejemplo n.º 20
0
        //轮询更新Wifi名字
        private void UpdateWifiName()
        {
            AndroidJavaObject wifiInfo = mNativeWifiManager.getConnectionInfo();
            string            ssid     = string.Empty;
            bool wifiEnable            = false;

            if (wifiInfo != null)
            {
                ssid = wifiInfo.Call <string>("getSSID");
                if (ssid != "<unknown ssid>")
                {
                    wifiEnable = true;
                    ssid       = ssid.Replace("\"", "");
                }
            }

            this.connnectedIcon.SetActive(wifiEnable);
            this.unconnectedIcon.SetActive(!wifiEnable);
            GuLog.Debug("Rssi:  " + mNativeWifiManager.getRssi());
            //Debug.LogFormat("----Component Test----WifiStatusView.UpdateWifiName: {0}, {1}", wifiEnable, ssid);
        }
Ejemplo n.º 21
0
        /************************************************自 定 义 方 法************************************************/
        private void CreateIncorrectPetName()
        {
            List <string> unlockedPetNames  = this.LocalUnlockedPetsAgent.GetUnlockedPets();
            List <string> incorrectPetNames = new List <string>();
            StringBuilder strbNames         = new StringBuilder("====DebugView.CreateIncorrectPetName.UnlockedPetNames====\n");

            unlockedPetNames.ForEach(t =>
            {
                t = t + "2";
                incorrectPetNames.Add(t);
                strbNames.AppendFormat("{0}, ", t);
            });
            strbNames.Remove(strbNames.Length - 2, 2);
            GuLog.Debug(strbNames.ToString());
            this.LocalUnlockedPetsAgent.SaveUnlockedPets(incorrectPetNames);

            string currentPetName = this.LocalPetInfoAgent.getCurrentPet() + "2";

            this.LocalPetInfoAgent.saveCurrentPet(currentPetName);
            GuLog.Debug(string.Format("----DebugView.CreateIncorrectPetName.CurrentPetName----{0}", currentPetName));
        }
Ejemplo n.º 22
0
        public void PlaySoundInChannal(string type, AudioSource audioSource, float maskVolume = 1f, System.Action callback = null)
        {
            if (soundConifg == null)
            {
                return;
            }

            SoundClip soundClip = soundConifg.GetSoundClip(type);

            if (soundClip != null && !string.IsNullOrEmpty(soundClip.SoundPath))
            {
                GuLog.Debug("<><SoundPlayer> PlaySoundInChannal:   " + soundClip);
                this.SetAllSoundVolume(maskVolume);
                this.PlaySoundWithChannel(soundClip, audioSource);
                if (this.delayCallbackCoroutine != null)
                {
                    this.StopCoroutine(this.delayCallbackCoroutine);
                }
                this.delayCallbackCoroutine = this.StartCoroutine(this.DelayCallback(audioSource, callback));
            }
        }
Ejemplo n.º 23
0
        /************************************************Unity方法与事件***********************************************/
        protected override void Start()
        {
            base.Start();

            videoPlayer.loopPointReached += (VideoPlayer source) =>
            {
                bMovieEnd = true;
            };

            BuglyUtil.Init();
            videoPlayer.Prepare();
            MissionConifg.LoadMissionConfig();
            propertyConfig.LoadPropertyConfig();
            TaskConifg.LoadTaskData();
            ItemConifg.LoadItemsConfig();
            TreasureBoxConfig.LoadTreasureBoxConfig();
            iconManager.OnlyLoadSelf();
            RoleConifg.LoadRoleConfig();
            LanConfig.LoadLanConfig();
            FontConfig.LoadFontConfig();
            I18NConfig.LoadResConfig();
            AccessoryConfig.LoadAccessoryConfig();
            AwardConfig.LoadAwardConfig();
            ActionConifg.LoadActionConfig();
            LevelConifg.LoadLevelConfig();
            SoundConfig.LoadSoundConfig();
            imageProgress.fillAmount = 0;
            GuLog.Debug("<><Preload>Load Begin!");
            StartCoroutine(StartLoading());
#if CLEAR_DATA
            LocalDataManager.getInstance().deleteAll();
#endif
            mHeartbearActionManager.addEventListener(mUploadFreindHeatbeatAction);
            mHeartbearActionManager.addEventListener(mUploadintakeHeatbeatAction);
            mHeartbeatManager.setHeartbeatListener(() =>
            {
                GuLog.Debug("Preload start do heart beat");
                mHeartbearActionManager.startHeartbeat();
            });
        }
Ejemplo n.º 24
0
        public void replaceAlarmList(string alarmInfo, Action success, Action error)
        {
            if (string.IsNullOrEmpty(alarmInfo))
            {
                GuLog.Error("----AlarmManager.replaceAlarmList----parameter[string: alarmInfo] is null or empty");
                return;
            }

            ClocksInfo clocksInfo = this.JsonUtils.String2Json <ClocksInfo>(alarmInfo);

            if (clocksInfo == null || clocksInfo.clocks == null)
            {
                GuLog.Error("----AlarmManager.replaceAlarmList----parameter[string: alarmInfo] can't convert to the type[ClocksInfo]");
                return;
            }

            List <ClocksItem> deleteItems = new List <ClocksItem>();

            clocksInfo.clocks.ForEach((clocksItem) =>
            {
                if (clocksItem != null && clocksItem.clock_enable == 0)
                {
                    deleteItems.Add(clocksItem);
                }
            });
            if (deleteItems.Count > 0)
            {
                deleteItems.ForEach((clocksItem) => { clocksInfo.clocks.Remove(clocksItem); });
            }

            alarmInfo = this.JsonUtils.Json2String(clocksInfo);
            GuLog.Debug(string.Format("----AlarmManager.replaceAlarmList----formatted alarmInfo: {0}", alarmInfo));

            SetAlarmCallback callback = new SetAlarmCallback();

            callback.setCallback(success, error);
            GuLog.Debug("<><AlarmManager> replaceAlarmList:" + alarmInfo);
            getAlarmManagerWrap().CallStatic("replaceAlarmList", alarmInfo, callback);
        }
Ejemplo n.º 25
0
 public string ReadFile(string path, string name)
 {
     lock (obj){
         StreamReader sr = null;
         try{
             sr = File.OpenText(path + Path.DirectorySeparatorChar + name);
         } catch (Exception e) {
             String str = e.ToString();
             GuLog.Debug(str);
             return("");
         }
         string        line;
         StringBuilder stringBulder = new StringBuilder();
         while ((line = sr.ReadLine()) != null)
         {
             stringBulder.Append(line);
         }
         sr.Close();
         sr.Dispose();
         return(stringBulder.ToString());
     }
 }
        public void LoadInteractiveCount()
        {
            interactivesInfo.Clear();
            List <InteractiveInfo> listInfos = null;

            try
            {
                listInfos = localDataRepository.getSpecialObject <List <InteractiveInfo> >(interactivesKey);
            }
            catch (Exception e)
            {
                GuLog.Info("<><InteractiveCountManager>LoadInteractiveCount error:" + e.ToString());
            }
            if (listInfos != null)
            {
                foreach (var info in listInfos)
                {
                    interactivesInfo.Add(info.interactiveId, info.interactiveCount);
                    GuLog.Debug("<><InteractiveCountManager>interactiveId:" + info.interactiveId + "    Count:" + info.interactiveCount.ToString());
                }
            }
        }
        private void OnDrinkWater(int intake, long drinkDuration)
        {
            if (TopViewHelper.Instance.IsInGuideView() || TopViewHelper.Instance.IsOpenedView(TopViewHelper.ETopView.eLanguageSetting))
            {
                GuLog.Debug("<><MainSceneView>eNoviceGuide is top!");
                return;
            }

            if (DrinkUtils.isValidDrink(intake, drinkDuration))
            {
                GuLog.Debug("<><MainSceneMediator>DrinkWaterCallback intake:<><>" + intake + "   drinkDuration:" + drinkDuration);
                FlurryUtil.LogEvent("Drink_Daily_count");

                dataProcess.DrinkWater(intake);
                dataManager.TodayDrinkTimes += 1;
            }
            else
            {
                dataProcess.DrinkFail();
            }
            closeSystemMenuSignal.Dispatch();
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 获取图片文件路径
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="languageShortName">指定语言</param>
        /// <returns></returns>
        public string GetImagePath(string key, string languageShortName = "")
        {
            if (string.IsNullOrEmpty(languageShortName))
            {
                languageShortName = this.GetLanguage();
            }

            string defaultPath = string.Format("CHS/{0}", key);

            if (this.resConfigs != null && this.resConfigs.ContainsKey(languageShortName) &&
                this.resConfigs[languageShortName].ImageElements != null)
            {
                ImageElement imageElement = this.resConfigs[languageShortName].ImageElements.Find(t => t.Key == key);
                GuLog.Debug(string.Format("----I18NConfig.GetImagePath----Key: {0}, FoundPath: {1}", key, imageElement != null ? imageElement.Value : defaultPath));
                return(imageElement != null ? imageElement.Value : defaultPath);
            }
            else
            {
                GuLog.Debug(string.Format("----I18NConfig.GetImagePath----Key: {0}, DefaultPath: {1}", key, defaultPath));
                return(defaultPath);
            }
        }
Ejemplo n.º 29
0
 public void DownloadNewsResource()
 {
     ClearExpiredNewEvent();
     spriteDownloadManager.StopCurrentReq();
     audioDownloadManager.StopCurrentReq();
     foreach (var newsEvent in GetNewsEventList())
     {
         if (!IsExpired(newsEvent.newsEvent))
         {
             if (newsEvent.eState == NewsEventState.Fresh || newsEvent.eState == NewsEventState.AudioOk)
             {
                 GuLog.Debug("<><NewsEventManager>DownloadNewsResource Sprite:" + newsEvent.spriteUrl.url);
                 spriteDownloadManager.DownloadSprite(newsEvent.spriteUrl, DownLoadSpriteResult);
             }
             if (newsEvent.eState == NewsEventState.Fresh || newsEvent.eState == NewsEventState.ImageOk)
             {
                 GuLog.Debug("<><NewsEventManager>DownloadNewsResource Audio:" + newsEvent.audioUrl.url);
                 audioDownloadManager.DownloadAudio(newsEvent.audioUrl, DownLoadAudioResult);
             }
         }
     }
 }
        private void saveData(RegisterResponseData info)
        {
            if (!string.IsNullOrEmpty(info.x_child_sn))
            {
                //Debug.LogFormat("--------SaveSN--------RegisterCupService.saveData: {0}", info.x_child_sn);
                mLocalChildInfoAgent.saveChildSN(info.x_child_sn);
                FlurryUtil.LogEvent("Pair_Get_Childsn_Sunccess_Event");
            }
            else
            {
                FlurryUtil.LogEvent("Pair_Get_Childsn_Fail_Event");
                GuLog.Warning("pair data childsn is null");
            }

            //删除本地数据
            this.LocalPetInfoAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear currentPet");
            this.LocalUnlockedPetsAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear unlockedPets");

            //保存网络数据
            //mLocalCupAgent.saveCupToken(CupBuild.getCupSn(), info.token);
            mNativeDataManager.saveToken(info.token);
            mLocalCupAgent.saveCupID(CupBuild.getCupSn(), info.x_cup_sn);
            LocalPetInfoAgent.saveCurrentPet(info.pet_model);
            //重新保存语言数据
            this.PlayerDataManager.SaveLanguage(this.PlayerDataManager.Language);

            if (info.timestamp > 0)
            {
                mTimeManager.setServerTime(info.timestamp * (1000L));
            }

            if (!string.IsNullOrEmpty(info.timezone))
            {
                mTimeManager.setTimeZone(info.timezone);
            }
        }