Skip to content

Commit 71be3dc

Browse files
committed
增加setting模块
1 parent e8d8ab7 commit 71be3dc

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

Assets/Game/Scripts/Base/GameMode.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class GameMode : MonoBehaviour
2424
public static WebRequestManager WebRequest;
2525
public static AudioManager Audio;
2626
public static LocalizationManager Localization;
27+
public static SettingManager Setting;
2728

2829
/// <summary>
2930
/// 当前程序集
@@ -67,6 +68,7 @@ IEnumerator Start()
6768
WebRequest = GameFrameworkMode.GetModule<WebRequestManager>();
6869
Audio = GameFrameworkMode.GetModule<AudioManager>();
6970
Localization = GameFrameworkMode.GetModule<LocalizationManager>();
71+
Setting = GameFrameworkMode.GetModule<SettingManager>();
7072
#endregion
7173

7274
#region resource

Assets/GameFramework/Setting.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright>
3+
// Copyright (c) 2018 Zhang Yang. All rights reserved.
4+
// </copyright>
5+
// <describe> #设置管理器模块# </describe>
6+
// <email> [email protected] </email>
7+
// <time> #2018年7月22日 14点27分# </time>
8+
//-----------------------------------------------------------------------
9+
10+
using System.Collections;
11+
using System.Collections.Generic;
12+
using UnityEngine;
13+
14+
namespace GameFramework.Taurus
15+
{
16+
public sealed class SettingManager : GameFrameworkModule
17+
{
18+
#region 属性
19+
#endregion
20+
21+
public int GetQuality()
22+
{
23+
return PlayerPrefs.GetInt("QualitySettings", (int)QualitySettings.GetQualityLevel());
24+
}
25+
26+
public void SetQuality(int level)
27+
{
28+
PlayerPrefs.SetInt("QualitySettings", level);
29+
}
30+
31+
public float GetAllSoundVolume()
32+
{
33+
return PlayerPrefs.GetFloat("AllSoundVolume", 1.0f);
34+
}
35+
36+
public void SetAllSoundVolume(float volume)
37+
{
38+
PlayerPrefs.SetFloat("AllSoundVolume", volume);
39+
}
40+
41+
public float GetBackgrounddMusicVolumme()
42+
{
43+
return PlayerPrefs.GetFloat("BackgroundMusicVolume", 1.0f);
44+
}
45+
46+
public void SetBackgroundMusicVolume(float volume)
47+
{
48+
PlayerPrefs.SetFloat("BackgroundMusicVolume", volume);
49+
}
50+
51+
public void SetUISoundVolume(float volume)
52+
{
53+
PlayerPrefs.SetFloat("UISoundVolume", volume);
54+
}
55+
56+
public float GetUISoundVolume()
57+
{
58+
return PlayerPrefs.GetFloat("UISoundVolume", 1.0f);
59+
60+
}
61+
62+
public void SetSoundEffectVolume(float volume)
63+
{
64+
PlayerPrefs.SetFloat("SoundEffectVolume", volume);
65+
}
66+
67+
public float GetSoundEffectVolumme()
68+
{
69+
return PlayerPrefs.GetFloat("SoundEffectVolume", 1.0f);
70+
}
71+
72+
73+
public void SetInt(string key, int value)
74+
{
75+
PlayerPrefs.SetInt(key, value);
76+
}
77+
78+
public int GetInt(string key)
79+
{
80+
return PlayerPrefs.GetInt(key, 0);
81+
}
82+
83+
public void SetFloat(string key, float value)
84+
{
85+
PlayerPrefs.SetFloat(key, value);
86+
}
87+
88+
public float GetFloat(string key)
89+
{
90+
return PlayerPrefs.GetFloat(key, 0.0f);
91+
}
92+
93+
public void SetString(string key, string value)
94+
{
95+
PlayerPrefs.SetString(key, value);
96+
}
97+
98+
public string GetString(string key)
99+
{
100+
return PlayerPrefs.GetString(key, "");
101+
}
102+
103+
104+
public override void OnClose()
105+
{
106+
}
107+
}
108+
}

Assets/GameFramework/Setting/SettingManager.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)