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
c9580d36
Commit
c9580d36
authored
Aug 23, 2023
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除不必要的函数参数
parent
d3f7db1e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
62 deletions
+84
-62
MainData.cs
Assets/GameMgr/MainData.cs
+2
-2
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+14
-6
MaskItemMgr.cs
Assets/GameMgr/MaskItemMgr.cs
+28
-31
TextItem.cs
Assets/GameMgr/TextItem.cs
+16
-0
TextItemMgr.cs
Assets/GameMgr/TextItemMgr.cs
+24
-23
No files found.
Assets/GameMgr/MainData.cs
View file @
c9580d36
...
...
@@ -49,8 +49,8 @@ public class MainData : MonoBehaviour
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
);
//自动适应大小基础
GameMgr
.
Ins
.
miMgr
.
Init
(
json
,
dynamic
,
png
);
//初始化遮罩
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
dynamic
,
png
);
//初始化文本
GameMgr
.
Ins
.
miMgr
.
Init
();
//初始化遮罩
GameMgr
.
Ins
.
tiMgr
.
Init
();
//初始化文本
float
w
=
config
.
x
/
json
.
width
;
float
h
=
config
.
y
/
json
.
height
;
...
...
Assets/GameMgr/MaskItem.cs
View file @
c9580d36
...
...
@@ -6,7 +6,6 @@ using UnityEngine.UI;
public
class
MaskItem
:
MonoBehaviour
{
public
bool
bigArea
=
false
;
public
int
roomId
=
-
1
;
public
int
groupId
=
-
1
;
public
float
IsUse
=
-
1
;
...
...
@@ -28,11 +27,11 @@ public class MaskItem : MonoBehaviour
Hide
();
}
}
public
void
Init
(
MainData
md
,
ExRoomDatas
erd
,
int
_roomId
,
int
_groupI
d
)
public
void
Init
(
ExRoomDatas
erd
,
RoomGroupsData
rgd
,
RoomDatas
r
d
)
{
Vector3
v
=
Vector3
.
zero
;
roomId
=
_roomI
d
;
groupId
=
_groupI
d
;
MainData
md
=
GameMgr
.
Ins
.
md
;
roomId
=
rd
.
i
d
;
groupId
=
rgd
.
i
d
;
//创建图片
Texture2D
te
=
new
Texture2D
((
int
)(
erd
.
size
.
z
-
erd
.
size
.
x
+
1
),
(
int
)(
erd
.
size
.
w
-
erd
.
size
.
y
+
1
),
TextureFormat
.
RGBA32
,
false
);
Color
[]
colors
=
te
.
GetPixels
();
...
...
@@ -58,7 +57,7 @@ public class MaskItem : MonoBehaviour
//坐标计算
Transform
p
=
Rect
.
parent
;
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
json
.
width
/
2
,
md
.
json
.
height
/
2
)
;
Rect
.
localPosition
=
Vector3
.
zero
;
Rect
.
SetParent
(
p
);
Rect
.
localScale
=
Vector2
.
one
;
...
...
@@ -72,6 +71,15 @@ public class MaskItem : MonoBehaviour
size
=
erd
.
size
;
}
public
void
Circle
()
{
roomId
=
-
1
;
groupId
=
-
1
;
IsUse
=
-
1
;
gameObject
.
SetActive
(
false
);
}
public
void
Show
()
{
gameObject
.
SetActive
(
true
);
...
...
Assets/GameMgr/MaskItemMgr.cs
View file @
c9580d36
using
DG.Tweening
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
...
...
@@ -27,32 +24,22 @@ public class MaskItemMgr : MonoBehaviour
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
temp
.
roomId
=
-
1
;
temp
.
groupId
=
-
1
;
temp
.
IsUse
=
-
1
;
temp
.
gameObject
.
SetActive
(
false
);
temp
.
Circle
();
}
}
public
MaskItem
Create
(
MainData
md
,
ExRoomDatas
erd
,
int
roomId
,
int
groupId
)
{
MaskItem
temp
=
Get
();
temp
.
Init
(
md
,
erd
,
roomId
,
groupId
);
return
temp
;
}
public
void
Play
(
Vector3
v
,
int
id
)
{
for
(
int
i
=
0
;
i
<
useList
.
Count
;
i
++)
public
void
CircleAll
()
{
if
(
useList
[
i
].
roomId
==
id
)
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--
)
{
useList
[
i
].
Play
(
v
);
}
Circle
(
useList
[
i
]);
}
}
public
void
Init
(
ResJsonData
rjd
,
DynamicData
dynamic
,
Texture2D
png
)
public
void
Init
()
{
MainData
md
=
GameMgr
.
Ins
.
md
;
ResJsonData
rjd
=
md
.
json
;
DynamicData
dynamic
=
md
.
dynamic
;
Texture2D
png
=
md
.
png
;
CircleAll
();
float
f
=
png
.
width
*
png
.
height
*
0.01f
;
for
(
int
i
=
0
;
i
<
rjd
.
roomGroupsData
.
Count
;
i
++)
...
...
@@ -62,26 +49,36 @@ public class MaskItemMgr : MonoBehaviour
{
RoomDatas
rd
=
rjd
.
roomDatas
[
rgd
.
roomIds
[
j
]];
if
(
rd
.
posIndex
.
Count
>
f
)
//if (!dynamic.step.Contains(rd.id))
{
ExRoomDatas
erd
=
new
ExRoomDatas
();
for
(
int
k
=
0
;
k
<
rd
.
posIndex
.
Count
;
k
++)
{
erd
.
AddData
(
rd
.
posIndex
[
k
],
png
.
width
);
}
Create
(
GameMgr
.
Ins
.
md
,
erd
,
rd
.
id
,
rd
.
groupI
d
);
Create
(
erd
,
rgd
,
r
d
);
}
}
}
}
public
MaskItem
Create
(
ExRoomDatas
erd
,
RoomGroupsData
rgd
,
RoomDatas
rd
)
{
MaskItem
temp
=
Get
();
temp
.
Init
(
erd
,
rgd
,
rd
);
return
temp
;
}
public
void
CircleAll
(
)
public
void
Play
(
Vector3
v
,
int
id
)
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--
)
for
(
int
i
=
0
;
i
<
useList
.
Count
;
i
++
)
{
Circle
(
useList
[
i
]);
if
(
useList
[
i
].
roomId
==
id
)
{
useList
[
i
].
Play
(
v
);
}
}
}
public
void
Show
(
int
groupId
=
-
1
)
{
...
...
@@ -95,7 +92,7 @@ public class MaskItemMgr : MonoBehaviour
for
(
int
i
=
0
;
i
<
rgd
.
roomIds
.
Count
;
i
++)
{
RoomDatas
rd
=
GameMgr
.
Ins
.
md
.
json
.
roomDatas
[
rgd
.
roomIds
[
i
]];
MaskItem
item
=
IsHave
(
r
d
.
i
d
,
rd
);
MaskItem
item
=
IsHave
(
r
g
d
,
rd
);
if
(!
GameMgr
.
Ins
.
md
.
dynamic
.
step
.
Contains
(
item
.
roomId
))
{
item
.
Show
();
...
...
@@ -103,11 +100,11 @@ public class MaskItemMgr : MonoBehaviour
}
}
}
public
MaskItem
IsHave
(
int
roomI
d
,
RoomDatas
rd
)
public
MaskItem
IsHave
(
RoomGroupsData
rg
d
,
RoomDatas
rd
)
{
for
(
int
j
=
0
;
j
<
useList
.
Count
;
j
++)
{
if
(
useList
[
j
].
roomId
==
r
oomI
d
)
if
(
useList
[
j
].
roomId
==
r
d
.
i
d
)
{
return
useList
[
j
];
}
...
...
@@ -117,7 +114,7 @@ public class MaskItemMgr : MonoBehaviour
{
erd
.
AddData
(
rd
.
posIndex
[
k
],
GameMgr
.
Ins
.
md
.
json
.
width
);
}
return
Create
(
GameMgr
.
Ins
.
md
,
erd
,
rd
.
id
,
rd
.
groupI
d
);
return
Create
(
erd
,
rgd
,
r
d
);
}
public
void
Replay
(
int
roomId
=
-
1
)
...
...
Assets/GameMgr/TextItem.cs
View file @
c9580d36
...
...
@@ -9,6 +9,7 @@ using UnityEngine.UI;
public
class
TextItem
:
MonoBehaviour
{
public
int
roomId
=
-
1
;
public
int
groupId
=
-
1
;
public
TextMeshProUGUI
Text
;
public
void
Show
()
...
...
@@ -19,4 +20,19 @@ public class TextItem : MonoBehaviour
{
gameObject
.
SetActive
(
false
);
}
public
void
Circle
()
{
gameObject
.
SetActive
(
false
);
}
public
void
Init
(
RoomGroupsData
rgd
,
RoomDatas
rd
)
{
MainData
md
=
GameMgr
.
Ins
.
md
;
roomId
=
rd
.
id
;
groupId
=
rgd
.
id
;
Text
.
fontSize
=
rd
.
pr
;
transform
.
localPosition
=
new
Vector3
(
rd
.
px
-
md
.
json
.
width
/
2f
,
rd
.
py
-
md
.
json
.
height
/
2f
,
0
);
Text
.
text
=
groupId
.
ToString
();
}
}
Assets/GameMgr/TextItemMgr.cs
View file @
c9580d36
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
...
...
@@ -20,23 +18,13 @@ public class TextItemMgr : MonoBehaviour
useList
.
Add
(
ret
);
return
ret
;
}
public
void
HideId
(
int
id
)
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
if
(
useList
[
i
].
roomId
==
id
)
{
useList
[
i
].
Hide
();
}
}
}
public
void
Circle
(
TextItem
temp
)
{
if
(
useList
.
Contains
(
temp
))
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
temp
.
gameObject
.
SetActive
(
false
);
temp
.
Circle
(
);
}
}
public
void
CircleAll
()
...
...
@@ -46,8 +34,12 @@ public class TextItemMgr : MonoBehaviour
Circle
(
useList
[
i
]);
}
}
public
void
Init
(
ResJsonData
rjd
,
DynamicData
dynamic
,
Texture2D
png
)
public
void
Init
()
{
MainData
md
=
GameMgr
.
Ins
.
md
;
ResJsonData
rjd
=
md
.
json
;
DynamicData
dynamic
=
md
.
dynamic
;
Texture2D
png
=
md
.
png
;
CircleAll
();
for
(
int
i
=
0
;
i
<
rjd
.
roomGroupsData
.
Count
;
i
++)
{
...
...
@@ -55,14 +47,23 @@ public class TextItemMgr : MonoBehaviour
for
(
int
j
=
0
;
j
<
rgd
.
roomIds
.
Count
;
j
++)
{
RoomDatas
rd
=
rjd
.
roomDatas
[
rgd
.
roomIds
[
j
]];
//if (!dynamic.step.Contains(rd.id))
Create
(
rgd
,
rd
);
}
}
}
public
TextItem
Create
(
RoomGroupsData
rgd
,
RoomDatas
rd
)
{
TextItem
temp
=
Get
();
temp
.
roomId
=
rd
.
id
;
temp
.
Text
.
fontSize
=
rd
.
pr
;
temp
.
transform
.
localPosition
=
new
Vector3
(
rd
.
px
-
png
.
width
/
2f
,
rd
.
py
-
png
.
height
/
2f
,
0
);
temp
.
Text
.
text
=
rgd
.
id
.
ToString
();
temp
.
Init
(
rgd
,
rd
);
return
temp
;
}
public
void
HideId
(
int
id
)
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
if
(
useList
[
i
].
roomId
==
id
)
{
useList
[
i
].
Hide
();
}
}
}
...
...
@@ -86,7 +87,7 @@ public class TextItemMgr : MonoBehaviour
{
if
(
item
.
Text
.
fontSize
>=
(
param
.
y
-
(
int
)((
size
-
param
.
x
)
/
param
.
z
)
*
param
.
w
))
{
if
(!
GameMgr
.
Ins
.
md
.
dynamic
.
step
.
Contains
(
item
.
roomId
))
if
(!
GameMgr
.
Ins
.
md
.
dynamic
.
step
.
Contains
(
item
.
roomId
))
{
item
.
Show
();
}
...
...
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