Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
T
tuseGameColor
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shujianhe
tuseGameColor
Commits
8f59239f
Commit
8f59239f
authored
Aug 24, 2023
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
性能优化
parent
e506bc57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+1
-1
MainData.cs
Assets/GameMgr/MainData.cs
+6
-4
No files found.
Assets/GameMgr/GameMgr.cs
View file @
8f59239f
...
@@ -67,7 +67,7 @@ public class GameMgr : MonoBehaviour
...
@@ -67,7 +67,7 @@ public class GameMgr : MonoBehaviour
#
endregion
#
endregion
#
region
点击事件逻辑
#
region
点击事件逻辑
public
static
readonly
Vector2
gunSize
=
new
Vector2
(
10
,
5
);
public
static
readonly
Vector2
gunSize
=
new
Vector2
(
50
,
2
);
private
float
time
=
0
;
private
float
time
=
0
;
private
Vector2
pos
=
Vector2
.
zero
;
private
Vector2
pos
=
Vector2
.
zero
;
private
int
isLongPress
=
-
1
;
//-1无逻辑,0按下,1响应点击,2响应长按
private
int
isLongPress
=
-
1
;
//-1无逻辑,0按下,1响应点击,2响应长按
...
...
Assets/GameMgr/MainData.cs
View file @
8f59239f
...
@@ -72,14 +72,15 @@ public class MainData : MonoBehaviour
...
@@ -72,14 +72,15 @@ public class MainData : MonoBehaviour
//点击逻辑,v图内像素坐标,b是否跳过当前选组ID判断,返回bool以判断散弹枪是否终止
//点击逻辑,v图内像素坐标,b是否跳过当前选组ID判断,返回bool以判断散弹枪是否终止
public
bool
OnClickFun
(
Vector2
v
,
bool
b
=
false
)
public
bool
OnClickFun
(
Vector2
v
,
bool
b
=
false
)
{
{
int
Index
=
(
int
)(
v
.
x
+
v
.
y
*
json
.
width
);
//x越界
//x越界
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
false
;
}
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
false
;
}
//y越界
//y越界
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
false
;
}
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
false
;
}
//涂过了,或点击到线
//涂过了,或点击到线
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
return
false
;
}
if
(
c_png
[
Index
]
!=
Color
.
white
)
{
return
false
;
}
Color
c
=
map
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
;
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
Color
c
=
c_map
[
Index
]
;
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
int
roomId
=
ResJsonData
.
ColorToV
(
c
).
x
;
int
roomId
=
ResJsonData
.
ColorToV
(
c
).
x
;
RoomDatas
rd
=
json
.
roomDatas
[
roomId
];
RoomDatas
rd
=
json
.
roomDatas
[
roomId
];
//涂过了
//涂过了
...
@@ -106,14 +107,15 @@ public class MainData : MonoBehaviour
...
@@ -106,14 +107,15 @@ public class MainData : MonoBehaviour
//长按逻辑,v图内像素坐标
//长按逻辑,v图内像素坐标
public
void
OnLongPressPos
(
Vector2
v
)
public
void
OnLongPressPos
(
Vector2
v
)
{
{
int
Index
=
(
int
)(
v
.
x
+
v
.
y
*
json
.
width
);
//x越界
//x越界
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
;
}
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
;
}
//y越界
//y越界
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
;
}
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
;
}
//涂过了,或点击到线
//涂过了,或点击到线
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
return
;
}
if
(
c_png
[
Index
]
!=
Color
.
white
)
{
return
;
}
Color
c
=
map
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
;
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
Color
c
=
c_map
[
Index
]
;
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
int
groupId
=
ResJsonData
.
ColorToV
(
c
).
y
;
int
groupId
=
ResJsonData
.
ColorToV
(
c
).
y
;
ChooseGroup
(
groupId
);
ChooseGroup
(
groupId
);
}
}
...
...
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