void Save(ref bool saveState, string key, SystemSet systemSet) { mObjOn[(int)systemSet].SetActive(saveState); mObjOff[(int)systemSet].SetActive(!saveState); int state = saveState ? 1 : 0; PlayerPrefs.SetInt(key, state); switch (systemSet) { case SystemSet.SoundButton: AudioManager.Instance.EnableSound(saveState); break; case SystemSet.MusicButton: AudioManager.Instance.EnableVoice(saveState); break; case SystemSet.EffectButton: BattleInfoCtrl.Instance.SetEffect(saveState); break; case SystemSet.RangeButton: GameMethod.SetRange(saveState); break; } }
public override void InitWhenCreateModel() { // base.InitWhenCreateModel(); if (PlayerPrefs.HasKey(GameMethod.RangeVoc)) { int sKey = PlayerPrefs.GetInt(GameMethod.RangeVoc); bool state = (sKey == 1) ? true : false; GameMethod.SetRange(state); } bool effectState = false; if (PlayerPrefs.HasKey(GameMethod.EffectVoc)) { int sKey = PlayerPrefs.GetInt(GameMethod.EffectVoc); effectState = (sKey == 1) ? true : false; } GameMethod.SetEffect(effectState); InitSkillDic(SkillIdDic); InitSkillDic(BaseSkillIdDic); EventCenter.Broadcast(EGameEvent.eGameEvent_LocalPlayerInit); ResourceUnit WalkAudioClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_HERO_WALKSOUND + ConfigReader.GetHeroInfo(this.NpcGUIDType).un32WalkSound, ResourceType.ASSET); WalkAudioClip = WalkAudioClipUnit.Asset as AudioClip; ResourceUnit DeadAudioClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_HERO_DEADSOUND + ConfigReader.GetHeroInfo(this.NpcGUIDType).HeroDeathSould, ResourceType.ASSET); DeadAudioClip = DeadAudioClipUnit.Asset as AudioClip; ResourceUnit EnterAltarClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_ENTERALTAR_SOUND, ResourceType.ASSET); EnterAltarClip = EnterAltarClipUnit.Asset as AudioClip; ResourceUnit RebornClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_REBORN_SOUND, ResourceType.ASSET); RebornClip = RebornClipUnit.Asset as AudioClip; base.InitWhenCreateModel(); EventCenter.AddListener <UInt64>(EGameEvent.eGameEvent_GameOver, OnGameOver); OnCameraUpdatePosition(); }