Merge remote-tracking branch 'origin/dev_m1' into dev_mobile_ble

# Conflicts:
#	Assets/Scripts/App.cs
This commit is contained in:
lishuo committed 2021-09-03 15:12:01 +08:00
commit 467a6f3810
33 files changed
+3529 -3073

No files matched your search

+4
View File
@@ -62,7 +62,11 @@ public class Item : PFUIPanel, IPointerEnterHandler, IPointerExitHandler, IPoint
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
}
var rect = ((RectTransform)transform).rect;
#if UNITY_ANDROID || UNITY_IOS
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 10, 0));
#else
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.5f, 0));
#endif
this.GetComponent<Image>().material = material;
hot = this.transform.Find("Hot");
@@ -77,6 +77,9 @@ public class FeedbackController : PFUIPanel
void AddImage(BaseEventData e,int index)
{
#if UNITY_ANDROID || UNITY_IOS
//App.ImageSelectorController.Select();
#else
var self = ((PointerEventData)e).pointerEnter;
Utils.OpenFile((path) =>
{
@@ -89,6 +92,8 @@ public class FeedbackController : PFUIPanel
self.transform.Find("close").gameObject.SetActive(true);
paths[self.name] = path;
});
#endif
}
void DelImage(BaseEventData e,Transform self,int index)
{
@@ -125,4 +130,10 @@ public class FeedbackController : PFUIPanel
{
}
//原生返回最好别调用
public void OnMobileImageSelect(string res)
{
Debug.Log(res);
Utils.showToast(gameObject, res, type: 1);
}
}
@@ -18,27 +18,19 @@ public class QuickLoginScroll : MonoBehaviour
void Start()
{
scroll = gameObject.GetComponent<ScrollRect>();
#if UNITY_IOS || UNITY_ANDROID
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.BeginDrag, b =>
{
startPos = scroll.horizontalNormalizedPosition;
Debug.Log(startPos);
Debug.Log("开始滑动"+startPos);
});
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, b =>
{
Debug.Log($"拽动结束{startPos},{endPos}");
endPos = scroll.horizontalNormalizedPosition;
if (startPos > endPos)
{
goLeft();
}
else if (startPos < endPos)
{
goRight();
}
goMovess();
});
//scroll.onValueChanged.AddListener((a) =>
//{
// Debug.Log(a);
//});
#endif
content = gameObject.transform.Find("Viewport").Find("Content");
lightbg = transform.parent.Find("Light");
//Initial();
@@ -87,7 +79,7 @@ public class QuickLoginScroll : MonoBehaviour
if (content.childCount - 3 > 0)
{
contentSize = 1f / (content.childCount - 3);
Debug.Log(contentSize);
//Debug.Log(contentSize);
}
else
{
@@ -106,18 +98,49 @@ public class QuickLoginScroll : MonoBehaviour
#endif
SetColor();
}
void goMovess()
{
int i = (int)System.Math.Round((scroll.horizontalNormalizedPosition - startPos) / contentSize);
//Debug.Log("左滑开始" + );
if (i == 0)
{
scroll.horizontalNormalizedPosition = startPos;
return;
}
goMove(i);
}
#if UNITY_ANDROID || UNITY_IOS
void goLeft()
{
if (scroll.horizontalNormalizedPosition <= 0 + 0.0001) return;
if (scroll.horizontalNormalizedPosition <= 0 + 0.0001)
{
return;
}
goMove(-1);
}
void goRight()
{
if (scroll.horizontalNormalizedPosition+0.0001 >= 1) return;
if (scroll.horizontalNormalizedPosition + 0.0001 >= 1)
{
return;
}
goMove();
}
#else
void goLeft()
{
if (scroll.horizontalNormalizedPosition <= contentSize) return;
goMove(-1);
}
void goRight()
{
if ((scroll.horizontalNormalizedPosition + contentSize) >= 1) return;
goMove();
}
#endif
void goMove(int i = 1)
{
Debug.Log("移动系数" + i);
doAni();
//#if !(UNITY_ANDROID || UNITY_IOS)
// if (!start) startPosition = scroll.horizontalNormalizedPosition;
@@ -126,6 +149,7 @@ public class QuickLoginScroll : MonoBehaviour
// if (!start) startPosition = ind*contentSize;
//#endif
if (!start) startPosition = scroll.horizontalNormalizedPosition;
scrollIndex = i;
start = true;
#if !(UNITY_ANDROID || UNITY_IOS)
scrollValue = i * contentSize / 10;
@@ -135,6 +159,7 @@ public class QuickLoginScroll : MonoBehaviour
}
private bool start = false;
private float scrollValue = 0, totalScrollValue = 0, startPosition = 0;
private int scrollIndex = 0;
int GetIndex(float? startPos = null)
{
#if !(UNITY_ANDROID || UNITY_IOS)
@@ -150,9 +175,9 @@ public class QuickLoginScroll : MonoBehaviour
((startPos ?? scroll.horizontalNormalizedPosition + contentSize) / contentSize, 0);
#endif
}
void SetColor()
void SetColor(int? rIndex = null)
{
int index = GetIndex();
int index = rIndex ?? GetIndex();
//lightbg.GetComponent<Image>().gameObject.SetActive(true);
//lightbg.GetComponent<Image>().DOFade(1, 0.2f);
//content.GetChild(index).GetComponent<QuickLoginUser>().setActive();
@@ -186,7 +211,7 @@ public class QuickLoginScroll : MonoBehaviour
#if !(UNITY_ANDROID || UNITY_IOS)
scroll.horizontalNormalizedPosition = startPosition + (totalScrollValue<0?-1:1)*contentSize;
#else
scroll.horizontalNormalizedPosition = (GetIndex(startPos) + (totalScrollValue < 0 ? -1 : 1)) * contentSize;
scroll.horizontalNormalizedPosition = (GetIndex(startPos) + scrollIndex) * contentSize;
#endif
//Debug.Log();
SetColor();
@@ -95,7 +95,12 @@ public class EarthController : PFUIPanel
//hotPanel = rootPanel.Find("HotPanel").gameObject;
//SetRounded(hotPanel.transform, 60);
//content = hotPanel.transform.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
var avatar = rootPanel.transform.Find("Avatar").GetComponent<RawImage>();
UIManager.AddEvent(avatar.gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
Utils.DisplayImage(avatar, App.CurrentUser.WxHeadImg, true);
//var mainCanvas = GameObject.Find("Canvas");
@@ -259,8 +259,8 @@ public class EditUserController : PFUIPanel
UIManager.Instance.loginRegOptions.GetCountryImage(index);
};
mConutryDropdown.SelectValue(App.CurrentUser.Country);
//mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
// UIManager.Instance.loginRegOptions.GetCountryImage(UIManager.Instance.loginRegOptions.countryDefaultValue);
mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
var rect = ((RectTransform)mHeadImage.transform).rect;
SetRounded(mHeadImage.transform, rect.height);
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
@@ -12,7 +12,7 @@ public class UserInfoController : PFUIPanel
// Start is called before the first frame update
UserApi userApi;
Transform infoPanel,summaryPanel;
protected override void Start()
protected override void Awake()
{
this.transform.localPosition = new Vector3(0, 0, 0);
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
@@ -120,7 +120,7 @@ public class RaceHomeScript : RaceScript
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/ItemSmall"),
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem"),
dotItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/DotItem");
#if UNITY_ANDROID || UNITY_ANDROID
#if UNITY_ANDROID || UNITY_IOS
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem-Mobile");
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/Mobile/ItemSmall-Mobile");
#endif
+21 -13
View File
@@ -18,6 +18,18 @@ public class RaceItemScript : MonoBehaviour
public enum ItemType { big, small }
private Transform parent;
[SerializeField] ItemType myType;
private string _from = null;
internal void Refresh()
{
if (mapCompetition == null) return;
var res1 = ConfigHelper.mapCompetitionApi.GetById(mapCompetition.Id);
if (res1.result)
{
Initial(res1.data, null);
}
}
public MapCompetition mapCompetition { get; set; }
void Start()
{
@@ -40,12 +52,16 @@ public class RaceItemScript : MonoBehaviour
});
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
#else
if (from == "list")
if (string.IsNullOrEmpty(_from))
{
_from = from;
}
if (_from == "list")
{
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
transform.GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowRaceDetailModal(mapCompetition);
UIManager.ShowRaceDetailModal(transform,mapCompetition);
});
}
#endif
@@ -69,7 +85,7 @@ public class RaceItemScript : MonoBehaviour
#if !(UNITY_ANDROID || UNITY_IOS)
SetButtonGroup(mapCompetition);
#else
if (from != "list")
if (_from != "list")
{
SetButtonGroup(mapCompetition);
}
@@ -272,11 +288,7 @@ public class RaceItemScript : MonoBehaviour
//SetStatus(mapCompetition);
//transform.Find("BtnContainer").gameObject.Destroy();
//SetButtonGroup(mapCompetition);
var res1 = ConfigHelper.mapCompetitionApi.GetById(mapCompetition.Id);
if (res1.result)
{
Initial(res1.data, null);
}
Refresh();
Utils.showToast(null, "success", type: 1);
}
else
@@ -296,11 +308,7 @@ public class RaceItemScript : MonoBehaviour
//transform.Find("BtnContainer").gameObject.Destroy();
//SetButtonGroup(mapCompetition);
App.CompetitionIdList.Remove(mapCompetition.Id);
var res1 = ConfigHelper.mapCompetitionApi.GetById(mapCompetition.Id);
if (res1.result)
{
Initial(res1.data, null);
}
Refresh();
Utils.showToast(null, "success", type: 1);
}
else
@@ -196,11 +196,11 @@ public class RaceListScript : RaceScript
protected override void Start()
{
#if (UNITY_ANDROID || UNITY_IOS)
var rectTransform = transform.GetComponent<RectTransform>();
var offsetMax = rectTransform.offsetMax;
rectTransform.offsetMax = new Vector2(0, offsetMax.y);
var offsetMin = rectTransform.offsetMin;
rectTransform.offsetMin = new Vector2(0, offsetMin.y);
//var rectTransform = transform.GetComponent<RectTransform>();
//var offsetMax = rectTransform.offsetMax;
//rectTransform.offsetMax = new Vector2(0, offsetMax.y);
//var offsetMin = rectTransform.offsetMin;
//rectTransform.offsetMin = new Vector2(0, offsetMin.y);
#endif
}
private async Task Login()
@@ -13,8 +13,9 @@ public class RaceModalScript : RaceScript
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
//停止计时器
UIManager.CloseModal();
gameObject.SetActive(false);
transform.GetComponent<RaceScript>().SetCurrentItem(null);
_parent.GetComponent<RaceItemScript>().Refresh();
});
}
@@ -23,8 +24,14 @@ public class RaceModalScript : RaceScript
{
}
public void Initial(MapCompetition mapCompetition)
public override void Show()
{
base.Show();
}
Transform _parent;
public void Initial(Transform parent, MapCompetition mapCompetition)
{
_parent = parent;
var item = transform.Find("Container/Main/ItemSmall-Mobile");
item.GetComponent<RaceItemScript>().Initial(mapCompetition, transform,"modal");
@@ -91,8 +91,10 @@ public class ResultListController : PFUIPanel
public void Load()
{
Debug.Log("刷新show");
if (contents != null && contents.Length == 2)
{
Debug.Log("刷新show进入");
Refresh(contents[scrollIndex]);
}
//if (scroll!=null)
@@ -89,7 +89,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
else
{
Debug.Log(index);
//Debug.Log(index);
right = transform.Find("RightMatch");
right.gameObject.SetActive(true);
btnDetail = right.Find("BtnDetail");