()
| 101 | } |
| 102 | |
| 103 | public void show() throws IOException { |
| 104 | Object root = FXMLLoader.load(this.getClass().getResource("/splash.fxml")); |
| 105 | Scene scene = new Scene((Parent) root); |
| 106 | scene.setFill(Color.TRANSPARENT); |
| 107 | stage = new Stage(); |
| 108 | stage.initStyle(StageStyle.TRANSPARENT); |
| 109 | stage.getIcons().add(new Image(Splash.class.getResourceAsStream("/logo_blue.png"))); |
| 110 | stage.setScene(scene); |
| 111 | |
| 112 | randomGame(scene); |
| 113 | |
| 114 | TextFlow startupTipFlow = (TextFlow) scene.lookup("#startup-tip"); |
| 115 | startupTipFlow.visibleProperty().bind(errorShowing.not()); |
| 116 | startupTipFlow.getChildren().setAll(UIUtil.stringToTextFlowNodes(randomElement(readTips()))); |
| 117 | |
| 118 | Label launchErrorLabel = (Label) scene.lookup("#launch-error"); |
| 119 | launchErrorLabel.textProperty().bind(launchError); |
| 120 | launchErrorLabel.visibleProperty().bind(errorShowing); |
| 121 | launchErrorLabel.managedProperty().bind(launchErrorLabel.visibleProperty()); |
| 122 | |
| 123 | Button errorButton = (Button) scene.lookup("#error-button"); |
| 124 | errorButton.visibleProperty().bind(errorShowing); |
| 125 | errorButton.managedProperty().bind(errorButton.visibleProperty()); |
| 126 | errorButton.setOnAction((event) -> System.exit(1)); |
| 127 | |
| 128 | // Footer data; version and copyright |
| 129 | String versionString = System.getProperty("defold.version"); |
| 130 | String channelName = System.getProperty("defold.channel"); |
| 131 | String sha1 = System.getProperty("defold.editor.sha1"); |
| 132 | |
| 133 | boolean hasVersion = true; |
| 134 | if (versionString == null || versionString.isEmpty()) { |
| 135 | versionString = "No version"; |
| 136 | hasVersion = false; |
| 137 | } |
| 138 | channelName = (channelName == null || channelName.isEmpty()) ? "No channel" : channelName; |
| 139 | channelName = " • " + channelName; |
| 140 | sha1 = (sha1 == null || sha1.isEmpty()) ? "no sha1" : sha1; |
| 141 | if (sha1.length() > 7) { |
| 142 | sha1 = sha1.substring(0, 7); |
| 143 | } |
| 144 | |
| 145 | Label channelLabel = (Label) scene.lookup("#version"); |
| 146 | channelLabel.setText(versionString + " (" + sha1 + ")" + channelName); |
| 147 | channelLabel.setVisible(true); |
| 148 | |
| 149 | String windowTitle = "Defold"; |
| 150 | if (hasVersion) { |
| 151 | windowTitle += " " + versionString; |
| 152 | } |
| 153 | stage.setTitle(windowTitle); |
| 154 | stage.setOnShown(event -> shown.set(true)); |
| 155 | stage.show(); |
| 156 | } |
| 157 | |
| 158 | public void close() { |
| 159 | stage.close(); |
no test coverage detected