Save_Farm_EatFruit
This commit is contained in:
parent
b3f89de677
commit
6199d1ac78
|
|
@ -2570,6 +2570,28 @@ function Get_FarmHarvestitems(urod, curSlot)
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
handlers.Save_Farm_EatFruit = function(args)
|
||||||
|
{
|
||||||
|
var readonlydata = Get_UserReadOnlyData();
|
||||||
|
var error = Get_Error(readonlydata, args.Token);
|
||||||
|
if (error < 0) return Get_Return(error);
|
||||||
|
|
||||||
|
var urod = Get_JsonUserData(readonlydata);
|
||||||
|
var table = Get_MissionTable();
|
||||||
|
var key = args.FruitID;
|
||||||
|
var amount = args.Amount;
|
||||||
|
if (Use_Item(table, urod, key, amount))
|
||||||
|
{
|
||||||
|
if (!urod.Farm.Eat[key])
|
||||||
|
urod.Farm.Eat[key] = amount;
|
||||||
|
else
|
||||||
|
urod.Farm.Eat[key] = Add_Amount(urod.Farm.Eat[key], amount);
|
||||||
|
|
||||||
|
Set_JsonUserData(urod);
|
||||||
|
return Get_Return(0);
|
||||||
|
}
|
||||||
|
return Get_Return(1);
|
||||||
|
}
|
||||||
/////////////////////////////////// 서버 처리
|
/////////////////////////////////// 서버 처리
|
||||||
|
|
||||||
handlers.Write_UnityInApp = function(args)
|
handlers.Write_UnityInApp = function(args)
|
||||||
|
|
|
||||||
|
|
@ -2337,6 +2337,7 @@ public class ServerInfo : MyCoroutine
|
||||||
Set_Coroutine(() => { Save_Buff(index, _act); }, 2f);
|
Set_Coroutine(() => { Save_Buff(index, _act); }, 2f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save_Farm_PlantSeed(int slot, int enchantid, Action<SC_FarmSlotPlantSeedResult> _act)
|
public void Save_Farm_PlantSeed(int slot, int enchantid, Action<SC_FarmSlotPlantSeedResult> _act)
|
||||||
{
|
{
|
||||||
NetWait.Ins.Set(true);
|
NetWait.Ins.Set(true);
|
||||||
|
|
@ -2448,6 +2449,42 @@ public class ServerInfo : MyCoroutine
|
||||||
Set_Coroutine(() => { Save_Farm_HarvestImm(slot, _act); }, 2f);
|
Set_Coroutine(() => { Save_Farm_HarvestImm(slot, _act); }, 2f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void Save_Farm_EatFruit(int id, int amount, Action _act)
|
||||||
|
{
|
||||||
|
NetWait.Ins.Set(true);
|
||||||
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||||
|
{
|
||||||
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
||||||
|
GeneratePlayStreamEvent = true,
|
||||||
|
FunctionParameter = new
|
||||||
|
{
|
||||||
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
||||||
|
FruitID = id,
|
||||||
|
Amount = amount
|
||||||
|
}
|
||||||
|
},
|
||||||
|
result =>
|
||||||
|
{
|
||||||
|
if (result.Error == null)
|
||||||
|
{
|
||||||
|
NetWait.Ins.Set(false);
|
||||||
|
var str_result = result.FunctionResult.ToString();
|
||||||
|
var error = MyErrorCheck(str_result);
|
||||||
|
// (0 성공, 1 실패 (갯수 부족))
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case 0: _act?.Invoke(); break;
|
||||||
|
case 1: ToastUI.Ins.Set(388); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Set_Coroutine(() => { Save_Farm_EatFruit(id, amount, _act); }, 2f);
|
||||||
|
},
|
||||||
|
fail =>
|
||||||
|
{
|
||||||
|
Set_Coroutine(() => { Save_Farm_EatFruit(id, amount, _act); }, 2f);
|
||||||
|
});
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 우편
|
#region 우편
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,10 @@ public class FarmInvenUI : BotMenuBase
|
||||||
texts[0].text = table_itemlist.Ins.Get_ItemName(itemData.n_ItemID);
|
texts[0].text = table_itemlist.Ins.Get_ItemName(itemData.n_ItemID);
|
||||||
texts[1].text = table_itemlist.Ins.Get_ItemDesc(itemData.n_ItemID);
|
texts[1].text = table_itemlist.Ins.Get_ItemDesc(itemData.n_ItemID);
|
||||||
texts[2].text = table_fruit.Ins.Get_Data_orNull(id).Get_Desc();
|
texts[2].text = table_fruit.Ins.Get_Data_orNull(id).Get_Desc();
|
||||||
|
texts[3].text = "";
|
||||||
|
#if UNITY_EDITOR
|
||||||
texts[3].text = $"(확인용)먹은 갯수 : {sdata.Get_EatFruitCount(id)}";
|
texts[3].text = $"(확인용)먹은 갯수 : {sdata.Get_EatFruitCount(id)}";
|
||||||
|
#endif
|
||||||
|
|
||||||
m_ArrowUI.Set(totalcount => { }, amount);
|
m_ArrowUI.Set(totalcount => { }, amount);
|
||||||
}
|
}
|
||||||
|
|
@ -55,12 +58,16 @@ public class FarmInvenUI : BotMenuBase
|
||||||
{
|
{
|
||||||
if (m_ArrowUI.Get_TotalCount() > 0)
|
if (m_ArrowUI.Get_TotalCount() > 0)
|
||||||
{
|
{
|
||||||
var sdata = ServerInfo.Ins.m_ServerData;
|
|
||||||
var id = SelectCard.Get_FruitID();
|
var id = SelectCard.Get_FruitID();
|
||||||
sdata.Use_Item(id, m_ArrowUI.Get_TotalCount());
|
var amount = m_ArrowUI.Get_TotalCount();
|
||||||
sdata.Add_EatFruitCount(id, m_ArrowUI.Get_TotalCount());
|
ServerInfo.Ins.Save_Farm_EatFruit(id, amount, () =>
|
||||||
|
{
|
||||||
|
var sdata = ServerInfo.Ins.m_ServerData;
|
||||||
|
sdata.Use_Item(id, amount);
|
||||||
|
sdata.Add_EatFruitCount(id, amount);
|
||||||
Set();
|
Set();
|
||||||
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue