가챠 등급까지

This commit is contained in:
Ino 2025-04-17 14:51:34 +09:00
parent b67016e8cb
commit d8a74f4548
7 changed files with 51 additions and 3 deletions

View File

@ -1 +1 @@
[{"n_ID": "10001", "n_Title": "290", "s_Banner": "", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "401", "n_NormalRandombag": "30001", "n_Extra10_Randombag": "40001", "n_PickupReward": "20001"}, {"n_ID": "10002", "n_Title": "292", "s_Banner": "", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "402", "n_NormalRandombag": "30002", "n_Extra10_Randombag": "40002", "n_PickupReward": "20002"}, {"n_ID": "10003", "n_Title": "293", "s_Banner": "", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "403", "n_NormalRandombag": "30003", "n_Extra10_Randombag": "40003", "n_PickupReward": "20003"}, {"n_ID": "10004", "n_Title": "209", "s_Banner": "", "n_GachaPrice": "1000", "n_GachaGoodsID": "1", "n_GachaTicketID": "404", "n_NormalRandombag": "30004", "n_Extra10_Randombag": "40004", "n_PickupReward": "20004"}]
[{"n_ID": "10001", "n_Title": "290", "s_Banner": "", "b_StageLv": "True", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "401", "n_NormalRandombag": "30001", "n_Extra10_Randombag": "40001", "n_PickupReward": "20001"}, {"n_ID": "10002", "n_Title": "292", "s_Banner": "", "b_StageLv": "True", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "402", "n_NormalRandombag": "30002", "n_Extra10_Randombag": "40002", "n_PickupReward": "20002"}, {"n_ID": "10003", "n_Title": "293", "s_Banner": "", "b_StageLv": "True", "n_GachaPrice": "500", "n_GachaGoodsID": "1", "n_GachaTicketID": "403", "n_NormalRandombag": "30003", "n_Extra10_Randombag": "40003", "n_PickupReward": "20003"}, {"n_ID": "10004", "n_Title": "209", "s_Banner": "", "b_StageLv": "False", "n_GachaPrice": "1000", "n_GachaGoodsID": "1", "n_GachaTicketID": "404", "n_NormalRandombag": "30004", "n_Extra10_Randombag": "40004", "n_PickupReward": "20004"}]

Binary file not shown.

View File

@ -136054,7 +136054,12 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 2484072702756935871}
objectReference: {fileID: 6559969037301942703}
- target: {fileID: 4356751522020398622, guid: cd989398c2e3d0a42b902fe9ec96fef5,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnClick_Gacha
objectReference: {fileID: 0}
- target: {fileID: 4592019639505408195, guid: cd989398c2e3d0a42b902fe9ec96fef5,
type: 3}
propertyPath: m_Pivot.x
@ -136376,7 +136381,12 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 2484072702756935871}
objectReference: {fileID: 6398787019567080357}
- target: {fileID: 4356751522020398622, guid: cd989398c2e3d0a42b902fe9ec96fef5,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnClick_Gacha
objectReference: {fileID: 0}
- target: {fileID: 4592019639505408195, guid: cd989398c2e3d0a42b902fe9ec96fef5,
type: 3}
propertyPath: m_Pivot.x

View File

@ -424,6 +424,17 @@ public partial class ServerData
return MapData[key1][key2].isClear();
return false;
}
public int MapData_Get_MaxChapter()
{
int maxchapter = 1;
var lst = table_battlemapconfig.Ins.Get_DataList(true);
for (int i = 1; i < lst.Count; i++)
{
if (MapData_isClearChaper(lst[i].n_MapID, 1))
maxchapter = lst[i].n_MapID;
}
return maxchapter;
}
public void MapData_SetClearChapter(int mapid, int diff)
{
Check_MapData(mapid, diff);

View File

@ -15,6 +15,7 @@ public class GachaConfigTableData : TableDataBase
public int n_Title;
public string s_Banner;
public bool b_StageLv;
protected ObscuredInt _GachaPrice;
public int n_GachaPrice

View File

@ -84,6 +84,7 @@ public class GachaRateTableData : TableDataBase
}
public List<float> list_rate = new List<float>();
public int Get_RandomGrade() { return DSUtil.Get_RandomIndex(list_rate) + 1; }
}
public class table_gacharate : table_missionbase
@ -91,6 +92,8 @@ public class table_gacharate : table_missionbase
public static table_gacharate Ins;
List<GachaRateTableData> tableDatas;
Dictionary<int, List<GachaRateTableData>> dic_data = new Dictionary<int, List<GachaRateTableData>>();
// (temp.n_ID, n_GachaLevel)
Dictionary<(int, int), GachaRateTableData> dic_datas = new Dictionary<(int, int), GachaRateTableData>();
protected override void Awake()
{
@ -117,6 +120,8 @@ public class table_gacharate : table_missionbase
if (!dic_data.ContainsKey(temp.n_ID))
dic_data.Add(temp.n_ID, new List<GachaRateTableData>());
dic_data[temp.n_ID].Add(temp);
dic_datas.Add((temp.n_ID, temp.n_GachaLevel), temp);
}
base.Start();
@ -124,4 +129,5 @@ public class table_gacharate : table_missionbase
public List<GachaRateTableData> Get_DataList() { return tableDatas; }
public List<GachaRateTableData> Get_DataList(int id) { return dic_data[id]; }
public GachaRateTableData Get_Data(int id, int lv) { return dic_datas[(id, lv)]; }
}

View File

@ -65,14 +65,34 @@ public class btn_gacha : MonoBehaviour
public void OnClick_Gacha()
{
var sdata = ServerInfo.Ins.m_ServerData;
switch (Get_BtnType(true))
{
case eGachaBtnType.OnlyTicket:
sdata.Use_Item(m_Data.n_GachaTicketID, m_Count);
Gacha_Process();
break;
case eGachaBtnType.TicketAndCash:
var ticketamount = sdata.Get_ItemAmount(m_Data.n_GachaTicketID);
sdata.Use_Item(m_Data.n_GachaGoodsID, (m_Count - ticketamount) * m_Data.n_GachaPrice);
sdata.Use_Item(m_Data.n_GachaTicketID, ticketamount);
Gacha_Process();
break;
case eGachaBtnType.OnlyCash:
sdata.Use_Item(m_Data.n_GachaGoodsID, m_Count * m_Data.n_GachaPrice);
Gacha_Process();
break;
}
}
void Gacha_Process()
{
var sdata = ServerInfo.Ins.m_ServerData;
var rateData = table_gacharate.Ins.Get_Data(m_Data.n_ID, m_Data.b_StageLv ? sdata.MapData_Get_MaxChapter() : 1);
for (int i = 0; i < m_Count; i++)
{
var grade = rateData.Get_RandomGrade();
Debug.Log(grade);
}
}
}