Skip to content

Commit

Permalink
feat: [クラスラッパー]MapObjectListで距離程に対応する要素を取得できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic9045 committed Aug 27, 2023
1 parent 8906c63 commit 9edc423
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Libs/BveTypes/ClassWrappers/Public/MapObjectList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private static void Initialize(BveTypeSet bveTypes)
CurrentIndexGetMethod = members.GetSourcePropertyGetterOf(nameof(CurrentIndex));
CurrentIndexSetMethod = members.GetSourcePropertySetterOf(nameof(CurrentIndex));

GoToAndGetCurrentMethod = members.GetSourceMethodOf(nameof(GoToAndGetCurrent));
GoToMethod = members.GetSourceMethodOf(nameof(GoTo));
}

Expand Down Expand Up @@ -61,11 +62,22 @@ public int CurrentIndex
set => CurrentIndexSetMethod.Invoke(Src, new object[] { value });
}

private static FastMethod GoToAndGetCurrentMethod;
/// <summary>
/// コレクションの指定した距離程に対応する要素へ移動し、それを取得します。
/// </summary>
/// <param name="location">移動先の距離程 [m]。</param>
public MapObjectBase GoToAndGetCurrent(double location)
{
object src = GoToAndGetCurrentMethod.Invoke(Src, new object[] { location });
return src is null ? null : (MapObjectBase)CreateFromSource(src);
}

private static FastMethod GoToMethod;
/// <summary>
/// 指定したインデックスへ移動します。
/// </summary>
/// <param name="index"></param>
/// <param name="index">移動先のインデックス。</param>
public void GoTo(int index) => GoToMethod.Invoke(Src, new object[] { index });
}
}
1 change: 1 addition & 0 deletions Libs/BveTypes/WrapTypes/5.8.7554.391.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
<Setter Original="d"/>
</Property>

<Method Wrapper="GoToAndGetCurrent" WrapperParams="System.Double" Original="c"/>
<Method Wrapper="GoTo" WrapperParams="System.Int32" Original="f"/>
</Class>

Expand Down
1 change: 1 addition & 0 deletions Libs/BveTypes/WrapTypes/6.0.7554.619.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
<Setter Original="d"/>
</Property>

<Method Wrapper="GoToAndGetCurrent" WrapperParams="System.Double" Original="c"/>
<Method Wrapper="GoTo" WrapperParams="System.Int32" Original="f"/>
</Class>

Expand Down

0 comments on commit 9edc423

Please sign in to comment.