Save_GachaBonus
This commit is contained in:
parent
d513a44943
commit
4c637a0ba5
|
|
@ -1892,6 +1892,32 @@ handlers.Save_Gacha = function(args)
|
|||
}
|
||||
return Get_Return(1);
|
||||
}
|
||||
handlers.Save_GachaBonus = function(args)
|
||||
{
|
||||
var readonlydata = Get_UserReadOnlyData();
|
||||
var error = Get_Error(readonlydata, args.Token);
|
||||
if (error < 0) return Get_Return(error);
|
||||
|
||||
if (args.SelectItemID <= 0) return Get_Return(2);
|
||||
|
||||
var urod = Get_JsonUserData(readonlydata);
|
||||
|
||||
var gachatable = Get_GachaConfigTable();
|
||||
var gachaData = Get_GachaConfigTable().find(f=>f.n_ID == args.GachaID);
|
||||
|
||||
if (urod.Gacha[args.GachaID] && urod.Gacha[args.GachaID][0] >= gachaData.n_RepeatRewardPoint)
|
||||
{
|
||||
var table = Get_MissionTable();
|
||||
var itemtable = Get_ItemTable();
|
||||
|
||||
urod.Gacha[args.GachaID][0] -= gachaData.n_RepeatRewardPoint;
|
||||
Add_Item(table, itemtable, urod, args.SelectItemID, 1);
|
||||
|
||||
Set_JsonUserData(urod);
|
||||
return Get_Return(0);
|
||||
}
|
||||
return Get_Return(1);
|
||||
}
|
||||
|
||||
handlers.Save_Costume_Equip = function(args)
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1524,13 +1524,13 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7600345790167984108}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 1, w: 0}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4320364344018254388}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 70.5, y: 0}
|
||||
|
|
|
|||
|
|
@ -2048,6 +2048,43 @@ public class ServerInfo : MyCoroutine
|
|||
Set_Coroutine(() => { Save_Gacha(id, count, _act); }, 2f);
|
||||
});
|
||||
}
|
||||
public void Save_GachaBonus(int id, int itemid, Action _act)
|
||||
{
|
||||
NetWait.Ins.Set(true);
|
||||
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||
{
|
||||
FunctionName = MethodBase.GetCurrentMethod().Name,
|
||||
GeneratePlayStreamEvent = true,
|
||||
FunctionParameter = new
|
||||
{
|
||||
Token = m_LoginInfo.EntityToken.EntityToken,
|
||||
GachaID = id,
|
||||
SelectItemID = itemid,
|
||||
}
|
||||
},
|
||||
result =>
|
||||
{
|
||||
if (result.Error == null)
|
||||
{
|
||||
NetWait.Ins.Set(false);
|
||||
var str_result = result.FunctionResult.ToString();
|
||||
var error = MyErrorCheck(str_result);
|
||||
// (0 성공, 1 실패 (포인트 부족), 2 실패 (아이템 선택 필요))
|
||||
switch (error)
|
||||
{
|
||||
case 0: _act?.Invoke(); break;
|
||||
case 1: ToastUI.Ins.Set(999900001); break;
|
||||
case 2: ToastUI.Ins.Set(999900014); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
Set_Coroutine(() => { Save_GachaBonus(id, itemid, _act); }, 2f);
|
||||
},
|
||||
fail =>
|
||||
{
|
||||
Set_Coroutine(() => { Save_GachaBonus(id, itemid, _act); }, 2f);
|
||||
});
|
||||
}
|
||||
|
||||
public void Save_Costume_Equip(int id, Action _act)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,17 +35,20 @@ public class GachaRepeatReward : uScrollViewMgr
|
|||
|
||||
public void OnClick_Get()
|
||||
{
|
||||
if (m_SelectID > 0)
|
||||
//if (m_SelectID > 0)
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
if (sdata.Get_GachaPoint(m_Data.n_ID) >= m_Data.n_RepeatRewardPoint)
|
||||
//if (sdata.Get_GachaPoint(m_Data.n_ID) >= m_Data.n_RepeatRewardPoint)
|
||||
{
|
||||
sdata.Use_GachaPoint(m_Data.n_ID, m_Data.n_RepeatRewardPoint);
|
||||
var item = new ItemSimpleData { itemid = m_SelectID, amount = 1 };
|
||||
sdata.Add_Item(item.itemid, item.amount);
|
||||
ObtainItemUI.Ins.Set(item);
|
||||
NewGameUI.Ins.m_GachaUI.m_gachaBase.Set_UI();
|
||||
OnClick_Back();
|
||||
ServerInfo.Ins.Save_GachaBonus(m_Data.n_ID, m_SelectID, () =>
|
||||
{
|
||||
sdata.Use_GachaPoint(m_Data.n_ID, m_Data.n_RepeatRewardPoint);
|
||||
var item = new ItemSimpleData { itemid = m_SelectID, amount = 1 };
|
||||
sdata.Add_Item(item.itemid, item.amount);
|
||||
ObtainItemUI.Ins.Set(item);
|
||||
NewGameUI.Ins.m_GachaUI.m_gachaBase.Set_UI();
|
||||
OnClick_Back();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue