- walk-sprint sign for direction pad

- session launch UI & animation fixes
This commit is contained in:
True Zhuanjia
2026-05-20 00:59:34 +08:00
parent e402c17fa6
commit 0af4c70e16
5 changed files with 83 additions and 17 deletions
+31 -4
View File
@@ -361,6 +361,8 @@ import ObjectiveC.runtime
@objc public var downIndicator = CAShapeLayer()
@objc public var leftIndicator = CAShapeLayer()
@objc public var rightIndicator = CAShapeLayer()
@objc public var sprintSign = CALayer()
@objc public var walkSign = CALayer()
@objc public var walkKeyThresholdPreviewLayer = CAShapeLayer()
@objc public var sprintKeyThresholdPreviewLayer = CAShapeLayer()
@@ -842,6 +844,8 @@ import ObjectiveC.runtime
self.rightIndicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
self.walkKeyThresholdPreviewLayer.strokeColor = self.buttonDownVisualEffectLayer.borderColor
self.sprintKeyThresholdPreviewLayer.strokeColor = self.buttonDownVisualEffectLayer.borderColor
GraphicUtils.changeColor(layer: self.sprintSign, color: standardHighlightColor.withAlphaComponent(highlightAlpha))
GraphicUtils.changeColor(layer: self.walkSign, color: standardHighlightColor.withAlphaComponent(highlightAlpha))
}
private func tweakAlpha(tweakBorderAlpha:Bool, tweakLabelAlpha:Bool = true){
@@ -1317,8 +1321,8 @@ import ObjectiveC.runtime
private func setupLrudDirectionLayer(directionLayer:CAShapeLayer) {
let indicatorFrame = CAShapeLayer();
indicatorFrame.frame = CGRectMake(0, 0, 75*highlightSizeFactor, 75*highlightSizeFactor)
indicatorFrame.cornerRadius = 9 * highlightSizeFactor
directionLayer.borderWidth = 6 * min(1.0, highlightSizeFactor)
indicatorFrame.cornerRadius = 23 * highlightSizeFactor
directionLayer.borderWidth = 5.3 * min(1.0, highlightSizeFactor)
directionLayer.frame = indicatorFrame.bounds.insetBy(dx: -directionLayer.borderWidth, dy: -directionLayer.borderWidth) // Adjust the inset as needed
directionLayer.cornerRadius = indicatorFrame.cornerRadius + directionLayer.borderWidth
directionLayer.backgroundColor = UIColor.clear.cgColor
@@ -1373,7 +1377,7 @@ import ObjectiveC.runtime
self.sendComboButtonsUpEvent(comboStrings: [self.comboButtonStrings[0]])
}
}
self.sprintSign.isHidden = !isInSprintMode
if !directionPadTouchBegan, isInSprintMode, vibrationOn {
vibrationGenerator.prepare()
vibrationGenerator.impactOccurred()
@@ -1393,7 +1397,7 @@ import ObjectiveC.runtime
self.sendComboButtonsUpEvent(comboStrings: [self.comboButtonStrings[1]])
}
}
self.walkSign.isHidden = !isInWalkMode
if !directionPadTouchBegan, isInWalkMode, vibrationOn {
vibrationGenerator.prepare()
vibrationGenerator.impactOccurred()
@@ -1670,6 +1674,7 @@ import ObjectiveC.runtime
}
}
@objc public func setupLrudDirectionIndicatorlayers() {
CATransaction.begin()
CATransaction.setDisableActions(true)
@@ -1702,6 +1707,26 @@ import ObjectiveC.runtime
self.layer.addSublayer(self.stickWheelAxis)
self.stickWheelAxis.isHidden = false
}
self.sprintSign.removeFromSuperlayer()
self.sprintSign = GraphicUtils.makeSVGLayer(from: "sprintSign", in: self.upIndicator, at:CGPoint(x: 0.5+0.028, y: 0.5-0.22), targetSize: CGSize(width: 26*highlightSizeFactor, height: 26*highlightSizeFactor))
GraphicUtils.changeColor(layer: self.sprintSign, color: standardHighlightColor)
self.upIndicator.addSublayer(self.sprintSign)
var frameInSelfLayer = self.upIndicator.convert(self.sprintSign.frame, to: self.layer)
self.sprintSign.removeFromSuperlayer()
self.layer.addSublayer(self.sprintSign)
self.sprintSign.frame = frameInSelfLayer
self.sprintSign.isHidden = !OnScreenWidgetView.editMode
self.walkSign.removeFromSuperlayer()
self.walkSign = GraphicUtils.makeSVGLayer(from: "walkSign", in: self.upIndicator, at:CGPoint(x: 0.5+0.032, y: 0.5-0.22), targetSize: CGSize(width: 32*highlightSizeFactor, height: 32*highlightSizeFactor))
GraphicUtils.changeColor(layer: self.walkSign, color: standardHighlightColor)
self.upIndicator.addSublayer(self.walkSign)
frameInSelfLayer = self.upIndicator.convert(self.walkSign.frame, to: self.layer)
self.walkSign.removeFromSuperlayer()
self.layer.addSublayer(self.walkSign)
self.walkSign.frame = frameInSelfLayer
self.walkSign.isHidden = true
setupMovementThresholdPreviewLayersIfNeeded()
updateMovementThresholdPreview()
@@ -3027,6 +3052,8 @@ import ObjectiveC.runtime
self.leftIndicator.isHidden = true
self.rightIndicator.isHidden = true
self.anchorBall.isHidden = true
self.sprintSign.isHidden = true
self.walkSign.isHidden = true
}
if CommandManager.verticalTouchPads.contains(touchPadString){
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generator: Apple Native CoreSVG 341-->
<!DOCTYPE svg
PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 17.3579 10.6133">
<g>
<rect height="10.6133" opacity="0" width="17.3579" x="0" y="0"/>
<path d="M0.41748 7.57495C0.143799 7.85327 0 8.19653 0 8.6001C0 9.42114 0.658691 10.0891 1.4751 10.0891C1.88794 10.0891 2.26831 9.92212 2.56519 9.61597L8.8877 3.11255L8.13159 3.11255L14.4355 9.61597C14.7324 9.92676 15.1174 10.0891 15.521 10.0891C16.3328 10.0891 16.9961 9.42114 16.9961 8.6001C16.9961 8.19189 16.8569 7.84863 16.574 7.57495L9.71802 0.556641C9.34692 0.180908 8.96655 0.00927734 8.50269 0C8.03882 0 7.65845 0.17627 7.28271 0.556641Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 866 B

+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generator: Apple Native CoreSVG 341-->
<!DOCTYPE svg
PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 17.5852 6.4292">
<g>
<rect height="6.4292" opacity="0" width="17.5852" x="0" y="0"/>
<path d="M0.853516 3.11719C0.357178 3.33984 0 3.77588 0 4.33252C0 5.25098 0.677246 5.85864 1.44727 5.85864C1.88794 5.85864 2.4353 5.60352 2.88989 5.39478L9.08252 2.75073L8.14551 2.75073L14.3381 5.39478C14.7881 5.60352 15.3401 5.85864 15.7761 5.85864C16.5508 5.85864 17.2234 5.25098 17.2234 4.33252C17.2234 3.77588 16.8708 3.33984 16.3699 3.11719L10.2283 0.463867C9.62988 0.199463 9.17065 0 8.61401 0C8.05273 0 7.59814 0.199463 6.99976 0.463867Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 862 B

@@ -1761,14 +1761,18 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
walkModeThresholdLabel.text = LocalizationHelper.localizedString(forKey: "Walkmode threshold")
walkModeThresholdStack.isHidden = true
let whiteAttrs: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white]
sprintKeyThresholdSlider.addTarget(self, action: #selector(sprintKeyThresholdSliderMoved(_:)), for: .valueChanged)
sprintKeyThresholdLabel.text = LocalizationHelper.localizedString(forKey: "Slide threshold")
sprintKeySelector.addTarget(self, action: #selector(sprintKeyActionChanged(_:)), for: .valueChanged)
sprintKeySelector.setTitleTextAttributes(whiteAttrs, for: .normal)
sprintKeyStack.isHidden = true
walkKeyThresholdSlider.addTarget(self, action: #selector(walkKeyThresholdSliderMoved(_:)), for: .valueChanged)
walkKeyThresholdLabel.text = LocalizationHelper.localizedString(forKey: "Slide threshold")
walkKeySelector.addTarget(self, action: #selector(walkKeyActionChanged(_:)), for: .valueChanged)
walkKeySelector.setTitleTextAttributes(whiteAttrs, for: .normal)
walkKeyStack.isHidden = true
minStickOffsetSlider.addTarget(self, action: #selector(minStickOffsetSliderMoved(_:)), for: .valueChanged)
@@ -1796,9 +1800,6 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
stickIndicatorOffsetLabel.text = LocalizationHelper.localizedString(forKey: "Indicator offset")
stickIndicatorOffsetStack.isHidden = true
anchorModeSelector.addTarget(self, action: #selector(anchorModeChanged(_:)), for: .valueChanged)
anchorModeStack.isHidden = true
autoDockTimerSlider.addTarget(self, action: #selector(autoDockTimerSliderMoved(_:)), for: .valueChanged)
autoDockTimerLabel.text = LocalizationHelper.localizedString(forKey: "Auto dock")
autoDockTimerStack.isHidden = true;
@@ -1806,8 +1807,11 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
dockedAlphaSlider.addTarget(self, action: #selector(dockedAlphaSliderMoved(_:)), for: .valueChanged)
dockedAlphaLabel.text = LocalizationHelper.localizedString(forKey: "Docked opacity")
dockedAlphaStack.isHidden = true;
let whiteAttrs: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white]
anchorModeSelector.addTarget(self, action: #selector(anchorModeChanged(_:)), for: .valueChanged)
anchorModeSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
anchorModeStack.isHidden = true
mouseButtonDownSelector.addTarget(self, action: #selector(mouseDownButtonChanged(_:)), for: .valueChanged)
mouseButtonDownSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
mouseDownButtonStack.isHidden = true
@@ -1819,11 +1823,13 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
buttonModeSelector.addTarget(self, action: #selector(buttonModeChanged(_:)), for: .valueChanged)
buttonModeSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
buttonModeStack.isHidden = true
collectedWidgetsSelector.addTarget(self, action: #selector(collectionHiddenChanged(_:)), for: .valueChanged)
collectedWidgetsSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
revealModeSelector.addTarget(self, action: #selector(revealModeChanged(_:)), for: .valueChanged)
revealModeSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
collectedWidgetsStack.isHidden = true
bulkMoveSelector.addTarget(self, action: #selector(bulkMoveChanged(_:)), for: .valueChanged)
bulkMoveSelector.setTitleTextAttributes(whiteAttrs, for: .normal)
bulkMoveStack.isHidden = true
@@ -2405,16 +2411,20 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
@objc private func anchorModeChanged(_ sender: UISegmentedControl) {
if let selectedWidget {
selectedWidget.touchPointAnchored = sender.selectedSegmentIndex == 1
componentSizeStack.isHidden = sender.selectedSegmentIndex != 0
stickIndicatorOffsetStack.isHidden = sender.selectedSegmentIndex != 1
stickIndicatorOffsetSlider.value = Float(selectedWidget.stickIndicatorOffset)
self.stickIndicatorOffsetSliderMoved(stickIndicatorOffsetSlider)
autoFitStack(self.widgetPanelStack)
if selectedWidget.isDisplacementBasedStickPad {
componentSizeStack.isHidden = sender.selectedSegmentIndex != 0
stickIndicatorOffsetStack.isHidden = sender.selectedSegmentIndex != 1
stickIndicatorOffsetSlider.value = Float(selectedWidget.stickIndicatorOffset)
self.stickIndicatorOffsetSliderMoved(stickIndicatorOffsetSlider)
}
if selectedWidget.isDirectionPad {
sensitivityXSlider.value = sender.selectedSegmentIndex == 0 ? 0.0 : 6.5
sensitivityXSliderMoved(sensitivityXSlider)
}
autoFitStack(self.widgetPanelStack)
}
}
@@ -788,9 +788,9 @@
}
- (void)updateTheme {
self.view.backgroundColor = ThemeManager.menuBackgroundColor;
_stageLabel.textColor = [ThemeManager.textColor colorWithAlphaComponent:0.9];
_spinner.color = ThemeManager.textColor;
self.view.backgroundColor = UIColor.blackColor;
_stageLabel.textColor = [UIColor.whiteColor colorWithAlphaComponent:0.9];
_spinner.color = UIColor.whiteColor;
}
- (void)viewDidLoad
@@ -817,6 +817,7 @@
_stageLabel.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);
_spinner = [[UIActivityIndicatorView alloc] init];
_spinner.color = UIColor.whiteColor;
[_spinner setUserInteractionEnabled:NO];
#if TARGET_OS_TV
[_spinner setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
@@ -967,6 +968,12 @@
_mainFrameViewcontroller.sessionLaunchedWithAbsoluteTouch = _settings.touchMode.intValue == AbsoluteTouch;
OnScreenWidgetView.gamepadArrivalReported = false;
OnScreenWidgetView.enableFolderAnimation = false;
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC));
dispatch_after(delay, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
OnScreenWidgetView.enableFolderAnimation = true;
});
}
- (void)keyboardWillShow:(NSNotification *)notification{