Save_Skill_MenuBack
This commit is contained in:
parent
e9ec3636c1
commit
26ba9cb3b7
|
|
@ -1378,6 +1378,35 @@ handlers.Save_Enchant_LvUp = function(args)
|
|||
}
|
||||
return Get_Return(1);
|
||||
}
|
||||
|
||||
handlers.Save_Skill_MenuBack = 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);
|
||||
|
||||
urod.Equip.Preset = args.Preset;
|
||||
for (var i = 0; i < 6; ++i)
|
||||
{
|
||||
if (args.Skills1[i] > 0 && !IsObtainItem(urod, args.Skills1[i])) return Get_Return(1);
|
||||
urod.Equip.Skill[1][i] = args.Skills1[i];
|
||||
}
|
||||
for (var i = 0; i < 6; ++i)
|
||||
{
|
||||
if (args.Skills2[i] > 0 && !IsObtainItem(urod, args.Skills2[i])) return Get_Return(1);
|
||||
urod.Equip.Skill[2][i] = args.Skills2[i];
|
||||
}
|
||||
for (var i = 0; i < 6; ++i)
|
||||
{
|
||||
if (args.Skills3[i] > 0 && !IsObtainItem(urod, args.Skills3[i])) return Get_Return(1);
|
||||
urod.Equip.Skill[3][i] = args.Skills3[i];
|
||||
}
|
||||
|
||||
Set_JsonUserData(urod);
|
||||
return Get_Return(0);
|
||||
}
|
||||
/////////////////////////////////// 서버 처리
|
||||
|
||||
handlers.Write_UnityInApp = function(args)
|
||||
|
|
@ -10146,9 +10175,11 @@ function IsRateTrue1000000(rate)
|
|||
{
|
||||
return Math.floor(Math.random() * 1000000) < rate;
|
||||
}
|
||||
function Add_Amount(...args)
|
||||
{
|
||||
return args.reduce((sum, val) => sum + Number(val), 0);
|
||||
function Add_Amount(...args) {
|
||||
return args.reduce((sum, val) => {
|
||||
let num = Number(val);
|
||||
return isNaN(num) ? sum : sum + num;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -146,8 +146,6 @@ public partial class ServerData
|
|||
Enchant = new List<SD_Slot_Enchant> { new SD_Slot_Enchant(), new SD_Slot_Enchant(), new SD_Slot_Enchant() }
|
||||
});
|
||||
|
||||
Add_SkillLv(1); // 최초 스킬 하나 지급
|
||||
|
||||
Common = new List<ObscuredInt>(); for (eCommon i = 0; i < eCommon.Max; i++) Common.Add(0);
|
||||
|
||||
Book = new List<ServerData_Book>();
|
||||
|
|
@ -2127,6 +2125,7 @@ public partial class ServerData
|
|||
else if (Enchant.ContainsKey(key)) return true;
|
||||
else if (Pet.ContainsKey(key)) return true;
|
||||
else if (Relic.ContainsKey(key)) return true;
|
||||
else if (Skill.ContainsKey(key)) return true;
|
||||
else
|
||||
{
|
||||
var itemdata = table_itemlist.Ins.Get_Data(id);
|
||||
|
|
|
|||
|
|
@ -1602,6 +1602,45 @@ public class ServerInfo : MyCoroutine
|
|||
Set_Coroutine(() => { Save_Enchant_LvUp(eid, _act); }, 2f);
|
||||
});
|
||||
}
|
||||
|
||||
public void Save_Skill_MenuBack(int preset, Dictionary<int, List<int>> skills, Action _act)
|
||||
{
|
||||
NetWait.Ins.Set(true);
|
||||
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||
{
|
||||
FunctionName = MethodBase.GetCurrentMethod().Name,
|
||||
GeneratePlayStreamEvent = true,
|
||||
FunctionParameter = new
|
||||
{
|
||||
Token = m_LoginInfo.EntityToken.EntityToken,
|
||||
Preset = preset,
|
||||
Skills1 = skills[1],
|
||||
Skills2 = skills[2],
|
||||
Skills3 = skills[3],
|
||||
}
|
||||
},
|
||||
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(999900023); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
Set_Coroutine(() => { Save_Skill_MenuBack(preset, skills, _act); }, 2f);
|
||||
},
|
||||
fail =>
|
||||
{
|
||||
Set_Coroutine(() => { Save_Skill_MenuBack(preset, skills, _act); }, 2f);
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 우편
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public class SkillCard : CardCoolTimeBase, IDropHandler
|
|||
if (!DSUtil.CheckNull(m_Data))
|
||||
unequipid = m_Data.n_SkillID;
|
||||
sdata.Equip.Set_Equip(eItem.Skill, draggedSkill.m_skillID, m_Slot, unequipid);
|
||||
NewGameUI.Ins.m_SkillUI.EquipSkill(m_Slot, draggedSkill.m_skillID);
|
||||
NewGameUI.Ins.m_SkillUI.Set_UI();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class SkillUI : BotMenuBase
|
||||
{
|
||||
|
|
@ -15,10 +16,33 @@ public class SkillUI : BotMenuBase
|
|||
List<TabUIData> list_skilltabData = new List<TabUIData>
|
||||
{ new TabUIData { n_btnName = 214 }, new TabUIData { n_btnName = 215 }, new TabUIData { n_btnName = 216 } };
|
||||
|
||||
int BeforePreset, AfterPreset;
|
||||
Dictionary<bool, Dictionary<int, List<int>>> dic_EquipSkill = new Dictionary<bool, Dictionary<int, List<int>>>();
|
||||
|
||||
public override void Set()
|
||||
{
|
||||
m_SkillEquipUI.OnClick_Back();
|
||||
base.Set();
|
||||
|
||||
if (dic_EquipSkill.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
dic_EquipSkill.Add(i == 0, new Dictionary<int, List<int>>());
|
||||
for (int j = 0; j < 3; j++)
|
||||
dic_EquipSkill[i == 0].Add(j + 1, new List<int> { 0, 0, 0, 0, 0, 0 });
|
||||
}
|
||||
}
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < sdata.Equip.Skill[i + 1].Count; j++)
|
||||
{
|
||||
dic_EquipSkill[true][i + 1][j] = sdata.Equip.Skill[i + 1][j];
|
||||
dic_EquipSkill[false][i + 1][j] = sdata.Equip.Skill[i + 1][j];
|
||||
}
|
||||
|
||||
BeforePreset = sdata.Equip.Preset;
|
||||
|
||||
Set_PresetTab();
|
||||
Set_SkillTab();
|
||||
Set_Money(table_skilllist.Ins.Get_MatIds());
|
||||
|
|
@ -57,6 +81,17 @@ public class SkillUI : BotMenuBase
|
|||
m_BattleUI.Set(eUICardType.UIEquip, sdata.Equip.Preset);
|
||||
}
|
||||
|
||||
public void EquipSkill(int slot, int skillid)
|
||||
{
|
||||
var curPreset = m_Tab.Get_Index() + 1;
|
||||
for (int i = 0; i < dic_EquipSkill[false][curPreset].Count; i++)
|
||||
{
|
||||
if (dic_EquipSkill[false][curPreset][i] == skillid)
|
||||
dic_EquipSkill[false][curPreset][i] = 0;
|
||||
}
|
||||
dic_EquipSkill[false][curPreset][slot - 1] = skillid;
|
||||
}
|
||||
|
||||
public void OnClick_SkillType()
|
||||
{
|
||||
var index = m_TabSkillType.Get_Index();
|
||||
|
|
@ -67,7 +102,28 @@ public class SkillUI : BotMenuBase
|
|||
public void OnClick_Preset()
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
sdata.Equip.Preset = m_Tab.Get_Index() + 1;
|
||||
AfterPreset = sdata.Equip.Preset = m_Tab.Get_Index() + 1;
|
||||
m_BattleUI.Set(eUICardType.UIEquip, sdata.Equip.Preset);
|
||||
}
|
||||
|
||||
public override void OnClick_Back()
|
||||
{
|
||||
base.OnClick_Back();
|
||||
|
||||
bool save = BeforePreset != AfterPreset;
|
||||
if (!save) save = !AreDictionariesEqual(dic_EquipSkill[true], dic_EquipSkill[false]);
|
||||
if (save) ServerInfo.Ins.Save_Skill_MenuBack(AfterPreset, dic_EquipSkill[false], null);
|
||||
}
|
||||
|
||||
bool AreDictionariesEqual(Dictionary<int, List<int>> a, Dictionary<int, List<int>> b)
|
||||
{
|
||||
if (a.Count != b.Count) return false;
|
||||
|
||||
foreach (var kv in a)
|
||||
{
|
||||
if (!b.TryGetValue(kv.Key, out var listB)) return false;
|
||||
if (!kv.Value.SequenceEqual(listB)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue