修改细节
This commit is contained in:
1 parent
2663068574
commit
1254414415
35 files changed
+3557
-3071
No files matched your search
@@ -109,7 +109,7 @@ namespace Assets.Scripts.Apis
|
||||
#if UNITY_ANDROID
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||
#elif UNITY_IOS
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("UnityiOS", ConfigHelper.AppVersion));
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||
#else
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||
#endif
|
||||
|
||||
@@ -75,7 +75,8 @@ public static class App
|
||||
public static string CurrentScene { get; set; }//当前场景
|
||||
public static float? topRectStartX { get; internal set; }
|
||||
|
||||
public static WeChatController weChatController = new WeChatController();
|
||||
public static WeChatController weChatController = WeChatController.Instance;
|
||||
//public static ImageSelectorController ImageSelectorController = ImageSelectorController.Instance;
|
||||
static App()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Create By Jooki: https://www.yuque.com/jooki
|
||||
/// 使用流程:
|
||||
/// WeChatController是一个单例, 请自行给变量 _className 赋值
|
||||
/// 使用前先调用 Init() 进行初始化,然后调用 IsWeChatAppInstalled() 检查用户设备上是否安装了微信;
|
||||
/// 之后为保险起见调用 IsWeChatAppInstalled() 判断微信是否已经安装;
|
||||
/// 最后就是按照需要分享的消息类型调用对应的方法
|
||||
/// </summary>
|
||||
public class ImageSelectorController
|
||||
{
|
||||
/// <summary>
|
||||
/// com.unityplugins.wechatshare是在Android Studio中创建的 Module,
|
||||
/// MainActivity 是一个Activity, 对外供C#调用的方法都写在这个Activity内
|
||||
/// </summary>
|
||||
private readonly string _className = "com.unityplugins.imageSelector.MainActivity";
|
||||
private AndroidJavaClass mainActivityClass = null;
|
||||
|
||||
private static ImageSelectorController _instance;
|
||||
public static ImageSelectorController Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new ImageSelectorController();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
private ImageSelectorController()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
mainActivityClass = new AndroidJavaClass(_className);
|
||||
// 第一个参数: MainActivity中的方法名
|
||||
// 第二、三个参数: 分别是SendMessageToUnity需要接收的第一和第二个参数,对比上面Java的代码
|
||||
#elif UNITY_IOS
|
||||
//RegisterApp(_APP_ID);
|
||||
#endif
|
||||
}
|
||||
public void Select()
|
||||
{
|
||||
mainActivityClass.CallStatic("Select");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 940302c983cec57408ad60c83c4d9343
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -211,10 +211,10 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("RaceDetailModal", ref this.mRaceModalScript);
|
||||
}
|
||||
}
|
||||
public static void ShowRaceDetailModal(MapCompetition mapCompetition)
|
||||
public static void ShowRaceDetailModal(Transform parent,MapCompetition mapCompetition)
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.RaceDetailModal, null, true);
|
||||
UIManager.Instance.mRaceModalScript.Initial(mapCompetition);
|
||||
UIManager.Instance.mRaceModalScript.Initial(parent, mapCompetition);
|
||||
//UIManager.Show(UIManager.Instance.RaceListPanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
#endregion
|
||||
@@ -663,7 +663,11 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
if (earthPanel == null)
|
||||
{
|
||||
#if (UNITY_ANDROID || UNITY_IOS)
|
||||
var obj = Resources.Load("UI/Prefab/Panel/Mobile/EarthPanel");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Panel/EarthPanel");
|
||||
#endif
|
||||
//var root = UIManager.Instance.MainPanel.transform.parent.parent;
|
||||
earthPanel = (GameObject)Instantiate(obj, UIManager.Instance.Root.transform);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user