1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml;
- using UnityEngine;
- using UnityEngine.UI;
- public class ChangeMouseBubble : Regist
- {
- public static Text titleTxt;
- public static Text coinTxt;
- public static Text diamondTxt;
- public static Text confirmTxt;
- public static Text cancelTxt;
- public static Button confirmBtn;
- public static Button cancelBtn;
- public static Transform panel;
- public static Transform subPanel;
- public static Action confirmCallback;
- public static Action cancelCallback;
- public override void RegistReference()
- {
- titleTxt = ResourceManager.Get<Text>(CanvasLabel.AM_Title);
- coinTxt = ResourceManager.Get<Text>(CanvasLabel.AM_CoinLab);
- diamondTxt = ResourceManager.Get<Text>(CanvasLabel.AM_DiamondLab);
- confirmTxt = ResourceManager.Get<Text>(CanvasLabel.AM_ConfirmLab);
- cancelTxt = ResourceManager.Get<Text>(CanvasLabel.AM_CancelLab);
- confirmBtn = ResourceManager.Get<Button>(CanvasLabel.AM_Confirm);
- cancelBtn = ResourceManager.Get<Button>(CanvasLabel.AM_Cancel);
- panel = ResourceManager.Get(CanvasLabel.AM_Bubble);
- subPanel = ResourceManager.Get(CanvasLabel.AM_Bubble0);
- }
- public override void ThirdInit()
- {
- LanguageManager.Add(titleTxt, new MulLanStr(LanguageLabel.UI__AL_Tip));
- LanguageManager.Add(confirmTxt, new MulLanStr(LanguageLabel.Common__Confirm));
- LanguageManager.Add(cancelTxt, new MulLanStr(LanguageLabel.Common__Cancel));
- panel.CreateTweenCG(1f, 0.25f, false, true, Curve.EaseOutQuad);
- subPanel.CreateTweenScale(Vector3.one, 0.25f, true, true, Curve.EaseOutQuad);
- confirmBtn.onClick.AddListener(OnConfirmClick);
- cancelBtn.onClick.AddListener(OnCancelClick);
- }
- public static void Open(Action confirm, Action cancel)
- {
- AudioManager.PlayClip(ResourceLabel.BubbleClip);
- panel.TweenForCG();
- subPanel.TweenForScale();
- coinTxt.text = Auxiliary.ShrinkAllNumberStr(ChangeMousePanel.goldCost, 0);
- diamondTxt.text = Auxiliary.ShrinkAllNumberStr(ChangeMousePanel.diamondCost, 0);
- confirmCallback = confirm;
- cancelCallback = cancel;
- }
- public static void Close()
- {
- panel.TweenBacCG();
- subPanel.TweenBacScale();
- }
- public static void OnConfirmClick()
- {
- Close();
- confirmCallback.SafeInvoke();
- AudioManager.PlayClip(ResourceLabel.CurrentClip);
- }
- public static void OnCancelClick()
- {
- Close();
- cancelCallback.SafeInvoke();
- AudioManager.PlayClip(ResourceLabel.CloseClip);
- }
- }
|