You've already forked taptap2024_GJ_chidouren
101 lines
4.5 KiB
C#
101 lines
4.5 KiB
C#
using System;
|
|
using Coffee.UIEffects;
|
|
using Framework.Asset;
|
|
using Framework.Audio;
|
|
using Framework.UI;
|
|
using Game;
|
|
using IcecreamView;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
using Views;
|
|
|
|
namespace Views
|
|
{
|
|
public static class UIManagerExtend
|
|
{
|
|
public static void OpenLoading (this IC_Controller controller, Action confirmAction , int gameType = 0)
|
|
{
|
|
controller.OpenView (UIPanel.LoadingPanel, confirmAction , new IC_ViewData(gameType));
|
|
}
|
|
|
|
public static void CloseLoading (this IC_Controller controller, Action confirmAction)
|
|
{
|
|
controller.CloseView (UIPanel.LoadingPanel, confirmAction);
|
|
}
|
|
|
|
public static void OpenTip (this IC_Controller controller, string text, Action confirmAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData ("提示" , text, null, false,confirmAction));
|
|
}
|
|
|
|
public static void OpenTip (this IC_Controller controller, string title, string text, Action confirmAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData (title , text, null,false, confirmAction));
|
|
}
|
|
|
|
public static void OpenAdTip(this IC_Controller controller, string title, string text, Action confirmAction, Action cancelAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData (title , text, null, true,cancelAction, confirmAction));
|
|
}
|
|
|
|
public static void OpenAdTip(this IC_Controller controller, string text, Action confirmAction, Action cancelAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData ("提示" , text, null, true,cancelAction, confirmAction));
|
|
}
|
|
|
|
public static void OpenImageTip (this IC_Controller controller, string title, string text, string spriteName , Action confirmAction)
|
|
{
|
|
var loadAlwaysAsset = AssetManager.Instance.LoadAlwaysAsset<Texture2D> ("Texture/Tip/" + spriteName);
|
|
Sprite sprite = Sprite.Create (loadAlwaysAsset ,
|
|
new Rect (0 , 0 , loadAlwaysAsset.width , loadAlwaysAsset.height) , Vector2.zero);
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData (title , text, sprite ,false, confirmAction));
|
|
}
|
|
|
|
public static void OpenTip (this IC_Controller controller, string title, string text, Action confirmAction , Action cancelAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData (title , text, null, false,cancelAction, confirmAction));
|
|
}
|
|
|
|
public static void OpenTip (this IC_Controller controller, string text, Action confirmAction , Action cancelAction)
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData ("提示" , text, null,false, cancelAction, confirmAction));
|
|
}
|
|
|
|
public static void OpenImageTip (this IC_Controller controller, string title, string text, string spriteName , Action confirmAction,
|
|
Action cancelAction)
|
|
{
|
|
var loadAlwaysAsset = AssetManager.Instance.LoadAlwaysAsset<Texture2D> ("Texture/Tip/" + spriteName);
|
|
Sprite sprite = Sprite.Create (loadAlwaysAsset ,
|
|
new Rect (0 , 0 , loadAlwaysAsset.width , loadAlwaysAsset.height) , Vector2.zero);
|
|
UIManager.Instance.OpenView (UIPanel.CommonTipPanel, new IC_ViewData (title , text, sprite ,false, cancelAction, confirmAction));
|
|
}
|
|
|
|
public static void OpenPropTip (this IC_Controller controller, string text)
|
|
{
|
|
if (!UIManager.Instance.IsOpenedView (UIPanel.PropTipPanel))
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.PropTipPanel);
|
|
}
|
|
EventManager.Instance.SendEvent (GameEventCode.PropTip, text);
|
|
}
|
|
|
|
public static void OpenProp2Tip (this IC_Controller controller, string text)
|
|
{
|
|
if (!UIManager.Instance.IsOpenedView (UIPanel.PropTipPanel))
|
|
{
|
|
UIManager.Instance.OpenView (UIPanel.PropTipPanel);
|
|
}
|
|
EventManager.Instance.SendEvent (GameEventCode.Prop2Tip, text);
|
|
}
|
|
|
|
public static void AddListener (this Button.ButtonClickedEvent onClick, UnityAction call, SeAudio soundEffect)
|
|
{
|
|
onClick.AddListener (() =>
|
|
{
|
|
call.Invoke ();
|
|
AudioManager.Instance.PlaySoundEffect (soundEffect);
|
|
});
|
|
}
|
|
}
|
|
} |