我想在我的游戏中实现一个奖励插页式广告,但我收到了很多 AdColony 错误,例如:“广告请求没有填充”或我的区域 ID 无效。
首先,这将是我配置 AdColony 区域的方式:
Zone is active? Yes
Zone Type: Preroll/Interstitial (Gives me "No fill for ad request error")
Value Exchange/V4VC (Gives me "Zone ID invalid, please check config error")
House Ads: Back Fill
Options: 0 0 1
Development: Show Test Ads Only (Although my app is currently Live)
Run Code Online (Sandbox Code Playgroud)
他们为您提供的 SDK 下载示例适用于应用程序而非游戏,因此我尝试将其翻译为游戏,尽管它没有什么不同,但我当前的代码可能存在问题。所以这就是我在 GameViewController.swift 中的方式。
// Outside I declare a struct
struct Constants
{
static let adColonyAppID = "app5aab6bb6aaf3xxxxxx"
static let adColonyZoneID = "vz19959f95bd62xxxxxx"
static let currencyBalance …Run Code Online (Sandbox Code Playgroud) 我试图理解如何在Swift中创建Vector,因为当我执行CGVectorMake()时,告诉我将dx和dy(衍生物)作为CGFloat传递.如何创建仅包含该信息的Vector(行)?
有人能解释一下吗?喜欢傻瓜?我在谷歌搜索但我仍然找不到简单的解释.
假设我想创建一个从点(0,0)到点(5,5)的向量.
我正在尝试<String, Array()>从json对象创建一个地图.想象一下,我得到了这个json结构:
[
{
"userId": "123123",
"password": "fafafa",
"age": "21"
},
{
"userId": "321321",
"password": "nana123",
"age": "34"
}
]
Run Code Online (Sandbox Code Playgroud)
我想创建的地图将是:
key(string),value(array)
{
"userId": [
"123123",
"321321"
],
"password": [
"fafafa",
"nana123"
],
"age": [
"21",
"34"
]
}
Run Code Online (Sandbox Code Playgroud)
是否有可能做到这一点?:/
提前致谢.
我正在尝试在Windows 7 64位中安装带有Erlang的RabbitMQ.我正在安装:
R16B01 Windows 64 Bit Binary File
rabbitmq-server-3.1.5.exe
Run Code Online (Sandbox Code Playgroud)
一步一步地遵循本教程
http://www.youtube.com/watch?v=x9wwZAuub1w
Run Code Online (Sandbox Code Playgroud)
但是在运行命令时:"rabbitmq-plugins enable rabbitmq_management"
出现此错误:
{error_logger,{{2013,9,12},{13,23,53}},"Failed to create cookie file 'z:/.erlang
.cookie': enoent",[]}
{error_logger,{{2013,9,12},{13,23,53}},crash_report,[[{initial_call,{auth,init,[
'Argument__1']}},{pid,<0.19.0>},{registered_name,[]},{error_info,{exit,{"Failed
to create cookie file 'z:/.erlang.cookie': enoent",[{auth,init_cookie,0,[{file,"
auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server
,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{f
ile,"proc_lib.erl"},{line,239}]}]},[{gen_server,init_it,6,[{file,"gen_server.erl
"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]
}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[<0.17.0>]},{d
ictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},
{reductions,951}],[]]}
{error_logger,{{2013,9,12},{13,23,53}},supervisor_report,[{supervisor,{local,net
_sup}},{errorContext,start_error},{reason,{"Failed to create cookie file 'z:/.er
lang.cookie': enoent",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{auth
,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_server
.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239
}]}]}},{offender,[{pid,undefined},{name,auth},{mfargs,{auth,start_link,[]}},{res
tart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2013,9,12},{13,23,53}},supervisor_report,[{supervisor,{local,ker
nel_sup}},{errorContext,start_error},{reason,{shutdown,{failed_to_start_child,au
th,{"Failed to create cookie file 'z:/.erlang.cookie': enoent",[{auth,init_cooki
e,0,[{file,"auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]}
,{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do
_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}}}},{offender,[{pid,undefined},{na
me,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{
shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2013,9,12},{13,23,53}},crash_report,[[{initial_call,{application
_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0
.9.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,
net_sup,{shutdown,{failed_to_start_child,auth,{"Failed to create cookie file 'z:
/.erlang.cookie': enoent",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{
auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_se
rver.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line
,239}]}]}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"ap …Run Code Online (Sandbox Code Playgroud) 我正在试图找出我的精灵的中心,我使用了一个足球精灵,改变了120到120的大小.我设法获得触摸位置.
获得中心的方法应该是sprite.origin.x +(sprite.width/2),但由于某种原因,我得到的值是没有意义的.因为无论我在哪里触球,触摸位置x总是小于Sprite中心,即使例如我触摸了球的右侧,因此location.x应该>而不是sprite.center. X.
这是获得球的中心点的小代码
let ballCenter = CGVectorMake(ball.position.x + (ball.frame.width / 2),
ball.position.y + (ball.frame.height / 2))
Run Code Online (Sandbox Code Playgroud)
但是当我打印出这样的结果时,总是会出现"真实"的情况.
if location.x < ballCenter.dx {
print("touched on left of ball ", location.x, location.y)
}else{
print("touched on right of ball ", location.x, location.y)
}
Run Code Online (Sandbox Code Playgroud)
这让我发疯,任何人都可以帮我理解这个吗?精灵起源不在左下角?
另外,为什么场景框架如此之小?当我使用iPhone 6S时,我看到我的屏幕宽度为375.0,屏幕高度为667.0,不应该更大吗?这太令人困惑了.
提前致谢.
我得到了一个占据屏幕垂直空间 50% 的 FlatList。这个 FlatList 只有几个项目,因此,并没有占据整个空间,而是占据了其中的一半,当我向上/向下滚动时,它看起来好像有overflow: hidden.
我读这在RN GitHub上了,就推荐使用flexGrow: 1的FlatList的contentContainerStyle,也与父视图flex: 1。但不工作。这仍然有效吗?他们说在 ScrollViews 上使用它,但是 FlatList 不是从 ScrollView 继承的还是类似的东西?
这是我目前的结构:
render() {
return (
<View style={{ flex: 1 }}>
<FlatList
contentContainerStyle={{ flexGrow: 1 }}
numColumns={2}
style={ styles.cardContainer }
keyExtractor={ this._keyExtractor }
data={ this.state.listData }
renderItem={ this._renderItem }
>
</FlatList>
</View>
);
}
Run Code Online (Sandbox Code Playgroud) 我试图在过滤和映射时缩小和类型保护特定对象的属性,但我不完全理解如何做到这一点。
假设我得到了 Person 接口的以下对象数组:
interface IPerson {
name: string;
age: number;
height: number | null;
}
const personArray: IPerson[] = [...]
Run Code Online (Sandbox Code Playgroud)
假设我想首先过滤那些不为空的内容,然后映射结果并对过滤掉的内容执行一些操作。
personArray
.filter((person) => person.height !== null)
.map((person) => this.doSomethingAboutIt(person.height))
Run Code Online (Sandbox Code Playgroud)
该doSomethingAboutIt函数只需要一个数字,而不是空值。这就是为什么我想首先过滤非空。但 TypeScripts 显示一个错误,指出 doSomethingAboutIt 需要 a number,而不是 a number | null。甚至认为在映射函数期间不应该有任何空值。当然 TypeScript 还不知道这一点。我以为它会自动推断出来,但我错了。
如何将类型缩小为仅对象属性的数字?
谢谢。
我做了这个代码
private static List<String> rebuildURLWithComplexValues(String url) {
List<String> tokens = null;
if(url != null && url.length() > 0) {
if(url.contains("flowVars")) {
String[] firstSplit = url.split("\\[");
for (int i = 0; i < firstSplit.length; i++) {
if(firstSplit[i].contains("'")) {
StringTokenizer st = new StringTokenizer(firstSplit[i], "\'");
tokens = new ArrayList<String>();
String token = st.nextToken();
System.out.println(token);
tokens.add(token);
}
}
return tokens;
}
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
Sysout正确地显示每个令牌,但是当我然后迭代arrayList或检查它的大小时,说1(应该是2)并且仅显示添加的最新令牌.
为什么会这样?
谢谢.
每次我对数组的 3 个以上项目执行 v- 时,我都试图创建一行。
我也在使用骨架 CSS。现在,只有 3 个项目的结构如下所示:
<div class="row">
<div class="one-third column" v-for="item in items">
<custom-component item="item"></custom-component>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,我意识到我应该在行元素上而不是在第一列上执行 v-for,但是我应该如何迭代?使用v-if="index % 3 === 0"? 这只是为了验证我们是否处于第 3 次迭代。
有任何想法吗?
谢谢。
我不明白发生了什么,它应该很简单,但由于某种原因,我得到了undefined一个属性,当我调试它时,我可以看到它在那里,不是未定义的。组件已安装,该功能正在安装中使用,并且一切都应该在那里并且可以工作。但 Vue 一直说它是undefined.
这是模板:
<template>
<div class="AnimatedCounter">
<span ref="counterText" class="AnimatedCounter-text">{{ count }}</span>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
mounted() {
this.setCount(this.counter);
},
methods: {
setCount: (val) => {
/* $refs props and $el is "undefined" at runtime */
const obj = this.$refs.counterText;
anime({
targets: this.$el,
n: val,
round: 1,
duration: 500,
easing: "linear",
update: () => {
this.count = obj.n;
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
无论我做什么,都会继续做同样的事情。我缺少什么?
javascript ×4
ios ×3
swift ×3
vue.js ×2
adcolony ×1
erlang ×1
install ×1
java ×1
json ×1
map ×1
math ×1
rabbitmq ×1
react-native ×1
sprite-kit ×1
token ×1
tokenize ×1
typescript ×1
windows ×1