| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using AppUI.Manager.View;
- using DG.Tweening;
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.Events;
- using UnityEngine.UI;
- namespace AppUI.View.Component
- {
- public class ModuleGuestView : MonoBehaviour
- {
- public string text;
- public string textKey;
- public object[] textFormatArgs = { };
- public UnityAction onLogin;
- //public string onAgreeTextKey;
- public UnityAction onSignUp;
- //public string onRejectTextKey;
- public UnityAction onGuestMode;
- public bool willDestroyAfterClick = true;
- public static ModuleGuestView Show()
- {
- GameObject o = Instantiate(ViewManager.GetPrefabByType(UIPrefabType.ModuleGuestView));
- ModuleGuestView v = o.AddComponent<ModuleGuestView>();
- return v;
- }
- void Start()
- {
- //if (textKey != null)
- //{
- // TextAutoLanguage2 t2 = transform.Find("Frame/Text").gameObject.AddComponent<TextAutoLanguage2>();
- // t2.textFormatArgs = textFormatArgs;
- // t2.SetTextKey(textKey);
- //}
- //else
- //{
- // transform.Find("Frame/Text").GetComponent<TMP_Text>().text = text;
- //}
- Transform BtnLogin = transform.Find("Frame/BtnLogin");
- BtnLogin.GetComponent<Button>().onClick.AddListener(() => {
- onLogin?.Invoke();
- if (willDestroyAfterClick) Destroy(gameObject);
- });
- Transform BtnSignUp = transform.Find("Frame/BtnSignUp");
- BtnSignUp.GetComponent<Button>().onClick.AddListener(() => {
- onSignUp?.Invoke();
- if (willDestroyAfterClick) Destroy(gameObject);
- });
- Transform BtnGuestMode = transform.Find("Frame/BtnGuestMode");
- BtnGuestMode.GetComponent<Button>().onClick.AddListener(() => {
- onGuestMode?.Invoke();
- if (willDestroyAfterClick) Destroy(gameObject);
- });
- //if (!string.IsNullOrEmpty(onAgreeTextKey))
- //{
- // btnAgree.GetComponentInChildren<TextAutoLanguage2>().SetTextKey(onAgreeTextKey);
- //}
- //if (!string.IsNullOrEmpty(onRejectTextKey))
- //{
- // btnReject.GetComponentInChildren<TextAutoLanguage2>().SetTextKey(onRejectTextKey);
- //}
- }
- }
- }
|