parent
bed13bfb5b
commit
77af568af3
|
@ -336,6 +336,7 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
|
|||
|
||||
FCLSeekBar itemBarScaleSeekbar = findViewById(R.id.item_bar_scale);
|
||||
FCLSeekBar windowScaleSeekbar = findViewById(R.id.window_scale);
|
||||
FCLSeekBar cursorOffsetSeekbar = findViewById(R.id.cursor_offset);
|
||||
FCLSeekBar mouseSensitivitySeekbar = findViewById(R.id.mouse_sensitivity);
|
||||
FCLSeekBar mouseSizeSeekbar = findViewById(R.id.mouse_size);
|
||||
FCLSeekBar gamepadDeadzoneSeekbar = findViewById(R.id.gamepad_deadzone_size);
|
||||
|
@ -344,6 +345,7 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
|
|||
|
||||
FCLTextView itemBarScaleText = findViewById(R.id.item_bar_scale_text);
|
||||
FCLTextView windowScaleText = findViewById(R.id.window_scale_text);
|
||||
FCLTextView cursorOffsetText = findViewById(R.id.cursor_offset_text);
|
||||
FCLTextView mouseSensitivityText = findViewById(R.id.mouse_sensitivity_text);
|
||||
FCLTextView mouseSizeText = findViewById(R.id.mouse_size_text);
|
||||
FCLTextView gamepadDeadzoneText = findViewById(R.id.gamepad_deadzone_text);
|
||||
|
@ -425,6 +427,25 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
|
|||
};
|
||||
windowScaleSeekbar.progressProperty().bindBidirectional(windowScaleProperty);
|
||||
|
||||
cursorOffsetSeekbar.addProgressListener();
|
||||
IntegerProperty cursorOffsetProperty = new SimpleIntegerProperty((int) (menuSetting.getCursorOffset())) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
super.invalidated();
|
||||
menuSetting.setCursorOffset(get());
|
||||
int screenWidth = AndroidUtils.getScreenWidth(FCLApplication.getCurrentActivity());
|
||||
int screenHeight = AndroidUtils.getScreenHeight(FCLApplication.getCurrentActivity());
|
||||
if (fclBridge != null) {
|
||||
double scaleFactor = fclBridge.getScaleFactor();
|
||||
int width = (int) ((screenWidth + get()) * scaleFactor);
|
||||
int height = (int) (screenHeight * scaleFactor);
|
||||
fclBridge.getSurfaceTexture().setDefaultBufferSize(width, height);
|
||||
fclBridge.pushEventWindow(width, height);
|
||||
}
|
||||
}
|
||||
};
|
||||
cursorOffsetSeekbar.progressProperty().bindBidirectional(cursorOffsetProperty);
|
||||
|
||||
mouseSensitivitySeekbar.addProgressListener();
|
||||
IntegerProperty mouseSensitivityProperty = new SimpleIntegerProperty((int) (menuSetting.getMouseSensitivity() * 100)) {
|
||||
@Override
|
||||
|
@ -465,6 +486,7 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
|
|||
|
||||
itemBarScaleText.stringProperty().bind(Bindings.createStringBinding(() -> String.valueOf(itemBarScaleProperty.get()), itemBarScaleProperty));
|
||||
windowScaleText.stringProperty().bind(Bindings.createStringBinding(() -> windowScaleProperty.get() + " %", windowScaleProperty));
|
||||
cursorOffsetText.stringProperty().bind(Bindings.createStringBinding(() -> String.valueOf(cursorOffsetProperty.get()), cursorOffsetProperty));
|
||||
mouseSensitivityText.stringProperty().bind(Bindings.createStringBinding(() -> mouseSensitivityProperty.get() + " %", mouseSensitivityProperty));
|
||||
mouseSizeText.stringProperty().bind(Bindings.createStringBinding(() -> menuSetting.mouseSizeProperty().get() + " dp", menuSetting.mouseSizeProperty()));
|
||||
gamepadDeadzoneText.stringProperty().bind(Bindings.createStringBinding(() -> gamepadDeadzoneProperty.get() + " %", gamepadDeadzoneProperty));
|
||||
|
|
|
@ -237,6 +237,20 @@ public class MenuSetting {
|
|||
this.windowScaleProperty.set(windowScale);
|
||||
}
|
||||
|
||||
private final DoubleProperty cursorOffsetProperty = new SimpleDoubleProperty(this, "cursorOffset", 0);
|
||||
|
||||
public DoubleProperty cursorOffsetProperty() {
|
||||
return cursorOffsetProperty;
|
||||
}
|
||||
|
||||
public double getCursorOffset() {
|
||||
return cursorOffsetProperty.get();
|
||||
}
|
||||
|
||||
public void setCursorOffset(double cursorOffset) {
|
||||
this.cursorOffsetProperty.set(cursorOffset);
|
||||
}
|
||||
|
||||
private final DoubleProperty mouseSensitivityProperty = new SimpleDoubleProperty(this, "mouseSensitivity", 1d);
|
||||
|
||||
public DoubleProperty mouseSensitivityProperty() {
|
||||
|
@ -311,6 +325,7 @@ public class MenuSetting {
|
|||
mouseSizeProperty.addListener(listener);
|
||||
itemBarScaleProperty.addListener(listener);
|
||||
windowScaleProperty.addListener(listener);
|
||||
cursorOffsetProperty.addListener(listener);
|
||||
gamepadDeadzoneProperty.addListener(listener);
|
||||
gamepadAimAssistZoneProperty.addListener(listener);
|
||||
}
|
||||
|
@ -338,6 +353,7 @@ public class MenuSetting {
|
|||
obj.addProperty("mouseSize", src.getMouseSize());
|
||||
obj.addProperty("itemBarScale", src.getItemBarScale());
|
||||
obj.addProperty("windowScale", src.getWindowScale());
|
||||
obj.addProperty("cursorOffset", src.getCursorOffset());
|
||||
obj.addProperty("gamepadDeadzone", src.getGamepadDeadzone());
|
||||
obj.addProperty("gamepadAimAssistZone", src.getGamepadAimAssistZone());
|
||||
return obj;
|
||||
|
@ -368,6 +384,7 @@ public class MenuSetting {
|
|||
ms.setMouseSize(Optional.ofNullable(obj.get("mouseSize")).map(JsonElement::getAsInt).orElse(15));
|
||||
ms.setItemBarScale(Optional.ofNullable(obj.get("itemBarScale")).map(JsonElement::getAsInt).orElse(0));
|
||||
ms.setWindowScale(Optional.ofNullable(obj.get("windowScale")).map(JsonElement::getAsDouble).orElse(1d));
|
||||
ms.setCursorOffset(Optional.ofNullable(obj.get("cursorOffset")).map(JsonElement::getAsInt).orElse(0));
|
||||
ms.setGamepadDeadzone(Optional.ofNullable(obj.get("gamepadDeadzone")).map(JsonElement::getAsDouble).orElse(0.2d));
|
||||
ms.setGamepadAimAssistZone(Optional.ofNullable(obj.get("gamepadAimAssistZone")).map(JsonElement::getAsDouble).orElse(0.98d));
|
||||
return ms;
|
||||
|
|
|
@ -253,6 +253,43 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:id="@+id/window_scale"/>
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:text="@string/settings_game_cursor_offset"
|
||||
android:textSize="12sp"
|
||||
app:auto_text_tint="true" />
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLTextView
|
||||
app:auto_text_tint="true"
|
||||
android:singleLine="true"
|
||||
android:id="@+id/cursor_offset_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</com.tungsten.fcllibrary.component.view.FCLLinearLayout>
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLSeekBar
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:max="150"
|
||||
android:min="-150"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cursor_offset"/>
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLTextView
|
||||
app:auto_text_tint="true"
|
||||
android:singleLine="true"
|
||||
|
|
|
@ -726,6 +726,7 @@
|
|||
<string name="settings_fcl_renderer_freedreno">Freedreno (OpenGL 4.6, 仅支持GPU a616-a660)</string>
|
||||
<string name="settings_game">游戏设置</string>
|
||||
<string name="settings_game_dimension">窗口分辨率</string>
|
||||
<string name="settings_game_cursor_offset">鼠标指针偏移</string>
|
||||
<string name="settings_game_java_version">Java 版本</string>
|
||||
<string name="settings_game_java_version_auto">自动选择</string>
|
||||
<string name="settings_game_working_directory">版本隔离</string>
|
||||
|
|
|
@ -763,6 +763,7 @@
|
|||
|
||||
<string name="settings_game">Game Settings</string>
|
||||
<string name="settings_game_dimension">Resolution</string>
|
||||
<string name="settings_game_cursor_offset">Cursor Offset</string>
|
||||
<string name="settings_game_java_version">Java Version</string>
|
||||
<string name="settings_game_java_version_auto">Auto</string>
|
||||
<string name="settings_game_java_version_8" translatable="false">JRE 8</string>
|
||||
|
|
Loading…
Reference in New Issue