317 lines
13 KiB
C#
317 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public enum UIMenu { Chapter, Witch, Equipment, Pet, Gamble, Book, Kettle, Max }
|
|
|
|
[Serializable]
|
|
public class Lobby_Bundle
|
|
{
|
|
// 로비 UI
|
|
public MenuBase[] arr_Menu; // 0 챕터, 1 마녀, 2 장비, 3 펫, 4 뽑기, 5 고서, 6 상점, 7 기억, 8 솥
|
|
public LobbyNonMenuBase[] arr_NonMenu; // 0 챕터선택, 1 마녀 세부 사항, 2 칭호, 3 아공간 가방, 4 우편함, 5 챕터퀘스트, 6 프리셋, 7 오프라인 보상, 8 룰렛, 9 출석부
|
|
public MenuBase[] arr_CenterNonMenu; // 0 랭킹, 1 미션, 2 합성 팝업, 3 패스, 4 공지
|
|
public GameObject[] gos_noti; // 0 마녀, 1 장비, 2 펫, 3 고서, 4 기억, 5 상점, 6 뽑기, 7 공지, 8 우편, 9 미션, 10 칭호, 11 가방, 12 패스, 13 챕터선택, 14 샵우편, 15 샵인벤, 16 솥, 17 샵패스, 18 룰렛, 19 출석부
|
|
|
|
#region 사용 클래스 모음
|
|
public OffLineReward Get_OffLineReward() { return arr_NonMenu[7] as OffLineReward; }
|
|
public PassUI Get_PassUI() { return arr_CenterNonMenu[3] as PassUI; }
|
|
public NoticeUI Get_NoticeUI() { return arr_CenterNonMenu[4] as NoticeUI; }
|
|
public AttendanceUI Get_AttendanceUI() { return arr_NonMenu[9] as AttendanceUI; }
|
|
#endregion
|
|
|
|
public void Set_BattleUI()
|
|
{
|
|
for (int i = 1; i < arr_Menu.Length; i++)
|
|
arr_Menu[i].Check();
|
|
arr_Menu[0].Set();
|
|
for (int i = 0; i < arr_NonMenu.Length; i++)
|
|
arr_NonMenu[i].Check();
|
|
for (int i = 0; i < arr_CenterNonMenu.Length; i++)
|
|
arr_CenterNonMenu[i].Check();
|
|
|
|
GameUI.Ins.Set_UI(eGameMode.Lobby);
|
|
Set_Noti();
|
|
}
|
|
public void Set_Noti()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
gos_noti[0].SetActive(false);
|
|
gos_noti[1].SetActive(GameUI.Ins.ExistNewItem(eItem.Weapon) || GameUI.Ins.ExistNewItem(eItem.Ring) || GameUI.Ins.ExistNewItem(eItem.Necklace) || GameUI.Ins.ExistNewItem(eItem.Extra) || GameUI.Ins.ExistNewItem(eItem.Fairy));
|
|
gos_noti[2].SetActive(GameUI.Ins.ExistNewItem(eItem.Pet));
|
|
gos_noti[3].SetActive(sdata.ExistCanCompleteBook());
|
|
gos_noti[4].SetActive((MyValue.CanEnter_Content(eContentOpen.Memory_Filed) && sdata.Check_ItemAmount(eItem.MemoryField, 1, 0, false)) ||
|
|
(MyValue.CanEnter_Content(eContentOpen.Memory_Forest) && sdata.Check_ItemAmount(eItem.MemoryForest, 1, 0, false)) ||
|
|
(MyValue.CanEnter_Content(eContentOpen.Memory_Dungeon) && sdata.Check_ItemAmount(eItem.MemoryDungeon, 1, 0, false)) ||
|
|
(MyValue.CanEnter_Content(eContentOpen.Memory_Witch) && sdata.Check_ItemAmount(eItem.MemoryWitchGrade, 1, 0, false)) ||
|
|
(MyValue.CanEnter_Content(eContentOpen.Memory_PetBattle) && sdata.Check_ItemAmount(eItem.MemoryPetBattle, 1, 0, false)));
|
|
if (!gos_noti[4].activeSelf) gos_noti[4].SetActive(MyValue.CanGetMemoryForestReward());
|
|
gos_noti[5].SetActive(sdata.CanShow_ShopAD());
|
|
gos_noti[7].SetActive(false);
|
|
gos_noti[10].SetActive(TitleGetUI.list_gettitle.Count > 0);
|
|
gos_noti[12].SetActive(sdata.ExistCanGetPass());
|
|
|
|
// 챕터 퀘스트 모두 완료하고 보상 받을 수 있거나 챕터 최초 클리어로 인해 다음 챕터로 갈 수 있을 때
|
|
gos_noti[13].SetActive(DataCheckMgr.Ins.NewChapter > 0 || sdata.IsCanGetChapterClearReward());
|
|
var chaptercount = table_chaptertext.Ins.Get_DataList().Count;
|
|
for (int i = 0; i < chaptercount; i++)
|
|
{
|
|
var CanGetChapterClearReward = sdata.IsCanGetChapterClearReward(i + 1);
|
|
if (CanGetChapterClearReward)
|
|
{
|
|
gos_noti[13].SetActive(true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 마실 수 있는 포션이 있거나, 조합 가능한 것이 있으면 on
|
|
gos_noti[16].SetActive(MyValue.CanDrinkPotion() || MyValue.CanCombineKettle(eItem.Potion) || MyValue.CanCombineKettle(eItem.Relic));
|
|
// 룰렛 광고 있거나 룰렛 뽑기권 개수가 충분하거나 보너스 뽑기라면 on
|
|
gos_noti[18].SetActive(sdata.Get_Common(eCommon.Roullette_ADCount) < 2 || sdata.Get_Common(eCommon.Roullette_Count) + 1 <= sdata.Get_Common(eCommon.Roullette_Ticket) || sdata.Get_Common(eCommon.Roullette_Count) >= (sdata.Get_Common(eCommon.Roullette_LuckyCount) + 1) * 5);
|
|
// 받을 수 있는 출석부 보상이 있을 때
|
|
gos_noti[19].SetActive(sdata.Get_Common(eCommon.AttendanceStep) < 15 && sdata.Get_Common(eCommon.AttendanceDOY) != ServerInfo.ServerTime.DayOfYear);
|
|
}
|
|
public void Set_MailNoti(bool _active) { gos_noti[8].SetActive(_active); gos_noti[14].SetActive(_active); gos_noti[17].SetActive(_active); }
|
|
public void Set_Label(UIMenu _menu) { arr_Menu[MyEnumToInt.Ins.Get_Int(_menu)].Set_Label(); }
|
|
public void OnClick_Button(GameObject _go)
|
|
{
|
|
}
|
|
public void OnClick_TR_Button(GameObject _go)
|
|
{
|
|
switch (_go.name)
|
|
{
|
|
case "btn_option":
|
|
OptionInfo.Ins.Set();
|
|
if (GuideQuestArrow.Ins.gos_arrow[34].gos[0].activeInHierarchy)
|
|
GuideQuestArrow.Ins.gos_arrow[34].gos[0].SetActive(false);
|
|
break;
|
|
case "btn_rank":
|
|
break;
|
|
case "btn_notice": Get_NoticeUI().Set(); break;
|
|
case "btn_achievement":
|
|
break;
|
|
case "btn_title":
|
|
if (MyValue.CanEnter_Content(eContentOpen.Title))
|
|
{
|
|
}
|
|
break;
|
|
case "btn_inven":
|
|
break;
|
|
case "btn_pass":
|
|
if (MyValue.CanEnter_Content(eContentOpen.Pass))
|
|
Get_PassUI().Set();
|
|
break;
|
|
case "Sleep":
|
|
OptionInfo.Ins.m_SleepMode.Set();
|
|
break;
|
|
case "btn_roullette":
|
|
break;
|
|
case "btn_attendance":
|
|
Get_AttendanceUI().Set();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
[Serializable]
|
|
public class Ingame_Bundle
|
|
{
|
|
// 인게임 UI
|
|
public UILabel[] labels; // 0 자동타겟, 1 자동마법, 2 x2
|
|
public UISprite[] sprites; // 0 자동타겟, 1 자동마법
|
|
public BossInfoUI m_BossInfoUI;
|
|
public SelectSkillUI m_SelectSkillUI;
|
|
public StageResult m_StageResult;
|
|
public PauseUI m_PauseUI;
|
|
public GameObject go_camrot;
|
|
public StageInfoUI m_StageInfoUI;
|
|
public StageInfoUI_DPS m_DPS;
|
|
public StageTimeUI m_StageTimeUI;
|
|
public PetBattleUI m_PetBattleUI;
|
|
|
|
public GameObject[] gos; // 0 맵 버튼, 1 x2, 2 자동 마법, 3 일시 정지
|
|
|
|
public void Init_IngameUI(int chapter)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
m_BossInfoUI.Set();
|
|
m_StageResult.Initialized();
|
|
m_PauseUI.Check();
|
|
m_PetBattleUI.Set(chapter);
|
|
m_StageInfoUI.Set_Stage(1, chapter, 1, 0);
|
|
|
|
Set_Labels();
|
|
|
|
m_SelectSkillUI.gameObject.SetActive(false);
|
|
|
|
DSUtil.InActivateGameObjects(gos);
|
|
GameUI.Ins.Set_AllUI(chapter == 0); // 농장 진입 시는 안 끔
|
|
m_DPS.gameObject.SetActive(false);
|
|
if (chapter == 102) m_DPS.Set(m_StageTimeUI);
|
|
else if (chapter == 101 | chapter == 103)
|
|
m_StageTimeUI.Set(chapter, () => { m_StageResult.Set(false, false, InGameInfo.Ins.Return_To_Lobby); });
|
|
else if (chapter == 104)
|
|
{
|
|
gos[0].SetActive(true);
|
|
}
|
|
else
|
|
m_StageTimeUI.gameObject.SetActive(false);
|
|
//gos[1].SetActive(LobbyChapterQuest.UseNote());
|
|
gos[1].SetActive(false);
|
|
|
|
//UIJoystick.Ins.gameObject.SetActive(chapter != 105);
|
|
gos[2].SetActive(chapter != 105);
|
|
gos[3].SetActive(chapter != 105);
|
|
}
|
|
public bool Active_SelectSkillUI() { return m_SelectSkillUI.gameObject.activeInHierarchy; }
|
|
|
|
Color32 active_auto = new Color32(0, 255, 245, 255);
|
|
Color32 inactive_auto = new Color32(192, 197, 222, 255);
|
|
public void Set_Labels()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
labels[2].text = sdata.Get_Common(eCommon.X2) == 1 ? "On" : "Off";
|
|
}
|
|
|
|
public void OnClick_Button(GameObject _go)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
switch (_go.name)
|
|
{
|
|
case "btn_pause":
|
|
m_PauseUI.Set();
|
|
break;
|
|
case "btn_autoskill":
|
|
Set_Labels();
|
|
break;
|
|
case "btn_autotarget":
|
|
//ActorInfo.Ins.Set_AutoTarget(sdata.Get_Common(eCommon.AutoTarget) == 1);
|
|
Set_Labels();
|
|
break;
|
|
case "btn_x2":
|
|
return;
|
|
//if (sdata.Get_Common(eCommon.MaxMapID) >= 2)
|
|
//{
|
|
// sdata.Set_Common(eCommon.X2, sdata.Get_Common(eCommon.X2) == 1 ? 0 : 1);
|
|
// Time.timeScale = sdata.Get_Common(eCommon.X2) + 1;
|
|
// Set_Labels();
|
|
//}
|
|
//else
|
|
// ToastUI.Ins.Set("1챕터 클리어 후 사용 가능합니다.");
|
|
case "btn_map":
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class GameUI : MonoBehaviourSingletonTemplate<GameUI>
|
|
{
|
|
public UIPanel m_UIPanel;
|
|
public GameObject[] gos_lobby, gos_ingame, gos_myfarm;
|
|
public Lobby_Bundle LobbyUI;
|
|
public Ingame_Bundle IngameUI;
|
|
|
|
private void Start()
|
|
{
|
|
Set_BattleUI(false);
|
|
ServerInfo.Ins.Check_OfflineReward();
|
|
}
|
|
|
|
public void Set_AllUI(bool _active)
|
|
{
|
|
m_UIPanel.alpha = _active ? 1f : 0f;
|
|
}
|
|
public void Set_UI(eGameMode _mode)
|
|
{
|
|
switch (_mode)
|
|
{
|
|
case eGameMode.Lobby:
|
|
DSUtil.InActivateGameObjects(gos_ingame);
|
|
DSUtil.InActivateGameObjects(gos_myfarm);
|
|
DSUtil.ActivateGameObjects(gos_lobby);
|
|
//if (MessageInfo.Ins) MessageInfo.Ins.go_Small.transform.localPosition = new Vector3(436f, 139f);
|
|
//go_Camera.GetComponent<UICamera>().allowMultiTouch = UICamera.first.allowMultiTouch = false;
|
|
if (SleepMode.IsActive) OptionInfo.Ins.m_SleepMode.Set();
|
|
if (GlobalVolumeMgr.isIns) GlobalVolumeMgr.Ins.Set(0);
|
|
break;
|
|
case eGameMode.Stage:
|
|
DSUtil.InActivateGameObjects(gos_lobby);
|
|
DSUtil.InActivateGameObjects(gos_myfarm);
|
|
DSUtil.ActivateGameObjects(gos_ingame);
|
|
//if (MessageInfo.Ins) MessageInfo.Ins.go_Small.transform.localPosition = new Vector3(436f, 44f);
|
|
//go_Camera.GetComponent<UICamera>().allowMultiTouch = UICamera.first.allowMultiTouch = true;
|
|
break;
|
|
case eGameMode.MyFarm:
|
|
DSUtil.InActivateGameObjects(gos_lobby);
|
|
DSUtil.InActivateGameObjects(gos_ingame);
|
|
DSUtil.ActivateGameObjects(gos_myfarm);
|
|
//if (MessageInfo.Ins) MessageInfo.Ins.go_Small.transform.localPosition = new Vector3(436f, 44f);
|
|
//go_Camera.GetComponent<UICamera>().allowMultiTouch = UICamera.first.allowMultiTouch = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
#region 로비 UI 처리
|
|
public void Set_BattleUI(bool _entermemory)
|
|
{
|
|
for (int i = 1; i < LobbyUI.arr_Menu.Length; i++)
|
|
LobbyUI.arr_Menu[i].Check();
|
|
|
|
LobbyUI.Set_BattleUI();
|
|
//InGameInfo.Ins.Load_Map(_entermemory); // 인게임 배경
|
|
}
|
|
public void OnClick_Button(GameObject _go) { LobbyUI.OnClick_Button(_go); }
|
|
public void OnClick_TR_Button(GameObject _go) { LobbyUI.OnClick_TR_Button(_go); }
|
|
#endregion
|
|
#region 인게임 UI 처리
|
|
public void OnClick_IngameButton(GameObject _go) { IngameUI.OnClick_Button(_go); }
|
|
#endregion
|
|
#region 신규 아이템
|
|
Dictionary<eItem, Dictionary<int, bool>> dic_newItem = new Dictionary<eItem, Dictionary<int, bool>>();
|
|
public void Clear_newItem(eItem item)
|
|
{
|
|
if (dic_newItem.ContainsKey(item))
|
|
dic_newItem[item].Clear();
|
|
}
|
|
public void Add_newItem(eItem item, int id)
|
|
{
|
|
if (!dic_newItem.ContainsKey(item))
|
|
dic_newItem.Add(item, new Dictionary<int, bool> { { id, true } });
|
|
else if (!dic_newItem[item].ContainsKey(id))
|
|
dic_newItem[item].Add(id, true);
|
|
}
|
|
public bool ExistNewItem(eItem item) { return dic_newItem.ContainsKey(item) && dic_newItem[item] != null && dic_newItem[item].Count > 0; }
|
|
public bool ExistNewItem(eItem item, int id) { return dic_newItem.ContainsKey(item) && dic_newItem[item] != null && dic_newItem[item].ContainsKey(id); }
|
|
#endregion
|
|
#region 페이드 인아웃
|
|
public UIPanel Panel_Fade;
|
|
public void IngameFade(float startAlpha = 0f, Action _actEnd = null)
|
|
{
|
|
StartCoroutine(Co_IngameFade(startAlpha, _actEnd));
|
|
}
|
|
public void IngameFade_Auto() { IngameFade(0f, () => { IngameFade(1f); }); }
|
|
IEnumerator Co_IngameFade(float startAlpha, Action _actEnd)
|
|
{
|
|
Panel_Fade.alpha = startAlpha;
|
|
while (true)
|
|
{
|
|
if (startAlpha <= 0f)
|
|
{
|
|
Panel_Fade.alpha += Time.deltaTime;
|
|
if (Panel_Fade.alpha >= 1f)
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
Panel_Fade.alpha -= Time.deltaTime;
|
|
if (Panel_Fade.alpha <= 0f)
|
|
break;
|
|
}
|
|
yield return null;
|
|
}
|
|
|
|
_actEnd?.Invoke();
|
|
}
|
|
#endregion
|
|
} |