- Adjust stick style.
- Add + button for iphone
This commit is contained in:
1 parent
805cf517bb
commit
747997f46c
2 files changed
+52
-20
No files matched your search
@@ -702,25 +702,27 @@ ICAgICAgICAgICAgIA
|
|||||||
</button>
|
</button>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RDI-on-aPY">
|
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RDI-on-aPY">
|
||||||
<rect key="frame" x="240" y="0.0" width="50" height="50"/>
|
<rect key="frame" x="240" y="0.0" width="50" height="50"/>
|
||||||
|
<subviews>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LPA-ea-YHC" userLabel="Save">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="50" id="Lot-pn-o60"/>
|
||||||
|
<constraint firstAttribute="height" constant="50" id="uWO-So-qxr"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||||
|
<color key="tintColor" red="0.6705882353" green="0.61568627450000002" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||||
|
<state key="normal" image="SquareAndArrowDown">
|
||||||
|
<preferredSymbolConfiguration key="preferredSymbolConfiguration" configurationType="pointSize" pointSize="64"/>
|
||||||
|
</state>
|
||||||
|
<connections>
|
||||||
|
<action selector="saveTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="cSe-fN-UWC"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LPA-ea-YHC" userLabel="Save">
|
|
||||||
<rect key="frame" x="360" y="0.0" width="50" height="50"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstAttribute="width" constant="50" id="Lot-pn-o60"/>
|
|
||||||
<constraint firstAttribute="height" constant="50" id="uWO-So-qxr"/>
|
|
||||||
</constraints>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
|
||||||
<color key="tintColor" red="0.6705882353" green="0.61568627450000002" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
||||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
|
||||||
<state key="normal" image="SquareAndArrowDown">
|
|
||||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" configurationType="pointSize" pointSize="64"/>
|
|
||||||
</state>
|
|
||||||
<connections>
|
|
||||||
<action selector="saveTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="cSe-fN-UWC"/>
|
|
||||||
</connections>
|
|
||||||
</button>
|
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rXW-Ms-2cJ" userLabel="Load">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rXW-Ms-2cJ" userLabel="Load">
|
||||||
<rect key="frame" x="480" y="0.0" width="50" height="50"/>
|
<rect key="frame" x="360" y="0.0" width="50" height="50"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="50" id="91g-27-mVH"/>
|
<constraint firstAttribute="width" constant="50" id="91g-27-mVH"/>
|
||||||
<constraint firstAttribute="height" constant="50" id="kRj-b6-Bx1"/>
|
<constraint firstAttribute="height" constant="50" id="kRj-b6-Bx1"/>
|
||||||
@@ -734,6 +736,28 @@ ICAgICAgICAgICAgIA
|
|||||||
<action selector="loadTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="DVp-Xi-K27"/>
|
<action selector="loadTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="DVp-Xi-K27"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Up4-28-sgF" userLabel="Add">
|
||||||
|
<rect key="frame" x="480" y="0.0" width="50" height="50"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="height" constant="50" id="rWU-US-9dl"/>
|
||||||
|
<constraint firstAttribute="width" constant="50" id="wWj-wB-MRd"/>
|
||||||
|
</constraints>
|
||||||
|
<color key="tintColor" red="0.6705882353" green="0.61568627450000002" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||||
|
<state key="normal">
|
||||||
|
<attributedString key="attributedTitle">
|
||||||
|
<fragment content="+">
|
||||||
|
<attributes>
|
||||||
|
<font key="NSFont" size="50" name="Arial-BoldMT"/>
|
||||||
|
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
|
||||||
|
</attributes>
|
||||||
|
</fragment>
|
||||||
|
</attributedString>
|
||||||
|
</state>
|
||||||
|
<connections>
|
||||||
|
<action selector="addTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="idY-3m-m01"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="530" id="6BK-sG-WTH"/>
|
<constraint firstAttribute="width" constant="530" id="6BK-sG-WTH"/>
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ static float LS_CENTER_X;
|
|||||||
static float LS_CENTER_Y;
|
static float LS_CENTER_Y;
|
||||||
static float RS_CENTER_X;
|
static float RS_CENTER_X;
|
||||||
static float RS_CENTER_Y;
|
static float RS_CENTER_Y;
|
||||||
|
static const float STICK_OPACITY = 0.63;
|
||||||
|
|
||||||
static float START_X;
|
static float START_X;
|
||||||
static float START_Y;
|
static float START_Y;
|
||||||
@@ -697,6 +698,7 @@ static float L3_Y;
|
|||||||
UIImage* leftStickImage = [UIImage imageNamed:@"StickInner"];
|
UIImage* leftStickImage = [UIImage imageNamed:@"StickInner"];
|
||||||
_leftStick.frame = CGRectMake(LS_CENTER_X - leftStickImage.size.width / 2, LS_CENTER_Y - leftStickImage.size.height / 2, leftStickImage.size.width, leftStickImage.size.height);
|
_leftStick.frame = CGRectMake(LS_CENTER_X - leftStickImage.size.width / 2, LS_CENTER_Y - leftStickImage.size.height / 2, leftStickImage.size.width, leftStickImage.size.height);
|
||||||
_leftStick.contents = (id) leftStickImage.CGImage;
|
_leftStick.contents = (id) leftStickImage.CGImage;
|
||||||
|
_leftStick.opacity = STICK_OPACITY; // make stick half transparent when it's idle
|
||||||
[_view.layer addSublayer:_leftStick];
|
[_view.layer addSublayer:_leftStick];
|
||||||
|
|
||||||
// create right analog stick
|
// create right analog stick
|
||||||
@@ -711,12 +713,13 @@ static float L3_Y;
|
|||||||
_rightStick.frame = CGRectMake(RS_CENTER_X - rightStickImage.size.width / 2, RS_CENTER_Y - rightStickImage.size.height / 2, rightStickImage.size.width, rightStickImage.size.height);
|
_rightStick.frame = CGRectMake(RS_CENTER_X - rightStickImage.size.width / 2, RS_CENTER_Y - rightStickImage.size.height / 2, rightStickImage.size.width, rightStickImage.size.height);
|
||||||
|
|
||||||
_rightStick.contents = (id) rightStickImage.CGImage;
|
_rightStick.contents = (id) rightStickImage.CGImage;
|
||||||
|
_rightStick.opacity = STICK_OPACITY; // make stick half transparent when it's idle
|
||||||
[_view.layer addSublayer:_rightStick];
|
[_view.layer addSublayer:_rightStick];
|
||||||
|
|
||||||
// make stick larger
|
// make stick larger
|
||||||
if(_largerStickLR1){
|
if(_largerStickLR1){
|
||||||
STICK_INNER_SIZE = rightStickImage.size.width *1.37;
|
STICK_INNER_SIZE = rightStickImage.size.width *1.33;
|
||||||
STICK_OUTER_SIZE = rightStickBgImage.size.width *1.17;
|
STICK_OUTER_SIZE = rightStickBgImage.size.width *1.10;
|
||||||
_rightStick.bounds = _leftStick.bounds = CGRectMake(0, 0, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
_rightStick.bounds = _leftStick.bounds = CGRectMake(0, 0, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||||
_rightStickBackground.bounds = _leftStickBackground.bounds = CGRectMake(0, 0, STICK_OUTER_SIZE, STICK_OUTER_SIZE);
|
_rightStickBackground.bounds = _leftStickBackground.bounds = CGRectMake(0, 0, STICK_OUTER_SIZE, STICK_OUTER_SIZE);
|
||||||
}
|
}
|
||||||
@@ -907,7 +910,8 @@ static float L3_Y;
|
|||||||
button.cornerRadius = 45;
|
button.cornerRadius = 45;
|
||||||
|
|
||||||
// 使用 shadowPath 定义阴影形状和扩展范围
|
// 使用 shadowPath 定义阴影形状和扩展范围
|
||||||
CGFloat spread = 15; // 扩散的大小
|
CGFloat spread = 15; // 扩散的大小gggkkkoooovv
|
||||||
|
if([button.name isEqualToString:@"leftStick"] || [button.name isEqualToString:@"rightStick"]) spread = 12;
|
||||||
CGRect largerRect = CGRectInset(button.bounds, -spread, -spread);
|
CGRect largerRect = CGRectInset(button.bounds, -spread, -spread);
|
||||||
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:largerRect cornerRadius:button.cornerRadius];
|
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:largerRect cornerRadius:button.cornerRadius];
|
||||||
button.shadowPath = shadowPath.CGPath;
|
button.shadowPath = shadowPath.CGPath;
|
||||||
@@ -1044,6 +1048,7 @@ static float L3_Y;
|
|||||||
_r3Touch = touch;
|
_r3Touch = touch;
|
||||||
updated = true;
|
updated = true;
|
||||||
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
||||||
|
_leftStick.opacity = 1.0; // make stick opaque while being moved
|
||||||
if (l3TouchStart != nil) {
|
if (l3TouchStart != nil) {
|
||||||
// Find elapsed time and convert to milliseconds
|
// Find elapsed time and convert to milliseconds
|
||||||
// Use (-) modifier to conversion since receiver is earlier than now
|
// Use (-) modifier to conversion since receiver is earlier than now
|
||||||
@@ -1059,6 +1064,7 @@ static float L3_Y;
|
|||||||
_lsTouch = touch;
|
_lsTouch = touch;
|
||||||
stickTouch = true;
|
stickTouch = true;
|
||||||
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
||||||
|
_rightStick.opacity = 1.0; // make stick opaque while being moved
|
||||||
if (r3TouchStart != nil) {
|
if (r3TouchStart != nil) {
|
||||||
// Find elapsed time and convert to milliseconds
|
// Find elapsed time and convert to milliseconds
|
||||||
// Use (-) modifier to conversion since receiver is earlier than now
|
// Use (-) modifier to conversion since receiver is earlier than now
|
||||||
@@ -1173,6 +1179,7 @@ static float L3_Y;
|
|||||||
} else if (touch == _lsTouch) {
|
} else if (touch == _lsTouch) {
|
||||||
_leftStick.frame = CGRectMake(LS_CENTER_X - STICK_INNER_SIZE / 2, LS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
_leftStick.frame = CGRectMake(LS_CENTER_X - STICK_INNER_SIZE / 2, LS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||||
_leftStick.shadowOpacity = 0.0;
|
_leftStick.shadowOpacity = 0.0;
|
||||||
|
_leftStick.opacity = STICK_OPACITY; // reset stick to half transparent
|
||||||
[_controllerSupport updateLeftStick:_controller x:0 y:0];
|
[_controllerSupport updateLeftStick:_controller x:0 y:0];
|
||||||
[_controllerSupport clearButtonFlag:_controller flags:LS_CLK_FLAG];
|
[_controllerSupport clearButtonFlag:_controller flags:LS_CLK_FLAG];
|
||||||
l3TouchStart = [NSDate date];
|
l3TouchStart = [NSDate date];
|
||||||
@@ -1181,6 +1188,7 @@ static float L3_Y;
|
|||||||
} else if (touch == _rsTouch) {
|
} else if (touch == _rsTouch) {
|
||||||
_rightStick.frame = CGRectMake(RS_CENTER_X - STICK_INNER_SIZE / 2, RS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
_rightStick.frame = CGRectMake(RS_CENTER_X - STICK_INNER_SIZE / 2, RS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||||
_rightStick.shadowOpacity = 0.0;
|
_rightStick.shadowOpacity = 0.0;
|
||||||
|
_rightStick.opacity = STICK_OPACITY;
|
||||||
[_controllerSupport updateRightStick:_controller x:0 y:0];
|
[_controllerSupport updateRightStick:_controller x:0 y:0];
|
||||||
[_controllerSupport clearButtonFlag:_controller flags:RS_CLK_FLAG];
|
[_controllerSupport clearButtonFlag:_controller flags:RS_CLK_FLAG];
|
||||||
r3TouchStart = [NSDate date];
|
r3TouchStart = [NSDate date];
|
||||||
|
|||||||
Reference in new issue
Block a user