Example #1
0
File: ListBox.cs Project: 7474/SRC
        // 項目をダブルクリック
        private void lstItems_DoubleClick(object eventSender, EventArgs eventArgs)
        {
            // 無効なアイテムが選択されている?
            if (lstItems.SelectedIndex < 0)
            {
                return;
            }

            if (Information.UBound(GUI.ListItemFlag) >= lstItems.SelectedIndex + 1)
            {
                if (GUI.ListItemFlag[lstItems.SelectedIndex + 1])
                {
                    return;
                }
            }

            if (LastSelectedItem != 0)
            {
                // 連続で選択
                if (!Visible)
                {
                    return;
                }

                Commands.SelectedItem = (short)(lstItems.SelectedIndex + 1);
                LastSelectedItem      = Commands.SelectedItem;
                GUI.TopItem           = (short)(lstItems.TopIndex + 1);
                if (GUI.IsFormClicked)
                {
                    Hide();
                }

                GUI.IsFormClicked = true;
            }
            else
            {
                // 連続でキャンセル
                Commands.SelectedItem = 0;
                LastSelectedItem      = Commands.SelectedItem;
                GUI.TopItem           = (short)(lstItems.TopIndex + 1);
                if (GUI.IsFormClicked)
                {
                    Hide();
                }

                GUI.IsFormClicked = true;
            }
        }
Example #2
0
        // 指定したレベルで使用可能なスペシャルパワーの個数
        public short CountSpecialPower(short lv)
        {
            short CountSpecialPowerRet = default;
            short i;
            var   loopTo = (short)Information.UBound(SpecialPowerName);

            for (i = 1; i <= loopTo; i++)
            {
                if (SpecialPowerNecessaryLevel[i] <= lv)
                {
                    CountSpecialPowerRet = (short)(CountSpecialPowerRet + 1);
                }
            }

            return(CountSpecialPowerRet);
        }
Example #3
0
        // 指定したレベルでスペシャルパワーsnameを使えるか?
        public bool IsSpecialPowerAvailable(short lv, ref string sname)
        {
            bool  IsSpecialPowerAvailableRet = default;
            short i;
            var   loopTo = (short)Information.UBound(SpecialPowerName);

            for (i = 1; i <= loopTo; i++)
            {
                if ((SpecialPowerName[i] ?? "") == (sname ?? ""))
                {
                    if (SpecialPowerNecessaryLevel[i] <= lv)
                    {
                        IsSpecialPowerAvailableRet = true;
                    }

                    return(IsSpecialPowerAvailableRet);
                }
            }

            IsSpecialPowerAvailableRet = false;
            return(IsSpecialPowerAvailableRet);
        }
Example #4
0
        // 指定したレベルで使用可能なidx番目のスペシャルパワー
        public string SpecialPower(short lv, short idx)
        {
            string SpecialPowerRet = default;
            short  i, n;

            n = 0;
            var loopTo = (short)Information.UBound(SpecialPowerName);

            for (i = 1; i <= loopTo; i++)
            {
                if (SpecialPowerNecessaryLevel[i] <= lv)
                {
                    n = (short)(n + 1);
                    if (idx == n)
                    {
                        SpecialPowerRet = SpecialPowerName[i];
                        return(SpecialPowerRet);
                    }
                }
            }

            return(SpecialPowerRet);
        }
Example #5
0
File: ListBox.cs Project: 7474/SRC
        // 選択されているアイテムに対応するユニットのステータス表示
        private void Timer2_Tick(object eventSender, EventArgs eventArgs)
        {
            Unit u;

            if (!Visible | !GUI.MainForm.Visible)
            {
                return;
            }

            if (lstItems.SelectedIndex == -1)
            {
                return;
            }
            ;
#error Cannot convert OnErrorGoToStatementSyntax - see comment for details

            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 10644
             *
             *
             * Input:
             *
             *      On Error GoTo ErrorHandler
             *
             */
            if (lstItems.SelectedIndex >= Information.UBound(GUI.ListItemID))
            {
                return;
            }

            // 選択されたユニットが存在する?
            bool localIsDefined2()
            {
                var tmp = GUI.ListItemID; object argIndex1 = tmp[lstItems.SelectedIndex + 1]; var ret = SRC.UList.IsDefined2(ref argIndex1); return(ret);
            }

            if (!localIsDefined2())
            {
                return;
            }

            var    tmp       = GUI.ListItemID;
            object argIndex1 = tmp[lstItems.SelectedIndex + 1];
            u = SRC.UList.Item2(ref argIndex1);

            // 選択されたユニットにパイロットが乗っている?
            if (u.CountPilot() == 0)
            {
                return;
            }

            // 既に表示している?
            if (ReferenceEquals(Status.DisplayedUnit, u))
            {
                return;
            }

            // 選択されたユニットをステータスウィンドウに表示
            Status.DisplayUnitStatus(ref u);
ErrorHandler:
            ;
        }
Example #6
0
File: ListBox.cs Project: 7474/SRC
        // リストボックスへのキー入力
        private void frmListBox_KeyDown(object eventSender, KeyEventArgs eventArgs)
        {
            short KeyCode = (short)eventArgs.KeyCode;
            short Shift   = (short)((int)eventArgs.KeyData / 0x10000);

            // 既にウィンドウが隠れている場合は無視
            if (!Visible)
            {
                return;
            }

            switch (KeyCode)
            {
            case (short)Keys.Up:
            {
                break;
            }

            case (short)Keys.Down:
            {
                break;
            }

            case (short)Keys.Left:
            case (short)Keys.Right:
            {
                break;
            }

            case (short)Keys.Escape:
            case (short)Keys.Delete:
            case (short)Keys.Back:
            {
                // キャンセル
                Commands.SelectedItem = 0;
                LastSelectedItem      = Commands.SelectedItem;
                GUI.TopItem           = (short)lstItems.TopIndex;
                if (GUI.IsFormClicked)
                {
                    Hide();
                }

                GUI.IsFormClicked = true;
                break;
            }

            default:
            {
                // 選択
                if (lstItems.SelectedIndex < 0)
                {
                    return;
                }

                if (Information.UBound(GUI.ListItemFlag) >= lstItems.SelectedIndex + 1)
                {
                    if (GUI.ListItemFlag[lstItems.SelectedIndex + 1])
                    {
                        return;
                    }
                }

                Commands.SelectedItem = (short)(lstItems.SelectedIndex + 1);
                LastSelectedItem      = Commands.SelectedItem;
                GUI.TopItem           = (short)(lstItems.TopIndex + 1);
                if (GUI.IsFormClicked)
                {
                    Hide();
                }

                GUI.IsFormClicked = true;
                break;
            }
            }
        }
Example #7
0
        // ユニット u のシチュエーション msg_situation におけるメッセージを選択
        public string SelectMessage(ref string msg_situation, [Optional, DefaultParameterValue(null)] ref Unit u)
        {
            string SelectMessageRet = default;

            string[] situations;
            string[] sub_situations;
            short[]  list0;
            short    list0_num;

            short[] tlist;
            short   tlist_num;

            short[] list;
            short   list_num;
            short   j, i, k;
            bool    found;
            var     t = default(Unit);
            short   w, tw;

            // 配列領域確保
            list0 = new short[301];
            tlist = new short[101];
            list  = new short[201];

            // シチュエーションを設定
            switch (msg_situation ?? "")
            {
            case "格闘":
            case "射撃":
            {
                situations    = new string[3];
                situations[2] = "攻撃";
                break;
            }

            case "格闘(命中)":
            case "射撃(命中)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(命中)";
                break;
            }

            case "格闘(回避)":
            case "射撃(回避)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(回避)";
                break;
            }

            case "格闘(とどめ)":
            case "射撃(とどめ)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(とどめ)";
                break;
            }

            case "格闘(クリティカル)":
            case "射撃(クリティカル)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(クリティカル)";
                break;
            }

            case "格闘(反撃)":
            case "射撃(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(反撃)";
                break;
            }

            case "格闘(命中)(反撃)":
            case "射撃(命中)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(命中)(反撃)";
                break;
            }

            case "格闘(回避)(反撃)":
            case "射撃(回避)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(回避)(反撃)";
                break;
            }

            case "格闘(とどめ)(反撃)":
            case "射撃(とどめ)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(とどめ)(反撃)";
                break;
            }

            case "格闘(クリティカル)(反撃)":
            case "射撃(クリティカル)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(クリティカル)(反撃)";
                break;
            }

            default:
            {
                situations = new string[2];
                break;
            }
            }

            situations[1] = msg_situation;

            // メッセージの候補リスト第一次審査
            list0_num = 0;
            var loopTo = intMessageNum;

            for (i = 1; i <= loopTo; i++)
            {
                var loopTo1 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo1; j++)
                {
                    if ((Strings.Left(strSituation[i], Strings.Len(situations[j])) ?? "") == (situations[j] ?? ""))
                    {
                        list0_num = (short)(list0_num + 1);
                        if (list0_num > Information.UBound(list0))
                        {
                            Array.Resize(ref list0, list0_num + 1);
                        }

                        list0[list0_num] = i;
                        break;
                    }
                }
            }

            if (list0_num == 0)
            {
                return(SelectMessageRet);
            }

            // 最初に相手限定のシチュエーションのみで検索
            if (u is null)
            {
                goto SkipMessagesWithTarget;
            }

            if (ReferenceEquals(u, Commands.SelectedUnit))
            {
                t = Commands.SelectedTarget;
            }
            else if (ReferenceEquals(u, Commands.SelectedTarget))
            {
                t = Commands.SelectedUnit;
            }

            if (t is null)
            {
                goto SkipMessagesWithTarget;
            }

            // 相手限定メッセージのリストを作成
            tlist_num = 0;
            var loopTo2 = list0_num;

            for (i = 1; i <= loopTo2; i++)
            {
                if (Strings.InStr(strSituation[list0[i]], "(対") > 0)
                {
                    tlist_num = (short)(tlist_num + 1);
                    if (tlist_num > Information.UBound(tlist))
                    {
                        Array.Resize(ref tlist, tlist_num + 1);
                    }

                    tlist[tlist_num] = list0[i];
                }
            }

            if (tlist_num == 0)
            {
                // 相手限定メッセージがない
                goto SkipMessagesWithTarget;
            }

            // 自分自身にアビリティを使う場合は必ず「(対自分)」を優先
            if (ReferenceEquals(t, u))
            {
                list_num = 0;
                var loopTo3 = tlist_num;
                for (i = 1; i <= loopTo3; i++)
                {
                    var loopTo4 = (short)Information.UBound(situations);
                    for (j = 1; j <= loopTo4; j++)
                    {
                        if ((strSituation[tlist[i]] ?? "") == (situations[j] + "(対自分)" ?? ""))
                        {
                            list_num = (short)(list_num + 1);
                            if (list_num > Information.UBound(list))
                            {
                                Array.Resize(ref list, list_num + 1);
                            }

                            list[list_num] = tlist[i];
                            break;
                        }
                    }
                }

                if (list_num > 0)
                {
                    SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
                    return(SelectMessageRet);
                }
            }

            string wclass, ch;

            {
                var withBlock = t;
                if (withBlock.Status != "出撃")
                {
                    goto SkipMessagesWithTarget;
                }

                sub_situations = new string[9];
                // 対パイロット名称
                sub_situations[1] = "(対" + withBlock.MainPilot().Name + ")";
                // 対パイロット愛称
                sub_situations[2] = "(対" + withBlock.MainPilot().get_Nickname(false) + ")";
                // 対ユニット名称
                sub_situations[3] = "(対" + withBlock.Name + ")";
                // 対ユニット愛称
                sub_situations[4] = "(対" + withBlock.Nickname + ")";
                // 対ユニットクラス
                sub_situations[5] = "(対" + withBlock.Class0 + ")";
                // 対ユニットサイズ
                sub_situations[6] = "(対" + withBlock.Size + ")";
                // 対地形名
                sub_situations[7] = "(対" + Map.TerrainName(withBlock.x, withBlock.y) + ")";
                // 対エリア
                sub_situations[8] = "(対" + withBlock.Area + ")";

                // 対メッセージクラス
                string argfname = "メッセージクラス";
                if (withBlock.IsFeatureAvailable(ref argfname))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    object argIndex1 = "メッセージクラス";
                    sub_situations[Information.UBound(sub_situations)] = "(対" + withBlock.FeatureData(ref argIndex1) + ")";
                }

                // 対性別
                switch (withBlock.MainPilot().Sex ?? "")
                {
                case "男性":
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対男性)";
                    break;
                }

                case "女性":
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対女性)";
                    break;
                }
                }

                // 対特殊能力
                {
                    var withBlock1 = withBlock.MainPilot();
                    var loopTo5    = withBlock1.CountSkill();
                    for (i = 1; i <= loopTo5; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        string localSkillName0()
                        {
                            object argIndex1 = i; var ret = withBlock1.SkillName0(ref argIndex1); return(ret);
                        }

                        sub_situations[Information.UBound(sub_situations)] = "(対" + localSkillName0() + ")";
                        if (sub_situations[Information.UBound(sub_situations)] == "(対非表示)")
                        {
                            string localSkill()
                            {
                                object argIndex1 = i; var ret = withBlock1.Skill(ref argIndex1); return(ret);
                            }

                            sub_situations[Information.UBound(sub_situations)] = "(対" + localSkill() + ")";
                        }
                    }
                }

                var loopTo6 = withBlock.CountFeature();
                for (i = 1; i <= loopTo6; i++)
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    string localFeatureName0()
                    {
                        object argIndex1 = i; var ret = withBlock.FeatureName0(ref argIndex1); return(ret);
                    }

                    sub_situations[Information.UBound(sub_situations)] = "(対" + localFeatureName0() + ")";
                    if (sub_situations[Information.UBound(sub_situations)] == "(対)")
                    {
                        string localFeature()
                        {
                            object argIndex1 = i; var ret = withBlock.Feature(ref argIndex1); return(ret);
                        }

                        sub_situations[Information.UBound(sub_situations)] = "(対" + localFeature() + ")";
                    }
                }

                // 対弱点
                if (Strings.Len(withBlock.strWeakness) > 0)
                {
                    var loopTo7 = (short)Strings.Len(withBlock.strWeakness);
                    for (i = 1; i <= loopTo7; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対弱点=" + GeneralLib.GetClassBundle(ref withBlock.strWeakness, ref i) + ")";
                    }
                }

                // 対有効
                if (Strings.Len(withBlock.strEffective) > 0)
                {
                    var loopTo8 = (short)Strings.Len(withBlock.strEffective);
                    for (i = 1; i <= loopTo8; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対有効=" + GeneralLib.GetClassBundle(ref withBlock.strEffective, ref i) + ")";
                    }
                }

                // 対ザコ
                if (Strings.InStr(withBlock.MainPilot().Name, "(ザコ)") > 0 & (u.MainPilot().Technique > withBlock.MainPilot().Technique | u.HP > withBlock.HP / 2))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対ザコ)";
                }

                // 対強敵
                if (withBlock.BossRank >= 0 | Strings.InStr(withBlock.MainPilot().Name, "(ザコ)") == 0 & u.MainPilot().Technique <= withBlock.MainPilot().Technique)
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対強敵)";
                }

                // 自分が使用する武器をチェック
                w = 0;
                if (ReferenceEquals(Commands.SelectedUnit, u))
                {
                    if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= u.CountWeapon())
                    {
                        w = Commands.SelectedWeapon;
                    }
                }
                else if (ReferenceEquals(Commands.SelectedTarget, u))
                {
                    if (0 < Commands.SelectedTWeapon & Commands.SelectedTWeapon <= u.CountWeapon())
                    {
                        w = Commands.SelectedTWeapon;
                    }
                }

                if (w > 0)
                {
                    // 対瀕死
                    if (withBlock.HP <= u.Damage(w, ref t, u.Party == "味方"))
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対瀕死)";
                    }

                    switch (u.HitProbability(w, ref t, u.Party == "味方"))
                    {
                    case var @case when @case < 50:
                    {
                        // 対高回避率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対高回避率)";
                        break;
                    }

                    case var case1 when case1 >= 100:
                    {
                        // 対低回避率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対低回避率)";
                        break;
                    }
                    }
                }

                // 相手が使用する武器をチェック
                tw = 0;
                if (ReferenceEquals(Commands.SelectedUnit, t))
                {
                    if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= withBlock.CountWeapon())
                    {
                        tw = Commands.SelectedWeapon;
                    }
                }
                else if (ReferenceEquals(Commands.SelectedTarget, t))
                {
                    if (0 < Commands.SelectedTWeapon & Commands.SelectedTWeapon <= withBlock.CountWeapon())
                    {
                        tw = Commands.SelectedTWeapon;
                    }
                }

                if (tw > 0)
                {
                    // 対武器名
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対" + withBlock.Weapon(tw).Name + ")";

                    // 対武器属性
                    wclass = withBlock.WeaponClass(tw);
                    var loopTo9 = (short)Strings.Len(wclass);
                    for (i = 1; i <= loopTo9; i++)
                    {
                        ch = GeneralLib.GetClassBundle(ref wclass, ref i);
                        switch (ch ?? "")
                        {
                        case var case2 when 0.ToString() <= case2 && case2 <= 127.ToString():
                        {
                            break;
                        }

                        default:
                        {
                            Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                            sub_situations[Information.UBound(sub_situations)] = "(対" + ch + "属性)";
                            break;
                        }
                        }
                    }

                    switch (withBlock.HitProbability(tw, ref u, withBlock.Party == "味方"))
                    {
                    case var case3 when case3 > 75:
                    {
                        // 対高命中率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対高命中率)";
                        break;
                    }

                    case var case4 when case4 < 25:
                    {
                        // 対低命中率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対低命中率)";
                        break;
                    }
                    }
                }
            }

            // 定義されている相手限定メッセージのうち、状況に合ったメッセージを抜き出す
            list_num = 0;
            var loopTo10 = tlist_num;

            for (i = 1; i <= loopTo10; i++)
            {
                found = false;
                var loopTo11 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo11; j++)
                {
                    var loopTo12 = (short)Information.UBound(sub_situations);
                    for (k = 1; k <= loopTo12; k++)
                    {
                        if ((strSituation[tlist[i]] ?? "") == (situations[j] + sub_situations[k] ?? ""))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }

                if (found)
                {
                    list_num = (short)(list_num + 1);
                    if (list_num > Information.UBound(list))
                    {
                        Array.Resize(ref list, list_num + 1);
                    }

                    list[list_num] = tlist[i];
                }
            }

            // 状況に合った相手限定メッセージが一つでもあれば、その中からメッセージを選択
            if (list_num > 0)
            {
                SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
                if (GeneralLib.Dice(2) == 1 | Strings.InStr(msg_situation, "(とどめ)") > 0 | msg_situation == "挑発" | msg_situation == "脱力" | msg_situation == "魅惑" | msg_situation == "威圧" | (u.Party ?? "") == (t.Party ?? ""))
                {
                    return(SelectMessageRet);
                }
            }

SkipMessagesWithTarget:
            ;


            // 次にサブシチュエーションなしとユニット限定のサブシチュエーションで検索
            if (u is object)
            {
                sub_situations    = new string[4];
                sub_situations[1] = "(" + u.Name + ")";
                sub_situations[2] = "(" + u.Nickname0 + ")";
                sub_situations[3] = "(" + u.Class0 + ")";
                switch (msg_situation ?? "")
                {
                case "格闘":
                case "射撃":
                case "格闘(反撃)":
                case "射撃(反撃)":
                {
                    if (ReferenceEquals(Commands.SelectedUnit, u))
                    {
                        // 自分が使用する武器をチェック
                        if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= u.CountWeapon())
                        {
                            Array.Resize(ref sub_situations, 5);
                            sub_situations[4] = "(" + u.WeaponNickname(Commands.SelectedWeapon) + ")";
                        }
                    }

                    break;
                }
                }

                string argfname1 = "メッセージクラス";
                if (u.IsFeatureAvailable(ref argfname1))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    object argIndex2 = "メッセージクラス";
                    sub_situations[Information.UBound(sub_situations)] = "(" + u.FeatureData(ref argIndex2) + ")";
                }
            }
            else
            {
                sub_situations = new string[1];
            }

            // 上で見つかったメッセージリストの中からシチュエーションに合ったメッセージを抜き出す
            list_num = 0;
            var loopTo13 = list0_num;

            for (i = 1; i <= loopTo13; i++)
            {
                found = false;
                var loopTo14 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo14; j++)
                {
                    if ((strSituation[list0[i]] ?? "") == (situations[j] ?? ""))
                    {
                        found = true;
                        break;
                    }

                    var loopTo15 = (short)Information.UBound(sub_situations);
                    for (k = 1; k <= loopTo15; k++)
                    {
                        if ((strSituation[list0[i]] ?? "") == (situations[j] + sub_situations[k] ?? ""))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }

                if (found)
                {
                    list_num = (short)(list_num + 1);
                    if (list_num > Information.UBound(list))
                    {
                        Array.Resize(ref list, list_num + 1);
                    }

                    list[list_num] = list0[i];
                }
            }

            // シチュエーションに合ったメッセージが見つかれば、その中からメッセージを選択
            if (list_num > 0)
            {
                SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
            }

            return(SelectMessageRet);
        }
Example #8
0
        // 「~順」ボタンをクリック
        private void cmdSort_Click(object eventSender, EventArgs eventArgs)
        {
            string[] item_list;
            int[]    key_list;
            string[] strkey_list;
            short    max_item;
            int      max_value;
            string   max_str;
            short    i, j;
            string   buf;
            bool     flag;

            // 現在のリスト表示内容をコピー
            {
                var withBlock = lstItems;
                item_list = new string[withBlock.Items.Count + 1];
                var loopTo = (short)withBlock.Items.Count;
                for (i = 1; i <= loopTo; i++)
                {
                    item_list[i] = Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemString(lstItems, i - 1);
                }
            }

            if (cmdSort.Text == "レベル順に並べ替え")
            {
                // メインパイロットのレベル順に並べ替え
                key_list = new int[Information.UBound(item_list) + 1];
                {
                    var withBlock1 = SRC.UList;
                    var loopTo1    = (short)Information.UBound(item_list);
                    for (i = 1; i <= loopTo1; i++)
                    {
                        Unit localItem()
                        {
                            var tmp = GUI.ListItemID; object argIndex1 = tmp[i]; var ret = withBlock1.Item(ref argIndex1); return(ret);
                        }

                        {
                            var withBlock2 = localItem().MainPilot();
                            key_list[i] = 500 * withBlock2.Level + withBlock2.Exp;
                        }
                    }
                }

                var loopTo2 = (short)(Information.UBound(item_list) - 1);
                for (i = 1; i <= loopTo2; i++)
                {
                    max_item  = i;
                    max_value = key_list[i];
                    var loopTo3 = (short)Information.UBound(item_list);
                    for (j = (short)(i + 1); j <= loopTo3; j++)
                    {
                        if (key_list[j] > max_value)
                        {
                            max_item  = j;
                            max_value = key_list[j];
                        }
                    }

                    if (max_item != i)
                    {
                        buf                      = item_list[i];
                        item_list[i]             = item_list[max_item];
                        item_list[max_item]      = buf;
                        buf                      = GUI.ListItemID[i];
                        GUI.ListItemID[i]        = GUI.ListItemID[max_item];
                        GUI.ListItemID[max_item] = buf;
                        flag                     = ItemFlag[i - 1];
                        ItemFlag[i - 1]          = ItemFlag[max_item - 1];
                        ItemFlag[max_item - 1]   = flag;
                        key_list[max_item]       = key_list[i];
                    }
                }
                // 並べ替え方法をトグルで切り替え
                cmdSort.Text = "名称順に並べ替え";
            }
            else
            {
                // ユニットの名称順に並べ替え
                strkey_list = new string[Information.UBound(item_list) + 1];
                {
                    var withBlock3 = SRC.UList;
                    var loopTo4    = (short)Information.UBound(item_list);
                    for (i = 1; i <= loopTo4; i++)
                    {
                        Unit localItem1()
                        {
                            var tmp = GUI.ListItemID; object argIndex1 = tmp[i]; var ret = withBlock3.Item(ref argIndex1); return(ret);
                        }

                        strkey_list[i] = localItem1().KanaName;
                    }
                }

                var loopTo5 = (short)(Information.UBound(item_list) - 1);
                for (i = 1; i <= loopTo5; i++)
                {
                    max_item = i;
                    max_str  = strkey_list[i];
                    var loopTo6 = (short)Information.UBound(item_list);
                    for (j = (short)(i + 1); j <= loopTo6; 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                      = item_list[i];
                        item_list[i]             = item_list[max_item];
                        item_list[max_item]      = buf;
                        buf                      = GUI.ListItemID[i];
                        GUI.ListItemID[i]        = GUI.ListItemID[max_item];
                        GUI.ListItemID[max_item] = buf;
                        flag                     = ItemFlag[i - 1];
                        ItemFlag[i - 1]          = ItemFlag[max_item - 1];
                        ItemFlag[max_item - 1]   = flag;
                        strkey_list[max_item]    = strkey_list[i];
                    }
                }
                // 並べ替え方法をトグルで切り替え
                cmdSort.Text = "レベル順に並べ替え";
            }

            // リスト表示を更新する
            {
                var withBlock4 = lstItems;
                withBlock4.Visible = false;
                var loopTo7 = (short)withBlock4.Items.Count;
                for (i = 1; i <= loopTo7; i++)
                {
                    Microsoft.VisualBasic.Compatibility.VB6.Support.SetItemString(lstItems, i - 1, item_list[i]);
                }
                withBlock4.TopIndex = 0;
                withBlock4.Visible  = true;
            }
        }
Example #9
0
File: Main.cs Project: 7474/SRC
        // マップ画面上でマウスカーソルを移動
        private void picMain_MouseMove(object eventSender, MouseEventArgs eventArgs)
        {
            short Button = (short)((int)eventArgs.Button / 0x100000);
            short Shift  = (short)((int)ModifierKeys / 0x10000);
            float X      = (float)Microsoft.VisualBasic.Compatibility.VB6.Support.PixelsToTwipsX(eventArgs.X);
            float Y      = (float)Microsoft.VisualBasic.Compatibility.VB6.Support.PixelsToTwipsY(eventArgs.Y);
            short Index  = picMain.GetIndex((Panel)eventSender);

            ;
#error Cannot convert LocalDeclarationStatementSyntax - see comment for details

            /* Cannot convert LocalDeclarationStatementSyntax, System.NotSupportedException: StaticKeyword not supported!
             * 場所 ICSharpCode.CodeConverter.CSharp.SyntaxKindExtensions.ConvertToken(SyntaxKind t, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifier(SyntaxToken m, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.<ConvertModifiersCore>d__43.MoveNext()
             * 場所 System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
             * 場所 System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
             * 場所 System.Linq.Buffer`1..ctor(IEnumerable`1 source)
             * 場所 System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
             * 場所 Microsoft.CodeAnalysis.SyntaxTokenList.CreateNode(IEnumerable`1 tokens)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifiers(SyntaxNode node, IReadOnlyCollection`1 modifiers, TokenContext context, Boolean isVariableOrConst, SyntaxKind[] extraCsModifierKinds)
             * 場所 ICSharpCode.CodeConverter.CSharp.MethodBodyExecutableStatementVisitor.<VisitLocalDeclarationStatement>d__31.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.HoistedNodeStateVisitor.<AddLocalVariablesAsync>d__6.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.<DefaultVisitInnerAsync>d__3.MoveNext()
             *
             * Input:
             *      Static LastMouseX, LastMouseY As Short
             *
             */
            ;
#error Cannot convert LocalDeclarationStatementSyntax - see comment for details

            /* Cannot convert LocalDeclarationStatementSyntax, System.NotSupportedException: StaticKeyword not supported!
             * 場所 ICSharpCode.CodeConverter.CSharp.SyntaxKindExtensions.ConvertToken(SyntaxKind t, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifier(SyntaxToken m, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.<ConvertModifiersCore>d__43.MoveNext()
             * 場所 System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
             * 場所 System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
             * 場所 System.Linq.Buffer`1..ctor(IEnumerable`1 source)
             * 場所 System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
             * 場所 Microsoft.CodeAnalysis.SyntaxTokenList.CreateNode(IEnumerable`1 tokens)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifiers(SyntaxNode node, IReadOnlyCollection`1 modifiers, TokenContext context, Boolean isVariableOrConst, SyntaxKind[] extraCsModifierKinds)
             * 場所 ICSharpCode.CodeConverter.CSharp.MethodBodyExecutableStatementVisitor.<VisitLocalDeclarationStatement>d__31.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.HoistedNodeStateVisitor.<AddLocalVariablesAsync>d__6.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.<DefaultVisitInnerAsync>d__3.MoveNext()
             *
             * Input:
             *      Static LastMapX, LastMapY As Short
             *
             */
            ;
#error Cannot convert LocalDeclarationStatementSyntax - see comment for details

            /* Cannot convert LocalDeclarationStatementSyntax, System.NotSupportedException: StaticKeyword not supported!
             * 場所 ICSharpCode.CodeConverter.CSharp.SyntaxKindExtensions.ConvertToken(SyntaxKind t, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifier(SyntaxToken m, TokenContext context)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.<ConvertModifiersCore>d__43.MoveNext()
             * 場所 System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
             * 場所 System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
             * 場所 System.Linq.Buffer`1..ctor(IEnumerable`1 source)
             * 場所 System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
             * 場所 Microsoft.CodeAnalysis.SyntaxTokenList.CreateNode(IEnumerable`1 tokens)
             * 場所 ICSharpCode.CodeConverter.CSharp.CommonConversions.ConvertModifiers(SyntaxNode node, IReadOnlyCollection`1 modifiers, TokenContext context, Boolean isVariableOrConst, SyntaxKind[] extraCsModifierKinds)
             * 場所 ICSharpCode.CodeConverter.CSharp.MethodBodyExecutableStatementVisitor.<VisitLocalDeclarationStatement>d__31.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.HoistedNodeStateVisitor.<AddLocalVariablesAsync>d__6.MoveNext()
             * --- 直前に例外がスローされた場所からのスタック トレースの終わり ---
             * 場所 ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.<DefaultVisitInnerAsync>d__3.MoveNext()
             *
             * Input:
             *      Static LastHostSpot As String
             *
             */
            short xx, yy;
            short i;

            // 前回のマウス位置を記録
            LastMouseX = (short)GUI.MouseX;
            LastMouseY = (short)GUI.MouseY;

            // 現在のマウス位置を記録
            GUI.MouseX = X;
            GUI.MouseY = Y;

            // GUIロック中?
            if (GUI.IsGUILocked)
            {
                if (!Commands.WaitClickMode)
                {
                    return;
                }

                // ホットポイントが定義されている場合はツールチップを変更
                var loopTo = (short)Information.UBound(Event_Renamed.HotPointList);
                for (i = 1; i <= loopTo; i++)
                {
                    {
                        var withBlock = Event_Renamed.HotPointList[i];
                        if (withBlock.Left_Renamed <= GUI.MouseX & GUI.MouseX < withBlock.Left_Renamed + withBlock.width & withBlock.Top <= GUI.MouseY & GUI.MouseY < withBlock.Top + withBlock.Height)
                        {
                            if (withBlock.Caption == "非表示" | string.IsNullOrEmpty(withBlock.Caption))
                            {
                                break;
                            }

                            if ((withBlock.Name ?? "") != (LastHostSpot ?? "") & !string.IsNullOrEmpty(LastHostSpot))
                            {
                                break;
                            }

                            // ツールチップの表示
                            My.MyProject.Forms.frmToolTip.ShowToolTip(ref withBlock.Caption);
                            {
                                var withBlock1 = picMain[0];
                                // UPGRADE_ISSUE:  プロパティ . はカスタム マウスポインタをサポートしません。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="45116EAB-7060-405E-8ABE-9DBB40DC2E86"' をクリックしてください。
                                if (!withBlock1.Cursor.Equals(99))
                                {
                                    withBlock1.Refresh();
                                    // UPGRADE_ISSUE: PictureBox プロパティ picMain.MousePointer はカスタム マウスポインタをサポートしません。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="45116EAB-7060-405E-8ABE-9DBB40DC2E86"' をクリックしてください。
                                    withBlock1.Cursor = vbCustom;
                                }
                            }

                            LastHostSpot = withBlock.Name;
                            return;
                        }
                    }
                }

                // ホットポイント上にカーソルがなければツールチップを消す
                My.MyProject.Forms.frmToolTip.Hide();
                LastHostSpot      = "";
                picMain[0].Cursor = Cursors.Default;
                return;
            }

            // マップが設定されていない場合はこれ以降の判定は不要
            if (Map.MapWidth < 15 | Map.MapHeight < 15)
            {
                return;
            }

            // カーソル上にユニットがいればステータスウィンドウにそのユニットを表示
            xx = GUI.PixelToMapX((short)X);
            yy = GUI.PixelToMapY((short)Y);
            // MOD START 240a
            // If MainWidth = 15 Then
            if (!GUI.NewGUIMode)
            {
                // MOD  END
                if (1 <= xx & xx <= Map.MapWidth & 1 <= yy & yy <= Map.MapHeight)
                {
                    // MOD START 240a
                    // If Not MapDataForUnit(xx, yy) Is Nothing Then
                    // InstantUnitStatusDisplay xx, yy
                    // End If
                    if (Map.MapDataForUnit[xx, yy] is null)
                    {
                        if (!string.IsNullOrEmpty(Map.MapFileName))
                        {
                            // ユニットがいない、かつステータス表示でなければ地形情報を表示
                            Status.DisplayGlobalStatus();
                        }
                    }
                    else
                    {
                        Status.InstantUnitStatusDisplay(xx, yy);
                    }
                }
                // MOD  END
                // ADD START 240a
                else
                {
                    // マップ外にカーソルがある場合
                    Status.DisplayGlobalStatus();
                    // ADD  END
                }
            }
            // ADD ユニット選択追加・移動時も表示 240a
            // If (CommandState = "ターゲット選択" Or CommandState = "移動後ターゲット選択") _
            // '            And (SelectedCommand <> "移動" _
            // '                And SelectedCommand <> "テレポート" _
            // '                And SelectedCommand <> "ジャンプ") _
            // '        Then
            else if (Commands.CommandState == "ターゲット選択" | Commands.CommandState == "移動後ターゲット選択" | Commands.CommandState == "ユニット選択")
            {
                if (1 <= xx & xx <= Map.MapWidth & 1 <= yy & yy <= Map.MapHeight)
                {
                    if (Map.MapDataForUnit[xx, yy] is object)
                    {
                        picMain[0].Refresh();
                        // RedrawScreen
                        Status.InstantUnitStatusDisplay(xx, yy);
                    }
                    // ADD Else
                    else
                    {
                        Status.ClearUnitStatus();
                    }
                }
            }
            else if (GUI.MouseX != (float)LastMouseX | GUI.MouseY != (float)LastMouseY)
            {
                Status.ClearUnitStatus();
            }

            // マップをドラッグ中?
            if (IsDragging & Button == 1)
            {
                // X軸の移動量を算出
                GUI.MapX = (short)(GUI.PrevMapX - (long)(X - GUI.PrevMouseX) / 32L);
                if (GUI.MapX < 1)
                {
                    GUI.MapX = 1;
                }
                else if (GUI.MapX > HScroll_Renamed.Maximum - HScroll_Renamed.LargeChange + 1)
                {
                    GUI.MapX = (short)(HScroll_Renamed.Maximum - HScroll_Renamed.LargeChange + 1);
                }

                // Y軸の移動量を算出
                GUI.MapY = (short)(GUI.PrevMapY - (long)(Y - GUI.PrevMouseY) / 32L);
                if (GUI.MapY < 1)
                {
                    GUI.MapY = 1;
                }
                else if (GUI.MapY > VScroll_Renamed.Maximum - VScroll_Renamed.LargeChange + 1)
                {
                    GUI.MapY = (short)(VScroll_Renamed.Maximum - VScroll_Renamed.LargeChange + 1);
                }

                if (string.IsNullOrEmpty(Map.MapFileName))
                {
                    // ステータス画面の場合は移動量を限定
                    GUI.MapX = 8;
                    if (GUI.MapY < 8)
                    {
                        GUI.MapY = 8;
                    }
                    else if (GUI.MapY > Map.MapHeight - 7)
                    {
                        GUI.MapY = (short)(Map.MapHeight - 7);
                    }
                }

                // マップ画面を新しい座標で更新
                if (!(GUI.MapX == LastMapX) | !(GUI.MapY == LastMapY))
                {
                    GUI.RefreshScreen();
                }
            }
        }