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

This commit is contained in:
CaiYanPeng 2022-06-01 16:10:35 +08:00
commit 475250e795
7 changed files with 44 additions and 45 deletions

View File

@ -179,7 +179,6 @@ GameObject:
- component: {fileID: 7672791435969097068} - component: {fileID: 7672791435969097068}
- component: {fileID: 740803332586528087} - component: {fileID: 740803332586528087}
- component: {fileID: 913971118869806231} - component: {fileID: 913971118869806231}
- component: {fileID: 3736854379713315744}
m_Layer: 5 m_Layer: 5
m_Name: NoDevice m_Name: NoDevice
m_TagString: Untagged m_TagString: Untagged
@ -246,20 +245,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: NO DEVICE m_Text:
--- !u!114 &3736854379713315744
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3184548043826394215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e47f6ee11b78f3247a0b474b6c36e2cd, type: 3}
m_Name:
m_EditorClassIdentifier:
key:
--- !u!1 &3878003491430181822 --- !u!1 &3878003491430181822
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -3615,6 +3615,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3a8eec0d4bf3f4841982794180df6e10, type: 3} m_Script: {fileID: 11500000, guid: 3a8eec0d4bf3f4841982794180df6e10, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
newNav: {fileID: 0}
--- !u!222 &454099902603697846 --- !u!222 &454099902603697846
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4611,7 +4612,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 21300000, guid: a38e5e467140caa4d9bd38fd08291bf7, type: 3} m_Sprite: {fileID: 21300000, guid: c8c6fdc9e45c8c246ba0619dbba0abdf, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1

View File

@ -205,7 +205,8 @@
"Cadence Sensor": "踏频", "Cadence Sensor": "踏频",
"Speed Meter": "速度计", "Speed Meter": "速度计",
"Heart Rate Monitor": "心率带", "Heart Rate Monitor": "心率带",
"NO DEVICE": "尚未连接设备", "NO DEVICE": "无可用设备",
"CHOOSE DEVICE": "查看可用设备",
"Edit": "编辑", "Edit": "编辑",
"Record": "记录", "Record": "记录",
"More": "更多", "More": "更多",
@ -363,7 +364,8 @@
"Minimum time is 20s.": "最低时间是20s", "Minimum time is 20s.": "最低时间是20s",
"Please enter an integer between 0-59.": "请输入一个0-59的整数", "Please enter an integer between 0-59.": "请输入一个0-59的整数",
"Please check the network status!": "请检查网络连接是否正常!", "Please check the network status!": "请检查网络连接是否正常!",
"FINISH": "终点" "FINISH": "终点",
"Continue the game?": "有中断的划船记录,是否继续?"
}, },
"en": { "en": {
"HOT ROUTES": "HOT ROUTES", "HOT ROUTES": "HOT ROUTES",
@ -450,6 +452,7 @@
"Cancel Reserve": "Cancel Reserve", "Cancel Reserve": "Cancel Reserve",
"Smart Trainer": "Smart Trainer", "Smart Trainer": "Smart Trainer",
"NO DEVICE": "NO DEVICE", "NO DEVICE": "NO DEVICE",
"CHOOSE DEVICE": "CHOOSE DEVICE",
"CONNECT": "CONNECT", "CONNECT": "CONNECT",
"CLOSE": "CLOSE", "CLOSE": "CLOSE",
"PAIR": "PAIR", "PAIR": "PAIR",
@ -721,6 +724,7 @@
"Minimum time is 20s.": "Minimum time is 20s.", "Minimum time is 20s.": "Minimum time is 20s.",
"Please enter an integer between 0-59.": "Please enter an integer between 0-59.", "Please enter an integer between 0-59.": "Please enter an integer between 0-59.",
"Please check the network status!": "Please check if the network connection is normal!", "Please check the network status!": "Please check if the network connection is normal!",
"FINISH": "FINISH" "FINISH": "FINISH",
"Continue the game?": "Continue the game?"
} }
} }

View File

@ -33,7 +33,7 @@ namespace Assets.Scripts.UI.Control
private Text text; private Text text;
//private Texture2D cursor; //private Texture2D cursor;
private Outline outline; private Outline outline;
private Button mButton; public Button mButton { get;set; }
private Sequence se = null; private Sequence se = null;
private Sequence a; private Sequence a;
private TweenerCore<float, float, FloatOptions> b; private TweenerCore<float, float, FloatOptions> b;

View File

@ -14,7 +14,7 @@ using Assets.Scripts.Devices;
public class ConnectDeviceModal : PFUIPanel public class ConnectDeviceModal : PFUIPanel
{ {
private float timer = 1.0f; private float timer = 0f;
private SensorType mSensorType = SensorType.None; private SensorType mSensorType = SensorType.None;
public SensorType SensorType { public SensorType SensorType {
get { get {
@ -59,7 +59,7 @@ public class ConnectDeviceModal : PFUIPanel
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>(); content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
noDevice = container.Find("NoDevice").GetComponent<Text>(); noDevice = container.Find("NoDevice").GetComponent<Text>();
noDevice.text = App.GetLocalString("NO DEVICE");
searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>(); searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>();
_x = searchIconRect.localPosition.x; _x = searchIconRect.localPosition.x;
_y = searchIconRect.localPosition.y; _y = searchIconRect.localPosition.y;
@ -147,7 +147,7 @@ public class ConnectDeviceModal : PFUIPanel
if(timer <= 0) if(timer <= 0)
{ {
SearchDevice(); SearchDevice();
timer = 1.0f; timer += 1.0f;
} }
Move(); Move();
@ -222,21 +222,6 @@ public class ConnectDeviceModal : PFUIPanel
if (firstDevice != null) if (firstDevice != null)
{ {
firstDevice.Set(true); 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 else
{ {
@ -253,6 +238,9 @@ public class ConnectDeviceModal : PFUIPanel
// firstDevice = devicesTemp.FirstOrDefault(d=>d) // 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); 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() public override void Show()

View File

@ -70,7 +70,7 @@ public class DeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject; mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject; mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>(); searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
mPairButton.SetActive(false); //mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject; connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
#if UNITY_IOS || UNITY_ANDROID #if UNITY_IOS || UNITY_ANDROID
unconnectionButton = unconnectionPanel.GetComponent<Button>(); unconnectionButton = unconnectionPanel.GetComponent<Button>();
@ -279,7 +279,7 @@ public class DeviceView : MonoBehaviour
connectionPanel.SetActive(false); connectionPanel.SetActive(false);
logo.sprite = sprite0; logo.sprite = sprite0;
noDevice.text = App.GetLocalString("NO DEVICE");
searchState.text = App.GetLocalString("Searching..."); searchState.text = App.GetLocalString("Searching...");
var hasDevice = false; var hasDevice = false;
@ -289,6 +289,7 @@ public class DeviceView : MonoBehaviour
else { else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType); hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
} }
noDevice.text = hasDevice? App.GetLocalString("CHOOSE DEVICE") : App.GetLocalString("NO DEVICE");
//Debug.Log(hasDevice); //Debug.Log(hasDevice);
if (hasDevice) if (hasDevice)
{ {
@ -306,7 +307,7 @@ public class DeviceView : MonoBehaviour
#if !(UNITY_IOS || UNITY_ANDROID) #if !(UNITY_IOS || UNITY_ANDROID)
mSearchButton.SetActive(true); mSearchButton.SetActive(true);
#endif #endif
mPairButton.SetActive(false); //mPairButton.SetActive(false);
} }
} }
else if(connectedDevice.State == DeviceState.Connecting) else if(connectedDevice.State == DeviceState.Connecting)

View File

@ -870,10 +870,14 @@ public class RowerHomeScript : PFUIPanel
{ {
try try
{ {
var files = Directory.GetFiles(PFConstants.RowerRecordCacheFolder); var dir = $"{PFConstants.RowerRecordCacheFolder}/{App.CurrentUser.Id}/";
if (files.Length > 0) 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 str = File.ReadAllText(files[0]);
var list = str.Replace("\r\n", " ").Split(' '); var list = str.Replace("\r\n", " ").Split(' ');
@ -925,7 +929,12 @@ public class RowerHomeScript : PFUIPanel
{ {
try 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)); File.WriteAllText(path, string.Join("\r\n", records));
PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}"); PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}");
} }