划船机优化

This commit is contained in:
lishuo committed 2022-06-10 19:31:07 +08:00
1 parent 2f64aa494f
commit 87a0e7fb6d
8 files changed
+109 -80

No files matched your search

@@ -295,6 +295,8 @@ public class RowerHomeScript : PFUIPanel
RowerData.PullChanged += PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.StartEvent += StartFunc;
RowerData.RowerResChanged -= ResChanged;
RowerData.RowerResChanged += ResChanged;
}
rowerType = new RowerType { type = 1, value = 500 };
HandleSelectType();
@@ -464,6 +466,7 @@ public class RowerHomeScript : PFUIPanel
int truelyTime = 0;
private void StartFunc(object sender, EventArgs e)
{
Debug.Log($"开始了:{openTimer}");
if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive())
{
print("当前有弹窗");
@@ -731,12 +734,16 @@ public class RowerHomeScript : PFUIPanel
transform.Find("ResBar/BtnSub").GetComponent<Button>().interactable = !(bool)sender;
transform.Find("ResBar/BtnAdd").GetComponent<Button>().interactable = !(bool)sender;
}
bool initRes = false;
private void ResChanged(object sender, EventArgs e)
{
if ((Convert.ToSingle(sender) >= 50) && slider)
Debug.Log(Convert.ToSingle(sender));
if (!initRes && slider)
{
slider.GetComponent<PFUISlider>().SetValue((Convert.ToSingle(sender) - 50) / 300f);
var origin = Convert.ToSingle(sender);
var wrapped = origin< 50 ? 50 : origin;
slider.GetComponent<PFUISlider>().SetValue((wrapped - 50) / 300f);
initRes = true;
}
}
@@ -798,6 +805,13 @@ public class RowerHomeScript : PFUIPanel
if (Rower == null)
{
//HandleDiscardDirect();
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Save the game?"), () =>
{
HandleSaveDirect();
UIManager.CloseConfirm();
}, 2, ()=> {
Init();
});
return;
}
if (RowerData == null) return;
@@ -827,6 +841,9 @@ public class RowerHomeScript : PFUIPanel
}
if (stopSeconds >= 2)
{
if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive())
return;
transform.Find("Stopped").gameObject.SetActive(true);
//if (stopSeconds == 6)
//{
@@ -1078,8 +1095,7 @@ public class RowerHomeScript : PFUIPanel
int pointCount = 0;
void PaintPullCurve(ushort y)
{
Debug.Log("收到拉力" + y + ","+ DateTime.Now.Ticks);
Debug.Log($"收到拉力 x={x} , y={y}");
//#if !UNITY_EDITOR
// if (!openTimer)
// {
@@ -1285,7 +1301,7 @@ public class RowerHomeScript : PFUIPanel
bool isFirstReset = false;
void HandleStatic()
{
var flag = Rower != null && RowerData != null;
var flag = Rower != null && RowerData != null && !(UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive());
if (transform.Find("Ready").gameObject.activeInHierarchy)
{
transform.Find("Ready/DeviceStatus").gameObject.SetActive(!flag);
@@ -135,6 +135,7 @@ public class RowerDeviceView : MonoBehaviour
UIManager.ShowConfirm("警告", "是否断开该设备?", () =>
{
device.Disconnect(false);
DeviceCache.Remove(device);
UIManager.CloseConfirm();
}, 2, () => {
UIManager.CloseConfirm();
@@ -151,6 +152,7 @@ public class RowerDeviceView : MonoBehaviour
var device = GetDevice();
if (device != null && device.State == DeviceState.Connected)
{
DeviceCache.Remove(device);
device.Disconnect(false);
}
UIManager.CloseConfirm();