You've already forked taptap2024_GJ_chidouren
76 lines
2.3 KiB
C#
76 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Coffee.UIEffects;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using IcecreamView;
|
|
using TMPro;
|
|
|
|
namespace Views
|
|
{
|
|
public class CommonTipPanel : IcecreamView.IC_AbstractModule
|
|
{
|
|
[SerializeField] private Image _img;
|
|
[SerializeField] private TMP_Text _title;
|
|
[SerializeField] private TMP_Text _content;
|
|
[SerializeField] private Button _cancelBtn;
|
|
[SerializeField] private Button _confirmBtn;
|
|
[SerializeField] private Image _adImg;
|
|
|
|
private Action _cancelAction;
|
|
private Action _confirmAction;
|
|
|
|
public override void OnInitView()
|
|
{
|
|
this._cancelBtn.onClick.AddListener(OnClick_Cancel, SeAudio.Btn_Back);
|
|
this._confirmBtn.onClick.AddListener(OnClick_Confirm, SeAudio.Btn_Confirm);
|
|
}
|
|
|
|
private void OnClick_Confirm()
|
|
{
|
|
this.ViewConnector.CloseView();
|
|
this._confirmAction?.Invoke();
|
|
}
|
|
|
|
private void OnClick_Cancel()
|
|
{
|
|
this.ViewConnector.CloseView();
|
|
this._cancelAction?.Invoke();
|
|
}
|
|
|
|
public override void OnOpenView(IC_ViewData parameters)
|
|
{
|
|
_adImg.gameObject.SetActive(parameters.GetValue<bool>(3));
|
|
var imgSprite = parameters.GetValue<Sprite>(2);
|
|
this._title.text = parameters.GetValue<string>(0);
|
|
this._content.text = parameters.GetValue<string>(1);
|
|
this._img.sprite = imgSprite;
|
|
if (parameters.MsgCount == 5)
|
|
{
|
|
this._cancelBtn.gameObject.SetActive(false);
|
|
this._confirmAction = parameters.GetValue<Action>(4);
|
|
}
|
|
else
|
|
{
|
|
this._cancelBtn.gameObject.SetActive(true);
|
|
this._cancelAction = parameters.GetValue<Action>(4);
|
|
this._confirmAction = parameters.GetValue<Action>(5);
|
|
}
|
|
|
|
|
|
if (ReferenceEquals(imgSprite, default))
|
|
{
|
|
this._img.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
this._img.gameObject.SetActive(true);
|
|
this._img.SetNativeSize();
|
|
}
|
|
}
|
|
|
|
public override void OnCloseView()
|
|
{
|
|
}
|
|
}
|
|
} |