You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Wiki/pages/多选项弹窗-%2D-MultiSelectionInq...

48 lines
2.6 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

**2023年02月07日 皮蛋创建 需代码侧审核格式及内容是否正确**
# 接口名称
```
MBInformationManager.ShowMultiSelectionInquiry
```
# 接口位置
```
TaleWorlds.Core
```
# 功能说明
- 一种弹窗。
- 玩家需要选择一个选项,然后单击确认。
- 弹窗时游戏暂停。
- 与其他弹窗相比,此弹窗主要用于玩家需要在多个选项中作出一项选择的情景下。
- # 案例截图
注意:截图案例来源于
- 随机事件模组Random Events MOD
- [中文站链接](https://bbs.mountblade.com.cn/download_729.html)
- [NexusMOD链接](https://www.nexusmods.com/mountandblade2bannerlord/mods/1410)
- ![QQ图片20230207004259-0119ca9b-48e8-42d3-849a-f6bf4993ced1.png](../assets/QQ图片20230207004259-0119ca9b-48e8-42d3-849a-f6bf4993ced1_1680367981514_0.png)
- # 使用案例
- 位于[军火商](https://bbs.mountblade.com.cn/download_60.html)模组
- `ArmsDealer.ArmsDealer.TrainSoldiersBehavior`
``cs
public void OnSessionLaunched(CampaignGameStarter campaignGameStarter)
{
new ADMenu(campaignGameStarter).AddConditionOption("town_arena", "town_ad_train_soldier", "{=addMenuTrainSoldier}Train Soldier", GameMenuOption.LeaveType.HostileAction, delegate(MenuCallbackArgs args)
{
TextObject disabledText = new TextObject("{=addMenuTrainSoldierDisable}", null);
return MenuHelper.SetOptionProperties(args, this._isCanTrainSoldier, true, disabledText);
}, delegate(MenuCallbackArgs args)
{
List<InquiryElement> list = Enumerable.ToList<InquiryElement>(Enumerable.Select<TroopRosterElement, InquiryElement>(Enumerable.Where<TroopRosterElement>(MobileParty.MainParty.MemberRoster.GetTroopRoster(), new Func<TroopRosterElement, bool>(this.FilterNormalTroop)), (TroopRosterElement troopRosterElement) => new InquiryElement(troopRosterElement, troopRosterElement.Character.Name.ToString() + "【" + troopRosterElement.Number.ToString() + "人】", new ImageIdentifier(CharacterCode.CreateFrom(troopRosterElement.Character)))));
if (list.Count == 0)
{
ADInfo.Display("{=adInquiryChooseSoldierEmpty}", "");
return;
}
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=adInquiryChooseSoldier}Choose Soldier", null).ToString(), "", list, true, 1, new TextObject("{=adConfirm}DONE", null).ToString(), "", delegate(List<InquiryElement> obj)
{
TroopRosterElement troopRosterElement = (TroopRosterElement)Enumerable.FirstOrDefault<InquiryElement>(obj).Identifier;
this.CreateNewMission(troopRosterElement);
}, null, ""), true, false);
}, 0);
}``
-