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
d3f7db1e
Commit
d3f7db1e
authored
Aug 23, 2023
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加注释
parent
e269b470
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
178 deletions
+109
-178
EffectItem.cs
Assets/GameMgr/EffectItem.cs
+1
-1
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+13
-12
MainData.cs
Assets/GameMgr/MainData.cs
+91
-161
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+3
-3
MaskItemMgr.cs
Assets/GameMgr/MaskItemMgr.cs
+1
-1
No files found.
Assets/GameMgr/EffectItem.cs
View file @
d3f7db1e
...
@@ -16,7 +16,7 @@ public class EffectItem : MonoBehaviour
...
@@ -16,7 +16,7 @@ public class EffectItem : MonoBehaviour
MainData
md
=
GameMgr
.
Ins
.
md
;
MainData
md
=
GameMgr
.
Ins
.
md
;
Transform
p
=
Rect
.
parent
;
Transform
p
=
Rect
.
parent
;
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
png
.
width
/
2
,
md
.
png
.
height
/
2
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
json
.
width
/
2
,
md
.
json
.
height
/
2
);
Rect
.
SetParent
(
p
);
Rect
.
SetParent
(
p
);
MainModule
mm
=
ps
.
main
;
MainModule
mm
=
ps
.
main
;
mm
.
startColor
=
c
;
mm
.
startColor
=
c
;
...
...
Assets/GameMgr/GameMgr.cs
View file @
d3f7db1e
...
@@ -21,12 +21,13 @@ public class GameMgr : MonoBehaviour
...
@@ -21,12 +21,13 @@ public class GameMgr : MonoBehaviour
void
Update
()
void
Update
()
{
{
Save
();
//自动保存逻辑
Click
();
//点击事件逻辑
Click
();
//点击事件逻辑
Play
();
//涂色重播逻辑
Play
();
//涂色重播逻辑
Save
();
//自动保存逻辑
}
}
//初始化,主逻辑入口
#
region
外部接口
//逻辑接口,主逻辑入口,初始化
public
void
Init
(
string
key
,
Texture2D
png
,
Sprite
jpg
,
ResJsonData
json
,
DynamicData
dynamic
,
Texture2D
map
)
public
void
Init
(
string
key
,
Texture2D
png
,
Sprite
jpg
,
ResJsonData
json
,
DynamicData
dynamic
,
Texture2D
map
)
{
{
ins
=
this
;
ins
=
this
;
...
@@ -39,7 +40,6 @@ public class GameMgr : MonoBehaviour
...
@@ -39,7 +40,6 @@ public class GameMgr : MonoBehaviour
{
{
gray
=
_gray
;
gray
=
_gray
;
}
}
//选组接口,传入组ID
//选组接口,传入组ID
public
void
ChooseGroup
(
int
groupId
)
public
void
ChooseGroup
(
int
groupId
)
{
{
...
@@ -63,8 +63,9 @@ public class GameMgr : MonoBehaviour
...
@@ -63,8 +63,9 @@ public class GameMgr : MonoBehaviour
{
{
md
.
AutoClick
();
md
.
AutoClick
();
}
}
#
endregion
#
region
点击
#
region
点击
事件逻辑
public
static
readonly
Vector2
gunSize
=
new
Vector2
(
3
,
10
);
public
static
readonly
Vector2
gunSize
=
new
Vector2
(
3
,
10
);
private
float
time
=
0
;
private
float
time
=
0
;
private
Vector2
pos
=
Vector2
.
zero
;
private
Vector2
pos
=
Vector2
.
zero
;
...
@@ -99,8 +100,8 @@ public class GameMgr : MonoBehaviour
...
@@ -99,8 +100,8 @@ public class GameMgr : MonoBehaviour
isLongPress
=
-
1
;
isLongPress
=
-
1
;
RectTransformUtility
.
ScreenPointToLocalPointInRectangle
(
md
.
rect
,
Input
.
mousePosition
,
Camera
.
main
,
out
Vector2
v
);
RectTransformUtility
.
ScreenPointToLocalPointInRectangle
(
md
.
rect
,
Input
.
mousePosition
,
Camera
.
main
,
out
Vector2
v
);
Debug
.
Log
(
"长按:"
+
v
);
Debug
.
Log
(
"长按:"
+
v
);
v
.
x
+=
md
.
png
.
width
/
2
;
v
.
x
+=
md
.
json
.
width
/
2
;
v
.
y
+=
md
.
png
.
height
/
2
;
v
.
y
+=
md
.
json
.
height
/
2
;
v
.
x
=
(
int
)
v
.
x
;
v
.
x
=
(
int
)
v
.
x
;
v
.
y
=
(
int
)
v
.
y
;
v
.
y
=
(
int
)
v
.
y
;
md
.
OnLongPressPos
(
v
);
md
.
OnLongPressPos
(
v
);
...
@@ -140,13 +141,13 @@ public class GameMgr : MonoBehaviour
...
@@ -140,13 +141,13 @@ public class GameMgr : MonoBehaviour
//点击由坐标系转图内像素坐标
//点击由坐标系转图内像素坐标
public
bool
OnClickPixel
(
Vector2
v
)
public
bool
OnClickPixel
(
Vector2
v
)
{
{
v
.
x
+=
md
.
png
.
width
/
2
;
v
.
x
+=
md
.
json
.
width
/
2
;
v
.
y
+=
md
.
png
.
height
/
2
;
v
.
y
+=
md
.
json
.
height
/
2
;
return
md
.
OnClick
Pos
(
v
);
return
md
.
OnClick
Fun
(
v
);
}
}
#
endregion
#
endregion
#
region
重播逻辑
#
region
涂色
重播逻辑
private
int
stepIndex
=
-
1
;
//重播判断值,-1不处理,0及以上为重播到第几步
private
int
stepIndex
=
-
1
;
//重播判断值,-1不处理,0及以上为重播到第几步
private
static
readonly
float
delay
=
0.5f
;
//重播延迟
private
static
readonly
float
delay
=
0.5f
;
//重播延迟
private
static
readonly
float
maxTime
=
0.1f
;
//重播步间隔
private
static
readonly
float
maxTime
=
0.1f
;
//重播步间隔
...
@@ -174,7 +175,7 @@ public class GameMgr : MonoBehaviour
...
@@ -174,7 +175,7 @@ public class GameMgr : MonoBehaviour
}
}
#
endregion
#
endregion
#
region
保存逻辑
#
region
自动
保存逻辑
private
float
saveTime
=
-
1
;
//保存判断值,由正变负则保存
private
float
saveTime
=
-
1
;
//保存判断值,由正变负则保存
//保存接口,点击涂色触发
//保存接口,点击涂色触发
public
void
SaveTime
()
public
void
SaveTime
()
...
@@ -193,7 +194,7 @@ public class GameMgr : MonoBehaviour
...
@@ -193,7 +194,7 @@ public class GameMgr : MonoBehaviour
saveTime
-=
Time
.
deltaTime
;
saveTime
-=
Time
.
deltaTime
;
if
(
saveTime
<=
0
)
if
(
saveTime
<=
0
)
{
{
md
.
Save
(
);
SaveManager
.
Instance
.
SaveRes
(
md
.
key
,
md
.
dynamic
,
md
.
png
);
Debug
.
Log
(
"自动保存"
);
Debug
.
Log
(
"自动保存"
);
}
}
}
}
...
...
Assets/GameMgr/MainData.cs
View file @
d3f7db1e
...
@@ -9,184 +9,129 @@ using UnityEngine;
...
@@ -9,184 +9,129 @@ using UnityEngine;
using
UnityEngine.EventSystems
;
using
UnityEngine.EventSystems
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
//System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
//sw.Start();
//sw.Stop();
//Debug.Log("耗时:" + sw.ElapsedMilliseconds);
public
class
MainData
:
MonoBehaviour
public
class
MainData
:
MonoBehaviour
{
{
public
static
Vector4
config
=
new
Vector4
(
0
,
150
,
725f
,
725f
);
public
static
Vector2
config
=
new
Vector2
(
725f
,
1250f
);
//基于开发分辨率设置进游戏时的缩放比例
public
string
key
=
""
;
public
Texture2D
png
=
null
;
//资源
public
Sprite
jpg
=
null
;
public
string
key
=
""
;
//当前资源key
public
Texture2D
map
=
null
;
public
Texture2D
png
=
null
;
//线框图
public
ResJsonData
json
;
public
Sprite
jpg
=
null
;
//彩色图
public
DynamicData
dynamic
;
public
Texture2D
map
=
null
;
//点阵图
public
ResJsonData
json
;
//json配置
public
DynamicData
dynamic
;
//动态数据
public
Image
imgpng
;
public
Image
imgpng
;
//线框图组件
public
Image
imgjpg
;
public
Image
imgjpg
;
//彩色图组件
public
RectTransform
rect
;
public
RectTransform
rect
;
//本节点
public
int
curGroupId
=
-
1
;
public
int
curGroupId
=
-
1
;
//当前选组ID
//初始化逻辑,获取资源,解析资源,初始化显示
public
void
Init
(
string
_key
,
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_json
,
DynamicData
_dynamic
,
Texture2D
_map
)
public
void
Init
(
string
_key
,
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_json
,
DynamicData
_dynamic
,
Texture2D
_map
)
{
{
ChooseGroup
();
ChooseGroup
();
//用于清空当前选组
//资源赋值
key
=
_key
;
key
=
_key
;
png
=
_png
;
png
=
_png
;
jpg
=
_jpg
;
jpg
=
_jpg
;
map
=
_map
;
map
=
_map
;
json
=
_json
;
json
=
_json
;
dynamic
=
_dynamic
;
dynamic
=
_dynamic
;
json
.
JoinMap
(
map
);
//把点阵数据放进json配置以快速获取某个区域的所有点
json
.
JoinMap
(
map
);
imgjpg
.
sprite
=
jpg
;
//由layout组件自动适应大小
imgpng
.
sprite
=
Sprite
.
Create
(
png
,
new
Rect
(
0
,
0
,
json
.
width
,
json
.
height
),
new
Vector2
(
0.5f
,
0.5f
));
imgpng
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
json
.
width
,
json
.
height
);
//自动适应大小基础
imgpng
.
sprite
=
Sprite
.
Create
(
png
,
new
Rect
(
0
,
0
,
png
.
width
,
png
.
height
),
new
Vector2
(
0.5f
,
0.5f
));
GameMgr
.
Ins
.
miMgr
.
Init
(
json
,
dynamic
,
png
);
//初始化遮罩
imgpng
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
png
.
width
,
png
.
height
);
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
dynamic
,
png
);
//初始化文本
imgjpg
.
sprite
=
jpg
;
imgjpg
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
png
.
width
,
png
.
height
);
float
w
=
config
.
z
/
png
.
width
;
float
w
=
config
.
x
/
json
.
width
;
float
h
=
config
.
w
/
png
.
height
;
float
h
=
config
.
y
/
json
.
height
;
float
s
=
Math
.
Min
(
w
,
h
);
float
s
=
Math
.
Min
(
w
,
h
);
transform
.
parent
.
localScale
=
Vector3
.
one
*
s
;
transform
.
parent
.
localScale
=
Vector3
.
one
*
s
;
transform
.
parent
.
localPosition
=
new
Vector3
(
config
.
x
,
config
.
y
,
0
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
,
true
);
//初始化缩放
GameMgr
.
Ins
.
miMgr
.
Init
(
json
,
dynamic
,
png
);
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
dynamic
,
png
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
,
true
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
,
dynamic
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
,
dynamic
);
//抛事件初始化组按钮
}
}
//点击逻辑,v图内像素坐标,b是否跳过当前选组ID判断,返回bool以判断散弹枪是否终止
public
bool
OnClick
Pos
(
Vector2
v
,
bool
b
=
false
)
public
bool
OnClick
Fun
(
Vector2
v
,
bool
b
=
false
)
{
{
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
//x越界
sw
.
Start
();
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
false
;
}
if
(
v
.
x
<
0
||
v
.
x
>=
png
.
width
)
//y越界
{
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
false
;
}
//Debug.Log("x越界:" + v.x);
//涂过了,或点击到线
return
false
;
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
return
false
;
}
}
if
(
v
.
y
<
0
||
v
.
y
>=
png
.
height
)
int
index
=
(
int
)(
v
.
x
+
v
.
y
*
json
.
width
);
//图内像素坐标转图内像素索引
{
Color
[]
c_map
=
map
.
GetPixels
();
//点阵数据
//Debug.Log("y越界:" + v.y);
Color
c
=
c_map
[
index
];
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
return
false
;
}
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
//Debug.Log("涂过了");
return
false
;
}
if
(
FunDo
(
v
,
b
))
{
sw
.
Stop
();
Debug
.
Log
(
"涂色全耗时:"
+
sw
.
ElapsedMilliseconds
);
return
true
;
}
return
false
;
}
public
bool
FunDo
(
Vector2
v
,
bool
b
=
false
)
{
int
index
=
(
int
)(
v
.
x
+
v
.
y
*
png
.
width
);
Color
[]
c_map
=
map
.
GetPixels
();
Color
c
=
c_map
[
index
];
int
roomId
=
ResJsonData
.
ColorToV
(
c
).
x
;
int
roomId
=
ResJsonData
.
ColorToV
(
c
).
x
;
RoomDatas
rd
=
json
.
roomDatas
[
roomId
];
RoomDatas
rd
=
json
.
roomDatas
[
roomId
];
if
(
rd
==
null
)
//涂过了
{
if
(
dynamic
.
step
.
Contains
(
rd
.
id
))
{
return
false
;
}
Debug
.
LogError
(
"沒找到點:"
+
v
.
x
+
"-"
+
v
.
y
);
//判断是否当前选组
return
false
;
if
(
rd
.
groupId
!=
curGroupId
&&
!
b
)
{
return
false
;
}
}
//染色逻辑
if
(
dynamic
.
step
.
Contains
(
rd
.
id
))
Color
[]
c_png
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
rd
.
posIndex
.
Count
;
i
++)
{
{
Debug
.
LogError
(
"點過了:"
+
rd
.
id
);
c_png
[
rd
.
posIndex
[
i
]]
=
Color
.
clear
;
return
false
;
}
}
if
(
rd
.
groupId
==
curGroupId
||
b
)
png
.
SetPixels
(
c_png
);
{
png
.
Apply
();
Color
[]
c_png
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
rd
.
posIndex
.
Count
;
i
++)
{
c_png
[
rd
.
posIndex
[
i
]]
=
Color
.
clear
;
}
png
.
SetPixels
(
c_png
);
png
.
Apply
();
dynamic
.
AddData
(
rd
.
groupId
,
rd
.
id
);
dynamic
.
AddData
(
rd
.
groupId
,
rd
.
id
);
//更新动态数据
RoomGroupsData
rgd
=
json
.
roomGroupsData
[
rd
.
groupId
-
1
];
RoomGroupsData
rgd
=
json
.
roomGroupsData
[
rd
.
groupId
-
1
];
GameMgr
.
Ins
.
eiMgr
.
Create
(
new
Color
(
rgd
.
R
/
255f
,
rgd
.
G
/
255f
,
rgd
.
B
/
255f
,
1
),
v
);
GameMgr
.
Ins
.
eiMgr
.
Create
(
new
Color
(
rgd
.
R
/
255f
,
rgd
.
G
/
255f
,
rgd
.
B
/
255f
,
1
),
v
);
//创建点击特效
GameMgr
.
Ins
.
tiMgr
.
HideId
(
rd
.
id
);
GameMgr
.
Ins
.
tiMgr
.
HideId
(
rd
.
id
);
//隐藏当前文本
GameMgr
.
Ins
.
miMgr
.
Play
(
v
,
rd
.
id
);
GameMgr
.
Ins
.
miMgr
.
Play
(
v
,
rd
.
id
);
//播放当前遮罩
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GropuItemChange
,
rgd
,
dynamic
);
GameMgr
.
Ins
.
SaveTime
();
//触发自动保存
GameMgr
.
Ins
.
SaveTime
();
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GropuItemChange
,
rgd
,
dynamic
);
//抛事件更新组按钮
return
true
;
return
true
;
}
return
false
;
}
}
//长按逻辑,v图内像素坐标
public
void
OnLongPressPos
(
Vector2
v
)
{
//x越界
if
(
v
.
x
<
0
||
v
.
x
>=
json
.
width
)
{
return
;
}
//y越界
if
(
v
.
y
<
0
||
v
.
y
>=
json
.
height
)
{
return
;
}
//涂过了,或点击到线
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
return
;
}
int
index
=
(
int
)(
v
.
x
+
v
.
y
*
json
.
width
);
//图内像素坐标转图内像素索引
Color
[]
c_map
=
map
.
GetPixels
();
//点阵数据
Color
c
=
c_map
[
index
];
//点击的点阵数据:rgba,rg为房间ID,ba为组ID
int
groupId
=
ResJsonData
.
ColorToV
(
c
).
y
;
ChooseGroup
(
groupId
);
}
//选组逻辑,id组ID
public
void
ChooseGroup
(
int
id
=
-
1
)
public
void
ChooseGroup
(
int
id
=
-
1
)
{
{
if
(
id
==
-
1
)
if
(
id
==
-
1
)
{
{
curGroupId
=
id
;
curGroupId
=
id
;
GameMgr
.
Ins
.
miMgr
.
Show
();
GameMgr
.
Ins
.
miMgr
.
Show
(
curGroupId
);
//选组-1隐藏全部遮罩
}
Debug
.
Log
(
"选中组:"
+
id
);
if
(
curGroupId
==
id
)
{
return
;
}
}
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
if
(
curGroupId
==
id
)
{
return
;
}
sw
.
Start
();
curGroupId
=
id
;
curGroupId
=
id
;
GameMgr
.
Ins
.
miMgr
.
Show
(
curGroupId
);
GameMgr
.
Ins
.
miMgr
.
Show
(
curGroupId
);
//显示当前选组遮罩
//GameMgr.Ins.miMgr.CircleAll();
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_ChoiseGroupByPic
,
curGroupId
);
//抛事件反选组按钮
//List<int> roomIds = json.roomGroupsData[curGroupId - 1].roomIds;
//for (int i = 0; i < roomIds.Count; i++)
//{
// RoomDatas rd = json.roomDatas[roomIds[i]];
// if (!dynamic.step.Contains(rd.id))
// {
// ExRoomDatas erd = new ExRoomDatas();
// for (int j = 0; j < rd.posIndex.Count; j++)
// {
// erd.AddData(rd.posIndex[j], png.width);
// }
// GameMgr.Ins.miMgr.Create(this, erd, rd.id, rd.groupId);
// }
//}
sw
.
Stop
();
Debug
.
Log
(
"选组耗时:"
+
sw
.
ElapsedMilliseconds
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_ChoiseGroupByPic
,
curGroupId
);
}
}
//重置逻辑
public
void
OnLongPressPos
(
Vector2
v
)
{
if
(
v
.
x
<
0
||
v
.
x
>=
png
.
width
)
{
//Debug.Log("x越界:" + v.x);
return
;
}
if
(
v
.
y
<
0
||
v
.
y
>=
png
.
height
)
{
//Debug.Log("y越界:" + v.y);
return
;
}
if
(
png
.
GetPixel
((
int
)
v
.
x
,
(
int
)
v
.
y
)
!=
Color
.
white
)
{
//Debug.Log("涂过了");
return
;
}
int
index
=
(
int
)(
v
.
x
+
v
.
y
*
png
.
width
);
Color
[]
c_map
=
map
.
GetPixels
();
Color
c
=
c_map
[
index
];
int
groupId
=
ResJsonData
.
ColorToV
(
c
).
y
;
ChooseGroup
(
groupId
);
}
public
void
Clear
()
public
void
Clear
()
{
{
dynamic
=
new
DynamicData
();
dynamic
=
new
DynamicData
();
//动态数据直接舍弃
//重置染色
Color
[]
c
=
png
.
GetPixels
();
Color
[]
c
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
{
{
...
@@ -197,38 +142,23 @@ public class MainData : MonoBehaviour
...
@@ -197,38 +142,23 @@ public class MainData : MonoBehaviour
}
}
png
.
SetPixels
(
c
);
png
.
SetPixels
(
c
);
png
.
Apply
();
png
.
Apply
();
SaveManager
.
Instance
.
SaveRes
(
key
,
dynamic
,
png
);
SaveManager
.
Instance
.
SaveRes
(
key
,
dynamic
,
png
);
//保存
}
}
//重播逻辑
public
void
RePlay
()
public
void
RePlay
()
{
{
ChooseGroup
();
ChooseGroup
();
//用于清空当前选组
GameMgr
.
Ins
.
miMgr
.
Replay
();
GameMgr
.
Ins
.
miMgr
.
Replay
();
//ExRoomDatas erd = new ExRoomDatas();
//for (int i = 0; i < dynamic.step.Count; i++)
//{
// RoomDatas rd = json.roomDatas[dynamic.step[i]];
// erd.Init();
// for (int j = 0; j < rd.posIndex.Count; j++)
// {
// erd.AddData(rd.posIndex[j], png.width);
// }
// GameMgr.Ins.miMgr.Create(this, erd, rd.id, rd.groupId);
//}
}
}
//辅助涂色逻辑
public
void
Save
()
{
SaveManager
.
Instance
.
SaveRes
(
key
,
dynamic
,
png
);
}
public
void
AutoClick
()
public
void
AutoClick
()
{
{
List
<
int
>
list
=
json
.
roomGroupsData
[
curGroupId
-
1
].
roomIds
;
List
<
int
>
list
=
json
.
roomGroupsData
[
curGroupId
-
1
].
roomIds
;
//当前选中组全部房间ID
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
{
if
(!
dynamic
.
step
.
Contains
(
list
[
i
]))
if
(!
dynamic
.
step
.
Contains
(
list
[
i
]))
//已涂过的跳过
{
{
OnClick
Pos
(
new
Vector2
(
json
.
roomDatas
[
list
[
i
]].
px
,
json
.
roomDatas
[
list
[
i
]].
py
));
OnClick
Fun
(
new
Vector2
(
json
.
roomDatas
[
list
[
i
]].
px
,
json
.
roomDatas
[
list
[
i
]].
py
));
return
;
return
;
}
}
}
}
...
...
Assets/GameMgr/MaskItem.cs
View file @
d3f7db1e
...
@@ -58,12 +58,12 @@ public class MaskItem : MonoBehaviour
...
@@ -58,12 +58,12 @@ public class MaskItem : MonoBehaviour
//坐标计算
//坐标计算
Transform
p
=
Rect
.
parent
;
Transform
p
=
Rect
.
parent
;
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
png
.
width
/
2
,
md
.
png
.
height
/
2
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
json
.
width
/
2
,
md
.
json
.
height
/
2
);
Rect
.
SetParent
(
p
);
Rect
.
SetParent
(
p
);
Rect
.
localScale
=
Vector2
.
one
;
Rect
.
localScale
=
Vector2
.
one
;
SPRect
.
SetParent
(
md
.
imgpng
.
transform
);
SPRect
.
SetParent
(
md
.
imgpng
.
transform
);
SPRect
.
localPosition
=
new
Vector3
(
erd
.
size
.
x
+
(
erd
.
size
.
z
+
1
-
erd
.
size
.
x
)
/
2
-
(
md
.
png
.
width
+
1
)
/
2
,
erd
.
size
.
y
+
(
erd
.
size
.
w
+
1
-
erd
.
size
.
y
)
/
2
-
(
md
.
png
.
height
+
1
)
/
2
,
0
);
SPRect
.
localPosition
=
new
Vector3
(
erd
.
size
.
x
+
(
erd
.
size
.
z
+
1
-
erd
.
size
.
x
)
/
2
-
(
md
.
json
.
width
+
1
)
/
2
,
erd
.
size
.
y
+
(
erd
.
size
.
w
+
1
-
erd
.
size
.
y
)
/
2
-
(
md
.
json
.
height
+
1
)
/
2
,
0
);
SPRect
.
SetParent
(
Rect
);
SPRect
.
SetParent
(
Rect
);
SPRect
.
localScale
=
Vector2
.
one
;
SPRect
.
localScale
=
Vector2
.
one
;
...
@@ -87,7 +87,7 @@ public class MaskItem : MonoBehaviour
...
@@ -87,7 +87,7 @@ public class MaskItem : MonoBehaviour
Transform
p
=
Rect
.
parent
;
Transform
p
=
Rect
.
parent
;
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
png
.
width
/
2
,
md
.
png
.
height
/
2
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
json
.
width
/
2
,
md
.
json
.
height
/
2
);
Rect
.
SetParent
(
p
);
Rect
.
SetParent
(
p
);
SPRect
.
SetParent
(
Rect
);
SPRect
.
SetParent
(
Rect
);
...
...
Assets/GameMgr/MaskItemMgr.cs
View file @
d3f7db1e
...
@@ -115,7 +115,7 @@ public class MaskItemMgr : MonoBehaviour
...
@@ -115,7 +115,7 @@ public class MaskItemMgr : MonoBehaviour
ExRoomDatas
erd
=
new
ExRoomDatas
();
ExRoomDatas
erd
=
new
ExRoomDatas
();
for
(
int
k
=
0
;
k
<
rd
.
posIndex
.
Count
;
k
++)
for
(
int
k
=
0
;
k
<
rd
.
posIndex
.
Count
;
k
++)
{
{
erd
.
AddData
(
rd
.
posIndex
[
k
],
GameMgr
.
Ins
.
md
.
png
.
width
);
erd
.
AddData
(
rd
.
posIndex
[
k
],
GameMgr
.
Ins
.
md
.
json
.
width
);
}
}
return
Create
(
GameMgr
.
Ins
.
md
,
erd
,
rd
.
id
,
rd
.
groupId
);
return
Create
(
GameMgr
.
Ins
.
md
,
erd
,
rd
.
id
,
rd
.
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