倒计时;三按钮弹窗
This commit is contained in:
parent
85e0a13f08
commit
b74c3b57b4
55
Assets/CountDownAnimation.cs
Normal file
55
Assets/CountDownAnimation.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CountDownAnimation : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
public void StartTime(UnityAction action)
|
||||
{
|
||||
HandleAnimation("5", action);
|
||||
}
|
||||
|
||||
void HandleAnimation(string s, UnityAction action)
|
||||
{
|
||||
GetComponent<Text>().text = s;
|
||||
transform.GetComponent<RectTransform>().DOScale(Vector3.one * 2, 0.5f).onComplete = () =>
|
||||
{
|
||||
transform.GetComponent<RectTransform>().DOScale(Vector3.one * 0.5f, 0.5f).onComplete = ()=>
|
||||
{
|
||||
if (s == "Go")
|
||||
{
|
||||
action.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
var flag = int.TryParse(s,out int a);
|
||||
if (flag)
|
||||
{
|
||||
if (a - 1 == 0)
|
||||
{
|
||||
HandleAnimation("Go", action);
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleAnimation((a - 1).ToString(), action);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/CountDownAnimation.cs.meta
Normal file
11
Assets/CountDownAnimation.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85535621a7b20f24b91b9a8e80b84ffa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1198
Assets/Resources/UI/Prefab/Common/Mobile/Confirm3.prefab
Normal file
1198
Assets/Resources/UI/Prefab/Common/Mobile/Confirm3.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d6f8e10355e98d448b11c62e45d8eba
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Assets/Resources/UI/Prefab/Panel/Mobile/CountDown.prefab
Normal file
93
Assets/Resources/UI/Prefab/Panel/Mobile/CountDown.prefab
Normal file
@ -0,0 +1,93 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7988615406063986404
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7988615406063986403}
|
||||
- component: {fileID: 7988615406063986401}
|
||||
- component: {fileID: 7988615406063986402}
|
||||
- component: {fileID: 7988615406063986400}
|
||||
m_Layer: 5
|
||||
m_Name: CountDown
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7988615406063986403
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7988615406063986404}
|
||||
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: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7988615406063986401
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7988615406063986404}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &7988615406063986402
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7988615406063986404}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 50
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 3
|
||||
m_MaxSize: 50
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 5
|
||||
--- !u!114 &7988615406063986400
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7988615406063986404}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 85535621a7b20f24b91b9a8e80b84ffa, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 562fb3955c04633419fe1ebb55a0c9eb
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -382,6 +382,12 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!224 &1528219284 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7988615405411164279}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1678571397
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -473,7 +479,7 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 1713454709}
|
||||
- {fileID: 1528219284}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -490,12 +496,6 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1678571397}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!224 &1713454709 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8180001678066936986}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1944211662
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -579,122 +579,122 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 48.593002, y: -4.8190002, z: -6.4140005}
|
||||
--- !u!1001 &8180001678066936986
|
||||
--- !u!1001 &7988615405411164279
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 1678571401}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8180001677565645550, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: RowerSelector
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
value: 160
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
value: 100
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8180001677565645551, guid: fc98065ce3e088344a2f354023c943c3,
|
||||
- target: {fileID: 7988615406063986403, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7988615406063986404, guid: 562fb3955c04633419fe1ebb55a0c9eb,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CountDown
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fc98065ce3e088344a2f354023c943c3, type: 3}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 562fb3955c04633419fe1ebb55a0c9eb, type: 3}
|
||||
|
||||
@ -194,7 +194,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
PullValue = val;
|
||||
}
|
||||
}
|
||||
Debug.Log("原始数据:" + string.Join(",", data));
|
||||
//Debug.Log("原始数据:" + string.Join(",", data));
|
||||
}
|
||||
public void Reset()
|
||||
{
|
||||
|
||||
105
Assets/Scripts/UI/Prefab/Confirm3.cs
Normal file
105
Assets/Scripts/UI/Prefab/Confirm3.cs
Normal file
@ -0,0 +1,105 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using System;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class Confirm3 : PFUIPanel
|
||||
{
|
||||
private PFUIText _title;
|
||||
private PFUIText _content;
|
||||
private PfUIButton _1;
|
||||
private PfUIButton _2;
|
||||
private PfUIButton _3;
|
||||
private UnityAction _action1;
|
||||
private UnityAction _action2;
|
||||
private UnityAction _action3;
|
||||
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
var wrap = this.transform.Find("GameObject");
|
||||
_title = wrap.Find("Title").GetComponent<PFUIText>();
|
||||
_content = wrap.Find("Content").GetComponent<PFUIText>();
|
||||
|
||||
_1 = wrap.Find("Container/Save").GetComponent<PfUIButton>();
|
||||
_2 = wrap.Find("Container/Discard").GetComponent<PfUIButton>();
|
||||
_3 = wrap.Find("Container/Cancel").GetComponent<PfUIButton>();
|
||||
|
||||
UIManager.AddEvent(_1.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if(_action1 != null)
|
||||
{
|
||||
_action1();
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(_2.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (_action2 != null)
|
||||
{
|
||||
_action2();
|
||||
}
|
||||
this.Close();
|
||||
});
|
||||
UIManager.AddEvent(_3.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (_action3 != null)
|
||||
{
|
||||
_action3();
|
||||
}
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Set(string title, string content, UnityAction action1,UnityAction action2, UnityAction action3)
|
||||
{
|
||||
//if(text == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//text.text = txt;
|
||||
_title.Text = title;
|
||||
_content.Text = content;
|
||||
_action1 = action1;
|
||||
_action2 = action2;
|
||||
_action3 = action3;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
//bg.alphaHitTestMinimumThreshold
|
||||
|
||||
var color = bg.color;
|
||||
color.a = 0.6f;
|
||||
bg.color = color;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
|
||||
bg.DOFade(0, 0.2f).OnComplete(() =>
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Prefab/Confirm3.cs.meta
Normal file
11
Assets/Scripts/UI/Prefab/Confirm3.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d1cc442a4153c84796605310af517e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -65,6 +65,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
List<TempRowerCalc> values;
|
||||
DateTime startTime,createTime;
|
||||
double Kj = 0;
|
||||
int seconds = 0;
|
||||
bool isPause = false;
|
||||
protected override void Awake()
|
||||
{
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
@ -117,33 +119,51 @@ public class RowerHomeScript : PFUIPanel
|
||||
//return;
|
||||
if (btnStart.CompareTag("Start"))
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
if (RowerData == null)
|
||||
{
|
||||
Utils.showToast(null, "Please connect the device!");
|
||||
return;
|
||||
}
|
||||
if (RowerData != null)
|
||||
#endif
|
||||
UIManager.ShowCountDownAnimation(() =>
|
||||
{
|
||||
RowerData.PullChanged += PaintPullCurveDelegate;
|
||||
}
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Untagged"];
|
||||
startTime = UIManager.Now.GetDateTime();
|
||||
TimerTicks();
|
||||
openTimer = true;
|
||||
timer = 1.0f;
|
||||
btnStart.tag = "Untagged";
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged += PaintPullCurveDelegate;
|
||||
}
|
||||
if (!isPause)
|
||||
{
|
||||
startTime = UIManager.Now.GetDateTime();
|
||||
}
|
||||
TimerTicks();
|
||||
openTimer = true;
|
||||
timer = 1.0f;
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Untagged"];
|
||||
btnStart.tag = "Untagged";
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowConfirm("Quit", "Do you want to keep the record?", () =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Save();
|
||||
Init();
|
||||
},cancel:()=>
|
||||
{
|
||||
Init();
|
||||
});
|
||||
UIManager.ShowConfirm3("Quit", "Do you want to keep the record?",
|
||||
() =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Save();
|
||||
Init();
|
||||
},
|
||||
()=>
|
||||
{
|
||||
Init();
|
||||
},
|
||||
()=>
|
||||
{
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
});
|
||||
}
|
||||
Debug.Log(RowerData);
|
||||
//StartCoroutine();
|
||||
@ -169,11 +189,11 @@ public class RowerHomeScript : PFUIPanel
|
||||
if (values.Count > 0)
|
||||
{
|
||||
model.MaxPower = values.Max(x => x.power);
|
||||
model.MaxPace = values.Min(x => x.pace);
|
||||
model.MaxPace = values.Where(x => x.pace > 0).Min(x => x.pace);
|
||||
model.MaxRate = values.Max(x => x.rate);
|
||||
model.MaxHeartRate = values.Max(x => x.heartRate);
|
||||
model.AvgPower = values.Average(x => x.power);
|
||||
model.AvgPace = values.Average(x => x.pace);
|
||||
model.AvgPace = values.Where(x => x.pace > 0).Average(x => x.pace);
|
||||
model.AvgRate = values.Average(x => x.rate);
|
||||
model.AvgHeartRate = (int)values.Average(x => x.heartRate);
|
||||
}
|
||||
@ -241,6 +261,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
values = new List<TempRowerCalc>();
|
||||
Kj = 0;
|
||||
x = 0;
|
||||
seconds = 0;
|
||||
isPause = false;
|
||||
}
|
||||
private void ReturnHome()
|
||||
{
|
||||
@ -261,7 +283,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
//PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
if (RowerData == null) return;
|
||||
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.ElapsedTime).ToString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = RowerData.TotalDistance.ToString();
|
||||
var power = RowerData.InstantaneousPower;
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = power.ToString();
|
||||
@ -292,8 +314,10 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
if (y > 1000) y = 1000;
|
||||
//拉力条
|
||||
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = ((float)y) / 1000;
|
||||
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = ((float)y) / 1000;
|
||||
var rate = ((float)y) * 2 / 1000;
|
||||
if (rate > 1) rate = 1;
|
||||
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = rate;
|
||||
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = rate;
|
||||
//动画
|
||||
left.Find("Rower").GetComponent<Image>().sprite = spriteDict[y / 67];
|
||||
//曲线
|
||||
|
||||
@ -116,7 +116,10 @@ public class RouteItem : MonoBehaviour
|
||||
{
|
||||
UIManager.AddEvent(btnReRide.gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
UIManager.ShowConfirm("Re-Rowing", "Rowing again?", () =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ public partial class RowerLargeDataFeed : MonoBehaviour, IComparer<DoubleVector2
|
||||
LoadWithoutDownSampling(start, end);
|
||||
else
|
||||
LoadWithDownSampling(start, end);
|
||||
graph.DataSource.MakeCurveCategorySmooth(Category);
|
||||
//graph.DataSource.MakeCurveCategorySmooth(Category);
|
||||
graph.DataSource.EndBatch();
|
||||
graph.HorizontalScrolling = pagePosition;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class RowerResult : PFUIPanel
|
||||
dataContent.Find("Table/AvgHR/Text").GetComponent<Text>().text
|
||||
= $"{_model.MaxHeartRate} BPM";
|
||||
dataContent.Find("Table/AvgRate/Text").GetComponent<Text>().text
|
||||
= $"{_model.MaxRate.ToString("#0")} W";
|
||||
= $"{_model.MaxRate.ToString("#0")} SPM";
|
||||
dataContent.Find("ChartPace/Avg/Value").GetComponent<Text>().text
|
||||
= $"{TimeSpan.FromSeconds(_model.AvgPace).ToString(@"mm\:ss")} /500M";
|
||||
dataContent.Find("ChartRate/Avg/Value").GetComponent<Text>().text
|
||||
@ -85,7 +85,18 @@ public class RowerResult : PFUIPanel
|
||||
//var b = _model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList();
|
||||
//Debug.Log(_model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList());
|
||||
chartPace.GetComponent<RowerLargeDataFeed>()
|
||||
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace)))).ToList());
|
||||
.SetData(_model.ChartList.Select((x, i) =>
|
||||
{
|
||||
if (x.Pace == 0)
|
||||
{
|
||||
return new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromHours(15))-2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace)));
|
||||
}
|
||||
|
||||
}).ToList());
|
||||
chartRate.GetComponent<RowerLargeDataFeed>()
|
||||
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, x.Rate)).ToList());
|
||||
chartHR.GetComponent<RowerLargeDataFeed>()
|
||||
|
||||
@ -17,7 +17,9 @@ public class RowerWelldone : PFUIPanel
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
Close();
|
||||
UIManager.ShowHomePanel();
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -271,6 +271,20 @@ public class UIManager : MonoBehaviour
|
||||
UIManager.Show(UIManager.Instance.RowerSelector, null, true);
|
||||
}
|
||||
/*划船机页面*/
|
||||
|
||||
private CountDownAnimation mCountDownAnimation;
|
||||
public CountDownAnimation CountDownAnimation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("CountDown", ref this.mCountDownAnimation);
|
||||
}
|
||||
}
|
||||
public static void ShowCountDownAnimation(UnityAction action)
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.CountDownAnimation, null, true);
|
||||
UIManager.Instance.CountDownAnimation.StartTime(action);
|
||||
}
|
||||
#region 比赛点击弹窗
|
||||
private RaceModalScript mRaceModalScript;
|
||||
public RaceModalScript RaceDetailModal
|
||||
@ -913,6 +927,24 @@ public class UIManager : MonoBehaviour
|
||||
UIManager.Instance.confirm.Close();
|
||||
}
|
||||
}
|
||||
public static void ShowConfirm3(string title, string content, UnityAction action1, UnityAction action2,UnityAction action3)
|
||||
{
|
||||
if (UIManager.Instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (UIManager.Instance.confirm3 == null)
|
||||
{
|
||||
UIManager.Instance.confirm3 = UIManager.Instance.GetInstance<Confirm3>("Confirm3", ref UIManager.Instance.confirm3);
|
||||
UIManager.Show(UIManager.Instance.confirm3, null, true);
|
||||
UIManager.Instance.confirm3.Set(title, content, action1, action2, action3);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.confirm3.Show();
|
||||
UIManager.Instance.confirm3.Set(title, content, action1, action2, action3);
|
||||
}
|
||||
}
|
||||
public LoginRegOptions loginRegOptions { get; private set; }
|
||||
private List<QUserInfo> _userInfos;
|
||||
public List<QUserInfo> userInfos
|
||||
@ -964,6 +996,8 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
Confirm3 confirm3 = null;
|
||||
|
||||
public static async void InitNow()
|
||||
{
|
||||
var now = await ConfigHelper.userApi.GetNow();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user