我如何根据我的光线投射检测到的标记来接收项目?
我们假设地面上有一把铜剑, 然后按“F”捡起来。
现在脚本应检测标签“CopperSword”并在库存中放置一个铜剑,或者如果标签发生在“IronSword”中,则应在库存中放置一把Iron Sword,依此类推。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.rvsoftcorp.zetaride.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:id="@+id/app_bar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="170dp"
android:background="?attr/colorPrimaryDark"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:alpha="0.9"></android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<View
android:id="@+id/ntb_sample_5"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/toolbar"
app:layout_anchorGravity="bottom|end"/
我可以硬编码每个“if-statement”来添加每个特定项目,但如果我有很多项目,那就不会感觉很诱人。所以必须有一种更简单的方法来解决这个问题。
答案 0 :(得分:0)
&#34;粘土会告诉他那个塑造它的东西,是什么使你成为什么?&#34;圣经,以赛亚书,45:9