修改细节

This commit is contained in:
CaiYanPeng 2021-07-27 18:36:49 +08:00
parent 164db7c013
commit ca938ab6f5
16 changed files with 1609 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -46,7 +46,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 15, y: 15, z: 15, w: 15}
spriteBorder: {x: 30, y: 30, z: 30, w: 30}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a70dccad18e97dd46b2b739e228989cc
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -332,6 +332,7 @@ GameObject:
- component: {fileID: 3445340291243714514}
- component: {fileID: 3445340291243714524}
- component: {fileID: 3340209317336321644}
- component: {fileID: 2919480864831927539}
m_Layer: 5
m_Name: RaceHomePanel
m_TagString: Untagged
@ -382,6 +383,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 93263b6a2a269ae4fb052ec2c022251c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!225 &2919480864831927539
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3445340291243714513}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &4573235035984813200
GameObject:
m_ObjectHideFlags: 0

View File

@ -673,7 +673,7 @@ RectTransform:
m_GameObject: {fileID: 1372050265900358655}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.5779092, y: 1.5779092, z: 1.5779092}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 71653441858533815}
- {fileID: 71653441061169207}
@ -812,6 +812,7 @@ GameObject:
- component: {fileID: 1673965681348374004}
- component: {fileID: 1673965681348374010}
- component: {fileID: 3032364714008089124}
- component: {fileID: 7732217181960295751}
m_Layer: 5
m_Name: RaceListPanel
m_TagString: Untagged
@ -862,6 +863,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 82b3faa60bd657241a826920f2d8ad14, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!225 &7732217181960295751
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1673965681348374007}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &2363214934641726875
GameObject:
m_ObjectHideFlags: 0

View File

@ -519,7 +519,7 @@ namespace Assets.Scripts.Apis
request.Method = "POST";
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
request.Accept = "application/json";
request.Headers.Add("Language", "Zh-cn");
request.Headers.Add("Language", "en");
request.CookieContainer = new CookieContainer();
foreach (Cookie item in cookies)
{

View File

@ -82,7 +82,7 @@ namespace Assets.Scripts.UI.Control
{
case Type.Normal:
{
image.color = ConvertColor("#414251");
image.color = ConvertColor("#303030");
}
break;
case Type.Border:
@ -152,7 +152,7 @@ namespace Assets.Scripts.UI.Control
{
case Type.Normal:
{
image.color = ConvertColor("#414251");
image.color = ConvertColor("#303030");
}
break;
case Type.Border:

View File

@ -338,8 +338,12 @@ public class EditUserController : PFUIPanel
//UIManager.ShowAlert(result.errMsg);
}
else
{
{
App.CurrentUser = JObject.FromObject(result.data).ToObject<UserResultModel>();
if (App.CurrentUser.Birthday.HasValue)
{
App.CurrentUser.Birthday = App.CurrentUser.Birthday.Value.ToLocalTime();
}
var userinfos = UIManager.Instance.userInfos;
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
if (i != -1)

View File

@ -13,12 +13,17 @@ public class RaceHomeScript : RaceScript
{
// Start is called before the first frame update
private ScrollRect scroll;
private Transform content,rightContainer,leftContainer,btnGoList,avatar;
private Transform content,rightContainer,leftContainer,btnGoList;
private float contentSize;
private int count;
private Button L, R;
//当前鼠标悬浮的卡片
async void Start()
public override void Show()
{
base.Show();
handleAvatar();
}
void Start()
{
scroll = transform.Find("LeftContainer/Swiper").GetComponent<ScrollRect>();
content = scroll.content;
@ -43,38 +48,31 @@ public class RaceHomeScript : RaceScript
});
}
StartTime();
#if UNITY_EDITOR
if (App.CurrentUser == null) //App.CurrentUser == null
{
await Login();
}
#endif
rightContainer = transform.Find("RightContainer");
leftContainer = transform.Find("LeftContainer");
btnGoList = rightContainer.Find("Container-2/BtnGoList");
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowRaceListPanel();
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
UIManager.ShowRaceListPanel();
};
});
avatar = transform.Find("Avatar");
if (avatar != null)
{
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
}
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7,order:0);
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1,order:1);
DisplayMaps(r.data,activityList.data);
handleAvatar();
GetData();
}
async void GetData()
{
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0);
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 1);
DisplayMaps(r.data, activityList.data);
Initial();
Utils.StartTimeUnLimit(10, () =>
Utils.StartTimeUnLimit(10, () =>
{
goRight();
});
}
private void DisplayMaps(List<MapCompetition> list, List<MapCompetition> activityList)
{
int i = 0;

View File

@ -46,7 +46,10 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
transform.Find("CountContainer/Text").GetComponent<Text>().text = mapCompetition.ApplyCount.ToString();
SetStatus(mapCompetition);
SetButtonGroup(mapCompetition);
this.parent = parent;
if (parent != null)
{
this.parent = parent;
}
this.mapCompetition = mapCompetition;
}

View File

@ -1,6 +1,7 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Prefab.Race;
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
@ -21,15 +22,14 @@ public class RaceListScript : RaceScript
private List<string> statusOptions = new List<string>();
bool isReserve = false;
int order = 1;
//筛选条件
async void Start()
public override void Show()
{
base.Show();
handleAvatar();
}
//筛选条件
void Start()
{
#if UNITY_EDITOR
if (App.CurrentUser == null) //App.CurrentUser == null
{
await Login();
}
#endif
scroll = transform.Find("ListContainer/List").gameObject;
if (scroll != null)
{
@ -108,18 +108,13 @@ public class RaceListScript : RaceScript
{
UIManager.AddEvent(btnReturn.gameObject, EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowRaceHomePanel(true);
});
}
avatar = transform.Find("Avatar");
if (avatar != null)
{
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
UIManager.ShowRaceHomePanel(true);
};
});
}
handleAvatar();
Refresh();
}
@ -134,7 +129,6 @@ public class RaceListScript : RaceScript
{
if (Input.GetAxis("Mouse ScrollWheel") != 0)
{
Debug.Log(scroll.GetComponent<ScrollRect>().verticalNormalizedPosition);
if (scroll.GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
{

View File

@ -1,4 +1,5 @@
using Assets.Scripts;
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -8,6 +9,11 @@ public class RaceScript : PFUIPanel
{
// Start is called before the first frame update
protected Transform currentItem { get; set; }
public override void Show()
{
base.Show();
transform.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
}
protected void StartTime()
{
timerFlag = true;
@ -34,6 +40,20 @@ public class RaceScript : PFUIPanel
StopTime();
}
}
private Transform avatar;
protected void handleAvatar()
{
avatar = transform.Find("Avatar");
if (avatar != null)
{
Debug.Log(App.CurrentUser.WxHeadImg);
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
}
}
/*
var second = Math.Ceiling((Now - mapCompetition.StartTime.ToLocalTime()).TotalSeconds);
@ -54,7 +74,6 @@ public class RaceScript : PFUIPanel
if (currentItem != null && currentItem.Find("GetReadyContainer").gameObject.activeSelf)
{
var map = currentItem.GetComponent<RaceItemScript>().mapCompetition;
Debug.Log(map.Status);
if (map.Status == 1)
{
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Application Start Time";
@ -67,16 +86,21 @@ public class RaceScript : PFUIPanel
else
{
//Dictionary<int,>
var time = (map.Status == 1 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime();
var time = (map.Status == 2 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime();
if (time.TotalSeconds < 0)
{
currentItem.Find("GetReadyContainer").GetComponent<CanvasGroup>().alpha = 0;
var res = ConfigHelper.mapCompetitionApi.GetById(map.Id);
if (res.result)
{
currentItem.GetComponent<RaceItemScript>().Initial(res.data, null);
}
}
else
{
currentItem.Find("GetReadyContainer").GetComponent<CanvasGroup>().alpha = 1;
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text
= map.Status == 1 ? "Get Ready" : "Riding Time";
= map.Status == 2 ? "Get Ready" : "Riding Time";
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text
= Utils.GetCountDown(time);
}

View File

@ -0,0 +1,168 @@
using Assets.Scripts;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class DownloadWorkoutsController : PFUIPanel
{
// Start is called before the first frame update
Transform Btn, Loading,Exit,BtnStart;
ScrollRect scroll;
string path;
[SerializeField] Transform log;
void Start()
{
Btn = transform.Find("Panel/BtnConfirm");
BtnStart = transform.Find("Panel/BtnStart");
Loading = transform.Find("Panel/LoadingContainer");
scroll = transform.Find("Panel/Scroll View").GetComponent<ScrollRect>();
Exit = transform.Find("Panel/Exit");
UIManager.AddEvent(Exit.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
Utils.showToast(gameObject, "Please update to the latest version.");
});
SetType(1);
//Button.GetComponent<Button>().enabled = false;
//Button.GetComponent<Button>().interactable = false;
path = Application.persistentDataPath + "/PowerFun.exe";
UIManager.AddEvent(Btn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
Application.Quit();
Utils.ExecFile(path);
});
UIManager.AddEvent(BtnStart.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (_base) =>
{
if (App.UpdateObject != null)
{
BtnStart.GetComponent<Button>().enabled = false;
BtnStart.GetComponent<Button>().interactable = false;
StartCoroutine(DownLoadExe(App.UpdateObject.Url, path, (a, b, isComplete) =>
{
transform.Find("Panel/LoadingContainer/Text").GetComponent<Text>().text = $"Downloaded {a.ToString("#0")}M / {b.ToString("#0")}M";// string.Format(, a, b);
transform.Find("Panel/LoadingContainer/Loading").GetComponent<Image>().fillAmount = (float)(a / b);
if (isComplete)
{
SetType(3);
PlayerPrefs.SetString("exeVersion", App.UpdateObject.Code);
new FileInfo(path + ".pfdownload").MoveTo(path);
}
}));
}
});
//transform
if (App.UpdateObject != null)
{
for (var i = 0; i < App.UpdateObject.UpdateLog.Count; i++)
{
var newLog = Instantiate<Transform>(log);
newLog.GetComponent<DownloadLog>().Initial(App.UpdateObject.UpdateLog[i]);
if (i == App.UpdateObject.UpdateLog.Count - 1)
{
newLog.GetComponent<DownloadLog>().HideLine();
}
newLog.SetParent(scroll.content);
newLog.localScale = Vector3.one;
}
}
}
/*下载文件*/
IEnumerator DownLoadExe(string url, string desFileName, Action<double, double, bool> OnDownloadProgressEvent)
{
string version = null;
if (App.UpdateObject != null)
{
version = App.UpdateObject.Code;
}
if (File.Exists(desFileName))
{
//if(PlayerPrefs.GetString("exeVersion")==)
if (version == null)
{
yield break;
}
else
{
if (version == PlayerPrefs.GetString("exeVersion"))
{
Application.Quit();
Utils.ExecFile(desFileName);
yield break;
}
else
{
File.Delete(desFileName);
}
}
//File.Delete(desFileName);
}
if (File.Exists(desFileName + ".pfdownload"))
{
File.Delete(desFileName + ".pfdownload");
}
SetType(2);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Timeout = 5000;
WebResponse response = request.GetResponse();
//UnityWebRequest request = UnityWebRequest.Get(url);
//yield return request.SendWebRequest();
int packLength = 1024 * 20;
int nReadSize = 0;
byte[] nbytes = new byte[packLength];
double dDownloadedLength = 0, dTotalLength = 0;
long countLength = response.ContentLength;
using (FileStream fs = new FileStream(desFileName + ".pfdownload", FileMode.Create))
using (Stream netStream = response.GetResponseStream())
{
nReadSize = netStream.Read(nbytes, 0, packLength);
while (nReadSize > 0)
{
fs.Write(nbytes, 0, nReadSize);
nReadSize = netStream.Read(nbytes, 0, packLength);
dDownloadedLength = fs.Length * 1.0 / (1024 * 1024);
dTotalLength = countLength * 1.0 / (1024 * 1024);
OnDownloadProgressEvent.Invoke(dDownloadedLength, dTotalLength, false);
//string ss = string.Format("已下载 {0:F}M / {1:F}M", dDownloadedLength, dTotalLength);
//Debug.Log(ss);
yield return null;
}
}
OnDownloadProgressEvent.Invoke(dDownloadedLength, dTotalLength, true);
}
void SetType(int a)
{
switch (a)
{
case 1:
// true 显示 button false 显示loading
Btn.gameObject.SetActive(false);
Loading.gameObject.SetActive(false);
BtnStart.gameObject.SetActive(true);
break;
case 2:
Btn.gameObject.SetActive(false);
Loading.gameObject.SetActive(true);
BtnStart.gameObject.SetActive(false);
break;
case 3:
Btn.gameObject.SetActive(true);
Loading.gameObject.SetActive(false);
BtnStart.gameObject.SetActive(false);
break;
default:break;
}
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81b820d9d4046d241b2e472e6a81b430
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -160,6 +160,21 @@ public class UIManager : MonoBehaviour
UIManager.Show(UIManager.Instance.RaceListPanel, UIManager.Instance.MainPanel);
}
/*比赛列表*/
/*比赛列表*/
private DownloadWorkoutsController mDownloadWorkoutsController;
public DownloadWorkoutsController DownloadWorkoutsModal
{
get
{
return this.GetPanelInstance("DownloadWorkoutsModal", ref this.mDownloadWorkoutsController);
}
}
public static void ShowDownloadWorkoutsPanel()
{
UIManager.Show(UIManager.Instance.DownloadWorkoutsModal, null, true);
//UIManager.Show(UIManager.Instance.RaceListPanel, UIManager.Instance.MainPanel);
}
/*比赛列表*/
private PFUIPanel mModalsPanel;
public PFUIPanel ModalsPanel
{