dtxmania 中文
Revision | 98dab2982370a27e853abcf936fdec728371e2f5 (tree) |
---|---|
Zeit | 2020-01-08 02:30:42 |
Autor | yyagi <yyagi.dtxmania@gmai...> |
Commiter | yyagi |
@@ -61,11 +61,30 @@ namespace DTXMania | ||
61 | 61 | this.prvFont = new CPrivateFastFont(CSkin.Path(path), (int)(18 * Scale.Y)); |
62 | 62 | //prvFont = new CPrivateFastFont(CSkin.Path(@"Graphics\fonts\mplus-1p-heavy.ttf"), (int)(18 * Scale.Y)); |
63 | 63 | |
64 | - stqMenuTitle = new stQuickMenuItem(); | |
64 | + | |
65 | + //stqMenuTitle = new stQuickMenuItem(); | |
66 | + //stqMenuTitleはprivate変数として宣言済みのため、stqMenuItemgはnewする必要なし。 | |
67 | + //newすると、QuickConfigでDrums/Guitar/Bassを切り替えるたびにstqMenuTitleが | |
68 | + //別の変数として再初期化され、付随していたstqMenuTitle.txNameのテクスチャがDispose漏れとして検出されてしまう | |
69 | + //(切り替えのたびにInitialize()を呼び出す設計の問題でもあるが) | |
70 | + | |
65 | 71 | stqMenuTitle.cItem = new COptionString(title); |
66 | 72 | stqMenuTitle.cItem.label = title; |
67 | 73 | //stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(title, Color.White, Color.Black), false); |
68 | 74 | //stqMenuTitle.rectName = prvFont.RectStrings; |
75 | + | |
76 | + // lciMenuItemsもstqMenuTitleと同様に、newの実行前に、既に紐づいているCTextureを解放しておく | |
77 | + if (lciMenuItems != null) | |
78 | + | |
79 | + { | |
80 | + for (int i = 0; i < lciMenuItems.Length; i++) | |
81 | + { | |
82 | + if (lciMenuItems[i].txName != null) | |
83 | + { | |
84 | + TextureFactory.tテクスチャの解放(ref lciMenuItems[i].txName); | |
85 | + } | |
86 | + } | |
87 | + } | |
69 | 88 | lciMenuItems = new stQuickMenuItem[menulist.Count]; |
70 | 89 | for (int i = 0; i < menulist.Count; i++) |
71 | 90 | { |
@@ -79,6 +98,8 @@ namespace DTXMania | ||
79 | 98 | |
80 | 99 | bShowAllItems = showAllItems; |
81 | 100 | n現在の選択行 = defaultPos; |
101 | + | |
102 | + this.OnManagedリソースの作成(); | |
82 | 103 | } |
83 | 104 | |
84 | 105 |
@@ -200,21 +221,35 @@ namespace DTXMania | ||
200 | 221 | string pathPopupMenuBackground = CSkin.Path(@"Graphics\ScreenSelect sort menu background.png"); |
201 | 222 | if (File.Exists(pathCursor)) |
202 | 223 | { |
203 | - this.txCursor = TextureFactory.tテクスチャの生成(pathCursor, false); | |
224 | + if (this.txCursor != null) | |
225 | + { | |
226 | + TextureFactory.tテクスチャの解放(ref this.txCursor); | |
227 | + } | |
228 | + this.txCursor = TextureFactory.tテクスチャの生成(pathCursor, false, "txCursor"); | |
204 | 229 | } |
205 | 230 | if (File.Exists(pathPopupMenuBackground)) |
206 | 231 | { |
207 | - this.txPopupMenuBackground = TextureFactory.tテクスチャの生成(pathPopupMenuBackground, false); | |
232 | + if (this.txPopupMenuBackground != null) | |
233 | + { | |
234 | + TextureFactory.tテクスチャの解放(ref this.txPopupMenuBackground); | |
235 | + } | |
236 | + this.txPopupMenuBackground = TextureFactory.tテクスチャの生成(pathPopupMenuBackground, false, "txPopupMenuBackground"); | |
208 | 237 | } |
209 | 238 | |
210 | - if (stqMenuTitle.txName == null) | |
239 | + if (this.stqMenuTitle.txName != null) | |
211 | 240 | { |
212 | - stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(stqMenuTitle.cItem.label, Color.White, Color.Black), false); | |
213 | - stqMenuTitle.rectName = prvFont.RectStrings; | |
241 | + TextureFactory.tテクスチャの解放(ref this.stqMenuTitle.txName); | |
214 | 242 | } |
243 | + stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(stqMenuTitle.cItem.label, Color.White, Color.Black), false, "stqMenuTitle.txName"); | |
244 | + stqMenuTitle.rectName = prvFont.RectStrings; | |
245 | + | |
215 | 246 | for (int i = 0; i < lciMenuItems.Length; i++) |
216 | 247 | { |
217 | - lciMenuItems[i].txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(lciMenuItems[i].label, Color.White, Color.Black), false); | |
248 | + if (lciMenuItems[i].txName != null) | |
249 | + { | |
250 | + TextureFactory.tテクスチャの解放(ref lciMenuItems[i].txName); | |
251 | + } | |
252 | + lciMenuItems[i].txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(lciMenuItems[i].label, Color.White, Color.Black), false, "lciMenuItems[i].txName"); | |
218 | 253 | lciMenuItems[i].rectName= prvFont.RectStrings; |
219 | 254 | } |
220 | 255 |