备份CatanBuilding瘦身独立工程
This commit is contained in:
75
Assets/Scripts/UI/Setting/AppraisePopupPanel.cs
Normal file
75
Assets/Scripts/UI/Setting/AppraisePopupPanel.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using tysdk;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AppraisePopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_diss;
|
||||
Button btn_cancel;
|
||||
Button btn_encourage;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var config = GContext.container.Resolve<IConfig>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_cancel = transform.Find("root/btn_cancel/btn_green").GetComponent<Button>();
|
||||
btn_diss = transform.Find("root/btn_diss/btn_green").GetComponent<Button>();
|
||||
btn_encourage = transform.Find("root/btn_encourage/btn_green").GetComponent<Button>();
|
||||
btn_close.onClick.AddListener(() =>
|
||||
{
|
||||
#if AGG
|
||||
using (var e = GEvent.TackEvent("store_rating"))
|
||||
{
|
||||
e.AddContent("select", "close");
|
||||
}
|
||||
#endif
|
||||
Close();
|
||||
});
|
||||
btn_cancel.onClick.AddListener(() =>
|
||||
{
|
||||
#if AGG
|
||||
using (var e = GEvent.TackEvent("store_rating"))
|
||||
{
|
||||
e.AddContent("select", "close");
|
||||
}
|
||||
#endif
|
||||
Close();
|
||||
});
|
||||
btn_diss.onClick.AddListener(() =>
|
||||
{
|
||||
#if AGG
|
||||
using (var e = GEvent.TackEvent("click_support"))
|
||||
{
|
||||
e.AddContent("button_position", 2);
|
||||
}
|
||||
|
||||
using (var e = GEvent.TackEvent("store_rating"))
|
||||
{
|
||||
e.AddContent("select", "aihelp");
|
||||
}
|
||||
#endif
|
||||
AIHelp.AIHelpSupport.Show("E001");
|
||||
|
||||
Close();
|
||||
});
|
||||
|
||||
btn_encourage.onClick.AddListener(() =>
|
||||
{
|
||||
#if AGG
|
||||
using (var e = GEvent.TackEvent("store_rating"))
|
||||
{
|
||||
e.AddContent("select", "rating");
|
||||
}
|
||||
#endif
|
||||
AppRequestReview.RequestReview(config.Get(GConstant.K_APP_Store_URL, string.Empty));
|
||||
Close();
|
||||
});
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.AppraisePopupPanel);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/AppraisePopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/AppraisePopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1973c74ead6ce74a92faa330e51f543
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
192
Assets/Scripts/UI/Setting/BindAccountPopupPanel.cs
Normal file
192
Assets/Scripts/UI/Setting/BindAccountPopupPanel.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using tysdk;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BindAccountPopupPanel : MonoBehaviour
|
||||
{
|
||||
IUserService userService;
|
||||
Button btn_close;
|
||||
Button btn_close1;
|
||||
|
||||
public Button btn_facebookbtn;
|
||||
public GameObject btn_facebookrewardPanel;
|
||||
public TMP_Text btn_facebookrewardText;
|
||||
public Image btn_facebookp_icon;
|
||||
|
||||
public Button btn_googlebtn;
|
||||
public GameObject btn_googlerewardPanel;
|
||||
public TMP_Text btn_googlerewardText;
|
||||
public Image btn_googlep_icon;
|
||||
|
||||
public Button btn_applebtn;
|
||||
public GameObject btn_applerewardPanel;
|
||||
public TMP_Text btn_applerewardText;
|
||||
public Image btn_applep_icon;
|
||||
|
||||
public Button btn_delete;
|
||||
|
||||
int rewardID;
|
||||
ItemData itemData;
|
||||
private void Awake()
|
||||
{
|
||||
userService = GContext.container.Resolve<IUserService>();
|
||||
btn_close1 = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_close = transform.Find("mask").GetComponent<Button>();
|
||||
|
||||
btn_googlebtn = transform.Find("root/layout/btn_google/btn_green").GetComponent<Button>();
|
||||
btn_googlerewardPanel = transform.Find("root/layout/btn_google/btn_green/Ani_Container/reward").gameObject;
|
||||
btn_googlerewardText = transform.Find("root/layout/btn_google/btn_green/Ani_Container/reward/p_text_num").GetComponent<TMP_Text>();
|
||||
btn_googlep_icon = transform.Find("root/layout/btn_google/btn_green/Ani_Container/reward/p_icon").GetComponent<Image>();
|
||||
|
||||
btn_facebookbtn = transform.Find("root/layout/btn_facebook/btn_green").GetComponent<Button>();
|
||||
btn_facebookrewardPanel = transform.Find("root/layout/btn_facebook/btn_green/Ani_Container/reward").gameObject;
|
||||
btn_facebookrewardText = transform.Find("root/layout/btn_facebook/btn_green/Ani_Container/reward/p_text_num").GetComponent<TMP_Text>();
|
||||
btn_facebookp_icon = transform.Find("root/layout/btn_facebook/btn_green/Ani_Container/reward/p_icon").GetComponent<Image>();
|
||||
|
||||
btn_applebtn = transform.Find("root/layout/btn_apple/btn_green").GetComponent<Button>();
|
||||
btn_applerewardPanel = transform.Find("root/layout/btn_apple/btn_green/Ani_Container/reward").gameObject;
|
||||
btn_applerewardText = transform.Find("root/layout/btn_apple/btn_green/Ani_Container/reward/p_text_num").GetComponent<TMP_Text>();
|
||||
btn_applep_icon = transform.Find("root/layout/btn_apple/btn_green/Ani_Container/reward/p_icon").GetComponent<Image>();
|
||||
|
||||
#if UNITY_IOS
|
||||
var google_obj = transform.Find("root/layout/btn_google");
|
||||
if(google_obj != null)
|
||||
google_obj.gameObject.SetActive(false);
|
||||
|
||||
var apple_obj = transform.Find("root/layout/btn_apple");
|
||||
if(apple_obj != null)
|
||||
apple_obj.gameObject.SetActive(true);
|
||||
#else
|
||||
var google_obj = transform.Find("root/layout/btn_google");
|
||||
if (google_obj != null)
|
||||
google_obj.gameObject.SetActive(true);
|
||||
|
||||
var apple_obj = transform.Find("root/layout/btn_apple");
|
||||
if (apple_obj != null)
|
||||
apple_obj.gameObject.SetActive(false);
|
||||
#endif
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
rewardID = GContext.container.Resolve<Tables>().TbGlobalConfig.AccountLinkReward;
|
||||
itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(rewardID);
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_close1.onClick.AddListener(OnClose);
|
||||
|
||||
btn_facebookbtn.interactable = false;
|
||||
btn_facebookrewardPanel.SetActive(false);
|
||||
btn_facebookbtn.onClick.AddListener(OnBtnFacebook);
|
||||
|
||||
btn_googlebtn.interactable = false;
|
||||
btn_googlerewardPanel.SetActive(false);
|
||||
btn_googlebtn.onClick.AddListener(OnBtnGoogle);
|
||||
|
||||
btn_applebtn.interactable = false;
|
||||
btn_applerewardPanel.SetActive(false);
|
||||
btn_applebtn.onClick.AddListener(OnBtnApple);
|
||||
|
||||
btn_delete.onClick.AddListener(OnBtnDelete);
|
||||
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
void SetMaterial()
|
||||
{
|
||||
bool isLinkGoogle = false;
|
||||
bool isLinkFacebook = false;
|
||||
bool isLinkApple = false;
|
||||
if (TYSdkFacade.TYAccountInfo != null)
|
||||
{
|
||||
isLinkGoogle = TYSdkFacade.TYAccountInfo.linkedAccout.Contains(EAccoutType.hwGoogle);
|
||||
isLinkFacebook = TYSdkFacade.TYAccountInfo.linkedAccout.Contains(EAccoutType.hwFacebook);
|
||||
isLinkApple = TYSdkFacade.TYAccountInfo.linkedAccout.Contains(EAccoutType.Apple);
|
||||
}
|
||||
|
||||
Item item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(itemData.id);
|
||||
|
||||
IUIService uIService = GContext.container.Resolve<IUIService>();
|
||||
if (!isLinkGoogle)
|
||||
{
|
||||
btn_googlerewardText.text = itemData.count.ToString();
|
||||
uIService.SetImageSprite(btn_googlep_icon, item.Icon, BasePanel.PanelName);
|
||||
}
|
||||
if (!isLinkFacebook)
|
||||
{
|
||||
btn_facebookrewardText.text = itemData.count.ToString();
|
||||
uIService.SetImageSprite(btn_facebookp_icon, item.Icon, BasePanel.PanelName);
|
||||
}
|
||||
|
||||
if (!isLinkApple)
|
||||
{
|
||||
btn_applerewardText.text = itemData.count.ToString();
|
||||
uIService.SetImageSprite(btn_applep_icon, item.Icon, BasePanel.PanelName);
|
||||
}
|
||||
|
||||
btn_googlebtn.interactable = !isLinkGoogle;
|
||||
btn_facebookbtn.interactable = !isLinkFacebook;
|
||||
btn_applebtn.interactable = !isLinkApple;
|
||||
|
||||
btn_googlerewardPanel.SetActive(!isLinkGoogle);
|
||||
btn_facebookrewardPanel.SetActive(!isLinkFacebook);
|
||||
btn_applerewardPanel.SetActive(!isLinkApple);
|
||||
}
|
||||
|
||||
async void OnBtnGoogle()
|
||||
{
|
||||
var result = await userService.LinkAccount(EAccoutType.hwGoogle);
|
||||
if (result)
|
||||
{
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(EAccoutType.hwGoogle.ToString(), "1");
|
||||
btn_googlebtn.interactable = false;
|
||||
btn_googlerewardPanel.SetActive(false);
|
||||
GetReward();
|
||||
}
|
||||
}
|
||||
|
||||
async void OnBtnFacebook()
|
||||
{
|
||||
var result = await userService.LinkAccount(EAccoutType.hwFacebook);
|
||||
if (result)
|
||||
{
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(EAccoutType.hwFacebook.ToString(), "1");
|
||||
btn_facebookbtn.interactable = false;
|
||||
btn_facebookrewardPanel.SetActive(false);
|
||||
GetReward();
|
||||
}
|
||||
}
|
||||
|
||||
async void OnBtnApple()
|
||||
{
|
||||
var result = await userService.LinkAccount(EAccoutType.Apple);
|
||||
if (result)
|
||||
{
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(EAccoutType.Apple.ToString(), "1");
|
||||
btn_applebtn.interactable = false;
|
||||
btn_applerewardPanel.SetActive(false);
|
||||
GetReward();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBtnDelete()
|
||||
{
|
||||
tysdk.TYSdkFacade.Instance.Signout();
|
||||
RootCtx.ExitGame();
|
||||
}
|
||||
|
||||
void GetReward()
|
||||
{
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(itemData);
|
||||
GContext.Publish(new ShowData(itemData));
|
||||
GContext.Publish(new ShowData());
|
||||
GContext.container.Resolve<PlayerShopData>().GetSKUs();
|
||||
}
|
||||
protected virtual void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.BindAccountPopupPanel);
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Setting/BindAccountPopupPanel.cs.meta
Normal file
3
Assets/Scripts/UI/Setting/BindAccountPopupPanel.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6758cd9403944bd9268c38890e11af4
|
||||
timeCreated: 1691837081
|
||||
54
Assets/Scripts/UI/Setting/BtnSwitch.cs
Normal file
54
Assets/Scripts/UI/Setting/BtnSwitch.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BtnSwitch : MonoBehaviour
|
||||
{
|
||||
public Button btn_on;
|
||||
public UnityEvent<bool> onToggle;
|
||||
bool isOn;
|
||||
public float movePosX = 60;
|
||||
private void Awake()
|
||||
{
|
||||
btn_on = transform.Find("Scrollbar").GetComponent<Button>();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
btn_on.onClick.AddListener(() => { OnToggle(!isOn); });
|
||||
}
|
||||
|
||||
void OnToggle(bool _isOn)
|
||||
{
|
||||
isOn = _isOn;
|
||||
btn_on.transform.DOKill();
|
||||
btn_on.transform.DOLocalMoveX(isOn ? movePosX : -movePosX, 0.2f);
|
||||
onToggle?.Invoke(isOn);
|
||||
}
|
||||
|
||||
public void SetState(bool _isOn)
|
||||
{
|
||||
isOn = _isOn;
|
||||
btn_on.transform.localPosition = new Vector3(isOn ? movePosX : -movePosX, 0, 0);
|
||||
}
|
||||
|
||||
public void SetStateSmooth(bool _isOn)
|
||||
{
|
||||
isOn = _isOn;
|
||||
btn_on.transform.DOKill();
|
||||
btn_on.transform.DOLocalMoveX(isOn ? movePosX : -movePosX, 0.3f);
|
||||
}
|
||||
|
||||
public void OverrideListener(Action<bool> action)
|
||||
{
|
||||
btn_on.onClick.RemoveAllListeners();
|
||||
btn_on.onClick.AddListener(() => { action(isOn); });
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
btn_on.onClick.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Setting/BtnSwitch.cs.meta
Normal file
3
Assets/Scripts/UI/Setting/BtnSwitch.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a11a3bd381144f594076e481bb64b17
|
||||
timeCreated: 1691820523
|
||||
34
Assets/Scripts/UI/Setting/DeleteAccountPopupPanel.cs
Normal file
34
Assets/Scripts/UI/Setting/DeleteAccountPopupPanel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeleteAccountPopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_close;
|
||||
public Button btn_sure;
|
||||
public Button btn_cancel;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("mask").GetComponent<Button>();
|
||||
btn_sure = transform.Find("root/btn_continue/btn_green").GetComponent<Button>();
|
||||
btn_cancel = transform.Find("root/btn_cancel/btn_green").GetComponent<Button>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_sure.onClick.AddListener(OnBtnSure);
|
||||
btn_cancel.onClick.AddListener(OnClose);
|
||||
}
|
||||
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.DeleteAccountPopupPanel);
|
||||
}
|
||||
|
||||
void OnBtnSure()
|
||||
{
|
||||
//取消关联
|
||||
//PlayFabMgr.Instance.DeleteAccount();
|
||||
//GameStateMgr.Instance.RestartGame();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45a3a72ac971469680f5bf6e0b7c140f
|
||||
timeCreated: 1691829743
|
||||
123
Assets/Scripts/UI/Setting/EventSignupPopupPanel.cs
Normal file
123
Assets/Scripts/UI/Setting/EventSignupPopupPanel.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventSignupPopupPanel : BasePanel
|
||||
{
|
||||
List<SignupDayItem> signupDayItems = new List<SignupDayItem>();
|
||||
TMP_Text text_num;
|
||||
SigninData signupData;
|
||||
Button btn_close;
|
||||
TMP_Text text_time;
|
||||
Tables tables;
|
||||
int Multiplier;
|
||||
List<int> signDayList;
|
||||
private TimeSpan remaining;
|
||||
|
||||
GameObject rewardPanel;
|
||||
Button reward_button;
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
signupData = GContext.container.Resolve<SigninData>();
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
signupDayItems.Add(transform.Find("root/day" + i).GetComponent<SignupDayItem>());
|
||||
}
|
||||
text_num = transform.Find("root/day7/text_num_new").GetComponent<TMP_Text>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
text_time = transform.Find("root/text_time").GetComponent<TMP_Text>();
|
||||
|
||||
rewardPanel = transform.Find("reward").gameObject;
|
||||
reward_button = transform.Find("reward/btn_play/btn_green").GetComponent<Button>();
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
Multiplier = 1;
|
||||
oldPanelName = panelName;
|
||||
base.Start();
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
ShowRewardPanel();
|
||||
var dailySignEvent = signupData.newSignEvent;
|
||||
SignInit signInit = tables.TbSignInit.GetOrDefault(dailySignEvent.ID);
|
||||
signDayList = signInit.SignDayList;
|
||||
for (int i = 0; i < signDayList.Count; i++)
|
||||
{
|
||||
SignReward dailySign = tables.TbSignReward.GetOrDefault(signDayList[i]);
|
||||
if (i < dailySignEvent.index && i < signDayList.Count - 1)
|
||||
{
|
||||
Multiplier += dailySign.Multiplier;
|
||||
}
|
||||
if (dailySign != null)
|
||||
{
|
||||
int DropID = dailySign.DropID;
|
||||
signupDayItems[i].ShowData(i, DropID, dailySignEvent.ID, Multiplier);
|
||||
}
|
||||
}
|
||||
text_num.text = $"x{Multiplier}";
|
||||
GContext.OnEvent<OnSignEvent>().Subscribe(OnSignEvent).AddTo(disposables);
|
||||
DateTime now = ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
DateTime tomorrow = GlobalUtils.TryParseDateTime(signupData.newSignEvent.time, now);
|
||||
remaining = tomorrow - now;
|
||||
text_time.text = ConvertTools.ConvertTime2(remaining.Days, remaining.Hours, remaining.Minutes, remaining.Seconds);
|
||||
StartCoroutine(Countdown());
|
||||
reward_button.onClick.AddListener(OnClickReward);
|
||||
}
|
||||
IEnumerator Countdown()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
remaining = remaining.Subtract(TimeSpan.FromSeconds(1));
|
||||
text_time.text = ConvertTools.ConvertTime2(remaining.Days, remaining.Hours, remaining.Minutes, remaining.Seconds);
|
||||
if (remaining.TotalSeconds <= 0)
|
||||
{
|
||||
OnClose();
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void OnSignEvent(OnSignEvent onSignEvent)
|
||||
{
|
||||
Multiplier = 1;
|
||||
var dailySignEvent = signupData.newSignEvent;
|
||||
for (int i = 0; i < dailySignEvent.index; i++)
|
||||
{
|
||||
SignReward dailySign = tables.TbSignReward.GetOrDefault(signDayList[i]);
|
||||
if (i < signDayList.Count - 1)
|
||||
{
|
||||
Multiplier += dailySign.Multiplier;
|
||||
}
|
||||
}
|
||||
text_num.text = $"x{Multiplier}";
|
||||
ShowRewardPanel();
|
||||
signupDayItems[6].SetMultiplier(Multiplier);
|
||||
}
|
||||
void ShowRewardPanel()
|
||||
{
|
||||
var dailySignEvent = signupData.newSignEvent;
|
||||
rewardPanel.SetActive(dailySignEvent.lastID != ZZTimeHelper.UtcNow().UtcNowOffset().DayOfYear && dailySignEvent.index < 7);
|
||||
}
|
||||
void OnClickReward()
|
||||
{
|
||||
if (signupData.newSignEvent.index < signupDayItems.Count)
|
||||
{
|
||||
signupDayItems[signupData.newSignEvent.index].OnClaimBtnClick();
|
||||
}
|
||||
}
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventSignupPopupPanel);
|
||||
}
|
||||
//private void OnDisable()
|
||||
//{
|
||||
// //GContext.container.Resolve<IFaceUIService>().ShowFaceUI();
|
||||
//}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/EventSignupPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/EventSignupPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d85a93b5607bc734c878fcb13c7e2e88
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
304
Assets/Scripts/UI/Setting/EventSignupPopupPanel_2.cs
Normal file
304
Assets/Scripts/UI/Setting/EventSignupPopupPanel_2.cs
Normal file
@@ -0,0 +1,304 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using DG.Tweening;
|
||||
using UniRx;
|
||||
using game;
|
||||
|
||||
public class EventSignupPopupPanel_2 : BasePanel
|
||||
{
|
||||
List<SignupDayItem> signupDayItems = new List<SignupDayItem>();
|
||||
Button btn_close;
|
||||
TMP_Text text_time;
|
||||
Tables tables;
|
||||
SigninData signupData;
|
||||
private TimeSpan remaining;
|
||||
Image bar;
|
||||
RewardFly rewardFly;
|
||||
RectTransform icon_done;
|
||||
GameObject effect_HomePanel;
|
||||
GameObject clickMask;
|
||||
Transform reward;
|
||||
List<SignupRewardItem> rewardItems = new List<SignupRewardItem>();
|
||||
|
||||
List<int> drops = new List<int>();
|
||||
List<MonthlySign> monthlySign;
|
||||
GameObject rewardPanel;
|
||||
Button reward_button;
|
||||
|
||||
//Button closeButton;
|
||||
//GameObject tips;
|
||||
//Image icon_1;
|
||||
//TMP_Text text_num_1;
|
||||
//Image icon_2;
|
||||
//TMP_Text text_num_2;
|
||||
//TMP_Text text_condition;
|
||||
|
||||
int curIndex;
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
monthlySign = tables.TbMonthlySign.DataList;
|
||||
signupData = GContext.container.Resolve<SigninData>();
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
signupDayItems.Add(transform.Find("root/day" + i).GetComponent<SignupDayItem>());
|
||||
}
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
text_time = transform.Find("root/text_time").GetComponent<TMP_Text>();
|
||||
|
||||
bar = transform.Find("root/bg_bar/bar").GetComponent<Image>();
|
||||
icon_done = transform.Find("root/bg_bar/icon_done").GetComponent<RectTransform>();
|
||||
effect_HomePanel = transform.Find("root/bg_bar/effect_HomePanel").gameObject;
|
||||
reward = transform.Find("root/reward");
|
||||
for (int i = 0; i < reward.childCount; i++)
|
||||
{
|
||||
rewardItems.Add(reward.GetChild(i).GetComponent<SignupRewardItem>());
|
||||
}
|
||||
|
||||
rewardPanel = transform.Find("reward").gameObject;
|
||||
reward_button = transform.Find("reward/btn_play/btn_green").GetComponent<Button>();
|
||||
//closeButton = transform.Find("closeButton").GetComponent<Button>();
|
||||
//tips = transform.Find("tips").gameObject;
|
||||
//icon_1 = tips.transform.Find("icon_1").GetComponent<Image>();
|
||||
//text_num_1 = tips.transform.Find("text_num_1").GetComponent<TMP_Text>();
|
||||
//icon_2 = tips.transform.Find("icon_2").GetComponent<Image>();
|
||||
//text_num_2 = tips.transform.Find("text_num_2").GetComponent<TMP_Text>();
|
||||
//text_condition = tips.transform.Find("text_condition").GetComponent<TMP_Text>();
|
||||
clickMask = transform.Find("clickMask").gameObject;
|
||||
rewardFly = transform.Find("RewardFly").GetComponent<RewardFly>();
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
//closeButton.gameObject.SetActive(false);
|
||||
//tips.SetActive(false);
|
||||
clickMask.SetActive(false);
|
||||
oldPanelName = panelName;
|
||||
base.Start();
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
reward_button.onClick.AddListener(OnClickReward);
|
||||
//closeButton.onClick.AddListener(() =>
|
||||
//{
|
||||
// tips.SetActive(false);
|
||||
// closeButton.gameObject.SetActive(false);
|
||||
//});
|
||||
int DropID;
|
||||
if (signupData.eventSignID > 0)
|
||||
{
|
||||
SignInit signInit = tables.TbSignInit.GetOrDefault(signupData.eventSignID);
|
||||
var signDayList = signInit.SignDayList;
|
||||
for (int i = 0; i < signDayList.Count; i++)
|
||||
{
|
||||
SignReward dailySign = tables.TbSignReward.GetOrDefault(signDayList[i]);
|
||||
if (dailySign != null)
|
||||
{
|
||||
DropID = dailySign.DropID;
|
||||
signupDayItems[i].ShowData(i, DropID, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < signupDayItems.Count; i++)
|
||||
{
|
||||
DailySign dailySign = tables.TbDailySign.DataList[i];
|
||||
DropID = dailySign.DropID;
|
||||
signupDayItems[i].ShowData(i, DropID, 0);
|
||||
}
|
||||
}
|
||||
DateTime now = ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
DateTime tomorrow = GlobalUtils.TryParseDateTime(signupData.dailySignEvent.time, now);
|
||||
remaining = tomorrow - now;
|
||||
text_time.text = ConvertTools.ConvertTime2(remaining.Days, remaining.Hours, remaining.Minutes, remaining.Seconds);
|
||||
StartCoroutine(Countdown());
|
||||
SetData();
|
||||
GContext.OnEvent<OnSignEvent>().Subscribe(OnSignEvent).AddTo(disposables);
|
||||
}
|
||||
void SetData()
|
||||
{
|
||||
for (int i = 0; i < rewardItems.Count; i++)
|
||||
{
|
||||
rewardItems[i].gameObject.SetActive(false);
|
||||
}
|
||||
int count = monthlySign.Count;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int index = i;
|
||||
drops.Add(monthlySign[i].DropID);
|
||||
rewardItems[i].gameObject.SetActive(true);
|
||||
rewardItems[i].SetData(() => OnClickReward(index, rewardItems[index].transform.position), monthlySign[i].SignDayAccount.ToString());
|
||||
}
|
||||
|
||||
float fillAmount = GetFillAmount();
|
||||
bar.fillAmount = fillAmount;
|
||||
RefreshPanel();
|
||||
}
|
||||
void RefreshPanel()
|
||||
{
|
||||
ShowRewardPanel();
|
||||
|
||||
bar.DOKill();
|
||||
float fillAmount = GetFillAmount();
|
||||
//float timer = fillAmount - bar.fillAmount;
|
||||
//if (timer > 0.02)
|
||||
//{
|
||||
// bar.DOFillAmount(fillAmount, timer * 2);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
bar.fillAmount = fillAmount;
|
||||
}
|
||||
int count = monthlySign.Count;
|
||||
int id;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
id = monthlySign[i].SignDayAccount;
|
||||
rewardItems[i].SetReceived(signupData.monthlySignEvent.index >= id);
|
||||
}
|
||||
}
|
||||
float GetFillAmount()
|
||||
{
|
||||
float fillAmount = 1 - 0.09f;
|
||||
int doneCount = 0;
|
||||
for (int i = 0; i < monthlySign.Count; i++)
|
||||
{
|
||||
if (monthlySign[i].SignDayAccount >= signupData.monthlySignEvent.index)
|
||||
{
|
||||
fillAmount = i * 0.25f +
|
||||
((float)(signupData.monthlySignEvent.index - doneCount)
|
||||
/ (monthlySign[i].SignDayAccount - doneCount))
|
||||
* (0.25f - 0.09f);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
doneCount = monthlySign[i].SignDayAccount;
|
||||
}
|
||||
}
|
||||
return fillAmount;
|
||||
}
|
||||
async void FlyReward(List<ItemData> itemDatas)
|
||||
{
|
||||
//飞入
|
||||
CollectionItemFly collectionItemFly = new CollectionItemFly
|
||||
{
|
||||
icon = icon_done.GetComponent<Image>().sprite,
|
||||
sourcePos = signupDayItems[signupData.dailySignEvent.index - 1].icon_done.transform.position,
|
||||
destPos = icon_done.transform.position,
|
||||
scale = Vector2.one,
|
||||
isPlayOpen = true,
|
||||
isPlayClose = true,
|
||||
targetIconSize = icon_done.rect.width
|
||||
};
|
||||
rewardFly.gameObject.SetActive(true);
|
||||
await rewardFly.ShowAsync(collectionItemFly);
|
||||
effect_HomePanel.SetActive(true);
|
||||
rewardFly.gameObject.SetActive(false);
|
||||
bar.DOKill();
|
||||
float fillAmount = GetFillAmount();
|
||||
//float timer = fillAmount - bar.fillAmount;
|
||||
bar.DOFillAmount(fillAmount, 0.5f);
|
||||
await Awaiters.Seconds(0.5f);
|
||||
if (itemDatas != null && itemDatas.Count > 0)
|
||||
{
|
||||
GContext.Publish(new ShowData(itemDatas));
|
||||
GContext.Publish(new ShowData());
|
||||
}
|
||||
clickMask.SetActive(false);
|
||||
}
|
||||
|
||||
async void OnSignEvent(OnSignEvent onSignEvent)
|
||||
{
|
||||
//signupDayItems[signupData.dailySignEvent.index-1]
|
||||
clickMask.SetActive(true);
|
||||
ShowRewardPanel();
|
||||
int count = monthlySign.Count;
|
||||
int id;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
id = monthlySign[i].SignDayAccount;
|
||||
rewardItems[i].SetReceived(signupData.monthlySignEvent.index >= id);
|
||||
}
|
||||
await Awaiters.Seconds(1.5f);
|
||||
GContext.Publish(new ShowData());
|
||||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||||
GContext.Publish(curRewardQCount);
|
||||
if (curRewardQCount.count <= 0)
|
||||
{
|
||||
FlyReward(onSignEvent.itemDataList);
|
||||
}
|
||||
else
|
||||
{
|
||||
GContext.OnEvent<RewardPanelClose>().First().Subscribe((e) =>
|
||||
{
|
||||
FlyReward(onSignEvent.itemDataList);
|
||||
}).AddTo(disposables);
|
||||
}
|
||||
|
||||
}
|
||||
IEnumerator Countdown()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
remaining = remaining.Subtract(TimeSpan.FromSeconds(1));
|
||||
text_time.text = ConvertTools.ConvertTime2(remaining.Days, remaining.Hours, remaining.Minutes, remaining.Seconds);
|
||||
if (remaining.TotalSeconds <= 0)
|
||||
{
|
||||
signupData.EventSignEnd();
|
||||
OnClose();
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void ShowRewardPanel()
|
||||
{
|
||||
var dailySignEvent = signupData.dailySignEvent;
|
||||
bool isReward = dailySignEvent.lastID != ZZTimeHelper.UtcNow().UtcNowOffset().DayOfYear && dailySignEvent.index < 7;
|
||||
rewardPanel.SetActive(isReward);
|
||||
btn_close.gameObject.SetActive(!isReward);
|
||||
}
|
||||
void OnClickReward()
|
||||
{
|
||||
if (signupData.dailySignEvent.index < signupDayItems.Count)
|
||||
{
|
||||
signupDayItems[signupData.dailySignEvent.index].OnClaimBtnClick();
|
||||
}
|
||||
}
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventSignupPopupPanel_2);
|
||||
}
|
||||
void OnClickReward(int index, Vector3 pos)
|
||||
{
|
||||
item_sanddig_tips.Show(pos, drops[index]);
|
||||
//closeButton.gameObject.SetActive(true);
|
||||
//List<ItemData> items = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(drops[index]);
|
||||
//int id = items[0].id;
|
||||
//float count = items[0].count;
|
||||
//GContext.container.Resolve<IUIService>().SetImageSprite(icon_1, tables.GetItemIconName(id), PanelName);
|
||||
//text_num_1.text = ConvertTools.GetNumberString((int)count);
|
||||
//id = items[1].id;
|
||||
//count = items[1].count;
|
||||
//GContext.container.Resolve<IUIService>().SetImageSprite(icon_2, tables.GetItemIconName(id), PanelName);
|
||||
//text_num_2.text = ConvertTools.GetNumberString((int)count);
|
||||
|
||||
//int doneCount = monthlySign[index].SignDayAccount;
|
||||
//string str = $"{doneCount}/{doneCount} <sprite=0>";
|
||||
//if (signupData.monthlySignEvent.index < doneCount)
|
||||
//{
|
||||
// str = $"{signupData.monthlySignEvent.index}/{doneCount} <sprite=0>";
|
||||
//}
|
||||
//text_condition.text = str;
|
||||
//tips.transform.position = pos;
|
||||
//tips.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/EventSignupPopupPanel_2.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/EventSignupPopupPanel_2.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be63cae3ef3cc4d49ba4155a65cee182
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
204
Assets/Scripts/UI/Setting/FishingMorePanel.cs
Normal file
204
Assets/Scripts/UI/Setting/FishingMorePanel.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingMorePanel : MonoBehaviour
|
||||
{
|
||||
Button btn_setting;
|
||||
Button btn_debug;
|
||||
Button btn_mask;
|
||||
TMP_Text text_name;
|
||||
Button btn_vip;
|
||||
Button btn_event;
|
||||
Button btn_survey;
|
||||
Button btn_announcement;
|
||||
Button btn_signin;
|
||||
Button btn_travelmap;
|
||||
//Button btn_redeemCode;
|
||||
Button btn_mail;
|
||||
TMP_Text text_vipLevel;
|
||||
TMP_Text text_version;
|
||||
TMP_Text text_id;
|
||||
Button btn_copy;
|
||||
Head head;
|
||||
Button headButton;
|
||||
Button btn_achieve;
|
||||
private CompositeDisposable disposables = new CompositeDisposable();
|
||||
private Button btnJoin;
|
||||
|
||||
//Button btn_leaderboard;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
btn_setting = transform.Find("bg/resource/btn_setting").GetComponent<Button>();
|
||||
btn_debug = transform.Find("bg/btn_debug/btn_green").GetComponent<Button>();
|
||||
btn_mask = transform.Find("Mask").GetComponent<Button>();
|
||||
head = transform.Find("bg/btn_head").GetComponent<Head>();
|
||||
headButton = transform.Find("bg/btn_head").GetComponent<Button>();
|
||||
text_name = transform.Find("bg/btn_head/text_name").GetComponent<TMP_Text>();
|
||||
btn_vip = transform.Find("bg/resource/btn_grade").GetComponent<Button>();
|
||||
btn_event = transform.Find("bg/resource/btn_event").GetComponent<Button>();
|
||||
btn_announcement = transform.Find("bg/resource/btn_announcement").GetComponent<Button>();
|
||||
btn_signin = transform.Find("bg/resource/btn_signin").GetComponent<Button>();
|
||||
//btn_redeemCode = transform.Find("bg/resource/btn_code").GetComponent<Button>();
|
||||
btn_mail = transform.Find("bg/resource/btn_mail").GetComponent<Button>();
|
||||
text_vipLevel = transform.Find("bg/resource/btn_grade/p_text_num").GetComponent<TMP_Text>();
|
||||
text_version = transform.Find("bg/player_info/text_version").GetComponent<TMP_Text>();
|
||||
text_id = transform.Find("bg/player_info/text_id").GetComponent<TMP_Text>();
|
||||
btn_copy = transform.Find("bg/player_info/text_id/btn_copy").GetComponent<Button>();
|
||||
btn_debug.gameObject.SetActive(GContext.container.Resolve<IConfig>().Get("GM", "0") == "1");
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("FishingMorePanel");
|
||||
btn_event.gameObject.SetActive(true);
|
||||
btn_achieve = transform.Find("bg/resource/btn_achieve").GetComponent<Button>();
|
||||
btn_survey = transform.Find("bg/resource/btn_survey").GetComponent<Button>();
|
||||
btnJoin = transform.Find("bg/resource/btn_join").GetComponent<Button>();
|
||||
btn_travelmap = transform.Find("bg/resource/btn_travelmap").GetComponent<Button>();
|
||||
//btn_leaderboard = transform.Find("bg/resource/btn_leaderboard").GetComponent<Button>();
|
||||
|
||||
btn_announcement.gameObject.SetActive(false);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
text_version.text = $"Ver. {VersionTool.FromLocal().ToVerString()}";
|
||||
text_id.text = $"ID: {GContext.container.Resolve<IUserService>().CustomId}";
|
||||
//GContext.OnEvent<ChangeLanguageEvent>().Subscribe(OnChangeLanguage).AddTo(disposables);
|
||||
//OnChangeLanguage();
|
||||
|
||||
headButton.onClick.AddListener(async () =>
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.PlayerHeadPopupPanel);
|
||||
});
|
||||
|
||||
btn_debug.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_debug.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.DeBugPanel);
|
||||
btn_debug.enabled = true;
|
||||
});
|
||||
btn_setting.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_setting.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.SettingPopupPanel);
|
||||
btn_setting.enabled = true;
|
||||
});
|
||||
btn_mask.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.FishingMorePanel); });
|
||||
text_name.text = GContext.container.Resolve<IUserService>().DisplayName;
|
||||
head.SetData(GContext.container.Resolve<IUserService>().AvatarUrl);
|
||||
btn_vip.gameObject.SetActive(false);// GContext.container.Resolve<PlayerShopData>().IsVIPOpen);
|
||||
btn_announcement.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_announcement.enabled = false;
|
||||
await UIManager.Instance.ShowUI(UITypes.NoticePopupPanel);
|
||||
btn_announcement.enabled = true;
|
||||
});
|
||||
btn_signin.gameObject.SetActive(GContext.container.Resolve<SigninData>().DailySignIsOpen());
|
||||
btn_signin.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_signin.enabled = false;
|
||||
await UIManager.Instance.ShowUI(UITypes.EventSignupPopupPanel_2);
|
||||
btn_signin.enabled = true;
|
||||
});
|
||||
//btn_vip.onClick.AddListener(OnClickVip);
|
||||
text_vipLevel.text = GContext.container.Resolve<PlayerData>().vip.ToString();
|
||||
btn_copy.onClick.AddListener(() =>
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = GContext.container.Resolve<IUserService>().CustomId;
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_25"));
|
||||
});
|
||||
btn_event.onClick.AddListener(OnClickEvent);
|
||||
GContext.OnEvent<ChangeAvatarEvent>().Subscribe(OnChangeAvatar).AddTo(disposables);
|
||||
|
||||
//btn_redeemCode.gameObject.SetActive(GContext.container.Resolve<RedeemCodeService>().IsUnlock);
|
||||
//// btn_redeemCode.gameObject.SetActive(false);
|
||||
//btn_redeemCode.onClick.AddListener(async () =>
|
||||
//{
|
||||
//btn_redeemCode.enabled = false;
|
||||
//await UIManager.Instance.GetUIAsync(UITypes.RedemptionCodePopupPanel);
|
||||
//btn_redeemCode.enabled = true;
|
||||
//});
|
||||
btn_mail.gameObject.SetActive(GContext.container.Resolve<IInGameMailService>().IsUnlock);
|
||||
btn_mail.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_mail.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.FishingMailPopupPanel);
|
||||
btn_mail.enabled = true;
|
||||
});
|
||||
btn_achieve.onClick.AddListener(async () =>
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
|
||||
await UIManager.Instance.ShowUI(UITypes.PlayerGradePanel);
|
||||
GContext.Publish(new HideHomePanelEvent());
|
||||
GContext.Publish(new ChangeTabEvent() { index = 1 });
|
||||
});
|
||||
btn_travelmap.onClick.AddListener(async () =>
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
|
||||
GContext.container.Unregister<TravelMapCtrl>();
|
||||
|
||||
var travelMapCtrl = new TravelMapCtrl();
|
||||
travelMapCtrl.Init(true);
|
||||
GContext.container.RegisterInstance<TravelMapCtrl>(travelMapCtrl);
|
||||
await UIManager.Instance.ShowUI(UITypes.TravelMapPanel);
|
||||
GContext.Publish(new HideHomePanelEvent());
|
||||
GContext.Publish(new MapShowEvent() { isShow = false });
|
||||
});
|
||||
btn_achieve.transform.Find("redpoint").gameObject.SetActive(GContext.container.Resolve<PlayerFishData>().PTSRed());
|
||||
|
||||
btn_achieve.gameObject.SetActive(GContext.container.Resolve<PlayerData>().OpenGrade);
|
||||
|
||||
btn_survey.onClick.AddListener(async () =>
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.SurveyPopupPanel);
|
||||
});
|
||||
|
||||
string sid = GContext.container.Resolve<SurveyService>().Sid;
|
||||
btn_survey.gameObject.SetActive(!string.IsNullOrEmpty(sid));
|
||||
|
||||
btnJoin.gameObject.SetActive(GContext.container.Resolve<FishingEventData>().IsJoinUsPanelOpen);
|
||||
btnJoin.onClick.RemoveAllListeners();
|
||||
btnJoin.onClick.AddListener(OnClickBtnJoin);
|
||||
// Debug.Log($"<color=#fbc21a>Level 41: {GContext.container.Resolve<FishingEventData>().IsJoinUsPanelOpen}</color>");
|
||||
// Debug.Log($"<color=#fbc21a>FootPrint: {!GContext.container.Resolve<IFootPrintService>().HasFootPrint(EFootPrint.HasCommunityGuidancePanelBeenOpened)}</color>");
|
||||
var doNeedRedDot = (GContext.container.Resolve<FishingEventData>().IsJoinUsPanelOpen && !GContext.container
|
||||
.Resolve<IFootPrintService>().HasFootPrint(EFootPrint.HasCommunityGuidancePanelBeenOpened));
|
||||
RedPointManager.Instance.SetRedPointState("menu.joinus", doNeedRedDot);
|
||||
|
||||
//排行榜
|
||||
//btn_leaderboard.gameObject.SetActive(GContext.container.Resolve<LeadboardData>().IsOpenleaderboard);
|
||||
//btn_leaderboard.onClick.AddListener(() =>
|
||||
//{
|
||||
// _ = UIManager.Instance.ShowUI(UITypes.FishingLeaderboardPanel);
|
||||
//});
|
||||
}
|
||||
|
||||
void OnClickEvent()
|
||||
{
|
||||
_ = UIManager.Instance.ShowUI(UITypes.EventReportPopupPanel);
|
||||
}
|
||||
void OnChangeAvatar(ChangeAvatarEvent data)
|
||||
{
|
||||
head.SetData(GContext.container.Resolve<IUserService>().AvatarUrl);
|
||||
text_name.text = GContext.container.Resolve<IUserService>().DisplayName;
|
||||
}
|
||||
//void OnChangeLanguage(ChangeLanguageEvent changeLanguageEvent = null)
|
||||
//{
|
||||
// GContext.Publish(new TitleNewsEvent());
|
||||
//}
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposables.Dispose();
|
||||
disposables = null;
|
||||
}
|
||||
|
||||
private async void OnClickBtnJoin()
|
||||
{
|
||||
btnJoin.onClick.RemoveAllListeners();
|
||||
await UIManager.Instance.ShowUI(UITypes.CommunityGuidancePanel);
|
||||
btnJoin.transform.Find("redpoint").gameObject.SetActive(false);
|
||||
btnJoin.onClick.AddListener(OnClickBtnJoin);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/FishingMorePanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/FishingMorePanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ace06118ffc5ad4f93c483927e1a390
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/Scripts/UI/Setting/FishingNoticePopupPanel.cs
Normal file
47
Assets/Scripts/UI/Setting/FishingNoticePopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingNoticePopupPanel : MonoBehaviour
|
||||
{
|
||||
public enum NoticeType
|
||||
{
|
||||
RECONNECTED,
|
||||
UPDATE,
|
||||
MAINTENANCE,
|
||||
}
|
||||
|
||||
static FishingNoticePopupPanel _instance;
|
||||
|
||||
public FishingNoticePopupPanel Show(NoticeType type = NoticeType.RECONNECTED)
|
||||
{
|
||||
ShowInit();
|
||||
_instance.transform.SetAsLastSibling();
|
||||
_instance.ShowNotice(type);
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private static async void ShowInit()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
GameObject loading = await UIManager.Instance.GetUIAsync(UITypes.FishingNoticePopupPanel);
|
||||
|
||||
if (loading != null)
|
||||
{
|
||||
_instance = loading.GetComponent<FishingNoticePopupPanel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject[] noticeList;
|
||||
public Action OnOkButtonClick;
|
||||
|
||||
void ShowNotice(NoticeType type)
|
||||
{
|
||||
for (int i = 0; i < noticeList.Length; i++)
|
||||
{
|
||||
noticeList[i].SetActive(i == (int)type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab1b1e1a3bae4d5db13f2bfcbfe64c94
|
||||
timeCreated: 1694162236
|
||||
9
Assets/Scripts/UI/Setting/FishingShopNoticePopupPanel.cs
Normal file
9
Assets/Scripts/UI/Setting/FishingShopNoticePopupPanel.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using GameCore;
|
||||
|
||||
public class FishingShopNoticePopupPanel : BindAccountPopupPanel
|
||||
{
|
||||
protected override void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingShopNoticePopupPanel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c84eb90655f57f74ab295e46b2d69cd1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
Assets/Scripts/UI/Setting/Head.cs
Normal file
36
Assets/Scripts/UI/Setting/Head.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using asap.core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ChangeAvatarEvent
|
||||
{
|
||||
}
|
||||
public class Head : MonoBehaviour
|
||||
{
|
||||
public Image bg_head;
|
||||
public Image icon_head;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void Reset()
|
||||
{
|
||||
Awake();
|
||||
}
|
||||
#endif
|
||||
private void Awake()
|
||||
{
|
||||
bg_head = transform.Find("bg_head").GetComponent<Image>();
|
||||
icon_head = transform.Find("mask/icon_head")?.GetComponent<Image>();
|
||||
if (icon_head == null)
|
||||
{
|
||||
Debug.LogError("《Head》挂在了不该挂的地方,或者没有《mask/icon_head》", this);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetData(string url)
|
||||
{
|
||||
if (icon_head != null)
|
||||
{
|
||||
GContext.container.Resolve<IUIService>().SetHeadImage(icon_head, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/Head.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/Head.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81028268bcaec5944bf65ed925b1440d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/Scripts/UI/Setting/NoticePopupPanel.cs
Normal file
47
Assets/Scripts/UI/Setting/NoticePopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using GameCore;
|
||||
using PlayFab.ClientModels;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NoticePopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_close;
|
||||
public Button btn_close2;
|
||||
public Button btn_sure;
|
||||
public TMP_Text text_content;
|
||||
public TMP_Text text_time;
|
||||
public TMP_Text text_title;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close2 = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_sure = transform.Find("root/btn_sure/btn_green").GetComponent<Button>();
|
||||
text_content = transform.Find("root/ScrollView/Viewport/Content/text_content").GetComponent<TMP_Text>();
|
||||
text_time = transform.Find("root/ScrollView/Viewport/Content/text_time").GetComponent<TMP_Text>();
|
||||
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_sure.onClick.AddListener(OnClose);
|
||||
btn_close2.onClick.AddListener(OnClose);
|
||||
TitleNewsEvent titleNewsEvent = new TitleNewsEvent();
|
||||
titleNewsEvent.show = true;
|
||||
GContext.Publish(titleNewsEvent);
|
||||
TitleNewsItem titleNewsItem = titleNewsEvent.titleNewsItem;
|
||||
if (titleNewsItem != null)
|
||||
{
|
||||
text_title.text = titleNewsItem.Title;
|
||||
text_content.text = titleNewsItem.Body;
|
||||
text_time.text = titleNewsItem.Timestamp.ToString("dd/MM/yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.NoticePopupPanel);
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Setting/NoticePopupPanel.cs.meta
Normal file
3
Assets/Scripts/UI/Setting/NoticePopupPanel.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d6151607ebd42ffbcf55a638f8482b7
|
||||
timeCreated: 1691836507
|
||||
253
Assets/Scripts/UI/Setting/PlayerHeadPopupPanel.cs
Normal file
253
Assets/Scripts/UI/Setting/PlayerHeadPopupPanel.cs
Normal file
@@ -0,0 +1,253 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using tysdk;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerHeadPopupPanel : MonoBehaviour
|
||||
{
|
||||
IUserService userService;
|
||||
public Button btn_mask;
|
||||
public Button btn_close;
|
||||
public Head head;
|
||||
public TMP_Text text_name;
|
||||
public Button btn_name;
|
||||
public Button btn_save;
|
||||
public Transform content;
|
||||
public GameObject item;
|
||||
string url;
|
||||
string headUrl;
|
||||
int index;
|
||||
List<HeadItem> platformHead = new List<HeadItem>();
|
||||
List<HeadItem> headItems = new List<HeadItem>();
|
||||
List<UserAvatar> userAvatars = new List<UserAvatar>();
|
||||
HeadItem headItem_fb;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
userAvatars = GContext.container.Resolve<Tables>().TbUserAvatar.DataList;
|
||||
userService = GContext.container.Resolve<IUserService>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
head = transform.Find("root/btn_head").GetComponent<Head>();
|
||||
text_name = transform.Find("root/btn_head/text_name").GetComponent<TMP_Text>();
|
||||
btn_name = transform.Find("root/btn_head/text_name/btn_change").GetComponent<Button>();
|
||||
btn_save = transform.Find("root/btn_save/btn_green").GetComponent<Button>();
|
||||
content = transform.Find("root/ScrollView1/Viewport/Content/Item/panel_head").GetComponent<Transform>();
|
||||
item = transform.Find("root/ScrollView1/Viewport/Content/Item/panel_head/head").gameObject;
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("PlayerHeadPopupPanel");
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
item.SetActive(false);
|
||||
text_name.text = userService.DisplayName;
|
||||
url = headUrl = userService.AvatarUrl;
|
||||
btn_save.onClick.AddListener(OnClickSave);
|
||||
btn_name.onClick.AddListener(OnClickName);
|
||||
btn_mask.onClick.AddListener(OnClickClose);
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
|
||||
|
||||
index = 0;
|
||||
|
||||
platformHead = new List<HeadItem>();
|
||||
#region facebookAvatar
|
||||
GameObject head_fb = Instantiate(item, content);
|
||||
head_fb.SetActive(true);
|
||||
headItem_fb = head_fb.AddComponent<HeadItem>();
|
||||
headItem_fb.SetSelected(false);
|
||||
headItem_fb.SetUrlAsync("sp_avatar_33");
|
||||
platformHead.Add(headItem_fb);
|
||||
headItem_fb.onClick = OnBtnFacebook;
|
||||
#endregion facebookAvatar
|
||||
|
||||
Dictionary<string, string> EAccoutUrl = userService.EAccoutUrl;
|
||||
if (EAccoutUrl != null && EAccoutUrl.Count > 0)
|
||||
{
|
||||
//平台头像
|
||||
if (EAccoutUrl.TryGetValue(EAccoutType.hwFacebook.ToString(), out string facebookAvatar))
|
||||
{
|
||||
headItem_fb.SetUrlAsync(facebookAvatar);
|
||||
headItem_fb.SetSelected(url == facebookAvatar);
|
||||
if (url == facebookAvatar)
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
headItem_fb.onClick = () => { ClickItem(-1, facebookAvatar); };
|
||||
headItem_fb.transform.Find("tag_facebook").gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < userAvatars.Count; i++)
|
||||
{
|
||||
GameObject gameObject = Instantiate(item, content);
|
||||
gameObject.SetActive(true);
|
||||
HeadItem headItem = gameObject.AddComponent<HeadItem>();
|
||||
headItem.SetSelected(false);
|
||||
string avatar = userAvatars[i].Avatar;
|
||||
int clickindex = i;
|
||||
headItem.onClick = () => { ClickItem(clickindex, avatar); };
|
||||
|
||||
headItems.Add(headItem);
|
||||
if (string.IsNullOrEmpty(headUrl))
|
||||
{
|
||||
if (userAvatars[i].ID == GContext.container.Resolve<Tables>().TbGlobalConfig.InitAvatar)
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userAvatars[i].Avatar == headUrl)
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index >= headItems.Count)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
if (index >= 0)
|
||||
{
|
||||
headItems[index].SetSelected(true);
|
||||
url = userAvatars[index].Avatar;
|
||||
}
|
||||
|
||||
head.SetData(url);
|
||||
for (int i = 0; i < userAvatars.Count; i++)
|
||||
{
|
||||
headItems[i].SetUrlAsync(userAvatars[i].Avatar);
|
||||
}
|
||||
}
|
||||
async void OnClickName()
|
||||
{
|
||||
btn_name.enabled = false;
|
||||
GameObject panel = await UIManager.Instance.GetUIAsync(UITypes.PlayerNamePopupPanel);
|
||||
PlayerNamePopupPanel playerNamePopupPanel = panel.GetComponent<PlayerNamePopupPanel>();
|
||||
//playerNamePopupPanel.inputField.text = text_name.text;
|
||||
playerNamePopupPanel.Show(text_name);
|
||||
btn_name.enabled = true;
|
||||
}
|
||||
void ClickItem(int _index, string avatar)
|
||||
{
|
||||
if (index == _index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (index >= 0)
|
||||
{
|
||||
headItems[index].SetSelected(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
platformHead[-index - 1].SetSelected(false);
|
||||
}
|
||||
index = _index;
|
||||
if (index >= 0)
|
||||
{
|
||||
headItems[index].SetSelected(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
platformHead[-index - 1].SetSelected(true);
|
||||
}
|
||||
url = avatar;
|
||||
head.SetData(url);
|
||||
}
|
||||
void OnClickSave()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url) && headUrl != url)
|
||||
{
|
||||
userService.UpdateAvatarUrl(url);
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_13"));
|
||||
}
|
||||
OnClickClose();
|
||||
}
|
||||
void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.PlayerHeadPopupPanel);
|
||||
}
|
||||
|
||||
async void OnBtnFacebook()
|
||||
{
|
||||
var result = await userService.LinkAccount(EAccoutType.hwFacebook);
|
||||
if (result)
|
||||
{
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(EAccoutType.hwFacebook.ToString(), "1");
|
||||
Dictionary<string, string> EAccoutUrl = userService.EAccoutUrl;
|
||||
if (EAccoutUrl != null && EAccoutUrl.Count > 0)
|
||||
{
|
||||
if (EAccoutUrl.TryGetValue(EAccoutType.hwFacebook.ToString(), out string facebookAvatar))
|
||||
{
|
||||
headItem_fb.SetUrlAsync(facebookAvatar);
|
||||
headItem_fb.onClick = () => { ClickItem(-1, facebookAvatar); };
|
||||
headItem_fb.transform.Find("tag_facebook").gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
GetReward();
|
||||
}
|
||||
}
|
||||
void GetReward()
|
||||
{
|
||||
int rewardID = GContext.container.Resolve<Tables>().TbGlobalConfig.AccountLinkReward;
|
||||
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(rewardID);
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(itemData);
|
||||
GContext.Publish(new ShowData(itemData));
|
||||
GContext.Publish(new ShowData());
|
||||
GContext.container.Resolve<PlayerShopData>().GetSKUs();
|
||||
}
|
||||
}
|
||||
class HeadItem : MonoBehaviour
|
||||
{
|
||||
public Image icon_head;
|
||||
Button btn_head;
|
||||
public GameObject selected;
|
||||
GameObject loading;
|
||||
public Action onClick;
|
||||
private void Awake()
|
||||
{
|
||||
btn_head = GetComponent<Button>();
|
||||
icon_head = transform.Find("mask/icon_head").GetComponent<Image>();
|
||||
selected = transform.Find("selected").gameObject;
|
||||
loading = transform.Find("loading").gameObject;
|
||||
btn_head.onClick.AddListener(OnClick);
|
||||
}
|
||||
public void SetSelected(bool value)
|
||||
{
|
||||
selected.SetActive(value);
|
||||
}
|
||||
void OnClick()
|
||||
{
|
||||
if (loading.activeSelf)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_102"));
|
||||
return;
|
||||
}
|
||||
if (onClick != null)
|
||||
{
|
||||
onClick();
|
||||
}
|
||||
}
|
||||
public async void SetUrlAsync(string url)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
loading.SetActive(true);
|
||||
await GContext.container.Resolve<IUIService>().SetHeadImage(icon_head, url);
|
||||
if (loading != null)
|
||||
{
|
||||
loading.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/PlayerHeadPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/PlayerHeadPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3eaeaab41ff5c540b453abc9f51a434
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Assets/Scripts/UI/Setting/PlayerNamePopupPanel.cs
Normal file
78
Assets/Scripts/UI/Setting/PlayerNamePopupPanel.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerNamePopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_mask;
|
||||
public Button btn_close;
|
||||
public Button btn_save;
|
||||
public TMP_InputField inputField;
|
||||
TMP_Text text_name;
|
||||
IChatService chatService;
|
||||
private void Awake()
|
||||
{
|
||||
chatService = GContext.container.Resolve<IChatService>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_save = transform.Find("root/btn_submit/btn_green").GetComponent<Button>();
|
||||
inputField = transform.Find("root/InputField_name").GetComponent<TMP_InputField>();
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("PlayerNamePopupPanel");
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_mask.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.PlayerNamePopupPanel); });
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.PlayerNamePopupPanel); });
|
||||
btn_save.onClick.AddListener(OnClickSave);
|
||||
}
|
||||
public void Show(TMP_Text text_name)
|
||||
{
|
||||
this.text_name = text_name;
|
||||
}
|
||||
async void OnClickSave()
|
||||
{
|
||||
btn_save.enabled = false;
|
||||
string nameInput = inputField.text;
|
||||
if (string.IsNullOrEmpty(nameInput) || nameInput.Equals(text_name.text))
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_14"));
|
||||
}
|
||||
else if (nameInput != nameInput.Trim())
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_19"));
|
||||
}
|
||||
else if (nameInput.Length < 2)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_15"));
|
||||
}
|
||||
else
|
||||
{
|
||||
bool value = await chatService.TextAudit(nameInput);
|
||||
if (value)
|
||||
{
|
||||
var result = await GContext.container.Resolve<IUserService>().ChangeDisplayName(nameInput);
|
||||
if (result == nameInput)
|
||||
{
|
||||
if (text_name != null)
|
||||
{
|
||||
text_name.text = nameInput;
|
||||
}
|
||||
UIManager.Instance.DestroyUI(UITypes.PlayerNamePopupPanel);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_19"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_33"));
|
||||
}
|
||||
}
|
||||
btn_save.enabled = true;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/PlayerNamePopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/PlayerNamePopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb360354057ec4b4c80ace3692bf3ba8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
94
Assets/Scripts/UI/Setting/SelectlanguagePopupPanel.cs
Normal file
94
Assets/Scripts/UI/Setting/SelectlanguagePopupPanel.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SelectlanguagePopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_close;
|
||||
public Button btn_mask;
|
||||
|
||||
public GameObject item;
|
||||
public Transform content;
|
||||
public Button btn_sure;
|
||||
int language;
|
||||
List<Toggle> toggles = new List<Toggle>();
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
content = transform.Find("root/panel_list/ScrollView/Viewport/Content").GetComponent<Transform>();
|
||||
btn_sure = transform.Find("root/btn_sure/btn_green").GetComponent<Button>();
|
||||
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
item.SetActive(false);
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.SelectlanguagePopupPanel); });
|
||||
btn_mask.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.SelectlanguagePopupPanel); });
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
List<LanguageConfig> _dataList = GContext.container.Resolve<cfg.Tables>().TbLanguageConfig.DataList;
|
||||
for (int i = 0; i < _dataList.Count; i++)
|
||||
{
|
||||
GameObject go = Instantiate(item, content);
|
||||
go.SetActive(true);
|
||||
Image image = go.transform.Find("img_languagelist").GetComponent<Image>();
|
||||
uiService.SetImageSprite(image, _dataList[i].LanImg);
|
||||
var i1 = i;
|
||||
Toggle toggle = go.GetComponent<Toggle>();
|
||||
toggle.onValueChanged.AddListener((isOn) =>
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
language = i1;
|
||||
}
|
||||
});
|
||||
toggles.Add(toggle);
|
||||
}
|
||||
|
||||
language = LocalizationMgr.LanguageIndex;
|
||||
for (int i = 0; i < toggles.Count; i++)
|
||||
{
|
||||
toggles[i].isOn = language == i;
|
||||
}
|
||||
btn_sure.onClick.AddListener(OnBtnLanguage);
|
||||
}
|
||||
|
||||
private async void OnBtnLanguage()
|
||||
{
|
||||
if (LocalizationMgr.LanguageIndex != language)
|
||||
{
|
||||
string languagePack = LocalizationMgr.languagePackList[language];
|
||||
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
|
||||
bool isInit = await loadResourceService.Load(languagePack);
|
||||
if (!isInit)
|
||||
{
|
||||
Debug.Log($"Load language pack {languagePack} failed. download");
|
||||
var panel = await UIManager.Instance.ShowUINotLoading(UITypes.DownLoadPopupPanel);
|
||||
panel.GetComponent<DownLoadPopupPanel>().SetBtn(() =>
|
||||
{
|
||||
SetLanguage();
|
||||
}, () =>
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.SelectlanguagePopupPanel);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLanguage();
|
||||
}
|
||||
//下载多语言包
|
||||
}
|
||||
|
||||
}
|
||||
void SetLanguage()
|
||||
{
|
||||
LocalizationMgr.SetLanguageAsync(language);
|
||||
UIManager.Instance.DestroyUI(UITypes.SelectlanguagePopupPanel);
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_108"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fe8ac4400344e8ea481c0db1a9cf071
|
||||
timeCreated: 1691823758
|
||||
255
Assets/Scripts/UI/Setting/SettingPopupPanel.cs
Normal file
255
Assets/Scripts/UI/Setting/SettingPopupPanel.cs
Normal file
@@ -0,0 +1,255 @@
|
||||
using System;
|
||||
using asap.core;
|
||||
using game;
|
||||
using Game;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using Unity.Notifications;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SettingPopupPanel : MonoBehaviour
|
||||
{
|
||||
private IConfig config;
|
||||
|
||||
ISettingService settingService;
|
||||
public Button btn_close;
|
||||
public Button btn_mask;
|
||||
public BtnSwitch music;
|
||||
public BtnSwitch sound;
|
||||
public BtnSwitch vibrate;
|
||||
public BtnSwitch notification;
|
||||
public Button btn_language;
|
||||
public TMP_Text txt_language;
|
||||
|
||||
public Button btn_policy;
|
||||
public Button btn_contact;
|
||||
public Button btn_announcement;
|
||||
public Button btn_service;
|
||||
public Button btn_delete;
|
||||
public Button btn_social;
|
||||
public Button btn_logout;
|
||||
public Button btn_support;
|
||||
|
||||
//new
|
||||
public ToggleSwitch toggles_quality;
|
||||
public ToggleSwitch toggles_weight;
|
||||
|
||||
public TMP_Text text_id;
|
||||
public TMP_Text text_version;
|
||||
protected CompositeDisposable disposables = new CompositeDisposable();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
config = GContext.container.Resolve<IConfig>();
|
||||
settingService = GContext.container.Resolve<ISettingService>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
music = transform.Find("root/normal_setting/music/btn_setting").GetComponent<BtnSwitch>();
|
||||
sound = transform.Find("root/normal_setting/sound/btn_setting").GetComponent<BtnSwitch>();
|
||||
vibrate = transform.Find("root/normal_setting/vibrate/btn_setting").GetComponent<BtnSwitch>();
|
||||
notification = transform.Find("root/normal_setting/notice/btn_setting").GetComponent<BtnSwitch>();
|
||||
btn_language = transform.Find("root/language_setting/btn_language/btn_green_c").GetComponent<Button>();
|
||||
txt_language = transform.Find("root/language_setting/btn_language/btn_green_c/Ani_Container/p_text").GetComponent<TMP_Text>();
|
||||
btn_policy = transform.Find("root/user_setting/btn_setting1/btn_policy").GetComponent<Button>();
|
||||
btn_contact = transform.Find("root/user_setting/btn_contact/btn_green").GetComponent<Button>();
|
||||
btn_announcement = transform.Find("root/user_setting/btn_announcement/btn_green").GetComponent<Button>();
|
||||
btn_service = transform.Find("root/user_setting/btn_service/btn_green").GetComponent<Button>();
|
||||
btn_delete = transform.Find("root/user_setting/btn_delete/btn_green").GetComponent<Button>();
|
||||
btn_social = transform.Find("root/btn_social/btn_green").GetComponent<Button>();
|
||||
text_id = transform.Find("root/player_info/text_id").GetComponent<TMP_Text>();
|
||||
text_version = transform.Find("root/player_info/text_version").GetComponent<TMP_Text>();
|
||||
|
||||
toggles_quality = transform.Find("root/normal_setting/graphic/tab").GetComponent<ToggleSwitch>();
|
||||
|
||||
toggles_weight = transform.Find("root/normal_setting/weight/tab").GetComponent<ToggleSwitch>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.SettingPopupPanel); });
|
||||
btn_mask.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.SettingPopupPanel); });
|
||||
music.onToggle.AddListener(OnToggleMusic);
|
||||
sound.onToggle.AddListener(OnToggleSound);
|
||||
vibrate.onToggle.AddListener(OnToggleVibrate);
|
||||
notification.OverrideListener(OnToggleNotification);
|
||||
text_id.text = $"ID: {GContext.container.Resolve<IUserService>().CustomId}";
|
||||
text_version.text = $"Ver. {VersionTool.FromLocal().ToVerString()}";
|
||||
music.SetState(settingService.Music);
|
||||
sound.SetState(settingService.Sound);
|
||||
vibrate.SetState(settingService.Vibration);
|
||||
notification.SetState(settingService.Notice);
|
||||
|
||||
btn_policy.onClick.AddListener(OpenPrivacy);
|
||||
// btn_contact.onClick.AddListener(() => { UIManager.Instance.GetUI(UITypes.ContactPopupPanel); });
|
||||
btn_language.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_language.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.SelectlanguagePopupPanel);
|
||||
btn_language.enabled = true;
|
||||
});
|
||||
btn_announcement.onClick.AddListener(async () =>
|
||||
{
|
||||
btn_announcement.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.NoticePopupPanel);
|
||||
btn_announcement.enabled = true;
|
||||
});
|
||||
btn_service.onClick.AddListener(OpenUserAgreement);
|
||||
btn_delete.OnClickAsObservable().Subscribe(async x =>
|
||||
{
|
||||
btn_delete.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.DeleteAccountPopupPanel);
|
||||
btn_delete.enabled = true;
|
||||
}).AddTo(disposables);
|
||||
|
||||
btn_social.OnClickAsObservable().Subscribe(async x =>
|
||||
{
|
||||
btn_social.enabled = false;
|
||||
await UIManager.Instance.GetUIAsync(UITypes.BindAccountPopupPanel);
|
||||
btn_social.enabled = true;
|
||||
}).AddTo(disposables);
|
||||
|
||||
btn_logout.OnClickAsObservable().Subscribe(async x =>
|
||||
{
|
||||
QuitStage.Logout = true;
|
||||
DestroyUI();
|
||||
await LoadingScreen.Show();
|
||||
await GContext.container.Resolve<IStageService>().SwitchStageAsync("QuitStage");
|
||||
}).AddTo(disposables);
|
||||
|
||||
btn_support.OnClickAsObservable().Subscribe(x =>
|
||||
{
|
||||
AIHelp.AIHelpSupport.Show("E001");
|
||||
|
||||
#if AGG
|
||||
using (var e = GEvent.TackEvent("click_support"))
|
||||
{
|
||||
e.AddContent("button_position", 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
}).AddTo(disposables);
|
||||
|
||||
|
||||
GContext.OnEvent<ChangeLanguageEvent>().Subscribe(OnChangeLanguage).AddTo(disposables);
|
||||
OnChangeLanguage();
|
||||
|
||||
//quality
|
||||
if (QualityLimit.IsLimitDevice())
|
||||
toggles_quality.HideFromIndex(2);
|
||||
else
|
||||
toggles_quality.HideFromIndex(-1);
|
||||
toggles_quality.SetState(QualitySettings.GetQualityLevel());
|
||||
toggles_quality.ChannalToggleChange += OnChangeQuality;
|
||||
|
||||
toggles_weight.SetState(settingService.UnitOfWeight);
|
||||
toggles_weight.ChannalToggleChange += OnUnitOfWeight;
|
||||
|
||||
}
|
||||
|
||||
void OnChangeQuality(int level)
|
||||
{
|
||||
QualityManager.ChangeQuality(level);
|
||||
zzwater.URPHelper.RendererFeatureSetActive(false, "FSBlur");
|
||||
zzwater.URPHelper.RendererFeatureSetActive(false, "FSWave");
|
||||
}
|
||||
|
||||
void DestroyUI()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.SettingPopupPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.HomePanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.CampPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.GuidancePanel);
|
||||
}
|
||||
void OpenPrivacy()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
var k = GConstant.K_IOS_Privacy_Policy_URL;
|
||||
var v = GConstant.V_IOS_Privacy_Policy_URL;
|
||||
#else
|
||||
var k = GConstant.K_Android_Privacy_Policy_URL;
|
||||
var v = GConstant.V_Android_Privacy_Policy_URL;
|
||||
#endif
|
||||
string privacy = config.Get(k, v);
|
||||
Application.OpenURL(privacy);
|
||||
}
|
||||
|
||||
void OpenUserAgreement()
|
||||
{
|
||||
string agreement = config.Get(GConstant.K_User_Agreement_URL, GConstant.V_User_Agreement_URL);
|
||||
Application.OpenURL(agreement);
|
||||
}
|
||||
|
||||
private void OnToggleMusic(bool isOn)
|
||||
{
|
||||
settingService.Music = isOn;
|
||||
}
|
||||
|
||||
private void OnToggleSound(bool isOn)
|
||||
{
|
||||
settingService.Sound = isOn;
|
||||
}
|
||||
|
||||
private void OnUnitOfWeight(int unitOfWeight)
|
||||
{
|
||||
if (settingService.UnitOfWeight != unitOfWeight)
|
||||
{
|
||||
settingService.UnitOfWeight = unitOfWeight;
|
||||
LocalizationMgr.SetUnitOfWeight();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleVibrate(bool isOn)
|
||||
{
|
||||
settingService.Vibration = isOn;
|
||||
if (isOn)
|
||||
{
|
||||
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleNotification(bool isOn)
|
||||
{
|
||||
NotificationCenter.OpenNotificationSettings();
|
||||
}
|
||||
|
||||
private void OnChangeLanguage(ChangeLanguageEvent changeLanguageEvent = null)
|
||||
{
|
||||
txt_language.text = LocalizationMgr.LanguageLanguages[LocalizationMgr.LanguageIndex];
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposables.Dispose();
|
||||
disposables = null;
|
||||
}
|
||||
|
||||
bool isNoticeOpen;
|
||||
private void OnApplicationFocus(bool hasFocus)
|
||||
{
|
||||
if (!hasFocus)
|
||||
{
|
||||
isNoticeOpen = settingService.Notice;
|
||||
}
|
||||
else
|
||||
{
|
||||
var isNoticeOn_now = settingService.Notice;
|
||||
if (isNoticeOpen != isNoticeOn_now)
|
||||
{
|
||||
isNoticeOpen = isNoticeOn_now;
|
||||
Debug.Log($"SettingPopupPanel OnApplicationFocus Notice enable {isNoticeOpen}");
|
||||
notification.SetStateSmooth(isNoticeOpen);
|
||||
if (isNoticeOpen)
|
||||
{
|
||||
GContext.container.Resolve<ILocalNotificationService>().ScheduleDefaultNotification();
|
||||
}
|
||||
else
|
||||
{
|
||||
GContext.container.Resolve<ILocalNotificationService>().ClearAllNotification();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Setting/SettingPopupPanel.cs.meta
Normal file
3
Assets/Scripts/UI/Setting/SettingPopupPanel.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a91a620cfad449bda06e09446a93f7a7
|
||||
timeCreated: 1691740692
|
||||
131
Assets/Scripts/UI/Setting/SignupDayItem.cs
Normal file
131
Assets/Scripts/UI/Setting/SignupDayItem.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SignupDayItem : MonoBehaviour
|
||||
{
|
||||
GameObject received;
|
||||
GameObject bg;
|
||||
GameObject claim_notice;
|
||||
GameObject bg_today;
|
||||
Button claim_btn;
|
||||
Animation ani;
|
||||
[NonSerialized]
|
||||
public Animation icon_done;
|
||||
RewardItemNew[] rewardItems;
|
||||
int index;
|
||||
SigninData signupData;
|
||||
Tables tables;
|
||||
List<ItemData> itemDatas;
|
||||
int ID;
|
||||
int DropID;
|
||||
private void Awake()
|
||||
{
|
||||
received = transform.Find("received").gameObject;
|
||||
bg = transform.Find("bg").gameObject;
|
||||
claim_notice = transform.Find("claim_notice").gameObject;
|
||||
bg_today = transform.Find("bg_today").gameObject;
|
||||
claim_btn = GetComponent<Button>();
|
||||
ani = GetComponent<Animation>();
|
||||
icon_done = transform.Find("received/icon_done").GetComponent<Animation>();
|
||||
rewardItems = transform.GetComponentsInChildren<RewardItemNew>();
|
||||
signupData = GContext.container.Resolve<SigninData>();
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
claim_btn.onClick.AddListener(OnClaimBtnClick);
|
||||
}
|
||||
public void ShowData(int index, int DropID, int ID, int Multiplier = 1)
|
||||
{
|
||||
this.index = index;
|
||||
this.ID = ID;
|
||||
this.DropID = DropID;
|
||||
DailySignEvent dailySignEvent;
|
||||
itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(DropID);
|
||||
if (ID > 0)
|
||||
{
|
||||
dailySignEvent = signupData.newSignEvent;
|
||||
if (index == 6 && Multiplier > 1)
|
||||
{
|
||||
for (int i = 0; i < itemDatas.Count; i++)
|
||||
{
|
||||
itemDatas[i].count *= Multiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dailySignEvent = signupData.dailySignEvent;
|
||||
}
|
||||
received.SetActive(index < dailySignEvent.index);
|
||||
int count = Math.Min(itemDatas.Count, rewardItems.Length);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
rewardItems[i].SetData(itemDatas[i]);
|
||||
}
|
||||
for (int i = 0; i < rewardItems.Length; i++)
|
||||
{
|
||||
rewardItems[i].gameObject.SetActive(i < count);
|
||||
rewardItems[i].SetReceived(index < dailySignEvent.index);
|
||||
}
|
||||
if (dailySignEvent.lastID != ZZTimeHelper.UtcNow().UtcNowOffset().DayOfYear)
|
||||
{
|
||||
bg.SetActive(dailySignEvent.index != index);
|
||||
bg_today.SetActive(dailySignEvent.index == index);
|
||||
if (dailySignEvent.index == index)
|
||||
ani.Play();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bg.SetActive(dailySignEvent.index - 1 != index);
|
||||
bg_today.SetActive(dailySignEvent.index - 1 == index);
|
||||
}
|
||||
claim_notice.SetActive(dailySignEvent.index == index && dailySignEvent.lastID != ZZTimeHelper.UtcNow().UtcNowOffset().DayOfYear);
|
||||
}
|
||||
public void SetMultiplier(int Multiplier)
|
||||
{
|
||||
itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(DropID);
|
||||
for (int i = 0; i < itemDatas.Count; i++)
|
||||
{
|
||||
itemDatas[i].count *= Multiplier;
|
||||
}
|
||||
int count = Math.Min(itemDatas.Count, rewardItems.Length);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
rewardItems[i].SetData(itemDatas[i]);
|
||||
}
|
||||
}
|
||||
public void OnClaimBtnClick()
|
||||
{
|
||||
claim_btn.enabled = false;
|
||||
bool isSign;
|
||||
if (ID > 0)
|
||||
{
|
||||
isSign = signupData.OnSpecialSign(ID, index, DropID);
|
||||
}
|
||||
else
|
||||
{
|
||||
isSign = signupData.OnDailySign(index, DropID);
|
||||
}
|
||||
if (isSign)
|
||||
{
|
||||
received.SetActive(true);
|
||||
icon_done.Play();
|
||||
ani.Stop();
|
||||
claim_notice.SetActive(false);
|
||||
for (int i = 0; i < rewardItems.Length; i++)
|
||||
{
|
||||
rewardItems[i].SetReceived(true);
|
||||
rewardItems[i].ParticleAttractor();
|
||||
}
|
||||
}
|
||||
claim_btn.enabled = true;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/SignupDayItem.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/SignupDayItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79d1b67fa6b12414cbf00cae6f26870d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/Scripts/UI/Setting/SignupRewardItem.cs
Normal file
56
Assets/Scripts/UI/Setting/SignupRewardItem.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SignupRewardItem : MonoBehaviour
|
||||
{
|
||||
public TMP_Text text_num;
|
||||
public GameObject num_bg;
|
||||
public GameObject received;
|
||||
public Button btn_click;
|
||||
Action OnClickReward;
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
text_num = transform.Find("text_progress").GetComponent<TMP_Text>();
|
||||
num_bg = transform.Find("bg_progress").gameObject;
|
||||
|
||||
received = transform.Find("received").gameObject;
|
||||
|
||||
btn_click = GetComponent<Button>();
|
||||
}
|
||||
public void SetReceived(bool _isReceived)
|
||||
{
|
||||
text_num.gameObject.SetActive(!_isReceived);
|
||||
num_bg.gameObject.SetActive(!_isReceived);
|
||||
received.SetActive(_isReceived);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (btn_click != null)
|
||||
{
|
||||
btn_click.onClick.AddListener(OnClick);
|
||||
}
|
||||
}
|
||||
|
||||
void OnClick()
|
||||
{
|
||||
OnClickReward();
|
||||
//GContext.container.Resolve<PlayerItemData>().ShowItemTips(id, transform);
|
||||
}
|
||||
public void SetData(Action onClickReward, string num)
|
||||
{
|
||||
OnClickReward = onClickReward;
|
||||
|
||||
//GContext.container.Resolve<IUIService>().SetImageSprite(icon, _tables.GetItemIconName(id), BasePanel.PanelName);
|
||||
|
||||
text_num.text = num;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/SignupRewardItem.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/SignupRewardItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d14d5a3799118b47b81f71fc60095e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/UI/Setting/SurveyPanel.cs
Normal file
46
Assets/Scripts/UI/Setting/SurveyPanel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SurveyPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
RectTransform RectPos;
|
||||
WebView webView;
|
||||
int left; int top; int right; int bottom;
|
||||
private void Awake()
|
||||
{
|
||||
webView = GetComponent<WebView>();
|
||||
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
|
||||
RectPos = transform.Find("content").GetComponent<RectTransform>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
|
||||
Vector2 anchoredPosition1 = GetComponent<RectTransform>().anchoredPosition;
|
||||
Vector2 anchoredPosition = anchoredPosition1 + RectPos.anchoredPosition;
|
||||
var rect = RectPos.rect;
|
||||
var rectparent = UIManager.Instance.RectTrans.rect;
|
||||
int width = (int)rectparent.width / 2;
|
||||
int height = (int)rectparent.height / 2;
|
||||
|
||||
left = width + (int)(rect.xMin + anchoredPosition.x);
|
||||
right = width - (int)(rect.xMax + anchoredPosition.x);
|
||||
top = height - (int)(rect.yMax + anchoredPosition.y);
|
||||
bottom = height + (int)(rect.yMin + anchoredPosition.y);
|
||||
|
||||
string Url = GContext.container.Resolve<SurveyService>().GetSurveyAnswer();
|
||||
webView.OnOpen(Url, left, top, right, bottom);
|
||||
btn_close.onClick.AddListener(Close);
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
GContext.container.Resolve<SurveyService>().GetSurveyCheckAnswer();
|
||||
UIManager.Instance.DestroyUI(UITypes.SurveyPanel);
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
webView.OnClose();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/SurveyPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/SurveyPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5cb5c906c361f545b6ec6a738322a7a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs
Normal file
47
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SurveyPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_go;
|
||||
RewardItemNew itemNew;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_go = transform.Find("root/btn_go/btn_green").GetComponent<Button>();
|
||||
itemNew = transform.Find("root/reward").GetComponent<RewardItemNew>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(Close);
|
||||
btn_go.onClick.AddListener(OnGo);
|
||||
SetReward();
|
||||
}
|
||||
void SetReward()
|
||||
{
|
||||
SurveyService surveyService = GContext.container.Resolve<SurveyService>();
|
||||
var SurveyReward = GContext.container.Resolve<Tables>().TbGlobalConfig.SurveyReward;
|
||||
int award = surveyService.Award;
|
||||
if (!SurveyReward.Contains(award))
|
||||
{
|
||||
Debug.LogError("问卷奖励错误: " + award);
|
||||
award = SurveyReward[0];
|
||||
}
|
||||
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(award);
|
||||
itemNew.SetData(itemData);
|
||||
}
|
||||
async void OnGo()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.SurveyPanel);
|
||||
Close();
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.SurveyPopupPanel);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27da31476f37a944b99e5e879fa1094a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Assets/Scripts/UI/Setting/ToggleSwitch.cs
Normal file
90
Assets/Scripts/UI/Setting/ToggleSwitch.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class ToggleSwitch : MonoBehaviour
|
||||
{
|
||||
public List<ToggleWithNum> ToggleGroup=new();
|
||||
|
||||
public List<Transform> ToggleIamges=new();
|
||||
|
||||
public UnityAction<int> ChannalToggleChange;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var toggles = GetComponentsInChildren<ToggleWithNum>();
|
||||
|
||||
for (int i = 0; i < toggles.Length; i++)
|
||||
{
|
||||
ToggleGroup.Add(toggles[i]);
|
||||
toggles[i].ChannalToggleChange += OnChangeToggle;
|
||||
}
|
||||
|
||||
ToggleIamges.Add(transform.Find("tab_selected_1"));
|
||||
ToggleIamges.Add(transform.Find("tab_selected_2"));
|
||||
ToggleIamges.Add(transform.Find("tab_selected_3"));
|
||||
ToggleIamges.Add(transform.Find("tab_selected_4"));
|
||||
}
|
||||
|
||||
public void HideFromIndex(int index)
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
foreach(ToggleWithNum toggle in ToggleGroup)
|
||||
{
|
||||
toggle.gameObject.SetActive(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < ToggleGroup.Count; i++)
|
||||
{
|
||||
ToggleGroup[i].gameObject.SetActive(i < index);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetState(int num)
|
||||
{
|
||||
for (int i = 0; i < ToggleGroup.Count; i++)
|
||||
{
|
||||
if (i == num)
|
||||
{
|
||||
ToggleIamges[i].gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleIamges[i].gameObject.SetActive(false);
|
||||
ToggleGroup[i].Toggle.SetIsOnWithoutNotify(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnChangeToggle(bool isOn,int num)
|
||||
{
|
||||
|
||||
ChannalToggleChange?.Invoke(num);
|
||||
for (int i=0; i<ToggleGroup.Count; i++)
|
||||
{
|
||||
if(i==num)
|
||||
{
|
||||
|
||||
ToggleIamges[num].gameObject.SetActive(isOn);
|
||||
ToggleIamges[num].localScale=Vector3.zero;
|
||||
ToggleIamges[num].DOKill();
|
||||
ToggleIamges[num].DOScale(1f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ToggleIamges[i].gameObject.SetActive(!isOn);
|
||||
ToggleGroup[i].Toggle.isOn = !isOn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/ToggleSwitch.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/ToggleSwitch.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4811d4d9269bce9499d1f11aab86919b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Scripts/UI/Setting/ToggleWithNum.cs
Normal file
35
Assets/Scripts/UI/Setting/ToggleWithNum.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ToggleWithNum : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private int offset = 1;
|
||||
|
||||
public int num;
|
||||
public bool InvokeWhenClose=false;
|
||||
|
||||
public Toggle Toggle;
|
||||
|
||||
public UnityAction<bool, int> ChannalToggleChange;
|
||||
void Awake()
|
||||
{
|
||||
num = transform.GetSiblingIndex()-1;
|
||||
Toggle = GetComponent<Toggle>();
|
||||
Toggle. onValueChanged.AddListener(OnToggleChange);
|
||||
}
|
||||
|
||||
public void OnToggleChange(bool isOn)
|
||||
{
|
||||
if(!InvokeWhenClose&&!isOn)
|
||||
return;
|
||||
|
||||
ChannalToggleChange?.Invoke(isOn,num);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Setting/ToggleWithNum.cs.meta
Normal file
11
Assets/Scripts/UI/Setting/ToggleWithNum.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7689b7b9f036874c95ec9bcd4660ab4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user