カルネージハートエクサのチームデータ編集ツール JAVAベース
マッチファイルを基準ファイル無しで新規作成出来るようにした
@@ -7,6 +7,10 @@ | ||
7 | 7 | |
8 | 8 | import java.awt.Point; |
9 | 9 | import java.io.File; |
10 | +import java.io.IOException; | |
11 | +import java.io.InputStream; | |
12 | +import java.util.logging.Level; | |
13 | +import java.util.logging.Logger; | |
10 | 14 | import javax.swing.JDialog; |
11 | 15 | import javax.swing.JFileChooser; |
12 | 16 | import javax.swing.filechooser.FileNameExtensionFilter; |
@@ -113,55 +117,33 @@ | ||
113 | 117 | }//GEN-LAST:event_openTeamActionPerformed |
114 | 118 | |
115 | 119 | private void makeMatchDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_makeMatchDataActionPerformed |
116 | - int nret; | |
117 | - JFileChooser fdlg = new JFileChooser(Main.cheMatchDataDir); | |
118 | - String filterTitle | |
119 | - = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
120 | - getString("filterTitleCHE"); | |
121 | - FileNameExtensionFilter ffilter | |
122 | - = new FileNameExtensionFilter(filterTitle, "CHE"); | |
123 | - fdlg.setFileFilter(ffilter); | |
124 | - nret = fdlg.showOpenDialog(getRootPane().getParent()); | |
125 | - if (nret == JFileChooser.APPROVE_OPTION) { | |
126 | - File ifile = fdlg.getSelectedFile(); | |
127 | - cheFile che = new cheFile(ifile.getAbsolutePath()); | |
128 | - Main.cheMatchDataDir = ifile.getParent(); | |
129 | - if (che.load() == true) { | |
130 | - if (che.is_teamfile() == false) { | |
131 | - JDialog dlg = new JDialog(this, | |
132 | - java.util.ResourceBundle.getBundle( | |
133 | - "chexaformation/resource"). | |
134 | - getString("titleMatchWindow"), | |
135 | - false); | |
136 | - che.set_fname("NEWMATCH.CHE"); | |
137 | - che.set_match_name("マッチデータ"); | |
138 | - che.clear_oke(); | |
139 | - MatchDataPanel panel = new MatchDataPanel(che); | |
140 | - dlg.add(panel); | |
141 | - dlg.pack(); | |
142 | - Point pos = this.getLocation(); | |
143 | - pos.x += this.getWidth(); | |
144 | - dlg.setLocation(pos); | |
145 | - panel.update_title(); | |
146 | - dlg.setVisible(true); | |
147 | - } else { | |
148 | - Main.mesg_box(this, | |
149 | - java.util.ResourceBundle.getBundle( | |
150 | - "chexaformation/resource").getString("loadCHE"), | |
151 | - java.util.ResourceBundle.getBundle( | |
152 | - "chexaformation/resource"). | |
153 | - getString("errNotMatchData"), | |
154 | - ifile.getAbsolutePath()); | |
155 | - } | |
156 | - } else { | |
157 | - Main.mesg_box(this, | |
158 | - java.util.ResourceBundle.getBundle( | |
159 | - "chexaformation/resource").getString("loadCHE"), | |
160 | - java.util.ResourceBundle.getBundle( | |
161 | - "chexaformation/resource").getString("faileReadCHE"), | |
162 | - ifile.getAbsolutePath()); | |
120 | + byte matchdata[] = new byte[336]; | |
121 | + cheFile che = null; | |
122 | + try { | |
123 | + InputStream ifs = getClass().getResourceAsStream("match.bin"); | |
124 | + if (ifs.read(matchdata) == matchdata.length) { | |
125 | + che = new cheFile(matchdata); | |
163 | 126 | } |
127 | + } catch (IOException ex) { | |
128 | + Logger.getLogger(mainForm.class.getName()). | |
129 | + log(Level.SEVERE, null, ex); | |
164 | 130 | } |
131 | + if (che != null) { | |
132 | + JDialog dlg = new JDialog(this, | |
133 | + java.util.ResourceBundle.getBundle( | |
134 | + "chexaformation/resource"). | |
135 | + getString("titleMatchWindow"), | |
136 | + false); | |
137 | + che.set_match_name("マッチデータ"); | |
138 | + MatchDataPanel panel = new MatchDataPanel(che); | |
139 | + dlg.add(panel); | |
140 | + dlg.pack(); | |
141 | + Point pos = this.getLocation(); | |
142 | + pos.x += this.getWidth(); | |
143 | + dlg.setLocation(pos); | |
144 | + panel.update_title(); | |
145 | + dlg.setVisible(true); | |
146 | + } | |
165 | 147 | }//GEN-LAST:event_makeMatchDataActionPerformed |
166 | 148 | |
167 | 149 | private void editMatchDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editMatchDataActionPerformed |
@@ -111,6 +111,24 @@ | ||
111 | 111 | /** |
112 | 112 | * コンストラクタ |
113 | 113 | * |
114 | + * @param d マッチデータパラメータ | |
115 | + */ | |
116 | + public cheFile(byte d[]) { | |
117 | + fname = "NEWMATCH.CHE"; | |
118 | + team_max = 16; | |
119 | + oke_max = 32; | |
120 | + bteamfile = false; | |
121 | + match_data = new byte[336]; | |
122 | + if (d.length >= 336) { | |
123 | + System.arraycopy(d, 0, match_data, 0, 336); | |
124 | + } | |
125 | + team = new cheTeamData[team_max]; | |
126 | + oke = new cheOkeData[oke_max]; | |
127 | + } | |
128 | + | |
129 | + /** | |
130 | + * コンストラクタ | |
131 | + * | |
114 | 132 | * @param s CHEファイル名 |
115 | 133 | */ |
116 | 134 | public cheFile(String s) { |