Beispiel #1
0
        public static Size DrawEventCategory(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            string text = lb.Items[index].ToString();

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            Font       normalFont = lb.Font;
            Rectangle  bounds     = listbounds;

            int lineHeight = (int)lb.Font.Height;

            string[] sp = text.Split(new string[] { "[", "//" }, StringSplitOptions.None);
            bounds.X += U.DrawText(sp[0], g, normalFont, brush, isWithDraw, bounds);
            for (int i = 1; i < sp.Length - 1; i++)
            {
                bounds.X += U.DrawText("[", g, normalFont, brush, isWithDraw, bounds);

                string nn = sp[i];
                int    p  = nn.IndexOf(':');
                if (p < 0)
                {
                    bounds.X += U.DrawText(nn, g, normalFont, brush, isWithDraw, bounds);
                    continue;
                }

                string item = nn.Substring(0, p);

                Bitmap bitmap = null;
                if (item == "UNIT")
                {
                    bitmap = UnitForm.DrawUnitMapFacePicture(1);
                }
                else if (item == "CLASS")
                {
                    bitmap = ClassForm.DrawWaitIcon(3);
                }
                else if (item == "POINTER_PROCS")
                {
                    bitmap = ImageSystemIconForm.WeaponIcon(4);
                }
                else if (item == "POINTER_ASM")
                {
                    bitmap = ImageSystemIconForm.WeaponIcon(8);
                }
                else if (item == "POINTER_UNIT")
                {
                    bitmap = ClassForm.DrawWaitIcon(7);
                }
                else if (item == "POINTER_EVENT")
                {//サブルーチンは目立つ緑のアイコン
                    bitmap = ImageSystemIconForm.MusicIcon(3);
                }
                else if (item == "MUSIC")
                {
                    bitmap = ImageSystemIconForm.MusicIcon(6);
                }
                else if (item == "SOUND")
                {
                    bitmap = ImageSystemIconForm.MusicIcon(7);
                }
                else if (item == "ITEM")
                {//アイテムアイコン
                    bitmap = ImageSystemIconForm.WeaponIcon(8);
                }
                else if (item == "FLAG")
                {
                    bitmap = ImageSystemIconForm.FlagIcon();
                }
                else if (item == "WMLOCATION")
                {//拠点
                    bitmap = WorldMapImageForm.DrawWorldMapIcon(0xB);
                }
                else if (item == "WMPATH")
                {//道
                    bitmap = WorldMapImageForm.DrawWorldMapIcon(0xB);
                }
                if (bitmap != null)
                {
                    U.MakeTransparent(bitmap);

                    Rectangle b = bounds;
                    b.Width  = lineHeight;
                    b.Height = lineHeight;

                    bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                    bitmap.Dispose();

                    bounds.X += U.DrawText(nn.Substring(p), g, normalFont, brush, isWithDraw, bounds);
                }
                else
                {
                    bounds.X += U.DrawText(nn.Substring(p + 1), g, normalFont, brush, isWithDraw, bounds);
                }
            }

            //コードをコメント形式で描画
            if (sp.Length > 0)
            {
                int        i            = sp.Length - 1;
                SolidBrush commentBrush = new SolidBrush(OptionForm.Color_Comment_ForeColor());
                if (bounds.X < 700)
                {
                    bounds.X = 700;
                }
                bounds.X += U.DrawText("//" + sp[i], g, normalFont, commentBrush, isWithDraw, bounds);
                commentBrush.Dispose();
            }
            brush.Dispose();
            bounds.Y += lineHeight;
            return(new Size(bounds.X, bounds.Y));
        }
Beispiel #2
0
        public Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            SolidBrush brush            = new SolidBrush(lb.ForeColor);
            SolidBrush foreKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor());
            Font       normalFont       = lb.Font;
            Font       boldFont         = new Font(lb.Font, FontStyle.Bold);
            Rectangle  bounds           = listbounds;
            int        lineHeight       = normalFont.Height;

            UseFlagID current = this.FlagList[index];
            string    text;
            int       maxWidth = 0;

            if (index == 0 || current.ID != this.FlagList[index - 1].ID)
            {     //フラグ名を描画
                if (index != 0)
                { //空行を入れる
                    bounds.Y += lineHeight;
                }

                //フラグのアイコンを描画
                Bitmap bitmap = ImageSystemIconForm.FlagIcon();
                U.MakeTransparent(bitmap);

                Rectangle b = bounds;
                b.Width   = lineHeight;
                b.Height  = lineHeight;
                bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                bitmap.Dispose();

                //フラグ名を書く
                string dummy;
                text      = ":";
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                text      = U.ToHexString(current.ID);
                bounds.X += U.DrawText(text, g, boldFont, brush, isWithDraw, bounds);

                text      = "  " + InputFormRef.GetFlagName(current.ID, out dummy);
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                //次の行へ
                maxWidth  = bounds.X;
                bounds.Y += lineHeight;
                bounds.X  = listbounds.X;
            }

            //名称の表示
            bounds.X += 10;
            text      = MainSimpleMenuEventErrorForm.TypeToString(current.DataType, current.Addr, current.Tag);
            bounds.X += U.DrawText(text, g, boldFont, foreKeywordBrush, isWithDraw, bounds);

            //次の行へ
            maxWidth  = Math.Max(bounds.X, maxWidth);
            bounds.Y += lineHeight;
            bounds.X  = listbounds.X;

            //情報を書く.
            bounds.X += 6;
            text      = current.Info;

            Size ss;

            if (current.DataType == FELint.Type.BATTTLE_TALK || current.DataType == FELint.Type.HAIKU)
            {
                ss = DrawUnitAllowToAllow(text, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_ALWAYS)
            {
                ss = EventCondForm.DrawEventListAlwaysOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_OBJECT)
            {
                ss = EventCondForm.DrawEventListObjectOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TALK)
            {
                ss = EventCondForm.DrawEventListTalkOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TURN)
            {
                ss = EventCondForm.DrawEventListTurnOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENTSCRIPT)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(Program.ROM.Data, current.Tag);
                ss = EventScriptForm.DrawCode(lb, g, bounds, isWithDraw, code);
            }
            else
            {
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
                bounds.Y += lineHeight;
                ss        = new Size(bounds.X, bounds.Y);
            }
            bounds.X = ss.Width;
            bounds.Y = ss.Height;

            brush.Dispose();
            foreKeywordBrush.Dispose();

            //最後の改行
            maxWidth = Math.Max(bounds.X, maxWidth);
            return(new Size(maxWidth, bounds.Y));
        }