|
|
@@ -118,11 +118,11 @@ public class UserSettings {
|
|
|
_ins = new UserSettings();
|
|
|
}
|
|
|
if (CommonConfig.SpecialVersion1) {
|
|
|
- if (PlayerPrefs.GetInt("sv1_UserSettings_1", 0) == 0) {
|
|
|
- PlayerPrefs.SetInt("sv1_UserSettings_1", 1);
|
|
|
+ if (PlayerPrefs.GetInt("sv1_UserSettings_2", 0) == 0) {
|
|
|
+ PlayerPrefs.SetInt("sv1_UserSettings_2", 1);
|
|
|
UserSettings us = _ins;
|
|
|
us.bowRotateConvert.screenSize = 60;
|
|
|
- us.bowRotateConvert.screenDistance = 0.5f;
|
|
|
+ us.bowRotateConvert.screenDistance = 1.5f;
|
|
|
us.Save();
|
|
|
}
|
|
|
}
|
|
|
@@ -162,29 +162,44 @@ public class BowRotateConvert {
|
|
|
public float screenSize = 60; //屏幕尺寸(英寸)
|
|
|
public float screenDistance = 2.5f; //玩家距离屏幕多远(米)
|
|
|
|
|
|
- // 游戏旋转角度 : 实际旋转角度
|
|
|
- public float GetRate() {
|
|
|
- double w = 16;
|
|
|
- double h = 9;
|
|
|
- double s = Convert.ToDouble(screenSize);
|
|
|
- double d = Convert.ToDouble(screenDistance);
|
|
|
- double r = 27.3 / 180 * Math.PI;
|
|
|
- double q = get_q();
|
|
|
- double s1 = s * 0.0254;
|
|
|
- double unit = Math.Sqrt(Math.Pow(s1, 2) / (Math.Pow(w, 2) + Math.Pow(h, 2)));
|
|
|
- double e = Math.Atan(q * unit / d);
|
|
|
- return (float) (r / e);
|
|
|
+ //获取合适的视野大小
|
|
|
+ public float GetFieldOfView() {
|
|
|
+ float w = 16;
|
|
|
+ float h = 9;
|
|
|
+ float s1 = screenSize * 0.0254f;
|
|
|
+ float unit = s1 / Mathf.Sqrt(w * w + h * h);
|
|
|
+ float screenHeight = 9 * unit;
|
|
|
+ return 2 * Mathf.Atan(screenHeight * 0.5f / screenDistance) * Mathf.Rad2Deg;
|
|
|
}
|
|
|
|
|
|
- private double get_q() {
|
|
|
- double w = 16;
|
|
|
- double h = 9;
|
|
|
- double s = 60.11;
|
|
|
- double d = 2.5;
|
|
|
- double e = 5.56 / 180 * Math.PI;
|
|
|
- double s1 = s * 0.0254;
|
|
|
- double unit = Math.Sqrt(Math.Pow(s1, 2) / (Math.Pow(w, 2) + Math.Pow(h, 2)));
|
|
|
- double q = Math.Tan(e) * d / unit;
|
|
|
- return q;
|
|
|
+ // 游戏旋转角度 : 实际旋转角度 (这个版本丢弃掉这个功能-所以直接返回1)
|
|
|
+ public float GetRate() {
|
|
|
+ return 1;
|
|
|
}
|
|
|
+
|
|
|
+ // 游戏旋转角度 : 实际旋转角度
|
|
|
+ // public float GetRate() {
|
|
|
+ // double w = 16;
|
|
|
+ // double h = 9;
|
|
|
+ // double s = Convert.ToDouble(screenSize);
|
|
|
+ // double d = Convert.ToDouble(screenDistance);
|
|
|
+ // double r = 27.3 / 180 * Math.PI;
|
|
|
+ // double q = get_q();
|
|
|
+ // double s1 = s * 0.0254;
|
|
|
+ // double unit = Math.Sqrt(Math.Pow(s1, 2) / (Math.Pow(w, 2) + Math.Pow(h, 2)));
|
|
|
+ // double e = Math.Atan(q * unit / d);
|
|
|
+ // return (float) (r / e);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // private double get_q() {
|
|
|
+ // double w = 16;
|
|
|
+ // double h = 9;
|
|
|
+ // double s = 60.11;
|
|
|
+ // double d = 2.5;
|
|
|
+ // double e = 5.56 / 180 * Math.PI;
|
|
|
+ // double s1 = s * 0.0254;
|
|
|
+ // double unit = Math.Sqrt(Math.Pow(s1, 2) / (Math.Pow(w, 2) + Math.Pow(h, 2)));
|
|
|
+ // double q = Math.Tan(e) * d / unit;
|
|
|
+ // return q;
|
|
|
+ // }
|
|
|
}
|