Esempio n. 1
0
        // 「合体」コマンド
        private void CombineCommand(UiCommand command)
        {
            //// MOD END MARGE
            //int i, j;
            //string[] list;
            //Unit u;

            //// MOD START MARGE
            //// If MainWidth <> 15 Then
            //if (GUI.NewGUIMode)
            //{
            //    // MOD END MARGE
            //    Status.ClearUnitStatus();
            //}

            GUI.LockGUI();
            //list = new string[1];
            //GUI.ListItemFlag = new bool[1];
            var currentUnit = SelectedUnit;

            if (string.IsNullOrEmpty(Map.MapFileName))
            {
                // ユニットステータスコマンドの時
                // パーツ合体ならば……
                if (command.Label == "パーツ合体" && currentUnit.IsFeatureAvailable("パーツ合体"))
                {
                    // パーツ合体を実施
                    currentUnit.Transform(currentUnit.FeatureData("パーツ合体"));
                    Status.DisplayUnitStatus(Map.MapDataForUnit[currentUnit.x, currentUnit.y]);
                    Map.MapDataForUnit[currentUnit.x, currentUnit.y].CheckAutoHyperMode();
                    Map.MapDataForUnit[currentUnit.x, currentUnit.y].CheckAutoNormalMode();

                    // ユニットリストの表示を更新
                    Event.MakeUnitList(smode: "");

                    // コマンドを終了
                    CommandState = "ユニット選択";
                    GUI.UnlockGUI();
                    return;
                }
            }

            // 選択可能な合体パターンのリストを作成
            var combines = currentUnit.CombineFeatures(SRC);
            int i;

            // どの合体を行うかを選択
            if (combines.Count == 1)
            {
                i = 1;
            }
            else
            {
                GUI.TopItem = 1;
                i           = GUI.ListBox(new ListBoxArgs
                {
                    lb_caption = "合体後の形態",
                    lb_info    = "名前",
                    lb_mode    = "",
                    HasFlag    = false,
                    Items      = combines.Select(x => new ListBoxItem
                    {
                        Text = x.CombineName,
                    }).ToList(),
                });
                if (i == 0)
                {
                    CancelCommand();
                    GUI.UnlockGUI();
                    return;
                }
            }
            var combineunitname = combines[i - 1].ConbineUnitName;

            if (Map.IsStatusView)
            {
                // ユニットステータスコマンドの時
                SelectedUnit.Combine(combineunitname, true);

                // ハイパーモード・ノーマルモードの自動発動をチェック
                SRC.UList.CheckAutoHyperMode();
                SRC.UList.CheckAutoNormalMode();

                // ユニットリストの表示を更新
                Event.MakeUnitList(smode: "");

                // コマンドを終了
                CommandState = "ユニット選択";
                GUI.UnlockGUI();
                return;
            }

            // 合体!
            SelectedUnit.Combine(combineunitname);

            // ハイパーモード&ノーマルモードの自動発動
            SRC.UList.CheckAutoHyperMode();
            SRC.UList.CheckAutoNormalMode();

            // 合体後のユニットを選択しておく
            SelectedUnit = Map.MapDataForUnit[SelectedUnit.x, SelectedUnit.y];

            // 行動数消費
            SelectedUnit.UseAction();

            // カーソル自動移動
            if (SRC.AutoMoveCursor)
            {
                GUI.MoveCursorPos("ユニット選択", SelectedUnit);
            }

            Status.DisplayUnitStatus(SelectedUnit);

            // 合体イベント
            Event.HandleEvent("合体", SelectedUnit.MainPilot().ID, SelectedUnit.Name);
            if (SRC.IsScenarioFinished)
            {
                SRC.IsScenarioFinished = false;
                GUI.UnlockGUI();
                return;
            }

            if (SRC.IsCanceled)
            {
                SRC.IsCanceled = false;
                Status.ClearUnitStatus();
                GUI.RedrawScreen();
                CommandState = "ユニット選択";
                GUI.UnlockGUI();
                return;
            }

            // 行動終了
            WaitCommand(true);
        }