Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qwgame
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵国君
qwgame
Commits
82ff63df
Commit
82ff63df
authored
Dec 11, 2018
by
李进峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add is visible
parent
e04fb7b2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
GameEnv.java
src/GameEnvironment/GameEnv.java
+36
-2
No files found.
src/GameEnvironment/GameEnv.java
View file @
82ff63df
...
@@ -421,7 +421,7 @@ public class GameEnv implements Serializable{
...
@@ -421,7 +421,7 @@ public class GameEnv implements Serializable{
}
}
}
}
/*********************************
*********通过npc获取物品列表************
**********************************/
/*********************************
通过npc获取物品列表
**********************************/
// 通过npcName获取所有物品名称列表
// 通过npcName获取所有物品名称列表
public
List
<
String
>
queryGoodsByNpcName
(
String
npcName
){
public
List
<
String
>
queryGoodsByNpcName
(
String
npcName
){
List
<
String
>
goodsNames
=
new
ArrayList
<
String
>();
List
<
String
>
goodsNames
=
new
ArrayList
<
String
>();
...
@@ -435,8 +435,9 @@ public class GameEnv implements Serializable{
...
@@ -435,8 +435,9 @@ public class GameEnv implements Serializable{
}
}
return
goodsNames
;
return
goodsNames
;
}
}
/**************************************
物品
***************************/
/**************************************
goods*************
***************************/
// 通过类和地点查询所有物品名称
// 通过类和地点查询所有物品名称
// 只有当可以询问的属性为是的时候才可以得到相应的物品列表
public
List
<
String
>
queryGoodsByClassAndSite
(
String
className
,
String
site
){
public
List
<
String
>
queryGoodsByClassAndSite
(
String
className
,
String
site
){
List
<
String
>
goodsNames
=
new
ArrayList
<
String
>();
List
<
String
>
goodsNames
=
new
ArrayList
<
String
>();
List
<
GoodsInstance
>
placeGoodsInstances
=
null
;
List
<
GoodsInstance
>
placeGoodsInstances
=
null
;
...
@@ -511,6 +512,39 @@ public class GameEnv implements Serializable{
...
@@ -511,6 +512,39 @@ public class GameEnv implements Serializable{
return
null
;
return
null
;
}
}
}
}
// 是否可以被询问 npc和物品的属性名称 可被询问
public
boolean
isVisible
(
String
name
)
{
GoodsInstance
goodsInstance
=
this
.
goodsInstanceIndex
.
get
(
name
);
NpcInstance
npcInstance
=
this
.
npcInstanceIndex
.
get
(
name
);
if
(
goodsInstance
!=
null
)
{
List
<
Attr
>
attrs
=
goodsInstance
.
getAttrs
();
for
(
int
i
=
0
;
i
<
attrs
.
size
();
i
++)
{
if
(
attrs
.
get
(
i
).
getName
().
equals
(
"可被询问"
))
{
if
(
attrs
.
get
(
i
).
getValue
().
equals
(
"是"
)){
return
true
;
}
else
{
return
false
;
}
}
}
return
false
;
}
else
if
(
npcInstance
!=
null
)
{
List
<
Attr
>
attrs
=
npcInstance
.
getAttrs
();
for
(
int
i
=
0
;
i
<
attrs
.
size
();
i
++)
{
if
(
attrs
.
get
(
i
).
getName
().
equals
(
"可被询问"
))
{
if
(
attrs
.
get
(
i
).
getValue
().
equals
(
"是"
)){
return
true
;
}
else
{
return
false
;
}
}
}
return
false
;
}
else
{
return
false
;
}
}
/**************************************npc*****************************************/
/**************************************npc*****************************************/
// 通过地点和类查询所有的npc名陈
// 通过地点和类查询所有的npc名陈
public
List
<
String
>
queryNpcByClassAndSite
(
String
className
,
String
site
){
public
List
<
String
>
queryNpcByClassAndSite
(
String
className
,
String
site
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment