地球收藏问题,ios 蓝牙有返回值处理,划船机倒计时1时重置

This commit is contained in:
CaiYanPeng 2021-09-30 15:23:40 +08:00
parent 9511e30e50
commit 6501284bbc
9 changed files with 36 additions and 13 deletions

View File

@ -13,12 +13,12 @@ public class CountDownAnimation : PFUIPanel
{ {
} }
public void StartTime(UnityAction action) public void StartTime(UnityAction action,UnityAction action2)
{ {
HandleAnimation("5", action); HandleAnimation("5", action, action2);
} }
void HandleAnimation(string s, UnityAction action) void HandleAnimation(string s, UnityAction action, UnityAction action2)
{ {
var text = transform.Find("Text"); var text = transform.Find("Text");
text.GetComponent<Text>().text = s; text.GetComponent<Text>().text = s;
@ -35,13 +35,17 @@ public class CountDownAnimation : PFUIPanel
var flag = int.TryParse(s,out int a); var flag = int.TryParse(s,out int a);
if (flag) if (flag)
{ {
if (a == 1 && action2 != null)
{
action2.Invoke();
}
if (a - 1 == 0) if (a - 1 == 0)
{ {
HandleAnimation("Go", action); HandleAnimation("Go", action, action2);
} }
else else
{ {
HandleAnimation((a - 1).ToString(), action); HandleAnimation((a - 1).ToString(), action, action2);
} }
} }
}; };

View File

@ -74,7 +74,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
public void Reset() public void Reset()
{ {
Debug.Log("发送重置命令"); Debug.Log("发送重置命令"+this.controlPointCharacteristic.ToString());
hwInterface.WriteCharacteristic(this.controlPointCharacteristic, new byte[] { 0x01 }); hwInterface.WriteCharacteristic(this.controlPointCharacteristic, new byte[] { 0x01 });
} }
} }

View File

@ -347,7 +347,7 @@ namespace Assets.Scripts.Ble
public void StopScan() public void StopScan()
{ {
bleMobileThread.Stop(); bleMobileThread?.Stop();
} }
//发现服务列表 //发现服务列表
@ -391,8 +391,12 @@ namespace Assets.Scripts.Ble
//写入特征值 //写入特征值
public void WriteCharacteristic(BleCharacteristicInfo characteristic, byte[] data) public void WriteCharacteristic(BleCharacteristicInfo characteristic, byte[] data)
{ {
BluetoothLEHardwareInterface.WriteCharacteristic(characteristic.Peripheral.Address, characteristic.Service.Id.ToString(), characteristic.Id.ToString(), data, data.Length, false, (characteristicUUID) => { bool withResponse = false;
#if UNITY_IOS
withResponse = characteristic.Id.ToString().ToLower().Contains("2AD9".ToLower());
#endif
BluetoothLEHardwareInterface.WriteCharacteristic(characteristic.Peripheral.Address, characteristic.Service.Id.ToString(), characteristic.Id.ToString(), data, data.Length, withResponse, (characteristicUUID) => {
Debug.Log("相应" + characteristicUUID);
BluetoothLEHardwareInterface.Log("Write Succeeded"); BluetoothLEHardwareInterface.Log("Write Succeeded");
}); });
} }

View File

@ -73,6 +73,7 @@ public class Item : PFUIPanel, IPointerEnterHandler, IPointerExitHandler, IPoint
SetRounded(hot, 17); SetRounded(hot, 17);
//UIManager.AddEvent(this.gameObject, EventTriggerType.PointerClick, OnPointerClick); //UIManager.AddEvent(this.gameObject, EventTriggerType.PointerClick, OnPointerClick);
transform.GetComponent<Button>().onClick.RemoveAllListeners();
transform.GetComponent<Button>().onClick.AddListener(() => { transform.GetComponent<Button>().onClick.AddListener(() => {
if (onClick != null) if (onClick != null)
{ {

View File

@ -61,6 +61,10 @@ public class MainNav : MonoBehaviour
{ {
transform.Find("Exit").gameObject.SetActive(true); transform.Find("Exit").gameObject.SetActive(true);
} }
if (transform.Find("Home"))
{
transform.Find("Home").gameObject.SetActive(false);
}
} }
// Start is called before the first frame update // Start is called before the first frame update

View File

@ -81,6 +81,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
// } // }
// SceneManager.LoadScene("Ride"); // SceneManager.LoadScene("Ride");
//}); //});
Debug.Log(84);
transform.GetComponent<Button>().onClick.RemoveAllListeners();
transform.GetComponent<Button>().onClick.AddListener(() => transform.GetComponent<Button>().onClick.AddListener(() =>
{ {
//UIManager.ShowMapDetailPanel(myMap.Id); //UIManager.ShowMapDetailPanel(myMap.Id);
@ -109,6 +111,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
diff.Find("Text").GetComponent<Text>().text = myMap.Hard; diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D); tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode); tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
transform.Find("CollectImg").GetComponent<Button>().onClick.RemoveAllListeners();
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect); transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite = transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[myMap.IsFavorite]; UIManager.Instance.collectDict[myMap.IsFavorite];

View File

@ -166,6 +166,7 @@ public class RowerHomeScript : PFUIPanel
} }
if (!isPause) if (!isPause)
{ {
startTime = UIManager.Now.GetDateTime(); startTime = UIManager.Now.GetDateTime();
} }
TimerTicks(); TimerTicks();
@ -173,6 +174,13 @@ public class RowerHomeScript : PFUIPanel
timer = 1.0f; timer = 1.0f;
btnStart.GetComponent<Image>().sprite = spriteDict["Untagged"]; btnStart.GetComponent<Image>().sprite = spriteDict["Untagged"];
btnStart.tag = "Untagged"; btnStart.tag = "Untagged";
},
()=>
{
if (Rower != null)
{
Rower.Reset();
}
}); });
} }
else else

View File

@ -289,10 +289,10 @@ public class UIManager : MonoBehaviour
return this.GetPanelInstance("CountDown", ref this.mCountDownAnimation); return this.GetPanelInstance("CountDown", ref this.mCountDownAnimation);
} }
} }
public static void ShowCountDownAnimation(UnityAction action) public static void ShowCountDownAnimation(UnityAction action, UnityAction action2 = null)
{ {
UIManager.Show(UIManager.Instance.CountDownAnimation, null, true); UIManager.Show(UIManager.Instance.CountDownAnimation, null, true);
UIManager.Instance.CountDownAnimation.StartTime(action); UIManager.Instance.CountDownAnimation.StartTime(action,action2);
} }
#region #region
private RaceModalScript mRaceModalScript; private RaceModalScript mRaceModalScript;

View File

@ -38,7 +38,6 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}