Persist Sarco data
This commit is contained in:
@@ -8,7 +8,7 @@ public enum ElementType
|
|||||||
Hydric,
|
Hydric,
|
||||||
Igneous,
|
Igneous,
|
||||||
Ferrum,
|
Ferrum,
|
||||||
Holy,
|
Sankta,
|
||||||
Curse,
|
Shura,
|
||||||
All
|
All
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace Zennysoft.Ma.Adapter.Entity
|
|||||||
{ ElementType.Igneous, igneousResistance },
|
{ ElementType.Igneous, igneousResistance },
|
||||||
{ ElementType.Ferrum, ferrumResistance },
|
{ ElementType.Ferrum, ferrumResistance },
|
||||||
{ ElementType.Telluric, telluricResistance },
|
{ ElementType.Telluric, telluricResistance },
|
||||||
{ ElementType.Holy, holyResistance },
|
{ ElementType.Sankta, holyResistance },
|
||||||
{ ElementType.Curse, curseResistance },
|
{ ElementType.Shura, curseResistance },
|
||||||
{ ElementType.All, aeolicResistance + hydricResistance + igneousResistance + ferrumResistance + telluricResistance + holyResistance + curseResistance },
|
{ ElementType.All, aeolicResistance + hydricResistance + igneousResistance + ferrumResistance + telluricResistance + holyResistance + curseResistance },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -33,8 +33,8 @@ namespace Zennysoft.Ma.Adapter.Entity
|
|||||||
left.ElementalResistance[ElementType.Igneous] + right.ElementalResistance[ElementType.Igneous],
|
left.ElementalResistance[ElementType.Igneous] + right.ElementalResistance[ElementType.Igneous],
|
||||||
left.ElementalResistance[ElementType.Ferrum] + right.ElementalResistance[ElementType.Ferrum],
|
left.ElementalResistance[ElementType.Ferrum] + right.ElementalResistance[ElementType.Ferrum],
|
||||||
left.ElementalResistance[ElementType.Telluric] + right.ElementalResistance[ElementType.Telluric],
|
left.ElementalResistance[ElementType.Telluric] + right.ElementalResistance[ElementType.Telluric],
|
||||||
left.ElementalResistance[ElementType.Holy] + right.ElementalResistance[ElementType.Holy],
|
left.ElementalResistance[ElementType.Sankta] + right.ElementalResistance[ElementType.Sankta],
|
||||||
left.ElementalResistance[ElementType.Curse] + right.ElementalResistance[ElementType.Curse]);
|
left.ElementalResistance[ElementType.Shura] + right.ElementalResistance[ElementType.Shura]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,24 @@ namespace Zennysoft.Ma.Adapter;
|
|||||||
[Meta, Id("sarco_data")]
|
[Meta, Id("sarco_data")]
|
||||||
public partial record SarcoData
|
public partial record SarcoData
|
||||||
{
|
{
|
||||||
|
[Save("aeolic_sarco")]
|
||||||
|
public bool AeolicSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
[Save("igneous_sarco")]
|
[Save("igneous_sarco")]
|
||||||
public bool IgneousSarcoAcquired { get; set; } = false;
|
public bool IgneousSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
|
[Save("telluric_sarco")]
|
||||||
|
public bool TelluricSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
|
[Save("hydric_sarco")]
|
||||||
|
public bool HydricSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
|
[Save("ferrum_sarco")]
|
||||||
|
public bool FerrumSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
|
[Save("sankta_sarco")]
|
||||||
|
public bool SanktaSarcoAcquired { get; set; } = false;
|
||||||
|
|
||||||
|
[Save("shura_sarco")]
|
||||||
|
public bool ShuraSarcoAcquired { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public partial class EnemyModelView2D : EnemyModelView, IEnemyModelView
|
|||||||
FlameHitAnimation.Stop();
|
FlameHitAnimation.Stop();
|
||||||
FlameHitAnimation.Play("FireHit");
|
FlameHitAnimation.Play("FireHit");
|
||||||
}
|
}
|
||||||
else if (elementType == ElementType.Holy)
|
else if (elementType == ElementType.Sankta)
|
||||||
{
|
{
|
||||||
if (HolyHitAnimation.IsPlaying())
|
if (HolyHitAnimation.IsPlaying())
|
||||||
HolyHitAnimation.Stop();
|
HolyHitAnimation.Stop();
|
||||||
@@ -86,7 +86,7 @@ public partial class EnemyModelView2D : EnemyModelView, IEnemyModelView
|
|||||||
WindHitAnimation.Stop();
|
WindHitAnimation.Stop();
|
||||||
WindHitAnimation.Play("WindHit");
|
WindHitAnimation.Play("WindHit");
|
||||||
}
|
}
|
||||||
else if (elementType == ElementType.Curse)
|
else if (elementType == ElementType.Shura)
|
||||||
{
|
{
|
||||||
if (CurseHitAnimation.IsPlaying())
|
if (CurseHitAnimation.IsPlaying())
|
||||||
CurseHitAnimation.Stop();
|
CurseHitAnimation.Stop();
|
||||||
|
|||||||
@@ -115,7 +115,13 @@ public partial class Game : Node3D, IGame
|
|||||||
},
|
},
|
||||||
SarcoData = new SarcoData()
|
SarcoData = new SarcoData()
|
||||||
{
|
{
|
||||||
|
AeolicSarcoAcquired = SarcoData.AeolicSarcoAcquired,
|
||||||
IgneousSarcoAcquired = SarcoData.IgneousSarcoAcquired,
|
IgneousSarcoAcquired = SarcoData.IgneousSarcoAcquired,
|
||||||
|
TelluricSarcoAcquired = SarcoData.TelluricSarcoAcquired,
|
||||||
|
HydricSarcoAcquired = SarcoData.HydricSarcoAcquired,
|
||||||
|
FerrumSarcoAcquired = SarcoData.FerrumSarcoAcquired,
|
||||||
|
SanktaSarcoAcquired = SarcoData.SanktaSarcoAcquired,
|
||||||
|
ShuraSarcoAcquired = SarcoData.ShuraSarcoAcquired,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return gameData;
|
return gameData;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public partial class Sarco : Node3D
|
|||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
_interactionComplete = _game.SarcoData.IgneousSarcoAcquired;
|
_interactionComplete = GetSaveDataByAffinity();
|
||||||
if (_interactionComplete)
|
if (_interactionComplete)
|
||||||
ShowFlower();
|
ShowFlower();
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ public partial class Sarco : Node3D
|
|||||||
{
|
{
|
||||||
GetTree().Paused = false;
|
GetTree().Paused = false;
|
||||||
_interactionComplete = true;
|
_interactionComplete = true;
|
||||||
_game.SarcoData.IgneousSarcoAcquired = true;
|
SetSaveDataByAffinity();
|
||||||
await _game.Save();
|
await _game.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,4 +84,42 @@ public partial class Sarco : Node3D
|
|||||||
{
|
{
|
||||||
_isInInteractZone = false;
|
_isInInteractZone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool GetSaveDataByAffinity()
|
||||||
|
{
|
||||||
|
if (Affinity == ElementType.Aeolic)
|
||||||
|
return _game.SarcoData.AeolicSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Igneous)
|
||||||
|
return _game.SarcoData.IgneousSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Telluric)
|
||||||
|
return _game.SarcoData.TelluricSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Hydric)
|
||||||
|
return _game.SarcoData.HydricSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Ferrum)
|
||||||
|
return _game.SarcoData.FerrumSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Sankta)
|
||||||
|
return _game.SarcoData.SanktaSarcoAcquired;
|
||||||
|
if (Affinity == ElementType.Shura)
|
||||||
|
return _game.SarcoData.ShuraSarcoAcquired;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetSaveDataByAffinity()
|
||||||
|
{
|
||||||
|
if (Affinity == ElementType.Aeolic)
|
||||||
|
_game.SarcoData.AeolicSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Igneous)
|
||||||
|
_game.SarcoData.IgneousSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Telluric)
|
||||||
|
_game.SarcoData.TelluricSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Hydric)
|
||||||
|
_game.SarcoData.HydricSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Ferrum)
|
||||||
|
_game.SarcoData.FerrumSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Sankta)
|
||||||
|
_game.SarcoData.SanktaSarcoAcquired = true;
|
||||||
|
if (Affinity == ElementType.Shura)
|
||||||
|
_game.SarcoData.ShuraSarcoAcquired = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3017,10 +3017,6 @@ transform = Transform3D(0.921192, 0.0644309, 0.329915, -0.635509, 0.0745904, 0.4
|
|||||||
mesh = SubResource("ArrayMesh_pxsmp")
|
mesh = SubResource("ArrayMesh_pxsmp")
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
[node name="Sarco2" parent="." instance=ExtResource("59_mic3u")]
|
|
||||||
transform = Transform3D(-0.561658, 0, -0.196382, 0, 0.595, 0, 0.196382, 0, -0.561658, -328.661, 2.6811, 27.9079)
|
|
||||||
Affinity = 4
|
|
||||||
|
|
||||||
[editable path="Node3D/Overworld Re-Scaled (Missing Distance Objects)"]
|
[editable path="Node3D/Overworld Re-Scaled (Missing Distance Objects)"]
|
||||||
[editable path="Actors/Rat"]
|
[editable path="Actors/Rat"]
|
||||||
[editable path="Actors/Clalo"]
|
[editable path="Actors/Clalo"]
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public partial class InGameUI : Control, IInGameUI
|
|||||||
case ElementType.Telluric:
|
case ElementType.Telluric:
|
||||||
TelluricImg.Visible = true;
|
TelluricImg.Visible = true;
|
||||||
break;
|
break;
|
||||||
case ElementType.Curse:
|
case ElementType.Shura:
|
||||||
SanktaImg.Visible = true;
|
SanktaImg.Visible = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user