Merge branch 'main' into pojav

This commit is contained in:
ShirosakiMio 2024-09-01 22:25:06 +08:00
commit 8fbc980439
14 changed files with 86 additions and 7 deletions

View File

@ -53,7 +53,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:largeHeap="true"
android:usesCleartextTraffic="true"

View File

@ -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));

View File

@ -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;

View File

@ -252,6 +252,43 @@
android:layout_width="match_parent"
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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<background android:drawable="@color/icon_background_color"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="icon_background_color">@android:color/system_accent1_0</color>
</resources>

View File

@ -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>

View File

@ -4,4 +4,5 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="ui_bg_color">#4DBCBCBC</color>
<color name="icon_background_color">#FFFFFF</color>
</resources>

View File

@ -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>