分享调整

This commit is contained in:
lishuo committed 2021-12-28 11:25:35 +08:00
1 parent ffc98f1a58
commit 8e0ce907d0
14 files changed
+1173 -529

No files matched your search

@@ -23,7 +23,8 @@ namespace Assets.Scenes.Ride.Scripts
GameObject ShareButton { get; set; }
GameObject ToolBarPanel { get; set; }
GameObject WeChatButton { get; set; }
GameObject WeChatGpButton { get; set; }
RawImage TopHead { get; set; }
RawImage SecondHead { get; set; }
@@ -60,9 +61,9 @@ namespace Assets.Scenes.Ride.Scripts
ShareButton = transform.Find("ShareButton").gameObject;
ToolBarPanel = transform.Find("ToolBarPanel").gameObject;
WeChatButton = transform.Find("ToolBarPanel/WeChatButton").gameObject;
ShareButton.SetActive(!cyclingController.isWatch);
UIManager.AddEvent(ShareButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, OpenShare);
UIManager.AddEvent(WeChatButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, OpenShare);
WeChatGpButton = transform.Find("ToolBarPanel/GoogleButton").gameObject;
UIManager.AddEvent(WeChatButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShareWechat);
UIManager.AddEvent(WeChatGpButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShareWechatGp);
#endif
SpriteTop = Resources.Load<Sprite>("Images/Ride/Match/top-1");
SpriteSecond = Resources.Load<Sprite>("Images/Ride/Match/top-2");
@@ -114,7 +115,7 @@ namespace Assets.Scenes.Ride.Scripts
Mine.SetActive(!cyclingController.isWatch);
RankingPanel.SetActive(cyclingController.isWatch);
TitleImage.SetActive(!cyclingController.isWatch);
//TitleImage.SetActive(!cyclingController.isWatch);
WatchTitle.SetActive(cyclingController.isWatch);
if (!cyclingController.isWatch)
@@ -243,5 +244,17 @@ namespace Assets.Scenes.Ride.Scripts
Utils.showToast(null, "未安装微信");
}
}
private void ShareWechatGp(BaseEventData baseEventData)
{
if (App.weChatController.IsWeChatAppInstalled())
{
App.weChatController.ShareWebpageToWX(1, $"{App.CurrentUser.WebHost}Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}", cyclingController.competition.NickName, "By " + App.CurrentUser.Nickname);
}
else
{
Utils.showToast(null, "未安装微信");
}
}
}
}
@@ -41,7 +41,7 @@ namespace Assets.Scenes.Ride.Scripts
GameObject goResultBtn;
GameObject cancelBtn;
GameObject shareWxBtn;
GameObject shareButton;
GameObject shareWxGpButton;
Transform toolbar;
#endregion
@@ -74,7 +74,7 @@ namespace Assets.Scenes.Ride.Scripts
toolbar = transform.Find("ToolBarPanel");
#if UNITY_ANDROID || UNITY_IOS
shareWxBtn = transform.Find("ToolBarPanel/WeChatButton").gameObject;
shareButton = transform.Find("ShareButton").gameObject;
shareWxGpButton = transform.Find("ToolBarPanel/GoogleButton").gameObject;
#endif
}
@@ -83,16 +83,10 @@ namespace Assets.Scenes.Ride.Scripts
cyclingController = controller;
cyclingController.AddEvent(goResultBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, GoResult);
cyclingController.AddEvent(cancelBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
#if UNITY_ANDROID || UNITY_IOS
cyclingController.AddEvent(shareWxBtn, EventTriggerType.PointerClick, shareToWx);
cyclingController.AddEvent(shareButton, EventTriggerType.PointerClick, opneShare);
}
private void opneShare(BaseEventData baseEventData)
{
((RectTransform)toolbar).pivot = new Vector2(0, ((RectTransform)toolbar).pivot.y);
toolbar.gameObject.SetActive(true);
shareButton.SetActive(false);
toolbar.DOScaleX(1,1);
cyclingController.AddEvent(shareWxGpButton, EventTriggerType.PointerClick, shareToWxGp);
#endif
}
private void shareToWx(BaseEventData b)
@@ -107,6 +101,18 @@ namespace Assets.Scenes.Ride.Scripts
}
}
private void shareToWxGp(BaseEventData b)
{
if (App.weChatController.IsWeChatAppInstalled())
{
App.weChatController.ShareWebpageToWX(1, $"{App.CurrentUser.WebHost}Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}", cyclingController.competition.NickName, "By " + App.CurrentUser.Nickname);
}
else
{
Utils.showToast(null, "未安装微信");
}
}
private void GoResult(BaseEventData baseEventData)
{
if (App.MainSceneParam.ContainsKey("Name"))