修改细节,修复bug
This commit is contained in:
1 parent
06aefb93c4
commit
30e09c9c7a
15 files changed
+3566
-3347
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user