Project_WL/Assets/Script/UI/Map/MapChoiceUI_Dungeon.cs

127 lines
4.3 KiB
C#

using CodeStage.AntiCheat.ObscuredTypes;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
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 최고 층수
List<eDungeon> dungeons = new List<eDungeon> { eDungeon.d1_Mimic, eDungeon.d2_Maze, eDungeon.d3_Nightmare, eDungeon.d4_Wave };
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);
switch (mapData.e_Dungeon)
{
case eDungeon.d1_Mimic:
m_ArrowUI.Set(totalcount => { Select_Lv(totalcount); }, SelectLv, true, 1);
break;
case eDungeon.d2_Maze:
SelectLv = Mathf.Max(1, SelectLv - 1);
texts_maze[0].text = texts_maze[1].text = "";
ServerInfo.Ins.Get_MyRank("Rank_Maze", 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:
break;
case eDungeon.d4_Wave:
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;
if (mapData.e_Dungeon == eDungeon.d2_Maze)
{ // 미궁은 입장 시 입장권 사용
sdata.Use_Item(mapData.n_TicketID, 1);
ServerInfo.Ins.Write(null, false);
MyValue.MyChoiceMapData.Set_MazeMapIndex();
}
InGameInfo.Ins.Load_Map(SelectMapID);
}
}
public void OnClick_MazeRank()
{
RankingMgr.Ins.Show_Rank(eRankingType.Maze);
}
}