private void InitAudio() { //初始化的时候,去获取音源组件 audioSource = GameTool.GetTheChildComponent <AudioSource>(this.gameObject, "AudioManager"); if (!GameTool.HasKey("AudioValue")) { GameTool.SetFloat("AudioValue", 0.5f); audioValue = 0.5f; } else { audioValue = GameTool.GetFloat("AudioValue"); audioSource.volume = audioValue; } if (!GameTool.HasKey("Mute")) { GameTool.SetString("Mute", "false"); isMute = false; } else { isMute = bool.Parse(GameTool.GetString("Mute")); audioSource.mute = isMute; } }
//初始化背包数据的方法 public void InitData() { // GameTool.DeleteAll();//测试用 if (!GameTool.HasKey("PackData")) { GameTool.SetString("PackData", "1'0;2'30;3'10;4'20;5'60;6'0;7'0;8'0;9'0;10'0;11'0;12'0;13'0;14'0;15'0;16'0;17'0;18'0;19'0;20'0;21'0;22'0"); } string data = GameTool.GetString("PackData"); string[] arrData = data.Split(';'); ToDictionary(arrData); }
public void InitData() { if (!GameTool.HasKey("CoinCount")) { GameTool.SetInt("CoinCount", 100); } coinCount = GameTool.GetInt("CoinCount"); if (!GameTool.HasKey("RedCount")) { GameTool.SetInt("RedCount", 20); } redCount = GameTool.GetInt("RedCount"); }
void Awake() { //GameTool.DeleteAll();//测试用 if (!GameTool.HasKey("CurrentLevel")) { GameTool.SetInt("CurrentLevel", 1); currentMaxLevel = 1; } else { currentMaxLevel = GameTool.GetInt("CurrentLevel"); } }