168 lines
6.2 KiB
C#
168 lines
6.2 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using static Koenigz.PerfectCulling.PerfectCullingVolumeBakeData;
|
|
|
|
public class MapChoiceUI_Dungeon : uScrollViewMgr
|
|
{
|
|
public static MapChoiceUI_Dungeon Ins;
|
|
|
|
public MoneyForm MoneyForm_Ticket;
|
|
public GameObject[] gos; // 0 1 2 3 던전 정보
|
|
public TextMeshProUGUI[] texts; // 0 던전이름
|
|
public ArrowUI m_ArrowUI; // 미믹 단계 설정
|
|
public TextMeshProUGUI[] texts_maze; // 0 랭킹, 1 최고 층수
|
|
public TabUIBase tab_NightmareDiff; // 악몽의 시련 난이도
|
|
public TextMeshProUGUI[] texts_wave; // 0 웨이브 난이도, 1 웨이브 최고 점수
|
|
public WaveRewardUI m_WaveRewardUI; // 웨이브 보상 정보
|
|
|
|
List<eDungeon> dungeons = new List<eDungeon> { eDungeon.d1_Mimic, eDungeon.d2_Maze, eDungeon.d3_Nightmare, eDungeon.d4_Wave };
|
|
List<TabUIData> list_NightmareTabData = new List<TabUIData>
|
|
{ new TabUIData{ btnName = "1" }, new TabUIData{ btnName = "2" }, new TabUIData{ btnName = "3" } };
|
|
|
|
protected ObscuredInt _SelectMapID = 1001;
|
|
public int SelectMapID
|
|
{
|
|
get { return _SelectMapID; }
|
|
set { _SelectMapID = value; _SelectMapID.RandomizeCryptoKey(); }
|
|
}
|
|
|
|
protected ObscuredInt _SelectLv;
|
|
public int SelectLv
|
|
{
|
|
get { return _SelectLv; }
|
|
set { _SelectLv = value; _SelectLv.RandomizeCryptoKey(); }
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
Ins = this;
|
|
Set_ScrollView(dungeons);
|
|
for (int i = 0; i < list_CardBase.Count; i++)
|
|
{
|
|
if (list_CardBase[i].Get_IntData() == SelectMapID)
|
|
(list_CardBase[i] as WorldMapDungeonCard).OnClick_Card();
|
|
}
|
|
}
|
|
|
|
public void Select_Dungeon(int mapid)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
SelectMapID = mapid;
|
|
var mapData = table_battlemapconfig.Ins.Get_Data(SelectMapID);
|
|
SelectLv = sdata.Get_DungeonLv(mapData.e_Dungeon) + 1;
|
|
var dungeonData = table_dungeonmapconfig.Ins.Get_Data_orNull(mapData.e_Dungeon, SelectLv);
|
|
if (DSUtil.CheckNull(dungeonData))
|
|
{
|
|
for (int i = 0; i < SelectLv; i++)
|
|
{
|
|
--SelectLv;
|
|
dungeonData = table_dungeonmapconfig.Ins.Get_Data_orNull(mapData.e_Dungeon, SelectLv);
|
|
if (!DSUtil.CheckNull(dungeonData))
|
|
break;
|
|
}
|
|
}
|
|
DSUtil.InActivateGameObjects(gos, dungeonData.Get_DungeonIndex());
|
|
|
|
texts[0].text = mapData.Get_Name();
|
|
MoneyForm_Ticket.Set(mapData.n_TicketID);
|
|
MoneyForm_Ticket.gameObject.SetActive(mapData.e_Dungeon != eDungeon.d4_Wave);
|
|
|
|
switch (mapData.e_Dungeon)
|
|
{
|
|
case eDungeon.d1_Mimic:
|
|
MyValue.MyChoiceMapData.n_Difficult = 1;
|
|
m_ArrowUI.Set(totalcount => { Select_Lv(totalcount); }, SelectLv, true, 1);
|
|
break;
|
|
case eDungeon.d2_Maze:
|
|
MyValue.MyChoiceMapData.n_Difficult = 1;
|
|
SelectLv = Mathf.Max(1, SelectLv - 1);
|
|
texts_maze[0].text = texts_maze[1].text = "";
|
|
ServerInfo.Ins.Get_MyRank(MyValue.dic_Leaderboard[mapData.e_Dungeon],
|
|
my =>
|
|
{
|
|
if (DSUtil.CheckNull(my))
|
|
{
|
|
texts_maze[0].text = DSUtil.Format(323, 99999);
|
|
}
|
|
else
|
|
{
|
|
texts_maze[0].text = DSUtil.Format(323, my.Rank);
|
|
//texts_maze[1].text = DSUtil.Format(324, my.Scores[0]);
|
|
}
|
|
texts_maze[1].text = DSUtil.Format(324, SelectLv);
|
|
});
|
|
break;
|
|
case eDungeon.d3_Nightmare:
|
|
list_NightmareTabData.ForEach(f => f.onClick = OnClick_NightmareTab);
|
|
tab_NightmareDiff.Set(list_NightmareTabData);
|
|
OnClick_NightmareTab();
|
|
ServerInfo.Ins.Get_MyRank(MyValue.dic_Leaderboard[mapData.e_Dungeon],
|
|
my =>
|
|
{
|
|
MyValue.MyChoiceMapData.d_NightmareBeforeDmg = DSUtil.CheckNull(my) ? 0d : double.Parse(my.Scores[0]);
|
|
});
|
|
break;
|
|
case eDungeon.d4_Wave:
|
|
texts_wave[0].text = DSUtil.Format(334, MyValue.MyChoiceMapData.n_Difficult);
|
|
texts_wave[1].text = DSUtil.Format(335, sdata.Get_DungeonValue(eDungeon.d4_Wave, 1));
|
|
break;
|
|
}
|
|
}
|
|
public void Select_Lv(int lv)
|
|
{
|
|
SelectLv = lv;
|
|
}
|
|
|
|
public void OnClick_GoDungeon()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
var mapData = table_battlemapconfig.Ins.Get_Data(SelectMapID);
|
|
// 웨이브는 무한 입장 가능
|
|
if (mapData.n_TicketID == 0 || sdata.Check_ItemAmount(mapData.n_TicketID, 1))
|
|
{
|
|
NewGameUI.Ins.m_MapChoiceUI.OnClick_Back();
|
|
|
|
MyValue.MyChoiceMapData.n_Difficult = 1; // TODO 정인호 : 나중에 선택한 난이도 넣어줄 것
|
|
MyValue.MyChoiceMapData.n_MapID = SelectMapID;
|
|
MyValue.MyChoiceMapData.n_PortalIndex = 0;
|
|
MyValue.MyChoiceMapData.n_DungeonLv = SelectLv;
|
|
|
|
switch (mapData.e_Dungeon)
|
|
{
|
|
case eDungeon.d2_Maze:
|
|
Use_Ticket(sdata, mapData);
|
|
MyValue.MyChoiceMapData.Set_MazeMapIndex();
|
|
break;
|
|
case eDungeon.d3_Nightmare:
|
|
Use_Ticket(sdata, mapData);
|
|
break;
|
|
}
|
|
|
|
InGameInfo.Ins.Load_Map(SelectMapID);
|
|
}
|
|
}
|
|
|
|
void Use_Ticket(ServerData sdata, BattleMapConfigTableData mapData)
|
|
{
|
|
sdata.Use_Item(mapData.n_TicketID, 1);
|
|
ServerInfo.Ins.Write(null, false);
|
|
}
|
|
|
|
public void OnClick_Ranking()
|
|
{
|
|
var mapData = table_battlemapconfig.Ins.Get_Data(SelectMapID);
|
|
RankingMgr.Ins.Show_Rank(mapData.e_Dungeon);
|
|
}
|
|
|
|
void OnClick_NightmareTab()
|
|
{
|
|
MyValue.MyChoiceMapData.n_Difficult = tab_NightmareDiff.Get_Index() + 1;
|
|
}
|
|
|
|
public void OnClick_WaveReward()
|
|
{
|
|
m_WaveRewardUI.Set();
|
|
}
|
|
} |