Save_Pet_Equip

This commit is contained in:
Ino 2025-07-08 15:36:10 +09:00
parent 06641b10f3
commit 24b47064f3
3 changed files with 60 additions and 5 deletions

View File

@ -1508,6 +1508,23 @@ handlers.Save_Pet_LvUp = function(args)
}
return Get_Return(1);
}
handlers.Save_Pet_Equip = 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);
if (!urod.Pet[args.PetID]) return Get_Return(1);
urod.Equip.Equip["Pet"] = args.PetID;
Add_MissionCount(Get_MissionTable(), urod, "PET_MOUNT_LIMIT", 0, 1);
Set_JsonUserData(urod);
return Get_Return(0);
}
/////////////////////////////////// 서버 처리
handlers.Write_UnityInApp = function(args)

View File

@ -1790,6 +1790,41 @@ public class ServerInfo : MyCoroutine
Set_Coroutine(() => { Save_Pet_LvUp(petid, _act); }, 2f);
});
}
public void Save_Pet_Equip(int petid, Action _act)
{
NetWait.Ins.Set(true);
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
{
FunctionName = MethodBase.GetCurrentMethod().Name,
GeneratePlayStreamEvent = true,
FunctionParameter = new
{
Token = m_LoginInfo.EntityToken.EntityToken,
PetID = petid,
}
},
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(999900014); break;
}
}
else
Set_Coroutine(() => { Save_Pet_Equip(petid, _act); }, 2f);
},
fail =>
{
Set_Coroutine(() => { Save_Pet_Equip(petid, _act); }, 2f);
});
}
#endregion
#region

View File

@ -89,11 +89,14 @@ public class PetUI_Right : uScrollViewMgr
{
if (CanEquip())
{
var sdata = ServerInfo.Ins.m_ServerData;
sdata.Equip.Set_Equip(eItem.Pet, Get_SelectPetData().n_PetID);
PCInfo.Ins.Make_Pet(false, sdata, MyValue.MyPC);
Set();
sdata.Add_MissionCount(ePurpose.PET_MOUNT_LIMIT);
ServerInfo.Ins.Save_Pet_Equip(Get_SelectPetData().n_PetID, () =>
{
var sdata = ServerInfo.Ins.m_ServerData;
sdata.Equip.Set_Equip(eItem.Pet, Get_SelectPetData().n_PetID);
PCInfo.Ins.Make_Pet(false, sdata, MyValue.MyPC);
Set();
sdata.Add_MissionCount(ePurpose.PET_MOUNT_LIMIT);
});
}
}