修改细节,修复bug
This commit is contained in:
parent
06aefb93c4
commit
30e09c9c7a
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,79 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &512581023253864657
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3352968575790546772}
|
||||
- component: {fileID: 5194161964235640498}
|
||||
- component: {fileID: 1144697767514498682}
|
||||
m_Layer: 5
|
||||
m_Name: Panel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &3352968575790546772
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 512581023253864657}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6182801171780224340}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -245}
|
||||
m_SizeDelta: {x: 205, y: 38}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5194161964235640498
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 512581023253864657}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &1144697767514498682
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 512581023253864657}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &676752742128862401
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -138,7 +212,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 167, y: -226}
|
||||
m_AnchoredPosition: {x: 194.5, y: -226}
|
||||
m_SizeDelta: {x: 1, y: 38}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &6083926578620374178
|
||||
@ -526,6 +600,7 @@ RectTransform:
|
||||
- {fileID: 5297867286345066477}
|
||||
- {fileID: 7238412377813769565}
|
||||
- {fileID: 9197141820760920897}
|
||||
- {fileID: 3352968575790546772}
|
||||
m_Father: {fileID: 6445869985133304203}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -2601,7 +2676,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Start Free Mode
|
||||
m_Text: Just Row
|
||||
--- !u!114 &7238412377813769538
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2653,8 +2728,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 20, y: -226}
|
||||
m_SizeDelta: {x: 139, y: 38}
|
||||
m_AnchoredPosition: {x: 92.5, y: -226}
|
||||
m_SizeDelta: {x: 94, y: 38}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &7238412377813769543
|
||||
MonoBehaviour:
|
||||
@ -3260,7 +3335,7 @@ PrefabInstance:
|
||||
- target: {fileID: 3150550772099312288, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 176
|
||||
value: 203.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3150550772099312288, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
@ -3575,7 +3650,7 @@ PrefabInstance:
|
||||
- target: {fileID: 545917028276686471, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
value: 40
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3150550772099312288, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
@ -3687,6 +3762,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: BtnCancel
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3150550772099312289, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3150550772916003707, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_Text
|
||||
@ -3695,12 +3775,12 @@ PrefabInstance:
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
|
||||
@ -3710,8 +3710,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 152, y: 0}
|
||||
m_SizeDelta: {x: 54, y: 16}
|
||||
m_AnchoredPosition: {x: 150, y: 0}
|
||||
m_SizeDelta: {x: 56, y: 16}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &2307627167488625470
|
||||
CanvasRenderer:
|
||||
@ -4745,7 +4745,7 @@ PrefabInstance:
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 20
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
@ -4920,7 +4920,7 @@ PrefabInstance:
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 20
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||
type: 3}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@ public delegate void ChangeLanguageDelegate();
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5087/";
|
||||
public static string Host = "http://192.168.0.101:5083/";
|
||||
|
||||
public static string AppVersion = Application.version;
|
||||
|
||||
@ -223,6 +223,7 @@ public static class App
|
||||
InitLanguage();
|
||||
#if !UNITY_EDITOR
|
||||
//测试服务器
|
||||
//Host = "http://pf.juze.pro/";
|
||||
Host = "http://192.168.0.101:5083/";
|
||||
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
|
||||
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
|
||||
@ -243,6 +244,7 @@ public static class App
|
||||
//UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
|
||||
//TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
|
||||
#endif
|
||||
|
||||
if (!FB.IsInitialized)
|
||||
{
|
||||
FB.Init();
|
||||
|
||||
@ -18,8 +18,8 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
public bool IsOptional => false;
|
||||
|
||||
public static event EventHandler EnableChanged;
|
||||
private static bool? _isEnabled;
|
||||
public static bool? IsEnabled
|
||||
private static bool _isEnabled;
|
||||
public static bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set
|
||||
@ -55,7 +55,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
public static RowerTaskPanel.RowerType rowerType { get; private set; }
|
||||
public void HandleAttributeReceived(byte[] data)
|
||||
{
|
||||
Debug.Log("数据" + string.Join(",", data));
|
||||
//Debug.Log("数据" + string.Join(",", data));
|
||||
if (data[0] == 53)
|
||||
{
|
||||
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10);
|
||||
@ -67,7 +67,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
List<ushort> r = new List<ushort>();
|
||||
for (int i = 3; i < data.Length; i += 2)
|
||||
{
|
||||
ushort pull = data[i] < 10 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i])));
|
||||
ushort pull = Convert.ToUInt16(Math.Round(LbsToNewton(data[i])));
|
||||
r.Add(pull);
|
||||
PullValue = pull;
|
||||
}
|
||||
@ -94,6 +94,9 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
{
|
||||
rowerType = null;
|
||||
}
|
||||
//isReadyStatus = data[9] == 0;
|
||||
var time = ((data[3] << 16) + (data[2] << 8) + data[1]) / 100;
|
||||
Debug.Log("划船时间"+time);
|
||||
isReadyStatus = data[9] == 0;
|
||||
//isReadyStatus = data[2] == 1 || data[2] == 129;
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
{
|
||||
Debug.Log("中控台获取");
|
||||
this.controlPointCharacteristic = character;
|
||||
C2RowerData.IsEnabled = false;
|
||||
}
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.RowerData))
|
||||
{
|
||||
@ -79,7 +80,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerCourse))
|
||||
{
|
||||
Debug.Log("c2划船机课程数据" + service.Id);
|
||||
//C2RowerData.IsEnabled = true;
|
||||
C2RowerData.IsEnabled = true;
|
||||
this.hwInterface.SubscribeCharacteristic(character, null);
|
||||
}
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerControl))
|
||||
|
||||
@ -134,7 +134,7 @@ namespace Assets.Scripts.Ble
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//Debug.Log($"設備信息,{item.IdGuid},{string.Join(";",item.IdByteArray)}" );
|
||||
//Debug.Log($"設備信息,{item.IdGuid},{string.Join(";", item.IdByteArray)}");
|
||||
if (item.IdByteArray == ServiceUuids.Ftms)
|
||||
{
|
||||
if (App.IsRowerMode == true)
|
||||
@ -231,7 +231,6 @@ namespace Assets.Scripts.Ble
|
||||
callback?.Invoke(self, info, s);
|
||||
this.callbacks.Remove(info);
|
||||
Debug.Log("连接成功!"+info.Name);
|
||||
Devices.Ble.Characteristic.C2RowerData.IsEnabled = info.Name.Contains("PM");
|
||||
if (this.callbacks.Any())
|
||||
{
|
||||
this.ConnectPeripheral(this.callbacks.First().Key, this.callbacks.First().Value);
|
||||
|
||||
@ -51,6 +51,12 @@ public class RowerHomeScript : PFUIPanel
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Debug.Log("銷毀");
|
||||
if (RowerCommonDataInstance != null)
|
||||
{
|
||||
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
|
||||
}
|
||||
C2RowerData.EnableChanged -= ModeChanged;
|
||||
FtmsRowerData.RowerResChanged -= ResChanged;
|
||||
|
||||
}
|
||||
private IRowerDevice Rower
|
||||
@ -183,7 +189,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
|
||||
var c1 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_create_44"), () =>
|
||||
{
|
||||
//UIManager.ShowRowerWelldone("81A85D49-ACAA-C764-101A-02555E6AC81A");
|
||||
//UIManager.ShowRowerWelldone("3026214f-e6e0-4297-8668-f7177dbaebe4");
|
||||
//return;
|
||||
if (checkRowing()) return;
|
||||
if (C2RowerData.IsEnabled == true && C2RowerData.rowerType != null) return;
|
||||
@ -191,7 +197,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
rowerType = type;
|
||||
HandleSelectType();
|
||||
});
|
||||
},rowerType);
|
||||
}, false);
|
||||
//var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_continue_44"), () =>
|
||||
//{
|
||||
@ -212,21 +218,29 @@ public class RowerHomeScript : PFUIPanel
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("Stopped/Confirm/BtnDrop").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
transform.Find("Stopped").gameObject.SetActive(false);
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
if (C2RowerData.IsEnabled == true)
|
||||
{
|
||||
Utils.showToast(null, "Please press Menu to save.",int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: Init);
|
||||
}
|
||||
else
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
Discard();
|
||||
});
|
||||
if (RowerCommonDataInstance != null)
|
||||
{
|
||||
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
|
||||
RowerCommonDataInstance.PullChanged += PaintPullCurve;
|
||||
}
|
||||
Init();
|
||||
}
|
||||
private void Discard()
|
||||
{
|
||||
transform.Find("Stopped").gameObject.SetActive(false);
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
if (C2RowerData.IsEnabled == true)
|
||||
{
|
||||
Utils.showToast(null, @"Press ""Menu"" to save.", int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: Init);
|
||||
}
|
||||
else
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSelectType()
|
||||
{
|
||||
@ -290,7 +304,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
};
|
||||
if (C2RowerData.IsEnabled == true)
|
||||
{
|
||||
Utils.showToast(null, "Please press Menu to save.",int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: f);
|
||||
Utils.showToast(null, @"Press ""Menu"" to save.", int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -364,6 +378,12 @@ public class RowerHomeScript : PFUIPanel
|
||||
|
||||
private void StartFunc()
|
||||
{
|
||||
//设定一个标准 如果满足条件不让他开始
|
||||
if (C2RowerData.IsEnabled && RowerData != null && RowerData.ElapsedTime >= 5)
|
||||
{
|
||||
Utils.showToast(null, @"Press ""Menu"" to save.", stopFunc: () => RowerData.ElapsedTime < 5);
|
||||
return;
|
||||
}
|
||||
if (!isPause)
|
||||
{
|
||||
startTime = UIManager.Now.GetDateTime();
|
||||
@ -409,10 +429,10 @@ public class RowerHomeScript : PFUIPanel
|
||||
model.AvgPower = values.Average(x => x.power);
|
||||
model.AvgRate = values.Average(x => x.rate);
|
||||
model.AvgHeartRate = (int)values.Average(x => x.heartRate);
|
||||
model.StrokeCount = (ushort)values.Max(x=>x.strokeCount);
|
||||
model.TotalDistance = (ushort)values.Max(x => x.distance);
|
||||
}
|
||||
model.StrokeCount = RowerData.StrokeCount;
|
||||
model.TotalTime = RowerData.ElapsedTime;
|
||||
model.TotalDistance = RowerData.TotalDistance;
|
||||
model.Type = rowerType.type == 0 ? (int?)null : rowerType.type;
|
||||
model.TypeValue = rowerType.value == 0 ? (float?)null : rowerType.value;
|
||||
model.ShadowIds = string.Join(",",GetComponent<RowerMultiModeScript>().shadowList.Select(x=>x.Nid));
|
||||
@ -523,9 +543,11 @@ public class RowerHomeScript : PFUIPanel
|
||||
|
||||
private void ModeChanged(object sender, EventArgs e)
|
||||
{
|
||||
print("增加服务"+RowerData.ResistanceLevel);
|
||||
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
|
||||
RowerCommonDataInstance.PullChanged += PaintPullCurve;
|
||||
if (RowerCommonDataInstance != null)
|
||||
{
|
||||
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
|
||||
RowerCommonDataInstance.PullChanged += PaintPullCurve;
|
||||
}
|
||||
slider.GetComponent<Slider>().interactable = !(bool)sender;
|
||||
transform.Find("ResBar/BtnSub").GetComponent<Button>().interactable = !(bool)sender;
|
||||
transform.Find("ResBar/BtnAdd").GetComponent<Button>().interactable = !(bool)sender;
|
||||
@ -534,13 +556,14 @@ public class RowerHomeScript : PFUIPanel
|
||||
private void ResChanged(object sender, EventArgs e)
|
||||
{
|
||||
print("收到阻力" + sender);
|
||||
if ((Convert.ToSingle(sender) > 50))
|
||||
if ((Convert.ToSingle(sender) > 50) && slider)
|
||||
{
|
||||
slider.GetComponent<PFUISlider>().SetValue((Convert.ToSingle(sender) - 50) / 300f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool checkRowing()
|
||||
{
|
||||
if (seconds > 0)
|
||||
@ -590,27 +613,18 @@ public class RowerHomeScript : PFUIPanel
|
||||
var power = RowerData.InstantaneousPower;
|
||||
var rate = RowerData.StrokeRate;
|
||||
TempRowerCalc tmpdata = null;
|
||||
|
||||
//里程停止逻辑
|
||||
if (totalDistance == RowerData.TotalDistance)
|
||||
{
|
||||
//判定一次停止
|
||||
stopSeconds++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
stopSeconds = 0;
|
||||
transform.Find("Stopped").gameObject.SetActive(false);
|
||||
}
|
||||
//if (stopSeconds >= 91)
|
||||
//{
|
||||
// Debug.Log("保存");
|
||||
// HandleSaveDirect();
|
||||
// return;
|
||||
//}
|
||||
//else if (stopSeconds == 81)
|
||||
//{
|
||||
// Utils.showToast(null, "Record will be saved!", duration: 10, stopFunc: () => stopSeconds < 6, isLowest: true,showSeconds:true);
|
||||
// return;
|
||||
//}
|
||||
if (stopSeconds >= 2)
|
||||
{
|
||||
transform.Find("Stopped").gameObject.SetActive(true);
|
||||
@ -620,8 +634,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
//}
|
||||
if (rowerType.type == 2)
|
||||
{
|
||||
var remainTime = rowerType.value - (seconds++);
|
||||
if (remainTime == 0)
|
||||
var remainTime = rowerType.value - (++seconds);
|
||||
if (remainTime == 0)
|
||||
{
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},0,0,0,{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = 0, power = 0, rate = 0, heartRate = heartRate, distance = distance, energy = energy };
|
||||
@ -633,9 +647,9 @@ public class RowerHomeScript : PFUIPanel
|
||||
TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(++seconds).ToPFString();
|
||||
}
|
||||
mid.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
//bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
@ -650,7 +664,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
SendDataToRace(tmpdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
totalDistance = (uint)distance;
|
||||
|
||||
var pace = RowerData.InstantaneousPace;
|
||||
@ -697,7 +711,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
if (rowerType.type == 2)
|
||||
{
|
||||
var remainTime = rowerType.value - (seconds++);
|
||||
var remainTime = rowerType.value - (++seconds);
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
if (remainTime == 0)
|
||||
{
|
||||
@ -711,12 +725,12 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(++seconds).ToPFString();
|
||||
}
|
||||
if (rowerType.type == 1)
|
||||
{
|
||||
var remainDistance = rowerType.value - totalDistance;
|
||||
if (remainDistance < 0)
|
||||
if (remainDistance <= 0)
|
||||
{
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "0";
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
@ -732,10 +746,15 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = totalDistance.ToString();
|
||||
}
|
||||
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
|
||||
values.Add(tmpdata);
|
||||
SendDataToRace(tmpdata);
|
||||
if (C2RowerData.IsEnabled == true && C2RowerData.isReadyStatus && values.Count()>10)
|
||||
{
|
||||
HandleSaveDirect();
|
||||
}
|
||||
//Debug.Log(1);
|
||||
}
|
||||
void SendDataToRace(TempRowerCalc tmpdata)
|
||||
|
||||
@ -116,6 +116,10 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
_distance = _list[currentSecond].Distance;
|
||||
}
|
||||
x.currentDistance = _distance;
|
||||
if (x.isMine && rowerType.type == 1 && x.currentDistance > rowerType.value)
|
||||
{
|
||||
x.currentDistance = (int)rowerType.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
userList = userList.OrderByDescending(x => x.currentDistance).ToList();
|
||||
@ -195,7 +199,14 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
t.gameObject.SetActive(true);
|
||||
TweenCallback callback = () =>
|
||||
{
|
||||
Utils.DisplayImageTempDict(t.Find("Left/Avatar").GetComponent<RawImage>(), data.Avatar, caches);
|
||||
if (string.IsNullOrEmpty(data.Avatar))
|
||||
{
|
||||
t.Find("Left/Avatar").GetComponent<RawImage>().texture = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImageTempDict(t.Find("Left/Avatar").GetComponent<RawImage>(), data.Avatar, caches);
|
||||
}
|
||||
var _c = countryList.SingleOrDefault(x => x.country == data.Country);
|
||||
if (_c != null)
|
||||
{
|
||||
@ -287,12 +298,12 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
diffWidth = 100 - ((int)rowerType.value - data.currentDistance);
|
||||
}
|
||||
if (data.isMine)
|
||||
{
|
||||
print("diff:" + diffWidth + ";"+ rowerType.type);
|
||||
}
|
||||
//if (data.isMine)
|
||||
//{
|
||||
// print("diff:" + diffWidth + ";"+ rowerType.type);
|
||||
//}
|
||||
if (diffWidth >= 0 && diffWidth <= 100)
|
||||
{
|
||||
{
|
||||
var tWidth = (diffWidth / 100f) * width;
|
||||
t.Find("Main/Boat").gameObject.SetActive(true);
|
||||
//t.Find("Main/Boat").localPosition = new Vector3(25 + tWidth, t.Find("Main/Boat").localPosition.y, t.Find("Main/Boat").localPosition.z);
|
||||
@ -359,21 +370,27 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
game.transform.Find("Content/Country").GetComponent<Image>().sprite = Resources.Load<Sprite>(_c.source);
|
||||
}
|
||||
int _d = 0, _p = 0;
|
||||
if (currentSecond < 0 || item.list.Count == 0)
|
||||
{
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = "0M";
|
||||
game.transform.Find("Content/Power").GetComponent<Text>().text = "0W";
|
||||
|
||||
}
|
||||
else if (currentSecond >= 0 && currentSecond < item.list.Count)
|
||||
{
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = item.list[currentSecond].Distance.ToString("#0M");
|
||||
game.transform.Find("Content/Power").GetComponent<Text>().text = item.list[currentSecond].Power.ToString("#0W");
|
||||
_d = item.list[currentSecond].Distance;
|
||||
_p = item.list[currentSecond].Power;
|
||||
}
|
||||
else
|
||||
{
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = item.list[item.list.Count - 1].Distance.ToString("#0M");
|
||||
game.transform.Find("Content/Power").GetComponent<Text>().text = item.list[item.list.Count - 1].Power.ToString("#0W");
|
||||
_d = item.list[item.list.Count - 1].Distance;
|
||||
_p = item.list[item.list.Count - 1].Power;
|
||||
}
|
||||
if (item.isMine && rowerType.type == 1 && _d > rowerType.value)
|
||||
{
|
||||
_d = (int)rowerType.value;
|
||||
}
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = $"{_d}M";
|
||||
game.transform.Find("Content/Power").GetComponent<Text>().text = $"{_p}W";
|
||||
if (item.isMine)
|
||||
{
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
|
||||
@ -458,30 +475,56 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
var offset = pan.deltaTranslation;
|
||||
if (scroll.localPosition.x >= 30 || scroll.localPosition.x <= -760) return;
|
||||
scroll.localPosition += new Vector3(offset.x, 0, 0);
|
||||
}
|
||||
};
|
||||
pan.gestureCompleteEvent += (r) =>
|
||||
{
|
||||
float x = 0;
|
||||
foreach (Transform t in transform.Find("Rower/Dots"))
|
||||
string selDot = "";
|
||||
if (Color.Equals(transform.Find("Rower/Dots/d1").GetComponent<Image>().color, Utils.HexToColorHtml("#f93086")))
|
||||
{
|
||||
if (scroll.localPosition.x >= startPosition.x - ((730 * 1) / 10))
|
||||
{
|
||||
x = startPosition.x;
|
||||
selDot = "d1";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print(491);
|
||||
x = startPosition.x - 730;
|
||||
selDot = "d2";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scroll.localPosition.x >= startPosition.x - ((730 * 9) / 10))
|
||||
{
|
||||
x = startPosition.x;
|
||||
selDot = "d1";
|
||||
}
|
||||
else
|
||||
{
|
||||
x = startPosition.x - 730;
|
||||
selDot = "d2";
|
||||
}
|
||||
}
|
||||
foreach (Transform t in transform.Find("Rower/Dots"))
|
||||
{
|
||||
t.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
if (scroll.localPosition.x >= startPosition.x - (730 / 2))
|
||||
{
|
||||
x = startPosition.x;
|
||||
transform.Find("Rower/Dots/d1").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
else
|
||||
{
|
||||
x = startPosition.x - 730;
|
||||
transform.Find("Rower/Dots/d2").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
transform.Find($"Rower/Dots/{selDot}").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
scroll.DOLocalMoveX(x, 0.5f);
|
||||
PlayerPrefs.SetFloat("RowerMultiModeLocationX", x);
|
||||
};
|
||||
TouchKit.addGestureRecognizer(pan);
|
||||
print("注册触摸事件");
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
TouchKit.removeAllGestureRecognizers();
|
||||
}
|
||||
//交换A,B索引的赛道
|
||||
void ChangeTrace(int indexA, int indexB)
|
||||
|
||||
@ -24,7 +24,7 @@ public class RowerTaskPanel : PFUIPanel
|
||||
public float value { get; set; }
|
||||
}
|
||||
Transform selector, distance, time;
|
||||
RowerType rowerType;
|
||||
public RowerType rowerType;
|
||||
|
||||
public Action<RowerType> callBack { get; set; }
|
||||
|
||||
@ -84,12 +84,18 @@ public class RowerTaskPanel : PFUIPanel
|
||||
{
|
||||
base.Show();
|
||||
InitAll();
|
||||
InitValue();
|
||||
}
|
||||
private void Go()
|
||||
{
|
||||
if (rowerType.type == 0 || rowerType.value == 0)
|
||||
{
|
||||
Utils.showToast(null, "请选择课程");
|
||||
Utils.showToast(null, "Please select a course.", isOnly:true);
|
||||
return;
|
||||
}
|
||||
if (rowerType.type == 1 && rowerType.value < 100)
|
||||
{
|
||||
Utils.showToast(null, "Minimum mileage is 100M.", isOnly: true);
|
||||
return;
|
||||
}
|
||||
if (callBack != null)
|
||||
@ -129,7 +135,7 @@ public class RowerTaskPanel : PFUIPanel
|
||||
}
|
||||
if (float.TryParse(s, out float b))
|
||||
{
|
||||
if (b < 0 || b > 59)
|
||||
if (b < 0 || b > 59)
|
||||
{
|
||||
Utils.showToast(null, "Please enter an integer between 0-59.");
|
||||
time.Find("CustomizeS").GetComponent<InputField>().text = "";
|
||||
@ -151,6 +157,7 @@ public class RowerTaskPanel : PFUIPanel
|
||||
btn.onClick.RemoveAllListeners();
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
InitAll();
|
||||
rowerType.type = btn.transform.parent.name == "Distance" ? 1 : 2;
|
||||
if (calcButton == null)
|
||||
{
|
||||
@ -168,6 +175,16 @@ public class RowerTaskPanel : PFUIPanel
|
||||
var input = item as PFUIInputField;
|
||||
input.CustomSelect = () =>
|
||||
{
|
||||
string ignoreName = null;
|
||||
if (input.name == "CustomizeMin")
|
||||
{
|
||||
ignoreName = "CustomizeS";
|
||||
}
|
||||
else if (input.name == "CustomizeS")
|
||||
{
|
||||
ignoreName = "CustomizeMin";
|
||||
}
|
||||
InitAll(ignoreName);
|
||||
ClickDistanceBtn(null, btns);
|
||||
rowerType.type = input.transform.parent.name == "Distance" ? 1 : 2;
|
||||
SetTextColor(input.gameObject, true);
|
||||
@ -220,22 +237,68 @@ public class RowerTaskPanel : PFUIPanel
|
||||
bg.GetComponent<Outline>().enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitAll()
|
||||
public readonly Dictionary<int, List<double>> stdList = new Dictionary<int, List<double>>
|
||||
{
|
||||
{ 1,new List<double>() { 500,1000,2000,5000,10000 }},
|
||||
{ 2,new List<double>() { 1800 }}
|
||||
};
|
||||
private void InitAll(string igName = null)
|
||||
{
|
||||
foreach (var item in formList)
|
||||
{
|
||||
if (item is Button)
|
||||
{
|
||||
SetButtonColor(item as Button, false);
|
||||
var btn = item as Button;
|
||||
if (btn.name == igName) continue;
|
||||
SetButtonColor(btn, false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var i = item as PFUIInputField;
|
||||
if (i.name == igName) continue;
|
||||
i.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
private void InitValue()
|
||||
{
|
||||
foreach (var item in formList)
|
||||
{
|
||||
if (item is Button)
|
||||
{
|
||||
var btn = item as Button;
|
||||
var flag = (rowerType.type == 1 && string.Equals(rowerType.value.ToString(), btn.name.Replace("Btn", ""))) ||
|
||||
(rowerType.type == 2 && rowerType.value == 1800 && btn.name == "Btn30");
|
||||
SetButtonColor(btn, flag);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var i = item as PFUIInputField;
|
||||
i.Text = "";
|
||||
if (stdList.ContainsKey(rowerType.type) && !stdList[rowerType.type].Contains(rowerType.value))
|
||||
{
|
||||
if (rowerType.type == 1 && i.name == "Customize")
|
||||
{
|
||||
i.Text = rowerType.value.ToString();
|
||||
}
|
||||
else if (rowerType.type == 2)
|
||||
{
|
||||
var ts = TimeSpan.FromSeconds(rowerType.value);
|
||||
if (i.name == "CustomizeMin")
|
||||
{
|
||||
i.Text = ts.Minutes.ToString();
|
||||
}
|
||||
else if (i.name == "CustomizeS")
|
||||
{
|
||||
i.Text = ts.Seconds.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ClickDistanceBtn(Button btn, IEnumerable<Button> list)
|
||||
{
|
||||
foreach (var item in list)
|
||||
|
||||
@ -116,7 +116,7 @@ public class RowerWelldone : PFUIPanel
|
||||
game.transform.Find("Content/Rank").GetComponent<Text>().text = (i + 1).ToString("00");
|
||||
game.transform.Find("Content/NickName").GetComponent<Text>().text = item.NickName;
|
||||
Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.WxHeadImg, caches);
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = data.info.Type == 1 ? TimeSpan.FromSeconds(item.Time).ToString() : item.TotalDistance.ToString("#0M");
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = data.info.Type == 1 ? TimeSpan.FromSeconds(item.Time).ToString(@"hh\:mm\:ss") : item.TotalDistance.ToString("#0M");
|
||||
game.transform.SetParent(rankContent);
|
||||
game.transform.localScale = Vector3.one;
|
||||
game.SetActive(true);
|
||||
|
||||
@ -352,8 +352,9 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("RowerTaskPanel", ref this.mRowerTaskPanel);
|
||||
}
|
||||
}
|
||||
public static void ShowRowerTaskPanel(Action<RowerTaskPanel.RowerType> callBack)
|
||||
public static void ShowRowerTaskPanel(Action<RowerTaskPanel.RowerType> callBack, RowerTaskPanel.RowerType type)
|
||||
{
|
||||
UIManager.Instance.RowerTaskPanel.rowerType = type;
|
||||
UIManager.Instance.RowerTaskPanel.callBack = callBack;
|
||||
UIManager.Show(UIManager.Instance.RowerTaskPanel, null, true);
|
||||
}
|
||||
|
||||
@ -78,8 +78,8 @@ public class Toast : MonoBehaviour
|
||||
}
|
||||
//Fade out
|
||||
yield return fadeInAndOut(txt, false, 0.5f);
|
||||
|
||||
gameObject.SetActive(false);
|
||||
DestroyImmediate(gameObject);
|
||||
//gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator fadeInAndOut(Text targetText, bool fadeIn, float duration)
|
||||
|
||||
@ -21,14 +21,22 @@ namespace Assets.Scripts
|
||||
{
|
||||
public static string ToPFString(this TimeSpan t)
|
||||
{
|
||||
var s = "00:00:00";
|
||||
var r = t.ToString(@"hh\:mm\:ss");
|
||||
int i = 0;
|
||||
for (; i < r.Length; i++)
|
||||
if (t.TotalSeconds >= 60)
|
||||
{
|
||||
if (s[i] != r[i]) break;
|
||||
var s = "00:00:00";
|
||||
var r = t.ToString(@"hh\:mm\:ss");
|
||||
int i = 0;
|
||||
for (; i < r.Length; i++)
|
||||
{
|
||||
if (s[i] != r[i]) break;
|
||||
}
|
||||
return r.Substring(i, r.Length - i);
|
||||
}
|
||||
return r.Substring(i, r.Length - i);
|
||||
else
|
||||
{
|
||||
return $":{t.TotalSeconds.ToString("#0")}";
|
||||
}
|
||||
|
||||
}
|
||||
/*获取ip*/
|
||||
public enum ADDRESSFAM
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user