This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c2120b
commit 1121b6c
Showing
12 changed files
with
595 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
预定制作: | ||
编队储存 | ||
随机效果、选卡色、换人重做 | ||
条件添加大于小于等于 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
235 changes: 147 additions & 88 deletions
235
src/main/java/yome/fgo/simulator/gui/components/FormationSelector.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
src/main/java/yome/fgo/simulator/gui/creators/FormationFXMLController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package yome.fgo.simulator.gui.creators; | ||
|
||
import com.google.common.collect.Lists; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.geometry.Insets; | ||
import javafx.geometry.Orientation; | ||
import javafx.geometry.Pos; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.Separator; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Priority; | ||
import javafx.scene.layout.VBox; | ||
import javafx.scene.text.Font; | ||
import javafx.stage.Stage; | ||
import yome.fgo.data.proto.FgoStorageData; | ||
import yome.fgo.data.proto.FgoStorageData.CraftEssencePreference; | ||
import yome.fgo.data.proto.FgoStorageData.Formation; | ||
import yome.fgo.data.proto.FgoStorageData.MysticCodePreference; | ||
import yome.fgo.data.proto.FgoStorageData.ServantPreference; | ||
import yome.fgo.simulator.gui.components.CraftEssenceDataAnchorPane; | ||
import yome.fgo.simulator.gui.components.MysticCodeDataAnchorPane; | ||
import yome.fgo.simulator.gui.components.ServantDataAnchorPane; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.net.URL; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.ResourceBundle; | ||
|
||
import static yome.fgo.simulator.ResourceManager.getUnknownServantThumbnail; | ||
import static yome.fgo.simulator.gui.helpers.ComponentUtils.LIST_ITEM_STYLE; | ||
import static yome.fgo.simulator.translation.TranslationManager.APPLICATION_SECTION; | ||
import static yome.fgo.simulator.translation.TranslationManager.getTranslation; | ||
|
||
public class FormationFXMLController implements Initializable { | ||
@FXML | ||
private VBox formationVBox; | ||
|
||
@Override | ||
public void initialize(final URL location, final ResourceBundle resources) { | ||
} | ||
|
||
public void fillFormations( | ||
final List<Formation> formationList, | ||
final Map<Integer, ServantDataAnchorPane> servantDataMap, | ||
final Map<Integer, CraftEssenceDataAnchorPane> ceDataMap, | ||
final Map<Integer, MysticCodeDataAnchorPane> mcDataMap, | ||
final Formation.Builder builder | ||
) { | ||
Image unknown = null; | ||
try { | ||
unknown = new Image(new FileInputStream(getUnknownServantThumbnail())); | ||
} catch (final FileNotFoundException ignored) { | ||
} | ||
|
||
for (int h = 0; h < formationList.size(); h += 1) { | ||
final Formation formation = formationList.get(h); | ||
|
||
final HBox nameHBox = new HBox(20); | ||
nameHBox.setAlignment(Pos.CENTER_LEFT); | ||
final Button selectButton = new Button(getTranslation(APPLICATION_SECTION, "Select Formation")); | ||
selectButton.setFont(new Font(18)); | ||
final Button deleteButton = new Button(getTranslation(APPLICATION_SECTION, "Delete Formation")); | ||
deleteButton.setFont(new Font(18)); | ||
final Label formationName = new Label(formation.getName()); | ||
formationName.setFont(new Font(18)); | ||
nameHBox.getChildren().addAll(selectButton, deleteButton, formationName); | ||
|
||
final HBox partyHBox = new HBox(15); | ||
final List<ServantPreference> servantPreferences = formation.getServantsList(); | ||
final List<CraftEssencePreference> craftEssencePreferences = formation.getCraftEssencesList(); | ||
for (int i = 0; i < formation.getServantsCount(); i += 1) { | ||
final VBox memberVBox = new VBox(20); | ||
final ServantPreference servantPreference = servantPreferences.get(i); | ||
final ServantDataAnchorPane servant; | ||
final int servantNo = servantPreference.getServantNo(); | ||
if (servantDataMap.containsKey(servantNo)) { | ||
final ServantDataAnchorPane reference = servantDataMap.get(servantNo); | ||
servant = new ServantDataAnchorPane(reference.getServantData(), reference.getAscensionImages()); | ||
servant.getImageView().setImage(servant.getAscensionImages().get(servantPreference.getOption().getAscension() - 1)); | ||
} else { | ||
servant = new ServantDataAnchorPane(null, Lists.newArrayList(unknown)); | ||
} | ||
|
||
final CraftEssenceDataAnchorPane craftEssence; | ||
final int ceNo = craftEssencePreferences.get(i).getCraftEssenceNo(); | ||
if (ceDataMap.containsKey(ceNo)) { | ||
final CraftEssenceDataAnchorPane reference = ceDataMap.get(ceNo); | ||
craftEssence = new CraftEssenceDataAnchorPane(reference.getCraftEssenceData(), reference.getImage()); | ||
} else { | ||
craftEssence = new CraftEssenceDataAnchorPane(null, unknown); | ||
} | ||
|
||
memberVBox.getChildren().addAll(servant, craftEssence); | ||
partyHBox.getChildren().add(memberVBox); | ||
} | ||
|
||
partyHBox.getChildren().add(new Separator(Orientation.VERTICAL)); | ||
|
||
final MysticCodePreference mysticCodePreference = formation.getMysticCode(); | ||
final MysticCodeDataAnchorPane mysticCode = new MysticCodeDataAnchorPane(); | ||
final MysticCodeDataAnchorPane reference = mcDataMap.get(mysticCodePreference.getMysticCodeNo()); | ||
mysticCode.setFrom(reference.getMysticCodeData(), reference.getImages(), mysticCodePreference.getOption().getGender()); | ||
|
||
partyHBox.getChildren().add(mysticCode); | ||
|
||
final VBox itemVBox = new VBox(10); | ||
itemVBox.setPadding(new Insets(20)); | ||
itemVBox.setStyle(LIST_ITEM_STYLE); | ||
itemVBox.getChildren().addAll(nameHBox, partyHBox); | ||
formationVBox.getChildren().add(itemVBox); | ||
|
||
selectButton.setOnAction(e -> { | ||
builder.mergeFrom(formation); | ||
final Stage stage = (Stage) formationVBox.getScene().getWindow(); | ||
stage.close(); | ||
}); | ||
deleteButton.setOnAction(e -> { | ||
formationVBox.getChildren().remove(itemVBox); | ||
formationList.remove(formation); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.