Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp

This commit is contained in:
Caiyanpeng committed 2022-06-01 16:10:35 +08:00
commit 475250e795
7 files changed
+44 -45

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ namespace Assets.Scripts.UI.Control
private Text text;
//private Texture2D cursor;
private Outline outline;
private Button mButton;
public Button mButton { get;set; }
private Sequence se = null;
private Sequence a;
private TweenerCore<float, float, FloatOptions> b;
@@ -14,7 +14,7 @@ using Assets.Scripts.Devices;
public class ConnectDeviceModal : PFUIPanel
{
private float timer = 1.0f;
private float timer = 0f;
private SensorType mSensorType = SensorType.None;
public SensorType SensorType {
get {
@@ -59,7 +59,7 @@ public class ConnectDeviceModal : PFUIPanel
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
noDevice = container.Find("NoDevice").GetComponent<Text>();
noDevice.text = App.GetLocalString("NO DEVICE");
searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>();
_x = searchIconRect.localPosition.x;
_y = searchIconRect.localPosition.y;
@@ -147,7 +147,7 @@ public class ConnectDeviceModal : PFUIPanel
if(timer <= 0)
{
SearchDevice();
timer = 1.0f;
timer += 1.0f;
}
Move();
@@ -222,21 +222,6 @@ public class ConnectDeviceModal : PFUIPanel
if (firstDevice != null)
{
firstDevice.Set(true);
var trainer = SensorType == SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
var nontrainer = firstDevice.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
if(trainer || nontrainer)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
//connectBtn.text.text = "DISCOUNECT";
noDevice.text = firstDevice.DeviceInfo.Name;
}
else
{
@@ -253,6 +238,9 @@ public class ConnectDeviceModal : PFUIPanel
// firstDevice = devicesTemp.FirstOrDefault(d=>d)
//}
}
//如果没有可连接的设备按钮只读
connectBtn.mButton.enabled = deviceList.Count > 0;
connectBtn.mButton.interactable = deviceList.Count > 0;
}
}
//选中需要连接的设备
@@ -278,6 +266,16 @@ public class ConnectDeviceModal : PFUIPanel
item.Value.Set(false);
}
}
noDevice.text = deviceItemObj.DeviceInfo.Name + "-"+ deviceItemObj.DeviceInfo.DeviceNumber;
if (deviceItemObj.DeviceInfo.State == DeviceState.Connected)
{
noDevice.color = Color.white;
}
else
{
noDevice.color = Utils.HexToColor("5C5C6E");
}
}
public override void Show()
@@ -70,7 +70,7 @@ public class DeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
#if UNITY_IOS || UNITY_ANDROID
unconnectionButton = unconnectionPanel.GetComponent<Button>();
@@ -279,7 +279,7 @@ public class DeviceView : MonoBehaviour
connectionPanel.SetActive(false);
logo.sprite = sprite0;
noDevice.text = App.GetLocalString("NO DEVICE");
searchState.text = App.GetLocalString("Searching...");
var hasDevice = false;
@@ -289,6 +289,7 @@ public class DeviceView : MonoBehaviour
else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
}
noDevice.text = hasDevice? App.GetLocalString("CHOOSE DEVICE") : App.GetLocalString("NO DEVICE");
//Debug.Log(hasDevice);
if (hasDevice)
{
@@ -306,7 +307,7 @@ public class DeviceView : MonoBehaviour
#if !(UNITY_IOS || UNITY_ANDROID)
mSearchButton.SetActive(true);
#endif
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
}
}
else if(connectedDevice.State == DeviceState.Connecting)
@@ -870,10 +870,14 @@ public class RowerHomeScript : PFUIPanel
{
try
{
var files = Directory.GetFiles(PFConstants.RowerRecordCacheFolder);
if (files.Length > 0)
var dir = $"{PFConstants.RowerRecordCacheFolder}/{App.CurrentUser.Id}/";
var hasLocalData = Directory.Exists(dir);
if (hasLocalData)
{
UIManager.ShowConfirm(App.GetLocalString("Warn"), App.GetLocalString("continue a game?"), () =>
var files = Directory.GetFiles(dir);
if (files.Length == 0)
return;
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Continue the game?"), () =>
{
var str = File.ReadAllText(files[0]);
var list = str.Replace("\r\n", " ").Split(' ');
@@ -925,7 +929,12 @@ public class RowerHomeScript : PFUIPanel
{
try
{
var path = $"{PFConstants.RowerRecordCacheFolder}/{Id}.txt";
var dir = $"{PFConstants.RowerRecordCacheFolder}/{App.CurrentUser.Id}/";
var path = $"{dir}/{Id}.txt";
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
File.WriteAllText(path, string.Join("\r\n", records));
PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}");
}