所以我试图在我的精灵套件游戏中实现应用程序购买,我在Swift工作.我知道我需要在我的类中添加SKProductsRequestDelegate和SKPaymentTransactionObserver协议GameScene才能执行此操作,但是当我添加它们时,我得到错误:
Type 'GameScene' does not conform to protocol 'SKProductsRequestDelegate'
Run Code Online (Sandbox Code Playgroud)
和类似的错误SKPaymentTransactionObserver.
我导入了StoreKit,这是我的代码:
import SpriteKit
import AVFoundation
import StoreKit
class GameScene: SKScene, SKPhysicsContactDelegate, SKProductsRequestDelegate, SKPaymentTransactionObserver {
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我已经查看了其他问题,但找不到明确的答案 - 我在故事板中创建了我的UIButton(不是以编程方式),我试图在点击时为整个按钮(不仅仅是文本)着色.我已将色调颜色设置为黑色,但这不会影响整个按钮.
我已经尝试将我的类型设置为系统,因为我听说会影响它但没有任何改变.仍然没有色彩.
此外,我必须非常"强力"触摸/点击(如果在设备上真的按下)甚至触发影响按钮文本的色调颜色,即使按钮单击注册.
按钮的动作功能将被调用,因此它不会影响功能,但文本"突出显示状态"似乎只有在用户点击非常困难时才会触发.
我该如何着色整个按钮?为什么突出显示的状态只能通过强制点击触发?
设置色调 -
尝试使用IBOutlet实现:
@IBOutlet var postBtn: UIButton!
postBtn = customButton()
postBtn.highlightedColor = UIColor.blueColor()
Run Code Online (Sandbox Code Playgroud)
在新文件中创建自定义类后:
public class customButton: UIButton {
public var highlightedColor = UIColor.blueColor()
public var unhighlightedColor = UIColor.clearColor()
override public var highlighted: Bool {
didSet {
if (highlighted) {
self.backgroundColor = UIColor.blueColor()
}
else {
self.backgroundColor = UIColor.clearColor()
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我最初将postBtn声明为a customButton()或者我被告知postBtn没有名为highlightedColor的成员,我会遇到错误的访问错误.我究竟做错了什么?
好吧,我通过https://developer.apple.com/videos/play/wwdc2019/609/提供的 RealityComposer 游戏进行筛选,并尝试找出如何让实体移动到用户点击的位置。
我可以在 .rc 场景中引用我的对象,如下所示:
struct ARViewContainer: UIViewRepresentable {
let arView = ARView(frame: .zero)
func makeUIView(context: Context) -> ARView {
// arView = ARView(frame: .zero)
// Load the "Box" scene from the "Experience" Reality File
let boxAnchor = try! Experience.loadBox()
//*Notifications
setupNotifications(anchor: boxAnchor)
//*Access vars
if boxAnchor.box1 != nil {
//print(box1.position.x)
/// Set local position
boxAnchor.box1!.position = [1.0, 0.0, 0.5]
/// Set world position
//boxAnchor.box1.setPosition([0.5, 0.2, 1.5], relativeTo: nil)
}
Run Code Online (Sandbox Code Playgroud)
我知道这涉及某种形式的 arhitest,但是,我收到以下错误:
UIView最后没有成员?
func touchesBegan(_ touches: Set<UITouch>, …Run Code Online (Sandbox Code Playgroud) 好吧,这就是我想要实现的目标(最好使用 JS/jQuery): https: //dribbble.com/shots/3445331-Expanding-Button
悬停时,我需要一个圆形 div 展开为药丸形状,以便其他按钮可以弹出其中。当我再次单击“x”时,我需要它回滚到圆形。
我只知道如何使用 JS/jQuery 来扩展事物。我怎样才能做到这一点?我只是用插件搜索找不到任何东西。
好的,有使用普通字典执行此操作的答案,但我的字典/要存储的内容的大小不断变化,所以我认为使用列表。这是我存储的内容:
public List<KeyValuePair<GameObject, float>> planesFilled;
Run Code Online (Sandbox Code Playgroud)
我必须不断更新这些值(如果它们生成并且不存在于我的更新函数的列表中,则添加对。我正在存储对象与场景中另一个对象之间的距离。
我遇到了与无法Contains仅调用密钥相关的错误 - 我不一定知道过去的值。我的密钥应该是游戏对象。
到目前为止我所拥有的:
foreach(GameObject plane in anchorManager.planesSpawned)
{
if (ContainsKeyValue(planesFilled.ToDictionary(), plane)) { //dont know value
} else {
planesFilled.Add (new KeyValuePair<GameObject, float>(plane, GetDistanceBetweenObjs(plane.transform, botController.transform)));
}
//planesFilled[plane] = new KeyValuePair<GameObject, float>(plane, GetDistanceBetweenObjs(plane.transform, botController.transform));
//list.Add(new KeyValuePair<double,double>(p.Key,p.Value));
planesFilled.Sort((pair1,pair2) => pair1.Value.CompareTo(pair2.Value));
}
Run Code Online (Sandbox Code Playgroud)
该函数已启动,但在我的场景中并不完全有效:
public bool ContainsKeyValue<TKey, TVal>(Dictionary<TKey, TVal> dictionnaire,
TKey expectedKey,
TVal expectedValue) where TVal : IComparable
{
TVal actualValue;
if (!dictionnaire.TryGetValue(expectedKey, out actualValue))
{
return false;
}
return actualValue.CompareTo(expectedValue) == 0;
}
Run Code Online (Sandbox Code Playgroud)
如何更新现有对象的值或将新对象添加到我的列表字典情况中?
好吧,我有一个大问题,我不知道如何解决,我以前从未遇到过这个问题 - 我的网站有一半不会在移动设备上显示。它被切成两半。我必须在一周内展示这个网站,直到现在才在移动设备上进行测试 - 我不知道该怎么做。这里是:
我有一个全尺寸的图像作为顶部图像,并且其中的文本正在延伸,但是我不知道问题是什么。我在 CSS 中使用了一些媒体选择器,但只是为了改变各种小事情。
我阅读了site-contentCSS 中设置宽度的内容 - 这可能是问题所在吗?
我绝望了 - 我该如何解决这个问题?
swift ×3
css ×2
html ×2
jquery ×2
arkit ×1
c# ×1
dictionary ×1
ios ×1
javascript ×1
list ×1
mobile ×1
sorting ×1
sprite-kit ×1
uibutton ×1