You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2484 lines
87 KiB

using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using IVDataFormat;
using Spine.Unity;
using System.Collections.Generic;
using System.Collections;
using System.Numerics;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;
using Vector2 = UnityEngine.Vector2;
using Vector3 = UnityEngine.Vector3;
public class GameUIMgr : MonoBehaviour
{
[SerializeField]
Camera UICamera;
#region Const
private static GameUIMgr curMgr = null;
#endregion Const
#region Main UI
[Header("Main UI")]
[SerializeField]
private Canvas canvasRight;
[SerializeField]
private Canvas canvasLeft;
[SerializeField]
private TextMeshProUGUI txtMainName;
[SerializeField]
private TextMeshProUGUI txtMainTitle;
[SerializeField]
private TextMeshProUGUI txtMainLv;
[SerializeField]
private TextMeshProUGUI txtMainBgmT;
[SerializeField]
private TextMeshProUGUI txtMainGold;
[SerializeField]
private TextMeshProUGUI txtMainDia;
[SerializeField]
private Image imgMainIcon;
[SerializeField]
private CanvasGroup cvBgmName;
private TextMeshProUGUI txtBgmName;
[SerializeField]
private Button btnZoom;
private RectTransform[] trfZooms;
private RectTransform trfZoomSelect;
[SerializeField]
private Canvas canvasFullBlack;
private Image imgFullBlack;
#endregion Main UI
#region Main Wrapper
private GameObject mainLeftTopSet;
private GameObject mainGroupPvp;
private GameObject mainRightTopSet;
private GameObject stageInfo;
private GameObject btnRetry;
private GameObject btnMenu;
private GameObject btnShop;
private GameObject btnPass;
private GameObject btnEvent;
private GameObject imgMenuPanel;
private TextMeshProUGUI txtEventButton;
private GameObject btnDungeonOut;
private GameObject btnOpenOpenRewardEvent;
private TextMeshProUGUI txtRewardEvent;
private GameObject mainLeftBottomSet;
private GameObject hotTimePanel;
private GameObject hotTimeActive;
private TextMeshProUGUI txtTimer;
private GameObject mainRightBottomSet;
private Toggle toggleDungeonAuto;
private TextMeshProUGUI txtCheckBox;
private GameObject mainBottomSet;
private Button dungeonButton;
[SerializeField]
private Canvas canvasMenu;
Image imgPvp;
GameObject imgPvpLock;
#endregion
#region RightBottom
GameObject[] skillPreset = new GameObject[6];
#endregion
#region Up Goods
[SerializeField]
private Canvas canvasUpUI;
private GameObject groupUpGood;
private GameObject goUpMail;
private GameObject goUpGold;
private GameObject goUpLvPoint;
private GameObject goUpReinStone;
private GameObject goUpSkillStone;
private GameObject goUpAwakenStone;
private GameObject goUpAwakenSkillStone;
private GameObject goUpGachaToken;
private GameObject goUpDia;
private GameObject goUpMileage;
private GameObject goUpPvpTicket;
private TextMeshProUGUI txtUpGold;
private TextMeshProUGUI txtUpLvPoint;
private TextMeshProUGUI txtUpReinStone;
private TextMeshProUGUI txtUpSkillStone;
private TextMeshProUGUI txtUpAwakenStone;
private TextMeshProUGUI txtUpAwakenSkillStone;
private TextMeshProUGUI txtUpGachaToken;
private TextMeshProUGUI txtUpDia;
private TextMeshProUGUI txtUpMileage;
private TextMeshProUGUI txtUpPvpTicket;
private Image imgUpGachaTicket;
#endregion Up Goods
#region Left Goods
[Header("Left Goods")]
private GameObject groupLeftGood;
private GameObject goLeftGold;
private GameObject goLeftLvPoint;
private GameObject goLeftReinStone;
private GameObject goLeftSkillStone;
private GameObject goLeftAwakenStone;
private GameObject goLeftAwakenSkillStone;
private GameObject goLeftChangeStone;
private GameObject goLeftPudding;
private GameObject goLeftDia;
private GameObject goLeftDgGoldTicket;
private GameObject goLeftDgEnhanceTicket;
private GameObject goLeftDgPetTicket;
private GameObject goLeftDgAwakenTicket;
private GameObject goLeftDgRelicTicket;
private GameObject goLeftMaskEnhance;
private TextMeshProUGUI txtLeftGold;
private TextMeshProUGUI txtLeftLvPoint;
private TextMeshProUGUI txtLeftReinStone;
private TextMeshProUGUI txtLeftSkillStone;
private TextMeshProUGUI txtLeftAwakenStone;
private TextMeshProUGUI txtLeftAwakenSkillStone;
private TextMeshProUGUI txtLeftChangeStone;
private TextMeshProUGUI txtLeftPudding;
private TextMeshProUGUI txtLeftDia;
private TextMeshProUGUI txtLeftDgGoldTicket;
private TextMeshProUGUI txtLeftDgEnhanceTicket;
private TextMeshProUGUI txtLeftDgPetTicket;
private TextMeshProUGUI txtLeftDgAwakenTicket;
private TextMeshProUGUI txtLeftDgRelicTicket;
private TextMeshProUGUI txtLeftMaskEnhance;
#endregion
#region Popup
[Header("Popup")]
[SerializeField]
private Canvas canvasPopup;
private IVPp1Button checkNet;
private IVPp1Button[] pp1Buttons;
private IVPp2Button[] pp2Buttons;
private IVPpGoods ppGoods;
private ParticleSystem ppGoodsEffect;
private ParticleSystem ppGoodsEffectLineS;
private ParticleSystem ppGoodsEffectLineM;
private ParticleSystem ppGoodsEffectLineL;
private IVPpPreset ppPreset;
private IVPpItemUse ppItemUse;
private IVPpItemUseTo ppItemUseTo;
private IVPpItemsUseTo ppItemsUseTo;
private IVPpItemBuy ppItemBuy;
private IVPpItemBuyCount ppItemBuyCount;
private IVPpRarityCheck ppRarityCheck;
private IVPpHelp ppHelp;
private IVPpToast toastTop;
private IVPpToast toastMiddle;
private IVPpToast toastBottom;
private IVPpNoticeToast toastNotice;
// 희귀도별 효과 팝업.
[SerializeField]
private GameObject goPopupRate;
[SerializeField]
private GameObject prfRarityRate;
private TextMeshProUGUI[] txtRarityTitles, txtRarityRates;
private bool bReLocalizeRarity;
// 전체 보유효과 팝업.
[SerializeField]
private GameObject goPopupHaveEfc;
[SerializeField]
private GameObject prfHaveEfc;
private TextMeshProUGUI txtHaveEfcT;
private TextMeshProUGUI[] txtHaveEfcTitles, txtHaveEfcValues;
// 게임 종료 팝업.
[SerializeField]
private IVPp2Button popupExit;
private bool bInitNeedExit = true;
// 오프라인 팝업.
[SerializeField]
private GameObject goPopupOffline;
private AsyncOperationHandle<SkeletonDataAsset> handleSkAnim;
#endregion Popup
#region Effect
private SkeletonAnimation skClrCompose;
private ParticleSystem ptcLeftEnhance;
#endregion Effect
#region Temp
[Header("Temp")]
[SerializeField]
private TextMeshProUGUI txtMainMenu;
[SerializeField]
private TextMeshProUGUI txtMainTShop;
#endregion Temp
private float fBackTick = 1f;
private int iPopup = 0;
private bool bChangingBgm = false;
private TweenerCore<float, float, FloatOptions> twcBgmName = null;
#region Base
public static void SLocalize(bool bmain)
{
if (curMgr != null)
curMgr.Localize(bmain);
}
private void Localize(bool bmain)
{
if (bmain)
{
txtMainBgmT.text = LocalizationText.GetText("bgm_title");
txtMainTShop.text = LocalizationText.GetText("shop_title");
txtMainMenu.text = LocalizationText.GetText("menu_title");
txtRewardEvent.text = LocalizationText.GetText("event_open");
}
else
{
txtCheckBox.text = LocalizationText.GetText("auto_progress");
txtEventButton.text = LocalizationText.GetText("event_title");
ppPreset.Localize();
}
}
// 설정에서 언어 변경 시 처리.
public static void SReLocalize()
{
curMgr.Localize(true);
curMgr.Localize(false);
curMgr.bReLocalizeRarity = true;
}
private void Awake()
{
curMgr = this;
TouchViewer.Instance.UICamera = UICamera;
VirtualPad.setCamera(UICamera);
}
private void Start()
{
imgFullBlack = canvasFullBlack.transform.GetChild(0).GetComponent<Image>();
txtBgmName = cvBgmName.transform.Find("txtBgmName").GetComponent<TextMeshProUGUI>();
mainGroupPvp = canvasRight.transform.Find("groupPvp").gameObject;
mainRightTopSet = canvasRight.transform.Find("RT").gameObject;
mainRightBottomSet = canvasRight.transform.Find("RB").gameObject;
mainLeftTopSet = canvasLeft.transform.Find("LT").gameObject;
mainLeftBottomSet = canvasLeft.transform.Find("LB").gameObject;
mainBottomSet = canvasLeft.transform.Find("B").gameObject;
stageInfo = mainRightTopSet.transform.Find("stageinfo").gameObject;
btnRetry = stageInfo.transform.Find("btnRetry").gameObject;
btnMenu = mainRightTopSet.transform.Find("btnMenu").gameObject;
btnShop = mainRightTopSet.transform.Find("btnShop").gameObject;
btnPass = mainRightTopSet.transform.Find("btnPass").gameObject;
btnEvent = mainRightTopSet.transform.Find("btnEvent").gameObject;
imgMenuPanel = mainRightTopSet.transform.Find("TopPanel").gameObject;
txtEventButton = btnEvent.transform.Find("txt").GetComponent<TextMeshProUGUI>();
txtEventButton.text = LocalizationText.GetText("event_title");
btnDungeonOut = mainRightTopSet.transform.Find("btnDungeonOut").gameObject;
dungeonButton = mainLeftBottomSet.transform.Find("BtnDungeon").GetComponent<Button>();
btnOpenOpenRewardEvent = canvasRight.transform.Find("btnOpenRewardEvent").gameObject;
txtRewardEvent = btnOpenOpenRewardEvent.transform.Find("txt").GetComponent<TextMeshProUGUI>();
#if false //TODO: block open event open button
if (DataHandler.GetPlayRewardEvent().sid >= 1)
{
btnOpenOpenRewardEvent.gameObject.SetActive(false);
}
#else
btnOpenOpenRewardEvent.gameObject.SetActive(false);
#endif
txtCheckBox = mainRightTopSet.transform.Find("CheckBox").transform.Find("txtCheckBox").GetComponent<TextMeshProUGUI>();
toggleDungeonAuto = txtCheckBox.transform.Find("CheckBoxToggle").GetComponent<Toggle>();
trfZooms = new RectTransform[3];
for(int i = 0; i<3; i++)
{
trfZooms[i] = new RectTransform();
trfZooms[i] = btnZoom.transform.GetChild(i).GetComponent<RectTransform>();
}
trfZoomSelect = btnZoom.transform.Find("ZoomSelect").GetComponent<RectTransform>();
trfZoomSelect.position = trfZooms[IVCameraController.SGetZoom()].position;
imgPvp = canvasMenu.transform.Find("OptionPanel").transform.Find("btnPvp").GetComponent<Image>();
imgPvpLock = imgPvp.transform.Find("lock").gameObject;
#region Up Goods
Transform trfupgood = canvasUpUI.transform.Find("RT").Find("upGoods");
groupUpGood = trfupgood.gameObject;
goUpMail = trfupgood.Find("btnMail").gameObject;
goUpGold = trfupgood.Find("goodsgold").gameObject;
goUpLvPoint = trfupgood.Find("goodslvpoint").gameObject;
goUpReinStone = trfupgood.Find("goodsrein").gameObject;
goUpSkillStone = trfupgood.Find("goodsskill").gameObject;
goUpAwakenStone = trfupgood.Find("goodsawaken").gameObject;
goUpAwakenSkillStone = trfupgood.Find("goodsawakenskill").gameObject;
goUpGachaToken = trfupgood.Find("goodsgacha").gameObject;
goUpDia = trfupgood.Find("goodsdia").gameObject;
goUpMileage = trfupgood.Find("goodsmileage").gameObject;
goUpPvpTicket = trfupgood.Find("goodspvp").gameObject;
txtUpGold = goUpGold.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpLvPoint = goUpLvPoint.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpReinStone = goUpReinStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpSkillStone = goUpSkillStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpAwakenStone = goUpAwakenStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpAwakenSkillStone = goUpAwakenSkillStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpGachaToken = goUpGachaToken.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpDia = goUpDia.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpMileage = goUpMileage.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtUpPvpTicket = goUpPvpTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
imgUpGachaTicket = goUpGachaToken.transform.Find("icon").GetComponent<Image>();
#endregion Up Goods
#region Left Goods
Transform trfleftgood = canvasUpUI.transform.Find("RT").Find("leftGoods");
groupLeftGood = trfleftgood.gameObject;
goLeftGold = trfleftgood.Find("goodsgold").gameObject;
goLeftLvPoint = trfleftgood.Find("goodslvpoint").gameObject;
goLeftReinStone = trfleftgood.Find("goodsrein").gameObject;
goLeftSkillStone = trfleftgood.Find("goodsskill").gameObject;
goLeftAwakenStone = trfleftgood.Find("goodsawaken").gameObject;
goLeftAwakenSkillStone = trfleftgood.Find("goodsawakenskill").gameObject;
goLeftChangeStone = trfleftgood.Find("goodschange").gameObject;
goLeftPudding = trfleftgood.Find("goodspudding").gameObject;
goLeftDia = trfleftgood.Find("goodsdia").gameObject;
goLeftDgGoldTicket = trfleftgood.Find("goodsgolddgticket").gameObject;
goLeftDgEnhanceTicket = trfleftgood.Find("goodsenhancedgticket").gameObject;
goLeftDgPetTicket = trfleftgood.Find("goodspetdgticket").gameObject;
goLeftDgAwakenTicket = trfleftgood.Find("goodsawakendgticket").gameObject;
goLeftDgRelicTicket = trfleftgood.Find("goodsrelicdgticket").gameObject;
goLeftMaskEnhance = trfleftgood.Find("goodsmaskenhance").gameObject;
txtLeftGold = goLeftGold.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftLvPoint = goLeftLvPoint.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftReinStone = goLeftReinStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftSkillStone = goLeftSkillStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftAwakenStone = goLeftAwakenStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftAwakenSkillStone = goLeftAwakenSkillStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftChangeStone = goLeftChangeStone.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftPudding = goLeftPudding.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDia = goLeftDia.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDgGoldTicket = goLeftDgGoldTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDgEnhanceTicket = goLeftDgEnhanceTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDgPetTicket = goLeftDgPetTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDgAwakenTicket = goLeftDgAwakenTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftDgRelicTicket = goLeftDgRelicTicket.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
txtLeftMaskEnhance = goLeftMaskEnhance.transform.Find("txtGoods").GetComponent<TextMeshProUGUI>();
#endregion Left Goods
#region General Popup
Transform trfpopup = canvasPopup.transform;
pp1Buttons = trfpopup.Find("popup1Buttons").GetComponentsInChildren<IVPp1Button>(true);
pp2Buttons = trfpopup.Find("popup2Buttons").GetComponentsInChildren<IVPp2Button>(true);
checkNet = trfpopup.Find("CheckNetwork").GetChild(0).GetComponent<IVPp1Button>();
ppGoods = trfpopup.Find("popupGoods").GetComponent<IVPpGoods>();
ppPreset = trfpopup.Find("popupPreset").GetComponent<IVPpPreset>();
ppItemUse = trfpopup.Find("popupItemUse").GetComponent<IVPpItemUse>();
ppItemUseTo = trfpopup.Find("popupItemUseTo").GetComponent<IVPpItemUseTo>();
ppItemsUseTo = trfpopup.Find("popupItemsUseTo").GetComponent<IVPpItemsUseTo>();
ppItemBuy = trfpopup.Find("popupItemBuy").GetComponent<IVPpItemBuy>();
ppItemBuyCount = trfpopup.Find("popupItemBuyCount").GetComponent<IVPpItemBuyCount>();
ppRarityCheck = trfpopup.Find("popupRarityCheck").GetComponent<IVPpRarityCheck>();
ppHelp = trfpopup.Find("popupHelp").GetComponent<IVPpHelp>();
toastTop = trfpopup.Find("toastTop").GetComponent<IVPpToast>();
toastMiddle = trfpopup.Find("toastMiddle").GetComponent<IVPpToast>();
toastBottom = trfpopup.Find("toastBottom").GetComponent<IVPpToast>();
toastNotice = trfpopup.Find("toastServerCheck").GetComponent<IVPpNoticeToast>();
for (int i = 0; i < pp1Buttons.Length; i++)
pp1Buttons[i].Init();
for (int i = 0; i < pp2Buttons.Length; i++)
pp2Buttons[i].Init();
checkNet.Init();
ppGoods.Init();
ppPreset.Init();
ppItemUse.Init();
ppItemUseTo.Init();
ppItemsUseTo.Init();
ppItemBuy.Init();
ppItemBuyCount.Init();
ppRarityCheck.Init();
ppHelp.Init();
toastTop.Init();
toastMiddle.Init();
toastBottom.Init();
toastNotice.Init();
#endregion General Popup
#region General Effect
skClrCompose = trfpopup.Find("skClrCompose").GetComponent<SkeletonAnimation>();
ptcLeftEnhance = trfpopup.transform.Find("leftGoodsEnhance").GetComponent<ParticleSystem>();
#endregion General Effect
hotTimePanel = mainLeftTopSet.transform.Find("HotTime").gameObject;
hotTimeActive = hotTimePanel.transform.Find("HotTimeActive").gameObject;
txtTimer = hotTimePanel.transform.Find("txtTimer").GetComponent<TextMeshProUGUI>();
EventMgr.HotTimeTimerSet();
ppGoodsEffect = ppGoods.transform.Find("RewardPopupEffcet").GetComponent<ParticleSystem>();
ppGoodsEffectLineS = ppGoods.transform.Find("RewardPopupEffect_line_s").GetComponent<ParticleSystem>();
ppGoodsEffectLineM = ppGoods.transform.Find("RewardPopupEffect_line_m").GetComponent<ParticleSystem>();
ppGoodsEffectLineL = ppGoods.transform.Find("RewardPopupEffect_line_l").GetComponent<ParticleSystem>();
skillPreset[0] = mainRightBottomSet.transform.Find("tabSkill").transform.Find("tabSkillDisable").gameObject;
skillPreset[1] = mainRightBottomSet.transform.Find("tabSkill (1)").transform.Find("tabSkillDisable").gameObject;
skillPreset[2] = mainRightBottomSet.transform.Find("tabSkill (2)").transform.Find("tabSkillDisable").gameObject;
skillPreset[3] = mainRightBottomSet.transform.Find("tabSkill (3)").transform.Find("tabSkillDisable").gameObject;
skillPreset[4] = mainRightBottomSet.transform.Find("tabSkill (4)").transform.Find("tabSkillDisable").gameObject;
skillPreset[5] = mainRightBottomSet.transform.Find("tabSkill (5)").transform.Find("tabSkillDisable").gameObject;
Localize(false);
SSetGoods();
}
private void Update()
{
if (fBackTick > 0f)
{
fBackTick -= Time.unscaledDeltaTime;
return;
}
// 백버튼 처리. 제일 상위 UI/조건부터 차례대로 확인.
if (Input.GetKeyDown(KeyCode.Escape))
{
if (CoverCamera.IsOn())
return;
if (canvasFullBlack.enabled)
return;
fBackTick = 0.15f;
// 절전모드.
if (SleepModeMgr.SCloseMenu())
return;
#region Popup
// 1버튼 팝업.
for (int i = pp1Buttons.Length - 1; i >= 0; i--)
{
if (pp1Buttons[i].IsOpen())
{
pp1Buttons[i].BtnYesPressed();
return;
}
}
// 2버튼 팝업.
for (int i = pp2Buttons.Length - 1; i >= 0; i--)
{
if (pp2Buttons[i].IsOpen())
{
pp2Buttons[i].BtnNoPressed();
return;
}
}
// 재화 획득 팝업.
if (ppGoods.IsOpen())
{
ppGoods.BtnYesPressed();
return;
}
// 프리셋 팝업.
if (ppPreset.IsOpen())
{
ppPreset.BtnNoPressed();
return;
}
// 아이템 사용 팝업.
if (ppItemUse.IsOpen())
{
ppItemUse.BtnNoPressed();
return;
}
// 아이템 사용-획득 팝업.
if (ppItemUseTo.IsOpen())
{
ppItemUseTo.BtnNoPressed();
return;
}
// 아이템들 사용 팝업.
if (ppItemsUseTo.IsOpen())
{
ppItemsUseTo.BtnNoPressed();
return;
}
// 아이템 구매 팝업.
if (ppItemBuy.IsOpen())
{
ppItemBuy.BtnNoPressed();
return;
}
// 아이템 수량 구매 팝업.
if (ppItemBuyCount.IsOpen())
{
ppItemBuyCount.BtnNoPressed();
return;
}
// 희귀도 선택 팝업.
if (ppRarityCheck.IsOpen())
{
ppRarityCheck.BtnNoPressed();
return;
}
// 희귀도별 확률 팝업.
if (goPopupRate.activeSelf)
{
ClosePopupRarityRate();
return;
}
// 전체 보유 효과 팝업.
if (goPopupHaveEfc.activeSelf)
{
ClosePopupHaveEfc();
return;
}
// 오프라인 팝업.
if (goPopupOffline.activeSelf)
{
ClosePopupOffline();
return;
}
// 게임 종료 팝업.
if (popupExit.IsOpen())
{
popupExit.BtnNoPressed();
return;
}
#endregion Popup
#region 중앙 팝업 컨텐츠
// 우편.
if (MailMgr.SCloseMenu())
return;
// 이벤트 & 공지.
if (NoticeMgr.SCloseMenu())
return;
//출석
if (AttendMgr.SCloseMenu())
return;
//재화 정보
if (GoodsInfo.SCloseMenu())
return;
#endregion 중앙 팝업 컨텐츠
#region 전체 화면 컨텐츠
// 결투장.
if (PvpMgr.SCloseMenu())
return;
// 패스.
if (PassMgr.SCloseMenu())
return;
// 상점.
if (ShopMgr.SCloseMenu())
return;
// 코스튬.
if (CustomizeMgr.SCloseMenu())
return;
// 소환.
if (GachaMgr.SCloseMenu())
return;
#endregion 전체 화면 컨텐츠
// 스테이지 실패 팝업.
if (BattleMgr.SCloseMenu())
return;
#region 좌우 분할 컨텐츠
// 강화
if (EnhanceMgr.SCloseMenu())
return;
// 펫.
if (PetMgr.SCloseMenu())
return;
// 스킬.
if (SkillMgr.SCloseMenu())
return;
// 가방.
if (BagMgr.SCloseMenu())
return;
// 스테이지.
if (StageMgr.SCloseMenu())
return;
//던전
if (DungeonMgr.SCloseMenu())
return;
// 채팅.
if (ChatMgr.SCloseMenu())
return;
// 프로필
if (ProfileMgr.SCloseProfile())
return;
//이벤트
if (EventMgr.SCloseMenu())
return;
// 설정.
if (SettingMgr.SCloseMenu())
return;
// 퀘스트.
if (QuestMgr.SCloseMenu())
return;
#endregion 좌우 분할 컨텐츠
if (canvasMenu.enabled)
{
CloseMenu();
return;
}
// 전투 종류에 따른 처리. 던전의 경우 던전 나가기 확인 팝업 표시 필요.
if (BattleMgr.CurrentBattleType != BattleMgr.BattleType.Stage)
{
return;
}
OpenPopupExit();
}
}
public static void SOpenMenu()
{
curMgr.OpenMenu();
}
public void OpenMenu()
{
if (imgMenuPanel.activeSelf)
{
imgMenuPanel.SetActive(false);
canvasMenu.enabled = true;
if (DataHandler.IsClearStage(DataHandler.Const.pvpOpenStage))
{
imgPvp.color = new Color(1f, 1f, 1f);
}
else
{
imgPvp.color = new Color(128 / 255f, 128 / 255f, 128 / 255f);
}
imgPvpLock.SetActive(!DataHandler.IsClearStage(DataHandler.Const.pvpOpenStage));
}
else
{
CloseMenu();
}
SoundMgr.PlaySfx(SoundName.BtnPress);
}
public static void SCloseMenu()
{
curMgr.CloseMenu();
}
public void CloseMenu()
{
imgMenuPanel.SetActive(true);
canvasMenu.enabled = false;
}
public static void SCloseRewardEvent()
{
curMgr.btnOpenOpenRewardEvent.SetActive(false);
}
#endregion Base
#region Control Scene
// 메인 UI 켜기.
public static void SSetMainUiOn(bool bvalue)
{
curMgr.canvasRight.gameObject.SetActive(bvalue);
curMgr.canvasLeft.gameObject.SetActive(bvalue);
}
// 우측 메인 그룹 켜고 끄기.
public static void SSetMainUiGroupRight(bool righttop, bool rightbottom, bool pvp, bool open)
{
curMgr.mainRightTopSet.SetActive(righttop);
curMgr.mainRightBottomSet.SetActive(rightbottom);
curMgr.mainGroupPvp.SetActive(pvp);
#if false //TODO: block open event open button
if (DataHandler.GetPlayRewardEvent().sid < 1)
{
curMgr.btnOpenOpenRewardEvent.SetActive(open);
}
#else
curMgr.btnOpenOpenRewardEvent.gameObject.SetActive(false);
#endif
}
// 좌측 메인 그룹 켜고 끄기.
public static void SSetMainUiGroupLeft(bool lefttop, bool leftbottom, bool bottom)
{
curMgr.mainLeftTopSet.SetActive(lefttop);
curMgr.mainLeftBottomSet.SetActive(leftbottom);
curMgr.mainBottomSet.SetActive(bottom);
}
// 팝업 UI 켜기.
public static void SSetPopupUiOn(bool bvalue)
{
curMgr.canvasPopup.enabled = bvalue;
if (!bvalue)
{
if (curMgr.popupExit.IsOpen())
curMgr.popupExit.BtnNoPressed();
if (curMgr.goPopupOffline.activeSelf)
curMgr.ClosePopupOffline();
}
}
#endregion Control Scene
#region Fade
public static void SFadeOutFullBack(float fduration)
{
if (curMgr != null)
curMgr.FadeOutFullBack(fduration);
}
private void FadeOutFullBack(float fduration)
{
Color clr = imgFullBlack.color;
clr.a = 0f;
canvasFullBlack.enabled = true;
imgFullBlack.DOFade(1f, fduration).SetUpdate(true);
}
public static void SFadeInFullBack(float fduration)
{
if (curMgr != null)
curMgr.FadeInFullBack(fduration);
}
private void FadeInFullBack(float fduration)
{
Color clr = imgFullBlack.color;
clr.a = 1f;
canvasFullBlack.enabled = true;
imgFullBlack.DOFade(0f, fduration).SetUpdate(true).OnComplete(() => canvasFullBlack.enabled = false);
}
public static void SFadeOutInFullBack(float ffadeout, float ffadein)
{
if (curMgr != null)
curMgr.FadeOutInFullBlack(ffadeout, ffadein);
}
private void FadeOutInFullBlack(float ffadeout, float ffadein)
{
Color clr = imgFullBlack.color;
clr.a = 0f;
canvasFullBlack.enabled = true;
imgFullBlack.DOFade(1f, ffadeout).SetUpdate(true).OnComplete(() =>
{
imgFullBlack.DOFade(0f, ffadein).SetUpdate(true).OnComplete(() => canvasFullBlack.enabled = false);
});
}
#endregion Fade
#region Player
//MainUI 왼쪽 상단에 플레이어 닉네임 설정
public static void SSetPlayerName()
{
curMgr.txtMainName.text = DataHandler.PlayData.playerName;
}
//MainUI 왼쪽 상단에 플레이어 칭호 설정
public static void SSetPlayerTitle(int id)
{
if (id == -1)
curMgr.txtMainTitle.text = LocalizationText.GetText("profile_empty_title");
else
curMgr.txtMainTitle.text = LocalizationText.GetText("profile_title_name" + id);
}
//MainUI 왼쪽 상단에 플레이어 레벨 설정
public static void SSetPlayerLv()
{
curMgr.txtMainLv.text = FormatString.TextLv(DataHandler.PlayData.playerLv);
}
//MainUI 왼쪽 상단에 플레이어 아이콘 설정
public static void SSetPlayerIcon(int id)
{
curMgr.imgMainIcon.sprite = AddressableMgr.GetPlayerIcon(id);
}
#endregion Player
#region Bgm & Zoom
public void ChangeBgm()
{
if (bChangingBgm)
return;
bChangingBgm = true;
// 배경음 변경 안 되었을 경우 변경 가능하도록.
if (SoundMgr.SChangeBgm())
{
bChangingBgm = false;
}
}
public static void SOnChangeBgm(string strname)
{
if (curMgr != null)
curMgr.OnChangeBgm(strname);
}
private void OnChangeBgm(string strname)
{
txtBgmName.text = strname;
cvBgmName.gameObject.SetActive(true);
if (twcBgmName == null)
twcBgmName = cvBgmName.DOFade(0f, 1f).SetDelay(1.5f).SetAutoKill(false).SetUpdate(true).OnComplete(() => bChangingBgm = false).Pause();
twcBgmName.Restart();
}
public void ChangeZoom()
{
trfZoomSelect.position =trfZooms[IVCameraController.SChangeZoom()].position;
SoundMgr.PlaySfx(SoundName.BtnPress);
}
#endregion Bgm & Zoom
#region Up & Left Panel
public static void SOpenUpPanel(bool isUp = false, bool gold = false, bool dia = false, bool lvpoint = false, bool enhance = false, bool skill = false, bool awaken = false, bool awakenskill = false, bool gacha = false,
bool mileage = false, bool pvp = false, bool mail = false, float addy = 0)
{
if (curMgr != null)
{
RectTransform upGoods = curMgr.groupUpGood.GetComponent<RectTransform>();
if (isUp)
{
upGoods.anchoredPosition = new Vector3(-120, -20 + addy, 0);
}
else
{
upGoods.anchoredPosition = new Vector3 (-120, -44, 0);
}
curMgr.goUpMail.SetActive(mail);
curMgr.goUpGold.SetActive(gold);
curMgr.goUpDia.SetActive(dia);
curMgr.goUpLvPoint.SetActive(lvpoint);
curMgr.goUpReinStone.SetActive(enhance);
curMgr.goUpSkillStone.SetActive(skill);
curMgr.goUpAwakenStone.SetActive(awaken);
curMgr.goUpAwakenSkillStone.SetActive(awakenskill);
curMgr.goUpGachaToken.SetActive(gacha);
curMgr.goUpMileage.SetActive(mileage);
curMgr.goUpPvpTicket.SetActive(pvp);
curMgr.groupUpGood.SetActive(true);
curMgr.groupLeftGood.SetActive(false);
curMgr.canvasUpUI.enabled = true;
}
}
public static void SCloseUpPanel()
{
if (curMgr != null)
{
curMgr.canvasUpUI.enabled = false;
}
}
/// <summary>
/// open left panel, relative to right panel
/// </summary>
public static void SOpenLeftPanel(bool gold = false, bool dia = false, bool lvpoint = false, bool enhance = false, bool skill = false, bool awaken = false, bool awakenskill = false, bool change = false, bool pudding = false,
bool dggoldticket = false, bool dgenhanceticket = false, bool dgpetticket = false, bool dgawakenticket = false, bool dgrelicticket = false, bool maskenhance = false)
{
if (curMgr != null)
{
SSetGoods();
curMgr.goLeftGold.SetActive(gold);
curMgr.goLeftDia.SetActive(dia);
curMgr.goLeftLvPoint.SetActive(lvpoint);
curMgr.goLeftReinStone.SetActive(enhance);
curMgr.goLeftSkillStone.SetActive(skill);
curMgr.goLeftAwakenStone.SetActive(awaken);
curMgr.goLeftAwakenSkillStone.SetActive(awakenskill);
curMgr.goLeftChangeStone.SetActive(change);
curMgr.goLeftPudding.SetActive(pudding);
curMgr.goLeftDgGoldTicket.SetActive(dggoldticket);
curMgr.goLeftDgEnhanceTicket.SetActive(dgenhanceticket);
curMgr.goLeftDgPetTicket.SetActive(dgpetticket);
curMgr.goLeftDgAwakenTicket.SetActive(dgawakenticket);
curMgr.goLeftDgRelicTicket.SetActive(dgrelicticket);
curMgr.goLeftMaskEnhance.SetActive(maskenhance);
curMgr.groupUpGood.SetActive(false);
curMgr.groupLeftGood.SetActive(true);
curMgr.canvasUpUI.enabled = true;
}
}
public static void SCloseLeftPanel()
{
if (curMgr != null)
{
curMgr.canvasUpUI.enabled = false;
}
}
#endregion Up & Left Panel
#region Popup Preset
/// <summary>
/// 현재 선택된 스킬 프리셋.
/// </summary>
/// <returns>프리셋 인덱스.</returns>
public static int SGetSkillPreset()
{
return curMgr.ppPreset.GetSkillPreset();
}
/// <summary>
/// 현재 선택된 펫 프리셋.
/// </summary>
/// <returns>프리셋 인덱스.</returns>
public static int SGetPetPreset()
{
return curMgr.ppPreset.GetPetPreset();
}
/// <summary>
/// 현재 선택된 각성 프리셋.
/// </summary>
/// <returns>프리셋 인덱스.</returns>
public static int SGetAwakenPreset()
{
return curMgr.ppPreset.GetAwakenPreset();
}
/// <summary>
/// 스테이지에서 사용하는 프리셋 인덱스 보존.
/// </summary>
/// <param name="iskillpreset">스킬 프리셋 인덱스.</param>
/// <param name="ipetpreset">펫 프리셋 인덱스트.</param>
/// <param name="iawakenpreset">각성 프리셋 인덱스.</param>
/// <returns></returns>
public static void SPreservePreset(int iskillpreset, int ipetpreset, int iawakenpreset)
{
curMgr.ppPreset.PreservePreset(iskillpreset, ipetpreset, iawakenpreset);
}
/// <summary>
/// 보존해 두었던 프리셋으로 되돌리기.
/// </summary>
/// <returns></returns>
public static void SReturnToPreservePreset()
{
curMgr.ppPreset.ReturnToPreservePreset();
}
/// <summary>
/// 프리셋 팝업 열기.
/// </summary>
/// <param name="iskillpreset">해당 컨텐츠에서 기본으로 선택된 스킬 프리셋 인덱스.</param>
/// <param name="ipetpreset">해당 컨텐츠에서 기본으로 선택된 펫 프리셋 인덱스트.</param>
/// <param name="iawakenpreset">해당 컨텐츠에서 기본으로 선택된 각성 프리셋 인덱스.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <returns></returns>
public static void SOpenPopupPreset(int iskillpreset, int ipetpreset, int iawakenpreset, System.Action actionyes = null, System.Action actionno = null)
{
if (curMgr != null)
curMgr.OpenPopupPreset(iskillpreset, ipetpreset, iawakenpreset, actionyes, actionno);
}
// 프리셋 팝업 열기.
private void OpenPopupPreset(int iskillpreset, int ipetpreset, int iawakenpreset, System.Action actionyes = null, System.Action actionno = null)
{
if (ppPreset == null || ppPreset.IsOpen())
return;
iPopup++;
ppPreset.Open(iskillpreset, ipetpreset, iawakenpreset, actionyes, actionno);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
public static void ClosePopupSet()
{
if (curMgr.ppPreset != null && curMgr.ppPreset.IsOpen())
{
curMgr.ppPreset.BtnNoPressed();
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = false;
return;
}
if (curMgr.pp2Buttons != null && DungeonMgr.isForceOut)
{
DungeonMgr.isForceOut = false;
for (int i = 0; i < curMgr.pp2Buttons.Length; i++)
{
// 이미 열려있는 팝업.
if (curMgr.pp2Buttons[i].IsOpen())
curMgr.pp2Buttons[i].BtnNoPressed();
}
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = false;
return;
}
}
/// <summary>
/// 스킬 프리셋 선택.
/// </summary>
/// <param name="ipresetindex">선택한 프리셋 인덱스.</param>
/// <returns></returns>
public static void SSetSkillPreset(int ipresetindex)
{
if (curMgr != null)
curMgr.ppPreset.SetSkillPreset(ipresetindex);
}
/// <summary>
/// 펫 프리셋 선택.
/// </summary>
/// <param name="ipresetindex">선택한 프리셋 인덱스.</param>
/// <returns></returns>
public static void SSetPetPreset(int ipresetindex)
{
if (curMgr != null)
curMgr.ppPreset.SetPetPreset(ipresetindex);
}
/// <summary>
/// 각성 프리셋 선택.
/// </summary>
/// <param name="ipresetindex">선택한 프리셋 인덱스.</param>
/// <returns></returns>
public static void SSetAwakenPreset(int ipresetindex)
{
if (curMgr != null)
curMgr.ppPreset.SetAwakenPreset(ipresetindex);
}
#endregion Popup Preset
#region Popup
/// <summary>
/// 1버튼 팝업 열기.
/// </summary>
/// <param name="strmsg">메시지 텍스트.</param>
/// <param name="actionyes">확인 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트. 기본값 '확인'.</param>
/// <param name="stryes">확인 버튼 텍스트. 기본값 '확인'.</param>
/// <param name="bclose">확인 버튼을 눌렀을때 팝업을 닫을지.</param>
/// <param name="ftime">자동으로 팝업이 닫히는 시간.</param>
public static void SOpenPopupCheckNet(string strmsg, System.Action actionyes = null, string strtitle = null, string stryes = null, bool bclose = true, float ftime = 0f, int igroup = -1)
{
if (curMgr != null)
curMgr.OepnPopupNet(strmsg, actionyes, strtitle, stryes, bclose, ftime, igroup);
}
private void OepnPopupNet(string strmsg, System.Action actionyes = null, string strtitle = null, string stryes = null, bool bclose = true, float ftime = 0f, int igroup = -1)
{
if (checkNet == null)
return;
if (checkNet.IsOpen())
return;
checkNet.Open(strmsg, actionyes,strtitle, stryes, bclose, ftime, igroup);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
return;
}
public static void SOpenPopup1Button(string strmsg, System.Action actionyes = null, string strtitle = null, string stryes = null, bool bclose = true, float ftime = 0f, int igroup = -1)
{
if (curMgr != null)
curMgr.OpenPopup1Button(strmsg, actionyes, strtitle, stryes, bclose, ftime, igroup);
}
// 1버튼 팝업 열기.
private void OpenPopup1Button(string strmsg, System.Action actionyes = null, string strtitle = null, string stryes = null, bool bclose = true, float ftime = 0f, int igroup = -1)
{
if (pp1Buttons == null)
return;
for (int i = 0; i < pp1Buttons.Length; i++)
{
// 이미 열려있는 팝업.
if (pp1Buttons[i].IsOpen())
continue;
iPopup++;
pp1Buttons[i].Open(strmsg, actionyes, strtitle, stryes, bclose, ftime, igroup);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
return;
}
}
/// <summary>
/// 1버튼 팝업 그룹 닫기.
/// </summary>
/// <param name="igroup">닫으려는 팝업의 그룹.</param>
/// <returns></returns>
public static void SClosePopup1Button(int igroup)
{
if (curMgr != null)
curMgr.ClosePopup1Button(igroup);
}
// 1버튼 팝업 그룹 닫기.
private void ClosePopup1Button(int igroup)
{
if (pp1Buttons == null)
return;
for (int i = 0; i < pp1Buttons.Length; i++)
{
// 닫혀있는 팝업.
if (!pp1Buttons[i].IsOpen())
continue;
pp1Buttons[i].CloseGroup(igroup);
}
}
/// <summary>
/// 2버튼 팝업 열기.
/// </summary>
/// <param name="strmsg">메시지 텍스트.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트. 기본값 '확인'.</param>
/// <param name="stryes">네 버튼 텍스트. 기본값 '네'.</param>
/// <param name="strno">아니오 버튼 텍스트. 기본값 '아니오'.</param>
/// <returns></returns>
public static void SOpenPopup2Button(string strmsg, System.Action actionyes = null, System.Action actionno = null, string strtitle = null, string stryes = null, string strno = null, int igroup = -1)
{
if (curMgr != null)
curMgr.OpenPopup2Button(strmsg, actionyes, actionno, strtitle, stryes, strno, igroup);
}
// 2버튼 팝업 열기.
private void OpenPopup2Button(string strmsg, System.Action actionyes = null, System.Action actionno = null, string strtitle = null, string stryes = null, string strno = null, int igroup = -1)
{
if (pp2Buttons == null)
return;
for (int i = 0; i < pp2Buttons.Length; i++)
{
// 이미 열려있는 팝업.
if (pp2Buttons[i].IsOpen())
continue;
iPopup++;
pp2Buttons[i].Open(strmsg, actionyes, actionno, strtitle, stryes, strno, igroup);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
return;
}
}
/// <summary>
/// 2버튼 팝업 그룹 닫기.
/// </summary>
/// <param name="igroup">닫으려는 팝업의 그룹.</param>
/// <returns></returns>
public static void SClosePopup2Button(int igroup)
{
if (curMgr != null)
curMgr.ClosePopup2Button(igroup);
}
// 2버튼 팝업 그룹 닫기.
private void ClosePopup2Button(int igroup)
{
if (pp2Buttons == null)
return;
for (int i = 0; i < pp2Buttons.Length; i++)
{
// 닫혀있는 팝업.
if (!pp2Buttons[i].IsOpen())
continue;
pp2Buttons[i].CloseGroup(igroup);
}
}
/// <summary>
/// 재화 목록 팝업 열기.
/// </summary>
/// <param name="goods">아이템 배열.</param>
/// <param name="actionyes">닫기 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="ftime">자동으로 팝업이 닫히는 시간.</param>
/// <returns></returns>
public static void SOpenPopupGoods(IList<nGoods> goods, System.Action actionyes = null, string strtitle = null, float ftime = 0f)
{
if (curMgr != null)
curMgr.OpenPopupGoods(goods, actionyes, strtitle, ftime);
}
// 재화 목록 팝업 열기.
private void OpenPopupGoods(IList<nGoods> goods, System.Action actionyes = null, string strtitle = null, float ftime = 0f)
{
if (ppGoods == null)
return;
iPopup++;
ppGoods.Open(goods, actionyes, strtitle, ftime);
ppGoodsEffect.Play();
SoundMgr.PlaySfx(SoundName.GetGoods);
StartCoroutine(PopupGoodsLineEffect());
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
int LineSML = 1;
public static void SetLineSML(int sml)
{
curMgr.LineSML = sml;
}
public IEnumerator PopupGoodsLineEffect()
{
yield return new WaitForSeconds(0.1f);
switch (LineSML)
{
case 1://small
curMgr.ppGoodsEffectLineS.Play();
break;
case 2://medium
curMgr.ppGoodsEffectLineM.Play();
break;
case 3://large
curMgr.ppGoodsEffectLineL.Play();
break;
}
}
/// <summary>
/// 아이템 사용 팝업 열기.
/// </summary>
/// <param name="goodsuse">사용할 아이템.</param>
/// <param name="actionsub">- 버튼을 눌렀을 때 처리.</param>
/// <param name="actionadd">+ 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmin">Min 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmax">Max 버튼을 눌렀을 때 처리.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="stryes">네 버튼 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupItemUse(nGoods goodsuse, System.Action actionsub, System.Action actionadd, System.Action actionmin, System.Action actionmax,
System.Action actionyes, System.Action actionno, string strtitle, string stryes, string strno)
{
curMgr.iPopup++;
curMgr.ppItemUse.Open(goodsuse, actionsub, actionadd, actionmin, actionmax, actionyes, actionno, strtitle, stryes, strno);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 아이템 사용 팝업 수 표시.
/// </summary>
/// <param name="icount">사용하려는 수. 1, 2, 3...</param>
/// <param name="iuse">실제로 사용되는 수. 한 번 사용할 때 5개가 필요한 아이템은 5, 10, 15...</param>
/// <returns></returns>
public static void SSetPopupItemUseCount(int icount, int iuse)
{
curMgr.ppItemUse.SetCount(icount, iuse);
}
/// <summary>
/// 아이템 사용-생성 팝업 열기.
/// </summary>
/// <param name="goodsuse">사용할 아이템.</param>
/// <param name="goodsto">생성될 아이템.</param>
/// <param name="actionsub">- 버튼을 눌렀을 때 처리.</param>
/// <param name="actionadd">+ 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmin">Min 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmax">Max 버튼을 눌렀을 때 처리.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="stryes">네 버튼 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupItemUseTo(nGoods goodsuse, nGoods goodsto, System.Action actionsub, System.Action actionadd, System.Action actionmin, System.Action actionmax,
System.Action actionyes, System.Action actionno, string strtitle, string stryes, string strno)
{
curMgr.iPopup++;
curMgr.ppItemUseTo.Open(goodsuse, goodsto, actionsub, actionadd, actionmin, actionmax, actionyes, actionno, strtitle, stryes, strno);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 아이템 사용-생성 팝업 수 표시.
/// </summary>
/// <param name="icount">사용하려는 수. 1, 2, 3...</param>
/// <param name="iuse">실제로 사용되는 수. 한 번 사용할 때 5개가 필요한 아이템은 5, 10, 15...</param>
/// <param name="icount">생성되는 수. 1, 2, 3...</param>
/// <returns></returns>
public static void SSetPopupItemUseToCount(int icount, int iuse, int ito)
{
curMgr.ppItemUseTo.SetCount(icount, iuse, ito);
}
/// <summary>
/// 아이템들 사용-생성 팝업 열기.
/// </summary>
/// <param name="goodsuses">사용할 아이템 배열.</param>
/// <param name="goodsto">생성될 아이템.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="stryes">네 버튼 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupItemsUseTo(nGoods[] goodsuses, nGoods goodsto, System.Action actionyes, System.Action actionno, string strtitle, string strmsg, string stryes, string strno)
{
curMgr.iPopup++;
curMgr.ppItemsUseTo.Open(goodsuses, goodsto, actionyes, actionno, strtitle, strmsg, stryes, strno);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 아이템들 사용-생성 팝업 수 표시.
/// </summary>
/// <param name="icnthaves">각 아이템별로 보유중인 수.</param>
/// <param name="icntneeds">각 아이템별로 필요한 수.</param>
/// <returns></returns>
public static void SSetPopupItemsUseToCount(int[] icnthaves, int[] icntneeds)
{
curMgr.ppItemsUseTo.SetCount(icnthaves, icntneeds);
}
/// <summary>
/// 아이템 구매 팝업 열기.
/// </summary>
/// <param name="goods">구매할 아이템.</param>
/// <param name="ibuytype">구매에 사용하는 재화 종류.</param>
/// <param name="ibuyid">구매에 사용하는 재화 ID.</param>
/// <param name="iprice">구매 가격.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupItemBuy(nGoods goods, int ibuytype, int ibuyid, int iprice, System.Action actionyes, System.Action actionno, string strtitle, string strno)
{
curMgr.iPopup++;
curMgr.ppItemBuy.Open(goods, ibuytype, ibuyid, iprice, actionyes, actionno, strtitle, strno);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 아이템 수량 구매 팝업 열기.
/// </summary>
/// <param name="goods">구매할 아이템.</param>
/// <param name="ibuytype">구매에 사용하는 재화 종류.</param>
/// <param name="ibuyid">구매에 사용하는 재화 ID.</param>
/// <param name="iprice">구매 가격.</param>
/// <param name="actionsub">- 버튼을 눌렀을 때 처리.</param>
/// <param name="actionadd">+ 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmin">Min 버튼을 눌렀을 때 처리.</param>
/// <param name="actionmax">Max 버튼을 눌렀을 때 처리.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupItemBuyCount(nGoods goods, int ibuytype, int ibuyid, int iprice,
System.Action actionsub, System.Action actionadd, System.Action actionmin, System.Action actionmax, System.Action actionyes, System.Action actionno, string strtitle, string strno, Sprite sprBtn=null)
{
curMgr.iPopup++;
curMgr.ppItemBuyCount.Open(goods, ibuytype, ibuyid, iprice, actionsub, actionadd, actionmin, actionmax, actionyes, actionno, strtitle, strno, sprBtn: sprBtn);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 아이템 수량 구매 팝업 수 표시.
/// </summary>
/// <param name="icount">사용하려는 수. 1, 2, 3...</param>
/// <param name="iunitcount">1개 구매했을때 획득하는 수량.</param>
/// <param name="iprice">1개 구매 가격.</param>
/// <returns></returns>
public static void SSetPopupItemBuyCount(int icount, int iunitcount, int iprice)
{
curMgr.ppItemBuyCount.SetCount(icount, iunitcount, iprice);
}
/// <summary>
/// 희귀도 체크 팝업 열기.
/// </summary>
/// <param name="goods">아이템.</param>
/// <param name="rarities">각 희귀도 초기 체크 상태.</param>
/// <param name="actiontoggle">토글을 눌렀을 때 처리.</param>
/// <param name="actionyes">네 버튼을 눌렀을 때 처리.</param>
/// <param name="actionno">아니오 버튼을 눌렀을 때 처리.</param>
/// <param name="strtitle">제목 텍스트.</param>
/// <param name="strdesc">설명 텍스트.</param>
/// <param name="stryes">네 버튼 텍스트.</param>
/// <param name="strno">아니오 버튼 텍스트.</param>
/// <returns></returns>
public static void SOpenPopupRarityCheck(nGoods goods, fRangeRarity rarities, System.Action actiontoggle, System.Action actionyes, System.Action actionno,
string strtitle, string strdesc, string stryes, string strno)
{
curMgr.iPopup++;
curMgr.ppRarityCheck.Open(goods, rarities, actiontoggle, actionyes, actionno, strtitle, strdesc, stryes, strno);
if (!curMgr.canvasPopup.enabled)
curMgr.canvasPopup.enabled = true;
}
/// <summary>
/// 희귀도 체크 Yes 버튼 활성화.
/// </summary>
/// <param name="benable">활성화 상태.</param>
/// <returns></returns>
public static void SSetPopupRarityCheckYes(bool benable)
{
curMgr.ppRarityCheck.SetBtnYes(benable);
}
/// <summary>
/// 희귀도 체크 상태.
/// </summary>
/// <returns>각 희귀도별 체크 상태 플래그.</returns>
public static fRangeRarity SGetPopupRarityCheck()
{
return curMgr.ppRarityCheck.GetPopupRarityCheck();
}
/// <summary>
/// 희귀도별 확률 팝업 열기.
/// </summary>
/// <returns></returns>
public static void SOpenPopupRarityRate()
{
curMgr.OpenPopupRarityRate();
}
private void OpenPopupRarityRate()
{
var gcp = GameProperty.Instance.GlobalColorPallete;
if (txtRarityTitles == null)
{
bReLocalizeRarity = false;
Transform trfpp = goPopupRate.transform;
trfpp.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_effectaddinfo");
trfpp.Find("txtRateT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("rate_rarityt");
trfpp.Find("txtOptionT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("option_rarityt");
trfpp.Find("txtRateMsg").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("option_raritymsg");
TextMeshProUGUI[] txtrates = trfpp.Find("rates").GetComponentsInChildren<TextMeshProUGUI>();
for (int i = 0; i < txtrates.Length; i++)
{
txtrates[i].text = FormatString.CombineAllString(Global.STR_Rarity[i + 1], FormatString.S_Blank, FormatString.TextIntPerBracket(DataHandler.GetExtraRarityRate(i + 1)));
}
Dictionary<eEffectType, int>[] datas = DataHandler.GetExtraAbilityIds();
RectTransform rtrfoption = trfpp.Find("SvOption").GetChild(0).GetComponent<RectTransform>();
string stroption = FormatString.StringFormat("{0}/{1}/{2}/{3}/{4}/{5}/{6}",
Utility.GetMergeStringWithColor(gcp.GetColorByKey("gray"), "{0}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("orange"), "{1}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("green"), "{2}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("magenta"), "{3}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("skyblue"), "{4}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("yellow"), "{5}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("red_light"), "{6}"));
Vector2 v2size = rtrfoption.sizeDelta;
v2size.y = datas[0].Count * 82 - 10;
rtrfoption.sizeDelta = v2size;
txtRarityTitles = new TextMeshProUGUI[datas[0].Count];
txtRarityRates = new TextMeshProUGUI[datas[0].Count];
int index = 0;
foreach (var item in datas[0])
{
eEffectType key = item.Key;
GameObject go = Instantiate(prfRarityRate, rtrfoption);
txtRarityTitles[index] = go.GetComponent<TextMeshProUGUI>();
txtRarityRates[index] = go.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
txtRarityTitles[index].text = FormatString.TextEffectTitle(key);
txtRarityRates[index].text = FormatString.StringFormat(stroption,
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[0][key]), true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[1][key]),true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[2][key]),true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[3][key]),true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[4][key]), true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[5][key]), true, true, true),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[6][key]), true, true, true));
index++;
}
}
else if (bReLocalizeRarity)
{
bReLocalizeRarity = false;
Transform trfpp = goPopupRate.transform;
trfpp.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_effectaddinfo");
trfpp.Find("txtRateT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("rate_rarityt");
trfpp.Find("txtOptionT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("option_rarityt");
trfpp.Find("txtRateMsg").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("option_raritymsg");
Dictionary<eEffectType, int>[] datas = DataHandler.GetExtraAbilityIds();
string stroption = FormatString.StringFormat("{0}/{1}/{2}/{3}/{4}/{5}/{6}",
Utility.GetMergeStringWithColor(gcp.GetColorByKey("gray"), "{0}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("orange"), "{1}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("green"), "{2}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("magenta"), "{3}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("skyblue"), "{4}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("yellow"), "{5}"),
Utility.GetMergeStringWithColor(gcp.GetColorByKey("red_light"), "{6}"));
int index = 0;
foreach (var item in datas[0])
{
eEffectType key = item.Key;
txtRarityTitles[index].text = FormatString.TextEffectTitle(key);
txtRarityRates[index].text = FormatString.StringFormat(stroption,
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[0][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[1][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[2][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[3][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[4][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[5][key])),
FormatString.TextEffectValue(key, DataHandler.GetExtraAbilityValue(datas[6][key])));
index++;
}
}
iPopup++;
goPopupRate.SetActive(true);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
// 희귀도별 확률 팝업 닫기.
public void ClosePopupRarityRate()
{
goPopupRate.SetActive(false);
iPopup--;
if (iPopup <= 0)
canvasPopup.enabled = false;
}
/// <summary>
/// 전체 효과 팝업 열기.
/// </summary>
/// <param name="strtitle">팝업 제목.</param>
/// <param name="datas">효과별 값.</param>
/// <returns></returns>
public static void SOpenPopupHaveEfc(string strtitle, Dictionary<eEffectType, long> datas)
{
SoundMgr.PlaySfx(SoundName.BtnPress);
curMgr.OpenPopupHaveEfc(strtitle, datas);
}
private void OpenPopupHaveEfc(string strtitle, Dictionary<eEffectType, long> datas)
{
// 팝업 처음 열 때.
if (txtHaveEfcT == null)
{
txtHaveEfcT = goPopupHaveEfc.transform.Find("txtTitle").GetComponent<TextMeshProUGUI>();
Transform trfsv = goPopupHaveEfc.transform.Find("Sv").GetChild(0);
txtHaveEfcTitles = new TextMeshProUGUI[datas.Count];
txtHaveEfcValues = new TextMeshProUGUI[datas.Count];
int index = 0;
foreach (var item in datas)
{
GameObject go = Instantiate(prfHaveEfc, trfsv);
txtHaveEfcTitles[index] = go.GetComponent<TextMeshProUGUI>();
txtHaveEfcValues[index] = go.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
if (item.Value <= 0L)
{
go.SetActive(false);
}
else
{
txtHaveEfcTitles[index].text = FormatString.TextEffectTitle(item.Key);
txtHaveEfcValues[index].text = FormatString.TextEffectValue(item.Key, item.Value, bint : true);
}
index++;
}
}
// 팝업에 세팅된 텍스트 수가 데이터 수보다 적을 때 추가 생성.
else if (datas.Count > txtHaveEfcTitles.Length)
{
Transform trfsv = goPopupHaveEfc.transform.Find("Sv").GetChild(0);
TextMeshProUGUI[] txttitles = txtHaveEfcTitles;
TextMeshProUGUI[] txtvalues = txtHaveEfcValues;
txtHaveEfcTitles = new TextMeshProUGUI[datas.Count];
txtHaveEfcValues = new TextMeshProUGUI[datas.Count];
int index = 0;
foreach (var item in datas)
{
// 기존 텍스트 그대로 사용.
if (index < txttitles.Length)
{
txtHaveEfcTitles[index] = txttitles[index];
txtHaveEfcValues[index] = txtvalues[index];
}
// 부족한 텍스트 추가 생성.
else
{
GameObject go = Instantiate(prfHaveEfc, trfsv);
txtHaveEfcTitles[index] = go.GetComponent<TextMeshProUGUI>();
txtHaveEfcValues[index] = go.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
}
if (item.Value <= 0L)
{
txtHaveEfcTitles[index].gameObject.SetActive(false);
}
else
{
txtHaveEfcTitles[index].text = FormatString.TextEffectTitle(item.Key);
txtHaveEfcValues[index].text = FormatString.TextEffectValue(item.Key, item.Value, bint: true);
txtHaveEfcTitles[index].gameObject.SetActive(true);
}
index++;
}
}
// 팝업에 세팅된 텍스트 수가 데이터 수 이하일때.
else
{
int index = 0;
foreach (var item in datas)
{
if (item.Value <= 0L)
{
txtHaveEfcTitles[index].gameObject.SetActive(false);
}
else
{
txtHaveEfcTitles[index].text = FormatString.TextEffectTitle(item.Key);
txtHaveEfcValues[index].text = FormatString.TextEffectValue(item.Key, item.Value, bint: true);
txtHaveEfcTitles[index].gameObject.SetActive(true);
}
index++;
}
// 남는 항목 비활성화.
for (; index < txtHaveEfcTitles.Length; index++)
{
txtHaveEfcTitles[index].gameObject.SetActive(false);
}
}
txtHaveEfcT.text = strtitle;
iPopup++;
goPopupHaveEfc.SetActive(true);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
// 전체 효과 정보 닫기.
public void ClosePopupHaveEfc()
{
SoundMgr.PlaySfx(SoundName.BtnPress);
goPopupHaveEfc.SetActive(false);
iPopup--;
if (iPopup <= 0)
canvasPopup.enabled = false;
}
/// <summary>
/// 토스트 팝업 열기.
/// </summary>
/// <param name="strmsg">내용.</param>
/// <param name="ftime">표시 시간.</param>
/// <param name="itype">토스트 위치. 1:Top, 0:Middle, -1:Bottom.</param>
/// <returns></returns>
public static void SOpenToast(string strmsg, float ftime = 2f, int itype = 1)
{
if (curMgr != null)
curMgr.OpenToast(strmsg, ftime, itype);
}
private void OpenToast(string strmsg, float ftime = 2f, int itype = 1)
{
if (toastTop == null)
return;
iPopup++;
switch (itype)
{
case -1:
toastBottom.Open(strmsg, ftime);
break;
case 0:
toastMiddle.Open(strmsg, ftime);
break;
default:
toastTop.Open(strmsg, ftime);
break;
}
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
// 팝업 닫았을 때.
public static void SOnClosePopup()
{
if (curMgr != null)
{
curMgr.iPopup--;
if (curMgr.iPopup <= 0)
curMgr.canvasPopup.enabled = false;
}
}
public static void SOpenToastNotice(string strmsg)
{
if (curMgr != null)
curMgr.OpenToastNotice(strmsg);
}
private void OpenToastNotice(string strmsg)
{
if (toastTop == null)
return;
iPopup++;
toastNotice.ServerNoticeOpen(strmsg);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
public static void CloseToastNotice()
{
if (curMgr != null)
curMgr.toastNotice.ServerNoticeClose();
}
public static void SOpenHelp(string strmsg)
{
if (curMgr != null)
curMgr.OpenHelp(strmsg);
}
private void OpenHelp(string strmsg)
{
if (toastTop == null)
return;
iPopup++;
ppHelp.Open(strmsg);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
}
// 팝업 닫았을 때.
public static void SOnCloseHelp()
{
if (curMgr != null)
{
curMgr.iPopup--;
if (curMgr.iPopup <= 0)
curMgr.canvasPopup.enabled = false;
}
SoundMgr.PlaySfx(SoundName.BtnPress);
}
#endregion Popup
#region Popup Exit & Offline
/// <summary>
/// 게임 종료 확인 팝업 열기.
/// </summary>
/// <returns></returns>
private void OpenPopupExit()
{
if (bInitNeedExit)
{
bInitNeedExit = false;
popupExit.Init();
}
iPopup++;
CoverCamera.Hold();
popupExit.Open(LocalizationText.GetText("msg_exit"), SingleMgr.GameFinishSvSave, OnClosePopupExit,
LocalizationText.GetText(Global.STR_CONFIRM), LocalizationText.GetText("all_quit"), LocalizationText.GetText(Global.STR_CANCEL));
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
// 애니메이션 로드.
Addressables.LoadAssetAsync<SkeletonDataAsset>("effect/game_off/game_off_SkeletonData.asset").Completed += ALoadExitComp;
}
private void OnClosePopupExit()
{
SkeletonAnimation skanim = popupExit.transform.Find("skanim").GetComponent<SkeletonAnimation>();
// 애니메이션 언로드.
if (skanim.skeletonDataAsset != null)
{
CoverCamera.Hold();
skanim.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
skanim.skeletonDataAsset.Clear();
skanim.ClearState();
skanim.skeletonDataAsset = null;
if (handleSkAnim.IsValid())
Addressables.Release(handleSkAnim);
AddressableMgr.SAddUnload();
CoverCamera.Release();
}
}
// 게임 종료 연출 로드.
private void ALoadExitComp(AsyncOperationHandle<SkeletonDataAsset> obj)
{
SkeletonAnimation skanim = popupExit.transform.Find("skanim").GetComponent<SkeletonAnimation>();
MeshRenderer renderer = skanim.GetComponent<MeshRenderer>();
renderer.sortingLayerID = canvasPopup.sortingLayerID;
renderer.sortingOrder = 201;
skanim.skeletonDataAsset = obj.Result;
skanim.Initialize(true);
skanim.AnimationState.SetAnimation(0, "idle", true);
skanim.transform.localScale = Vector3.one;
handleSkAnim = obj;
CoverCamera.Release();
}
public void OpenPopupRefreshTest()
{
if (bInitNeedExit)
{
bInitNeedExit = false;
popupExit.Init();
}
iPopup++;
popupExit.Open(LocalizationText.GetText("test_refresh"), SettingMgr.STestRefreshDate, OnClosePopupExit,
LocalizationText.GetText(Global.STR_CONFIRM), LocalizationText.GetText("all_quit"), LocalizationText.GetText(Global.STR_CANCEL));
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
// 애니메이션 로드.
Addressables.LoadAssetAsync<SkeletonDataAsset>("effect/game_off/game_off_SkeletonData.asset").Completed += ALoadExitComp;
}
/// <summary>
/// 오프라인 팝업 열기.
/// </summary>
/// <param name="itimesec">오프라인 시간(초).</param>
/// <param name="goods">보상 목록.</param>
/// <returns></returns>
public static void SOpenPopupOffline(int itimesec, List<nGoods> goods)
{
curMgr.OpenPopupOffline(itimesec, goods);
}
private void OpenPopupOffline(int itimesec, List<nGoods> goods)
{
SoundMgr.PlaySfx(SoundName.GetGoods);
Transform trfpopup = goPopupOffline.transform;
trfpopup.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("offline_title");
if (itimesec > 86400)
itimesec = 86400;
trfpopup.Find("txtTime").GetComponent<TextMeshProUGUI>().text = FormatString.TextTime(itimesec);
trfpopup.Find("txtDesc").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("offline_desc");
trfpopup.Find("btnYes").GetChild(0).GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText(Global.STR_OK);
GoodsItem[] goodsitems = trfpopup.Find("wrapper").GetComponentsInChildren<GoodsItem>(true);
for (int i = 0; i < goodsitems.Length; i++)
{
if (i >= goods.Count)
{
goodsitems[i].gameObject.SetActive(false);
continue;
}
goodsitems[i].SetData(goods[i]);
goodsitems[i].gameObject.SetActive(true);
}
iPopup++;
CoverCamera.Hold();
goPopupOffline.SetActive(true);
if (!canvasPopup.enabled)
canvasPopup.enabled = true;
// 애니메이션 로드.
Addressables.LoadAssetAsync<SkeletonDataAsset>("effect/offline_present/offline_present_SkeletonData.asset").Completed += ALoadOfflineComp;
}
public void ClosePopupOffline()
{
SkeletonAnimation skanim = goPopupOffline.transform.Find("skanim").GetComponent<SkeletonAnimation>();
// 애니메이션 언로드.
if (skanim.skeletonDataAsset != null)
{
CoverCamera.Hold();
skanim.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
skanim.skeletonDataAsset.Clear();
skanim.ClearState();
skanim.skeletonDataAsset = null;
if (handleSkAnim.IsValid())
Addressables.Release(handleSkAnim);
AddressableMgr.SAddUnload();
CoverCamera.Release();
}
goPopupOffline.SetActive(false);
SSetPlayerLv();
iPopup--;
if (iPopup <= 0)
canvasPopup.enabled = false;
SoundMgr.PlaySfx(SoundName.BtnPress);
}
// 오프라인 연출 로드.
private void ALoadOfflineComp(AsyncOperationHandle<SkeletonDataAsset> obj)
{
SkeletonAnimation skanim = goPopupOffline.transform.Find("skanim").GetComponent<SkeletonAnimation>();
MeshRenderer renderer = skanim.GetComponent<MeshRenderer>();
renderer.sortingLayerID = canvasPopup.sortingLayerID;
renderer.sortingOrder = 201;
skanim.skeletonDataAsset = obj.Result;
skanim.Initialize(true);
skanim.AnimationState.SetAnimation(0, "idle", true);
skanim.transform.localScale = Vector3.one;
handleSkAnim = obj;
CoverCamera.Release();
}
#endregion Popup Exit & Offline
#region General Effect
/// <summary>
/// 색상 합성 연출 재생.
/// </summary>
/// <returns></returns>
public static void SPlayEfcClrCompose()
{
curMgr.skClrCompose.gameObject.SetActive(true);
curMgr.skClrCompose.AnimationState.SetAnimation(0, "animation", false);
}
public static void SPlayEfcOpenColorBox()
{
curMgr.skClrCompose.gameObject.SetActive(true);
curMgr.skClrCompose.AnimationState.SetAnimation(0, "ColorOpenBox", false);
}
/// <summary>
/// 색상 합성 연출 정지.
/// </summary>
/// <returns></returns>
public static void SStopEfcClrCompose()
{
curMgr.skClrCompose.gameObject.SetActive(false);
}
/// <summary>
/// 좌측 창 강화 이펙트 재생.
/// </summary>
/// <returns></returns>
public static void SPlayEfcLeftEnhance()
{
curMgr.ptcLeftEnhance.Play();
}
#endregion General Effect
#region Goods
public static void SSetGoods()
{
if (curMgr == null) return;
curMgr.txtMainGold.text = FormatString.BigIntString1(DataHandler.Goods.gold);
curMgr.txtUpGold.text = curMgr.txtMainGold.text;
curMgr.txtLeftGold.text = curMgr.txtMainGold.text;
curMgr.txtMainDia.text = FormatString.TextInt(DataHandler.Goods.Dia);
curMgr.txtUpDia.text = curMgr.txtMainDia.text;
curMgr.txtLeftDia.text = curMgr.txtMainDia.text;
curMgr.txtUpMileage.text = FormatString.TextInt(DataHandler.Goods.mileage);
curMgr.txtUpReinStone.text = FormatString.TextInt(DataHandler.Goods.gearReinStone);
curMgr.txtLeftReinStone.text = curMgr.txtUpReinStone.text;
curMgr.txtUpSkillStone.text = FormatString.TextInt(DataHandler.Goods.skillReinStone);
curMgr.txtLeftSkillStone.text = curMgr.txtUpSkillStone.text;
curMgr.txtUpAwakenStone.text = FormatString.TextInt(DataHandler.Goods.gearAwakenStone);
curMgr.txtLeftAwakenStone.text = curMgr.txtUpAwakenStone.text;
curMgr.txtUpAwakenSkillStone.text = FormatString.TextInt(DataHandler.Goods.skillAwakenStone);
curMgr.txtLeftAwakenSkillStone.text = curMgr.txtUpAwakenSkillStone.text;
curMgr.txtLeftChangeStone.text = FormatString.TextInt(DataHandler.Goods.changeStone);
curMgr.txtLeftPudding.text = FormatString.TextInt(DataHandler.Goods.pudding);
curMgr.txtUpLvPoint.text = FormatString.TextInt(DataHandler.Goods.point);
curMgr.txtLeftLvPoint.text = curMgr.txtUpLvPoint.text;
curMgr.txtLeftDgGoldTicket.text = FormatString.TextInt(DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind.GoldDG).ticket);
curMgr.txtLeftDgEnhanceTicket.text = FormatString.TextInt(DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind.EnhanceStoneDG).ticket);
curMgr.txtLeftDgPetTicket.text = FormatString.TextInt(DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind.PetDG).ticket);
curMgr.txtLeftDgAwakenTicket.text = FormatString.TextInt(DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind.AwakenStoneDG).ticket);
curMgr.txtLeftDgRelicTicket.text = FormatString.TextInt(DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind.relicDG).ticket);
curMgr.txtLeftMaskEnhance.text = FormatString.TextInt(DataHandler.Goods.condMight);
}
public static void SSetGold(BigInteger value)
{
if (curMgr == null) return;
curMgr.txtMainGold.text = FormatString.BigIntString1(value);
curMgr.txtUpGold.text = curMgr.txtMainGold.text;
curMgr.txtLeftGold.text = curMgr.txtMainGold.text;
}
public static void SSetDia(int value)
{
if (curMgr == null) return;
curMgr.txtMainDia.text = FormatString.TextInt(value);
curMgr.txtUpDia.text = curMgr.txtMainDia.text;
curMgr.txtLeftDia.text = curMgr.txtMainDia.text;
}
public static void SSetLvPoint(int value)
{
if (curMgr == null) return;
curMgr.txtUpLvPoint.text = FormatString.TextInt(value);
curMgr.txtLeftLvPoint.text = curMgr.txtUpLvPoint.text;
}
public static void SSetEnhanceStone(int value)
{
if (curMgr == null) return;
curMgr.txtUpReinStone.text = FormatString.TextInt(value);
curMgr.txtLeftReinStone.text = curMgr.txtUpReinStone.text;
}
public static void SSetSkillStone(int value)
{
if (curMgr == null) return;
curMgr.txtUpSkillStone.text = FormatString.TextInt(value);
curMgr.txtLeftSkillStone.text = curMgr.txtUpSkillStone.text;
}
public static void SSetAwakenStone(int value)
{
if (curMgr == null) return;
curMgr.txtUpAwakenStone.text = FormatString.TextInt(value);
curMgr.txtLeftAwakenStone.text = curMgr.txtUpAwakenStone.text;
}
public static void SSetAwakenSkillStone(int value)
{
if (curMgr == null) return;
curMgr.txtUpAwakenSkillStone.text = FormatString.TextInt(value);
curMgr.txtLeftAwakenSkillStone.text = curMgr.txtUpAwakenSkillStone.text;
}
public static void SSetChangeStone(int value)
{
if (curMgr == null) return;
curMgr.txtLeftChangeStone.text = FormatString.TextInt(value);
}
public static void SSetPudding(int value)
{
if (curMgr == null) return;
curMgr.txtLeftPudding.text = FormatString.TextInt(value);
}
public static void SSetGachaTokenType(int icode)
{
if (curMgr == null) return;
curMgr.imgUpGachaTicket.sprite = AddressableMgr.GetGoodsIcon(icode);
}
public static void SSetGachaToken(int value)
{
if (curMgr == null) return;
curMgr.txtUpGachaToken.text = FormatString.TextInt(value);
}
public static void SSetPvpTicket(int value)
{
curMgr.txtUpPvpTicket.text = FormatString.TextInt(value);
}
#endregion Goods
public void moveContent(int inum)
{
SoundMgr.PlaySfx(SoundName.BtnPress);
SingleMgr.MoveContent((eEventMoveType)inum);
}
public void forceEscape()
{
if (CoverCamera.IsOn())
return;
if (canvasFullBlack.enabled)
return;
fBackTick = 0.15f;
#region Popup
// 1버튼 팝업.
for (int i = pp1Buttons.Length - 1; i >= 0; i--)
{
if (pp1Buttons[i].IsOpen())
{
pp1Buttons[i].BtnYesPressed();
return;
}
}
// 2버튼 팝업.
for (int i = pp2Buttons.Length - 1; i >= 0; i--)
{
if (pp2Buttons[i].IsOpen())
{
pp2Buttons[i].BtnNoPressed();
return;
}
}
// 재화 획득 팝업.
if (ppGoods.IsOpen())
{
ppGoods.BtnYesPressed();
return;
}
// 프리셋 팝업.
if (ppPreset.IsOpen())
{
ppPreset.BtnNoPressed();
return;
}
// 아이템 사용 팝업.
if (ppItemUse.IsOpen())
{
ppItemUse.BtnNoPressed();
return;
}
// 아이템 사용-획득 팝업.
if (ppItemUseTo.IsOpen())
{
ppItemUseTo.BtnNoPressed();
return;
}
// 아이템들 사용 팝업.
if (ppItemsUseTo.IsOpen())
{
ppItemsUseTo.BtnNoPressed();
return;
}
// 아이템 구매 팝업.
if (ppItemBuy.IsOpen())
{
ppItemBuy.BtnNoPressed();
return;
}
// 아이템 수량 구매 팝업.
if (ppItemBuyCount.IsOpen())
{
ppItemBuyCount.BtnNoPressed();
return;
}
// 희귀도 선택 팝업.
if (ppRarityCheck.IsOpen())
{
ppRarityCheck.BtnNoPressed();
return;
}
// 희귀도별 확률 팝업.
if (goPopupRate.activeSelf)
{
ClosePopupRarityRate();
return;
}
// 전체 보유 효과 팝업.
if (goPopupHaveEfc.activeSelf)
{
ClosePopupHaveEfc();
return;
}
// 오프라인 팝업.
if (goPopupOffline.activeSelf)
{
ClosePopupOffline();
return;
}
// 게임 종료 팝업.
if (popupExit.IsOpen())
{
popupExit.BtnNoPressed();
return;
}
#endregion Popup
#region 중앙 팝업 컨텐츠
// 우편.
if (MailMgr.SCloseMenu())
return;
// 이벤트 & 공지.
if (NoticeMgr.SCloseMenu())
return;
//출석
if (AttendMgr.SCloseMenu())
return;
#endregion 중앙 팝업 컨텐츠
#region 전체 화면 컨텐츠
// 결투장.
if (PvpMgr.SCloseMenu())
return;
// 패스.
if (PassMgr.SCloseMenu())
return;
// 상점.
if (ShopMgr.SCloseMenu())
return;
// 코스튬.
if (CustomizeMgr.SCloseMenu())
return;
// 소환.
if (GachaMgr.SCloseMenu())
return;
#endregion 전체 화면 컨텐츠
#region 좌우 분할 컨텐츠
// 강화
if (EnhanceMgr.SCloseMenu())
return;
// 펫.
if (PetMgr.SCloseMenu())
return;
// 스킬.
if (SkillMgr.SCloseMenu())
return;
// 가방.
if (BagMgr.SCloseMenu())
return;
// 스테이지.
if (StageMgr.SCloseMenu())
return;
//던전
if (DungeonMgr.SCloseMenu())
return;
// 채팅.
if (ChatMgr.SCloseMenu())
return;
// 프로필
if (ProfileMgr.SCloseProfile())
return;
//이벤트
if (EventMgr.SCloseMenu())
return;
// 설정.
if (SettingMgr.SCloseMenu())
return;
#endregion 좌우 분할 컨텐츠
if (DispatchMgr.Instance.DispatchView.viewState != ViewState.Hidden)
{
DispatchMgr.Instance.DispatchView.Hide();
return;
}
if (canvasMenu.enabled)
{
CloseMenu();
return;
}
}
public static void SOnOffDungeonButton(bool onoff)
{
curMgr.btnRetry.SetActive(onoff);
curMgr.imgMenuPanel.SetActive(onoff);
curMgr.btnMenu.SetActive(onoff);
curMgr.btnShop.SetActive(onoff);
curMgr.btnPass.SetActive(onoff);
curMgr.btnEvent.SetActive(onoff);
curMgr.btnDungeonOut.SetActive(!onoff);
curMgr.hotTimePanel.SetActive(onoff);
#if false //TODO: block open event open button
if (DataHandler.GetPlayRewardEvent().sid < 1)
{
curMgr.btnOpenOpenRewardEvent.SetActive(onoff);
}
#else
curMgr.btnOpenOpenRewardEvent.gameObject.SetActive(false);
#endif
if (BattleMgr.CurrentBattleType == BattleMgr.BattleType.AwakenDungeon || BattleMgr.CurrentBattleType == BattleMgr.BattleType.GuardianDungeon)
{
curMgr.txtCheckBox.gameObject.SetActive(false);
}
else
{
curMgr.txtCheckBox.gameObject.SetActive(!onoff);
curMgr.toggleDungeonAuto.SetIsOnWithoutNotify(DungeonMgr.GetAutoProgress());
}
//curMgr.mainLeftBottomSet.SetActive(onoff);
//curMgr.mainBottomSet.SetActive(onoff);
curMgr.dungeonButton.interactable = onoff;
for (int i = 0; i < curMgr.skillPreset.Length; i++)
{
if (DataHandler.PlayData.usePreset != i)
{
curMgr.skillPreset[i].SetActive(!onoff);
}
}
}
IEnumerator SkillPresetOn(float delayTime, bool onoff)
{
yield return new WaitForSeconds(delayTime);
for(int i = 0; i < curMgr.skillPreset.Length; i++)
{
curMgr.skillPreset[i].SetActive(onoff);
}
}
public static void SAllOffDownMenu()
{
EnhanceMgr.CloseEnhance();
}
public static void SRightWindowClose()
{
StageMgr.SCloseMenu();
SettingMgr.SCloseMenu();
EventMgr.SCloseMenu();
TreasureMgr.SCloseMenu();
}
#region HotTimeUIOnOff
public static void SSetActiveHotTime(bool bactive)
{
//curMgr.hotTimePanel.SetActive(bactive);
}
public static void HotTimeUIOnOff(bool isOn)
{
curMgr.hotTimeActive.SetActive(isOn);
curMgr.txtTimer.gameObject.SetActive(isOn);
}
public static void HotTimerSetting(string timer)
{
curMgr.txtTimer.text = timer;
}
#endregion
#region Test Log
[SerializeField]
private TextMeshProUGUI txtTestLog;
public static void SPrintTestLog(string strlog)
{
if (curMgr != null)
curMgr.txtTestLog.text = FormatString.CombineStringWithBreakLine(curMgr.txtTestLog.text, strlog);
Logger.Log(strlog);
}
#endregion Test Log
}