|
@@ -5,8 +5,8 @@ using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class GameDebug : MonoBehaviour
|
|
public class GameDebug : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
- [SerializeField] Slider speedSlider;
|
|
|
|
|
- [SerializeField] Slider distanceSlider;
|
|
|
|
|
|
|
+ [SerializeField] InputField speedInput;
|
|
|
|
|
+ [SerializeField] InputField distanceInput;
|
|
|
[SerializeField] Text absoluteAngleText;
|
|
[SerializeField] Text absoluteAngleText;
|
|
|
[SerializeField] InputField offsetAngleInput;
|
|
[SerializeField] InputField offsetAngleInput;
|
|
|
[SerializeField] Text logText;
|
|
[SerializeField] Text logText;
|
|
@@ -23,8 +23,10 @@ public class GameDebug : MonoBehaviour
|
|
|
void Start()
|
|
void Start()
|
|
|
{
|
|
{
|
|
|
BowCamera.ins.enabled = false;
|
|
BowCamera.ins.enabled = false;
|
|
|
- onSlider();
|
|
|
|
|
- onSlider1();
|
|
|
|
|
|
|
+ speedInput.onEndEdit.AddListener(onSpeedInput);
|
|
|
|
|
+ distanceInput.onEndEdit.AddListener(onDistanceInput);
|
|
|
|
|
+ onSpeedInput(null);
|
|
|
|
|
+ onDistanceInput(null);
|
|
|
loaded = true;
|
|
loaded = true;
|
|
|
caluculateAbsoluteAngle();
|
|
caluculateAbsoluteAngle();
|
|
|
//增加射程卡
|
|
//增加射程卡
|
|
@@ -35,18 +37,29 @@ public class GameDebug : MonoBehaviour
|
|
|
LoginMgr.myUserInfo.bagList.Add(propInfo);
|
|
LoginMgr.myUserInfo.bagList.Add(propInfo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void onSlider()
|
|
|
|
|
|
|
+ public void onSpeedInput(string s)
|
|
|
{
|
|
{
|
|
|
- float value = speedSlider.value;
|
|
|
|
|
- speedSlider.GetComponentInChildren<Text>().text = "发射速度 " + (value).ToString("#0.00") + "m/s";
|
|
|
|
|
|
|
+ float value = 60;
|
|
|
|
|
+ try {
|
|
|
|
|
+ value = float.Parse(speedInput.text);
|
|
|
|
|
+ } catch (System.Exception) {
|
|
|
|
|
+ Log("发射速度解析错误\n已重置为默认值");
|
|
|
|
|
+ }
|
|
|
Arrow.speed = GameMgr.RealSizeToGameSize(value);
|
|
Arrow.speed = GameMgr.RealSizeToGameSize(value);
|
|
|
caluculateAbsoluteAngle();
|
|
caluculateAbsoluteAngle();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void onSlider1()
|
|
|
|
|
|
|
+ public void onDistanceInput(string s)
|
|
|
{
|
|
{
|
|
|
- float value = distanceSlider.value;
|
|
|
|
|
- distanceSlider.GetComponentInChildren<Text>().text = "靶心距离 " + (value).ToString("#0.00") + "m";
|
|
|
|
|
|
|
+ float value = 50;
|
|
|
|
|
+ try {
|
|
|
|
|
+ value = float.Parse(distanceInput.text);
|
|
|
|
|
+ } catch (System.Exception) {
|
|
|
|
|
+ Log("靶心距离解析错误\n已重置为默认值");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (value < 10 || value > 70) {
|
|
|
|
|
+ Log("靶心距离超出范围\n超出合法区间");
|
|
|
|
|
+ }
|
|
|
TargetBody target = GameObject.Find("GameArea/010").GetComponentInChildren<TargetBody>();
|
|
TargetBody target = GameObject.Find("GameArea/010").GetComponentInChildren<TargetBody>();
|
|
|
target.SetDistance(value);
|
|
target.SetDistance(value);
|
|
|
caluculateAbsoluteAngle();
|
|
caluculateAbsoluteAngle();
|