protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { num_result = 0d; var buf = SRC.Expression.GetValueAsString(@params[1], is_term[1]); var i = SRC.Expression.GetValueAsLong(@params[2], is_term[2]); str_result = GeneralLib.LeftPaddedString(buf, i); return(ValueType.StringType); }
// スペシャルパワーコマンドを開始 private void StartSpecialPowerCommand() { GUI.LockGUI(); SelectedCommand = "スペシャルパワー"; { var u = SelectedUnit; // スペシャルパワーを使用可能なパイロットの一覧を作成 var pilots = u.PilotsHaveSpecialPower(); var listItems = pilots.Select(p => { return(new ListBoxItem { Text = GeneralLib.RightPaddedString(p.get_Nickname(false), 17) + GeneralLib.RightPaddedString($"{p.SP}/{p.MaxSP}", 8) + string.Join("", Enumerable.Range(1, p.CountSpecialPower).Select(i => { var sname = p.get_SpecialPower(i); if (p.SP >= p.SpecialPowerCost(sname)) { return SRC.SPDList.Item(sname).ShortName; } else { return ""; } })), }); }).ToList(); GUI.TopItem = 1; int i; if (pilots.Count > 1) { // どのパイロットを使うか選択 if (Expression.IsOptionDefined("等身大基準")) { i = GUI.ListBox(new ListBoxArgs { Items = listItems, HasFlag = false, lb_caption = "キャラクター選択", lb_info = "キャラクター " + Expression.Term("SP", SelectedUnit, 2) + "/Max" + Expression.Term("SP", SelectedUnit, 2), lb_mode = "連続表示,カーソル移動" }); } else { i = GUI.ListBox(new ListBoxArgs { Items = listItems, HasFlag = false, lb_caption = "パイロット選択", lb_info = "パイロット " + Expression.Term("SP", SelectedUnit, 2) + "/Max" + Expression.Term("SP", SelectedUnit, 2), lb_mode = "連続表示,カーソル移動" }); } } else { // 一人しかいないので選択の必要なし i = 1; } // 誰もスペシャルパワーを使えなければキャンセル if (i == 0) { GUI.CloseListBox(); if (SRC.AutoMoveCursor) { GUI.RestoreCursorPos(); } GUI.UnlockGUI(); CancelCommand(); return; } // スペシャルパワーを使うパイロットを設定 SelectedPilot = pilots[i - 1]; // そのパイロットのステータスを表示 if (pilots.Count > 1) { Status.DisplayPilotStatus(SelectedPilot); } } { var p = SelectedPilot; // 使用可能なスペシャルパワーの一覧を作成 var spList = p.SpecialPowerNames.Select(sname => { var cost = p.SpecialPowerCost(sname); var spd = SRC.SPDList.Item(sname); return(new ListBoxItem { Text = GeneralLib.RightPaddedString(sname, 13) + GeneralLib.LeftPaddedString("" + cost, 3) + " " + spd.Comment, ListItemFlag = p.SP < cost || !p.IsSpecialPowerUseful(sname), }); }).ToList(); // どのコマンドを使用するかを選択 GUI.TopItem = 1; var i = GUI.ListBox(new ListBoxArgs { Items = spList, HasFlag = true, lb_caption = Expression.Term("スペシャルパワー", SelectedUnit) + "選択", lb_info = "名称 消費" + Expression.Term("SP", SelectedUnit) + "(" + p.get_Nickname(false) + " " + Expression.Term("SP", SelectedUnit) + "=" + SrcFormatter.Format(p.SP) + "/" + SrcFormatter.Format(p.MaxSP) + ")", lb_mode = "カーソル移動(行きのみ)" }); // キャンセル if (i == 0) { Status.DisplayUnitStatus(SelectedUnit); // カーソル自動移動 if (SRC.AutoMoveCursor) { GUI.MoveCursorPos("ユニット選択", SelectedUnit); } GUI.UnlockGUI(); CancelCommand(); return; } // 使用するスペシャルパワーを設定 SelectedSpecialPower = SelectedPilot.get_SpecialPower(i); } // 味方スペシャルパワー実行の効果により他のパイロットが持っているスペシャルパワーを // 使う場合は記録しておき、後で消費SPを倍にする必要がある // TODO Impl 夢 //if (SRC.SPDList.Item(SelectedSpecialPower).EffectType(1) == "味方スペシャルパワー実行") if (false) { //// スペシャルパワー一覧 //list = new string[1]; //var loopTo6 = SRC.SPDList.Count(); //for (i = 1; i <= loopTo6; i++) //{ // { // var withBlock5 = SRC.SPDList.Item(i); // if (withBlock5.EffectType(1) != "味方スペシャルパワー実行" && withBlock5.intName != "非表示") // { // Array.Resize(list, Information.UBound(list) + 1 + 1); // Array.Resize(strkey_list, Information.UBound(list) + 1); // list[Information.UBound(list)] = withBlock5.Name; // strkey_list[Information.UBound(list)] = withBlock5.KanaName; // } // } //} //GUI.ListItemFlag = new bool[Information.UBound(list) + 1]; //// ソート //var loopTo7 = (Information.UBound(strkey_list) - 1); //for (i = 1; i <= loopTo7; i++) //{ // max_item = i; // max_str = strkey_list[i]; // var loopTo8 = Information.UBound(strkey_list); // for (j = (i + 1); j <= loopTo8; j++) // { // if (Strings.StrComp(strkey_list[j], max_str, (CompareMethod)1) == -1) // { // max_item = j; // max_str = strkey_list[j]; // } // } // if (max_item != i) // { // buf = list[i]; // list[i] = list[max_item]; // list[max_item] = buf; // buf = strkey_list[i]; // strkey_list[i] = max_str; // strkey_list[max_item] = buf; // } //} //// スペシャルパワーを使用可能なパイロットがいるかどうかを判定 //var loopTo9 = Information.UBound(list); //for (i = 1; i <= loopTo9; i++) //{ // GUI.ListItemFlag[i] = true; // foreach (Pilot currentP in SRC.PList) // { // p = currentP; // if (p.Party == "味方") // { // if (p.Unit is object) // { // if (p.Unit.Status == "出撃" && !p.Unit.IsConditionSatisfied("憑依")) // { // // 本当に乗っている? // found = false; // { // var withBlock6 = p.Unit; // if (ReferenceEquals(p, withBlock6.MainPilot())) // { // found = true; // } // else // { // var loopTo10 = withBlock6.CountPilot(); // for (j = 2; j <= loopTo10; j++) // { // Pilot localPilot1() { object argIndex1 = j; var ret = withBlock6.Pilot(argIndex1); return ret; } // if (ReferenceEquals(p, localPilot1())) // { // found = true; // break; // } // } // var loopTo11 = withBlock6.CountSupport(); // for (j = 1; j <= loopTo11; j++) // { // Pilot localSupport() { object argIndex1 = j; var ret = withBlock6.Support(argIndex1); return ret; } // if (ReferenceEquals(p, localSupport())) // { // found = true; // break; // } // } // if (ReferenceEquals(p, withBlock6.AdditionalSupport())) // { // found = true; // } // } // } // if (found) // { // if (p.IsSpecialPowerAvailable(list[i])) // { // GUI.ListItemFlag[i] = false; // break; // } // } // } // } // } // } //} //// 各スペシャルパワーが使用可能か判定 //{ // var withBlock7 = SelectedPilot; // var loopTo12 = Information.UBound(list); // for (i = 1; i <= loopTo12; i++) // { // if (!GUI.ListItemFlag[i] && withBlock7.SP >= 2 * withBlock7.SpecialPowerCost(list[i])) // { // if (!withBlock7.IsSpecialPowerUseful(list[i])) // { // GUI.ListItemFlag[i] = true; // } // } // else // { // GUI.ListItemFlag[i] = true; // } // } //} //// スペシャルパワーの解説を設定 //GUI.ListItemComment = new string[Information.UBound(list) + 1]; //var loopTo13 = Information.UBound(list); //for (i = 1; i <= loopTo13; i++) //{ // SpecialPowerData localItem4() { var tmp = list; object argIndex1 = tmp[i]; var ret = SRC.SPDList.Item(argIndex1); return ret; } // GUI.ListItemComment[i] = localItem4().Comment; //} //// 検索するスペシャルパワーを選択 //GUI.TopItem = 1; //ret = GUI.MultiColumnListBox(Expression.Term(argtname7, u: argu) + "検索", list, true); //if (ret == 0) //{ // SelectedSpecialPower = ""; // CancelCommand(); // GUI.UnlockGUI(); // return; //} //// スペシャルパワー使用メッセージ //if (SelectedUnit.IsMessageDefined(SelectedSpecialPower)) //{ // GUI.OpenMessageForm(u1: null1, u2: null2); // SelectedUnit.PilotMessage(SelectedSpecialPower, msg_mode: ""); // GUI.CloseMessageForm(); //} //SelectedSpecialPower = list[ret]; //WithDoubleSPConsumption = true; } else { WithDoubleSPConsumption = false; } var sd = SRC.SPDList.Item(SelectedSpecialPower); // ターゲットを選択する必要があるスペシャルパワーの場合 switch (sd.TargetType ?? "") { case "味方": case "敵": case "任意": { // マップ上のユニットからターゲットを選択する GUI.OpenMessageForm(null, null); GUI.DisplaySysMessage(SelectedPilot.get_Nickname(false) + "は" + SelectedSpecialPower + "を使った。;" + "ターゲットを選んでください。"); GUI.CloseMessageForm(); // ターゲットのエリアを設定 for (var i = 1; i <= Map.MapWidth; i++) { for (var j = 1; j <= Map.MapHeight; j++) { Map.MaskData[i, j] = true; var u = Map.MapDataForUnit[i, j]; if (u is null) { goto NextLoop; } // 陣営が合っている? switch (sd.TargetType ?? "") { case "味方": { { var withBlock8 = u; if (withBlock8.Party != "味方" && withBlock8.Party0 != "味方" && withBlock8.Party != "NPC" && withBlock8.Party0 != "NPC") { goto NextLoop; } } break; } case "敵": { { var withBlock9 = u; if (withBlock9.Party == "味方" && withBlock9.Party0 == "味方" || withBlock9.Party == "NPC" && withBlock9.Party0 == "NPC") { goto NextLoop; } } break; } } // スペシャルパワーを適用可能? if (!sd.Effective(SelectedPilot, u)) { goto NextLoop; } Map.MaskData[i, j] = false; NextLoop: ; } } GUI.MaskScreen(); CommandState = "ターゲット選択"; GUI.UnlockGUI(); return; } case "破壊味方": { // 破壊された味方ユニットの中からターゲットを選択する GUI.OpenMessageForm(null, null); GUI.DisplaySysMessage(SelectedPilot.get_Nickname(false) + "は" + SelectedSpecialPower + "を使った。;" + "復活させるユニットを選んでください。"); GUI.CloseMessageForm(); // 破壊された味方ユニットのリストを作成 var units = SRC.UList.Items .Where(u => u.Party0 == "味方" && u.Status == "破壊" && (u.CountPilot() > 0 || u.Data.PilotNum == 0)) .Select(u => new ListBoxItem { Text = GeneralLib.RightPaddedString(u.Nickname, 28) + GeneralLib.RightPaddedString(u.MainPilot().get_Nickname(false), 18) + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MainPilot().Level), 3), ListItemID = u.ID, }).ToList(); GUI.TopItem = 1; var ret = GUI.ListBox(new ListBoxArgs { Items = units, lb_caption = "ユニット選択", lb_info = "ユニット名 パイロット レベル", lb_mode = "", }); if (ret == 0) { GUI.UnlockGUI(); CancelCommand(); return; } SelectedTarget = SRC.UList.Item(units[ret - 1].ListItemID); break; } } // 自爆を選択した場合は確認を取る if (sd.IsEffectAvailable("自爆")) { var ret = GUI.Confirm("自爆させますか?", "自爆", GuiConfirmOption.OkCancel | GuiConfirmOption.Question); if (ret == GuiDialogResult.Ok) { GUI.UnlockGUI(); return; } } // 使用イベント Event.HandleEvent("使用", SelectedUnit.MainPilot().ID, SelectedSpecialPower); if (SRC.IsScenarioFinished) { SRC.IsScenarioFinished = false; GUI.UnlockGUI(); return; } if (SRC.IsCanceled) { SRC.IsCanceled = false; GUI.UnlockGUI(); return; } // スペシャルパワーを使用 if (WithDoubleSPConsumption) { SelectedPilot.UseSpecialPower(SelectedSpecialPower, 2d); } else { SelectedPilot.UseSpecialPower(SelectedSpecialPower); } SelectedUnit = SelectedUnit.CurrentForm(); // カーソル自動移動 if (SRC.AutoMoveCursor) { GUI.MoveCursorPos("ユニット選択", SelectedUnit); } // ステータスウィンドウを更新 Status.DisplayUnitStatus(SelectedUnit); // 使用後イベント Event.HandleEvent("使用後", SelectedUnit.MainPilot().ID, SelectedSpecialPower); if (SRC.IsScenarioFinished) { SRC.IsScenarioFinished = false; } if (SRC.IsCanceled) { SRC.IsCanceled = false; } SelectedSpecialPower = ""; GUI.UnlockGUI(); CommandState = "ユニット選択"; }
protected override int ExecInternal() { // short unum; // short ux, uy; // var uclass = default(string); // string buf, opt = default; // short j, i, num; // int tmp; // int min_value; // short max_item; // int max_value; // int[] lv_list; // string[] list; // short ret; // bool without_refresh; // bool without_animation; var opt = ""; var num = ArgNum; for (var i = 5; i <= num; i++) { switch (GetArgAsString(i) ?? "") { case "密集": opt = opt + " 出撃"; break; case "非同期": opt = opt + " 非同期"; break; case "アニメ非表示": opt = opt + " アニメ非表示"; break; } } if (Strings.InStr(opt, "出撃") <= 0) { opt = opt + " 部隊配置"; } if (num < 4) { throw new EventErrorException(this, "Organizeコマンドの引数の数が違います"); } var unum = GetArgAsLong(2); if (unum < 1) { throw new EventErrorException(this, "ユニット数が不正です"); } var ux = GetArgAsLong(3); if (ux < 1) { ux = 1; } else if (ux > Map.MapWidth) { ux = Map.MapWidth; } var uy = GetArgAsLong(4); if (uy < 1) { uy = 1; } else if (uy > Map.MapHeight) { uy = Map.MapHeight; } var uclass = ""; if (num < 5) { uclass = "全て"; } else { var loopTo1 = num; for (var i = 5; i <= num; i++) { uclass = uclass + " " + GetArgAsString(i); } uclass = Strings.Trim(uclass); } Beginning: ; var units = SRC.UList.Items .Where(u => !(u.Party0 != "味方" || u.Status != "待機" || u.CountPilot() == 0)) // パイロット数のチェック .Where(u => !((u.Data.PilotNum == 1 || Math.Abs(u.Data.PilotNum) == 2) && u.CountPilot() < Math.Abs(u.Data.PilotNum) && !u.IsFeatureAvailable("1人乗り可能"))) .Where(u => { var td = Map.Terrain(1, 1); switch (td.Class) { case "宇宙": case "月面": if (u.get_Adaption(4) == 0) { return(false); } break; default: // 宇宙専用ユニットは宇宙でしか活動できない if (u.Transportation == "宇宙") { return(false); } // 空中マップか? if (td.Name == "空" && Map.Terrain((Map.MapWidth / 2), (Map.MapHeight / 2)).Name == "空" && Map.Terrain(Map.MapWidth, Map.MapHeight).Name == "空") { if (!u.IsTransAvailable("空")) { return(false); } } break; } return(true); }) .Where(u => { switch (uclass) { case "全て": case "": break; // 全てのユニット case "通常ユニット": if (u.IsFeatureAvailable("母艦")) { return(false); } break; case "母艦ユニット": if (!u.IsFeatureAvailable("母艦")) { return(false); } break; case "LL": if (u.Size == "XL") { return(false); } break; case "L": if (u.Size == "XL" || u.Size == "LL") { return(false); } break; case "M": if (u.Size == "XL" || u.Size == "LL" || u.Size == "L") { return(false); } break; case "S": if (u.Size == "XL" || u.Size == "LL" || u.Size == "L" || u.Size == "M") { return(false); } break; case "SS": if (u.Size == "XL" || u.Size == "LL" || u.Size == "L" || u.Size == "M" || u.Size == "S") { return(false); } break; default: // ユニットクラス指定した場合 // 指定されたクラスに該当するか return(GeneralLib.ToL(uclass).Any(x => x == u.Class0)); } return(true); }) .ToList(); if (!units.Any()) { return(EventData.NextID); } // レベルの一覧と最大値・最小値を求める var min_value = units.Min(u => u.MainPilot().Level + u.MainPilot().Exp); var max_value = units.Max(u => u.MainPilot().Level + u.MainPilot().Exp); // レベルにばらつきがある時にのみレベルでソート if (min_value != max_value) { units = units.OrderByDescending(u => u.MainPilot().Level + u.MainPilot().Exp).ToList(); } var list = units .Select(u => { var msg = ""; if (Expression.IsOptionDefined("等身大基準")) { msg = u.Nickname0 + Strings.Space(GeneralLib.MaxLng(52 - Strings.LenB(u.Nickname0), 1)) + GeneralLib.LeftPaddedString("" + u.MainPilot().Level, 2); } else { msg = u.Nickname0 + Strings.Space(GeneralLib.MaxLng(36 - Strings.LenB(u.Nickname0), 1)) + u.MainPilot().get_Nickname(false) + Strings.Space(GeneralLib.MaxLng(17 - Strings.LenB(u.MainPilot().get_Nickname(false)), 1)) + GeneralLib.LeftPaddedString("" + u.MainPilot().Level, 2); } return(new ListBoxItem(msg, u.ID)); }).ToList(); int ret; do { string info; if (Expression.IsOptionDefined("等身大基準")) { info = "ユニット Lv"; } else { info = "ユニット パイロット Lv"; } ret = GUI.MultiSelectListBox(new ListBoxArgs { lb_caption = "出撃ユニット選択", lb_info = info, Items = list, }, unum); if (ret == 0) { Commands.CommandState = "ユニット選択"; GUI.UnlockGUI(); Commands.ViewMode = true; while (Commands.ViewMode) { GUI.Sleep(50); } GUI.LockGUI(); goto Beginning; } }while (ret == 0); if (Strings.InStr(opt, "非同期") > 0) { GUI.Center(ux, uy); GUI.RefreshScreen(); } foreach (var u in list.Where(x => x.ListItemFlag) .Select(x => SRC.UList.Item(x.ListItemID))) { u.UsedAction = 0; u.UsedSupportAttack = 0; u.UsedSupportGuard = 0; u.UsedSyncAttack = 0; u.UsedCounterAttack = 0; u.StandBy(ux, uy, opt); } SRC.UList.CheckAutoHyperMode(); return(EventData.NextID); }
// 「換装」コマンド public void ExchangeFormCommand() { GUI.LockGUI(); var fd = SelectedUnit.Feature("換装"); // 選択可能な換装先のリストを作成 var uList = fd.DataL.Select(x => SelectedUnit.OtherForm(x)) .Where(x => x.IsAvailable()) .Select(u => { // 各形態の表示内容を作成 var msg = ""; msg += (u.Nickname == SelectedUnit.Nickname0) ? GeneralLib.RightPaddedString(u.Name, 27) : GeneralLib.RightPaddedString(u.Nickname0, 27); // ユニットに関する情報 msg += GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MaxHP), 6); msg += GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MaxEN), 5); msg += GeneralLib.LeftPaddedString(SrcFormatter.Format(u.get_Armor("")), 5); msg += GeneralLib.LeftPaddedString(SrcFormatter.Format(u.get_Mobility("")), 5); var weapons = u.Weapons.Where(uw => uw.IsDisplayFor(WeaponListMode.List)).ToList(); // 最大攻撃力 var maxPower = weapons.Max(uw => uw.WeaponPower("")); msg += GeneralLib.LeftPaddedString("" + maxPower, 7); // 最大射程 var maxRange = weapons.Max(uw => uw.WeaponMaxRange()); msg += GeneralLib.LeftPaddedString("" + maxRange, 5); // 換装先が持つ特殊能力一覧 var comment = string.Join(" ", u.Features .Select(fd => fd.FeatureName(u)) .Where(x => !string.IsNullOrEmpty(x)) .Distinct()); return(new ListBoxItem(msg, u.ID) { ListItemComment = comment, }); }) .ToList(); // どの形態に換装するかを選択 GUI.TopItem = 1; var tfRet = GUI.ListBox(new ListBoxArgs { Items = uList, lb_caption = "変更先選択", lb_info = "ユニット " + Expression.Term("HP", null, 4) + " " + Expression.Term("EN", null, 4) + " " + Expression.Term("装甲", null, 4) + " " + Expression.Term("運動", u: null) + " 適応 攻撃力 射程", lb_mode = "連続表示,コメント", }); // キャンセル? if (tfRet == 0) { CancelCommand(); GUI.UnlockGUI(); return; } // 換装を実施 SelectedUnit.Transform(SelectedUnit.OtherForm(uList[tfRet - 1].ListItemID).Name); // ユニットリストの再構築 Event.MakeUnitList(smode: ""); // カーソル自動移動 if (SRC.AutoMoveCursor) { GUI.MoveCursorPos("ユニット選択", SelectedUnit.CurrentForm()); } Status.DisplayUnitStatus(SelectedUnit.CurrentForm()); CommandState = "ユニット選択"; GUI.UnlockGUI(); }
// ユニット一覧の表示 private void UnitListCommand() { GUI.LockGUI(); GUI.TopItem = 1; GUI.EnlargeListBoxHeight(); GUI.ReduceListBoxWidth(); // デフォルトのソート方法 var uparty = "味方"; var sort_mode = "レベル"; var pilot_status_mode = false; Beginning: ; // ユニット一覧のリストを作成 var list = new List <ListBoxItem>(); list.Add(new ListBoxItem("▽陣営変更・並べ替え▽", "▽陣営変更・並べ替え▽")); var units = SRC.UList.Items .Where(u => u.Party0 == uparty && (u.Status == "出撃" || u.Status == "格納")) .Where(u => !(Expression.IsOptionDefined("ユニット情報隠蔽") && !u.IsConditionSatisfied("識別済み") && (u.Party0 == "敵" || u.Party0 == "中立") || u.IsConditionSatisfied("ユニット情報隠蔽"))) .Select(u => { var msg = ""; if (!u.IsFeatureAvailable("ダミーユニット")) { // 通常のユニット表示 if (Expression.IsOptionDefined("等身大基準")) { // 等身大基準を使った場合のユニット表示 msg = GeneralLib.RightPaddedString(u.Nickname0, 33) + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MainPilot().Level), 3) + " "; } else { msg = GeneralLib.RightPaddedString(u.Nickname0, 23); if (u.MainPilot().Nickname0 == "パイロット不在") { // パイロットが乗っていない場合 msg = GeneralLib.RightPaddedString(msg + "", 34) + GeneralLib.LeftPaddedString("", 2); } else { msg = GeneralLib.RightPaddedString(msg + u.MainPilot().get_Nickname(false), 34) + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MainPilot().Level), 2); } msg = GeneralLib.RightPaddedString(msg, 37); } if (u.IsConditionSatisfied("データ不明")) { msg = msg + "?????/????? ???/???"; } else { msg = msg + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.HP), 5) + "/" + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MaxHP), 5) + " " + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.EN), 3) + "/" + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MaxEN), 3); } } else { // パイロットステータス表示時 pilot_status_mode = true; { var p = u.MainPilot(); msg = GeneralLib.RightPaddedString(p.get_Nickname(false), 21) + GeneralLib.LeftPaddedString(SrcFormatter.Format(p.Level), 3) + GeneralLib.LeftPaddedString(SrcFormatter.Format(p.SP) + "/" + SrcFormatter.Format(p.MaxSP), 9); // 使用可能なスペシャルパワー一覧 msg += string.Join("", p.SpecialPowerNames .Where(x => p.SP > p.SpecialPowerCost(x)) .Select(x => SRC.SPDList.Item(x).ShortName)); } } if (u.Action == 0) { msg = msg + "済"; } if (u.Status == "格納") { msg = msg + "格"; } return(new ListBoxItem(msg, u.ID)); }) .ToList(); SortList: ; // ソート if (Strings.InStr(sort_mode, "名称") == 0) { // 数値を使ったソート units = units.OrderByDescending(x => { var u = SRC.UList.Item(x.ListItemID); switch (sort_mode) { case "HP": return(u.MaxHP); case "EN": return(u.MaxEN); case "レベル": case "パイロットレベル": return(u.MainPilot()?.TotalExp ?? 0); default: return(0); } }).ToList(); } else { // 数値以外を使ったソート units = units.OrderBy(x => { var u = SRC.UList.Item(x.ListItemID); switch (sort_mode) { case "名称": case "ユニット名称": return(u.KanaName); case "パイロット名称": return(u.MainPilot()?.KanaName ?? ""); default: return(""); } }).ToList(); } // リストを表示 string caption; string info; if (pilot_status_mode) { caption = uparty + "パイロット一覧"; info = "パイロット名 レベル " + Expression.Term("SP", null, 4) + " " + Expression.Term("スペシャルパワー"); } else if (Expression.IsOptionDefined("等身大基準")) { caption = uparty + "ユニット一覧"; info = "ユニット名 Lv " + Expression.Term("HP", null, 8) + Expression.Term("EN");; } else { caption = uparty + "ユニット一覧"; info = "ユニット パイロット Lv " + Expression.Term("HP", null, 8) + Expression.Term("EN");; } var ret = GUI.ListBox(new ListBoxArgs { HasFlag = true, Items = list.AppendRange(units).ToList(), lb_caption = caption, lb_info = info, lb_mode = "連続表示", }); switch (ret) { case 0: { // キャンセル GUI.CloseListBox(); GUI.ReduceListBoxHeight(); GUI.EnlargeListBoxWidth(); GUI.UnlockGUI(); return; } case 1: { // 表示する陣営 IList <ListBoxItem> sortItems = new List <ListBoxItem> { new ListBoxItem("味方一覧", "味方一覧"), new ListBoxItem("NPC一覧", "NPC一覧"), new ListBoxItem("敵一覧", "敵一覧"), new ListBoxItem("中立一覧", "中立一覧"), }; if (pilot_status_mode) { sortItems = sortItems.AppendRange(new ListBoxItem[] { new ListBoxItem("パイロット名称で並べ替え", "パイロット名称で並べ替え"), new ListBoxItem("レベルで並べ替え", "レベルで並べ替え"), new ListBoxItem(Expression.Term("SP") + "で並べ替え", "SPで並べ替え"), }).ToList(); } else if (Expression.IsOptionDefined("等身大基準")) { sortItems = sortItems.AppendRange(new ListBoxItem[] { new ListBoxItem("名称で並べ替え", "名称で並べ替え"), new ListBoxItem("レベルで並べ替え", "レベルで並べ替え"), new ListBoxItem(Expression.Term("HP") + "で並べ替え", "HPで並べ替え"), new ListBoxItem(Expression.Term("スペシャルパワー") + "で並べ替え", "スペシャルパワーで並べ替え"), }).ToList(); } else { sortItems = sortItems.AppendRange(new ListBoxItem[] { new ListBoxItem(Expression.Term("HP") + "で並べ替え", "HPで並べ替え"), new ListBoxItem(Expression.Term("EN") + "で並べ替え", "ENで並べ替え"), new ListBoxItem(Expression.Term("パイロットレベルで並べ替え"), "パイロットレベルで並べ替え"), new ListBoxItem(Expression.Term("ユニット名称で並べ替え"), "ユニット名称で並べ替え"), new ListBoxItem(Expression.Term("ユニット名称で並べ替え"), "ユニット名称で並べ替え"), }).ToList(); } var sortRes = GUI.ListBox(new ListBoxArgs { HasFlag = false, Items = sortItems, lb_caption = "選択", lb_info = "一覧表示方法", lb_mode = "連続表示", }); // 陣営を変更して再表示 if (sortRes > 0) { var sel = sortItems[sortRes - 1].ListItemID; if (Strings.Right(sel, 2) == "一覧") { uparty = Strings.Left(sel, Strings.Len(sel) - 2); goto Beginning; } else if (Strings.Right(sel, 5) == "で並べ替え") { sort_mode = Strings.Left(sel, Strings.Len(sel) - 5); goto SortList; } } goto SortList; } } GUI.CloseListBox(); GUI.ReduceListBoxHeight(); GUI.EnlargeListBoxWidth(); // 選択されたユニットを画面中央に表示 var uid = units[ret - 2].ListItemID; var u = SRC.UList.Item(uid); GUI.Center(u.x, u.y); GUI.RefreshScreen(); Status.DisplayUnitStatus(u); // カーソル自動移動 if (SRC.AutoMoveCursor) { GUI.MoveCursorPos("ユニット選択", u); } GUI.UnlockGUI(); }
// 「発進」コマンドを開始 private void StartLaunchCommand() { // 母艦に搭載しているユニットの一覧を作成 var list = SelectedUnit.UnitOnBoards.Select(onBoardUnit => { return(new ListBoxItem { Text = GeneralLib.RightPaddedString(onBoardUnit.Nickname0, 25) + GeneralLib.RightPaddedString(onBoardUnit.MainPilot().get_Nickname(false), 17) + GeneralLib.LeftPaddedString(SrcFormatter.Format(onBoardUnit.MainPilot().Level), 2) + GeneralLib.RightPaddedString(SrcFormatter.Format(onBoardUnit.HP) + "/" + SrcFormatter.Format(onBoardUnit.MaxHP), 12) + " " + GeneralLib.RightPaddedString(SrcFormatter.Format(onBoardUnit.EN) + "/" + SrcFormatter.Format(onBoardUnit.MaxEN), 8), ListItemID = onBoardUnit.ID, ListItemFlag = onBoardUnit.Action <= 0, }); }).ToList(); // どのユニットを発進させるか選択 GUI.TopItem = 1; var ret = GUI.ListBox(new ListBoxArgs { HasFlag = true, Items = list, lb_caption = "ユニット選択", lb_info = "ユニット名 パイロット Lv " + Expression.Term("HP", null, 8) + Expression.Term("EN", null), lb_mode = "カーソル移動", }); // キャンセルされた? if (ret == 0) { CancelCommand(); return; } SelectedCommand = "発進"; // ユニットの発進処理 // XXX 発進後の合体がなんか変だった(バウ(MA)) SelectedTarget = SRC.UList.Item(list[ret - 1].ListItemID); { var launchUnit = SelectedTarget; launchUnit.x = SelectedUnit.x; launchUnit.y = SelectedUnit.y; if (launchUnit.IsFeatureAvailable("テレポート") && (launchUnit.Data.Speed == 0 || GeneralLib.LIndex(launchUnit.FeatureData("テレポート"), 2) == "0")) { // テレポートによる発進 Map.AreaInTeleport(SelectedTarget); } else if (launchUnit.IsFeatureAvailable("ジャンプ") && (launchUnit.Data.Speed == 0 || GeneralLib.LLength(launchUnit.FeatureData("ジャンプ")) < 2 || GeneralLib.LIndex(launchUnit.FeatureData("ジャンプ"), 2) == "0")) { // ジャンプによる発進 Map.AreaInSpeed(SelectedTarget, true); } else { // 通常移動による発進 Map.AreaInSpeed(SelectedTarget); } // 母艦を中央表示 GUI.Center(launchUnit.x, launchUnit.y); // TODO 発進させるユニットを母艦の代わりに表示 //// 発進させるユニットを母艦の代わりに表示 //if (launchUnit.BitmapID == 0) //{ // var withBlock3 = SRC.UList.Item(launchUnit.Name); // if ((SelectedTarget.Party0 ?? "") == (withBlock3.Party0 ?? "") && withBlock3.BitmapID != 0 && (SelectedTarget.get_Bitmap(false) ?? "") == (withBlock3.get_Bitmap(false) ?? "")) // { // SelectedTarget.BitmapID = withBlock3.BitmapID; // } // else // { // SelectedTarget.BitmapID = GUI.MakeUnitBitmap(SelectedTarget); // } //} GUI.MaskScreen(); } if (CommandState == "コマンド選択") { CommandState = "ターゲット選択"; } }