mirror of
https://gitea.tendokyu.moe/beerpsi/sinmai-mods.git
synced 2024-12-04 03:57:16 +01:00
36 lines
892 B
C#
36 lines
892 B
C#
|
// ReSharper disable CheckNamespace
|
|||
|
// ReSharper disable InconsistentNaming
|
|||
|
|
|||
|
using System.Globalization;
|
|||
|
using MonoMod;
|
|||
|
|
|||
|
namespace Manager;
|
|||
|
|
|||
|
class patch_MA2Record : MA2Record
|
|||
|
{
|
|||
|
[MonoModIgnore]
|
|||
|
private static extern Ma2fileParamID.Def getParamIDFromRec(Ma2fileRecordID.Def rec, int index);
|
|||
|
|
|||
|
[MonoModReplace]
|
|||
|
public new float getF32(uint index)
|
|||
|
{
|
|||
|
if (index >= _str.Count)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
var paramIDFromRec = getParamIDFromRec(_recID, (int)index);
|
|||
|
|
|||
|
if (!paramIDFromRec.isValid() || !paramIDFromRec.isAvailableFloat() || _str[(int)index].Length == 0)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
if (!float.TryParse(_str[(int)index], NumberStyles.Float, CultureInfo.InvariantCulture, out var num))
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
return num;
|
|||
|
}
|
|||
|
}
|