之前动画加上排名变化
This commit is contained in:
1 parent
92d0579060
commit
95ab695632
4 files changed
+4763
-4063
No files matched your search
@@ -124,21 +124,13 @@ public class RowerDeviceView : MonoBehaviour
|
||||
|
||||
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||
{
|
||||
if (deviceModal == null)
|
||||
{
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||
#endif
|
||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||
}
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
connectButtonClick();
|
||||
}));
|
||||
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
if (!mPairButton.activeInHierarchy && !mDisconnectButton.activeInHierarchy) return;
|
||||
connectButtonClick();
|
||||
});
|
||||
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
|
||||
//var device = GetDevice();
|
||||
//if(device != null && device.State == DeviceState.Connected)
|
||||
@@ -156,9 +148,23 @@ public class RowerDeviceView : MonoBehaviour
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
}));
|
||||
|
||||
}
|
||||
void connectButtonClick()
|
||||
{
|
||||
if (deviceModal == null)
|
||||
{
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||
#endif
|
||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||
}
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
}
|
||||
void InitLogo()
|
||||
{
|
||||
if (SensorType == SensorType.Power)
|
||||
|
||||
@@ -125,8 +125,15 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
userList = userList.OrderByDescending(x => x.currentDistance).ToList();
|
||||
for (int i = 0; i < userList.Count; i++)
|
||||
{
|
||||
userList[i].currentRank = i + 1;
|
||||
int rank = i + 1, userId = userList[i].UserId;
|
||||
if (rankDiffDict.ContainsKey(userId))
|
||||
{
|
||||
rankDiffDict[userId].rank = rank;
|
||||
rankDiffDict[userId].diff = userList[i].currentRank - rank;
|
||||
}
|
||||
userList[i].currentRank = rank;
|
||||
}
|
||||
print(string.Join(",", rankDiffDict.Select(x => x.Value.diff)));
|
||||
}
|
||||
private List<TraceData> HandleData()
|
||||
{
|
||||
@@ -149,7 +156,12 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
List<TraceData> userList;
|
||||
TraceData myData;
|
||||
public List<RowerRank> shadowList { get; private set; }
|
||||
|
||||
public class RankDiff
|
||||
{
|
||||
public int rank { get; set; }
|
||||
public int diff { get; set; }
|
||||
}
|
||||
public Dictionary<int, RankDiff> rankDiffDict;
|
||||
public async void GetShadowList(RowerTaskPanel.RowerType rowerType)
|
||||
{
|
||||
this.rowerType = rowerType;
|
||||
@@ -177,9 +189,11 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
myData.Country = App.CurrentUser.Country;
|
||||
_tmpList.Add(myData);
|
||||
userList = _tmpList.OrderByDescending(x => x.currentDistance).ToList();
|
||||
rankDiffDict = new Dictionary<int, RankDiff>();
|
||||
for (int i = 0; i < userList.Count; i++)
|
||||
{
|
||||
userList[i].currentRank = i + 1;
|
||||
rankDiffDict.Add(userList[i].UserId, new RankDiff { rank = userList[i].currentRank, diff = 0 });
|
||||
}
|
||||
DisplayUserRanks(true);
|
||||
DisplayTraces();
|
||||
@@ -258,7 +272,13 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
var tmp = traceList[i].trace.DOLocalRotate(new Vector3(90, 0, 0), 0.3f);
|
||||
tmp.onComplete = callback;
|
||||
sq1.Append(tmp);
|
||||
|
||||
sq1.Append(traceList[i].trace.DOLocalRotate(new Vector3(0, 0, 0), 0.3f));
|
||||
|
||||
//var sq2 = DOTween.Sequence();
|
||||
//sq2.Append(t.GetComponent<Image>().DOFade(1, 0.05f));
|
||||
//sq2.Append(t.GetComponent<Image>().DOFade(0, 0.05f));
|
||||
//sq1.Append(sq2);
|
||||
sq.Join(sq1);
|
||||
}
|
||||
else
|
||||
@@ -314,6 +334,25 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
t.Find("Main/Boat").localPosition = new Vector3(-21.5f, t.Find("Main/Boat").localPosition.y, t.Find("Main/Boat").localPosition.z);
|
||||
t.Find("Main/Boat").gameObject.SetActive(false);
|
||||
}
|
||||
var diffTransfrom = transform.Find("Rower/Modes/Scroll/M2/Track/RankDiff"+t.name).GetComponent<Text>();
|
||||
if (rankDiffDict[data.UserId].diff > 0)
|
||||
{
|
||||
diffTransfrom.text = "+" + rankDiffDict[data.UserId].diff;
|
||||
var rankDiffSQ = DOTween.Sequence();
|
||||
rankDiffSQ.Append(diffTransfrom.DOColor(Utils.HexToColorHtml("#bd362bff"), 0.3f));
|
||||
rankDiffSQ.AppendInterval(0.4f);
|
||||
rankDiffSQ.Append(diffTransfrom.DOColor(Utils.HexToColorHtml("#ffffff00"), 0.3f));
|
||||
sq.Join(rankDiffSQ);
|
||||
}
|
||||
else if (rankDiffDict[data.UserId].diff < 0)
|
||||
{
|
||||
diffTransfrom.text = "" + rankDiffDict[data.UserId].diff;
|
||||
var rankDiffSQ = DOTween.Sequence();
|
||||
rankDiffSQ.Append(diffTransfrom.DOColor(Utils.HexToColorHtml("#27bac0ff"), 0.3f));
|
||||
rankDiffSQ.AppendInterval(0.4f);
|
||||
rankDiffSQ.Append(diffTransfrom.DOColor(Utils.HexToColorHtml("#ffffff00"), 0.3f));
|
||||
sq.Join(rankDiffSQ);
|
||||
}
|
||||
sq.Play();
|
||||
}
|
||||
for (; i < traceList.Count; i++)
|
||||
|
||||
Reference in new issue
Block a user