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
ebc07515
Commit
ebc07515
authored
Aug 22, 2023
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手動保存
parent
cd01177b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
25 deletions
+31
-25
GameEditor.cs
Assets/Editor/GameEditor.cs
+7
-13
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+5
-0
MainData.cs
Assets/GameMgr/MainData.cs
+7
-3
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+8
-6
MaskItemMgr.cs
Assets/GameMgr/MaskItemMgr.cs
+4
-3
ccgCTqoiwmXnQ1RGBb_json.bin
...wmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin
+0
-0
ccgCTqoiwmXnQ1RGBb_png.png
...iwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_png.png
+0
-0
No files found.
Assets/Editor/GameEditor.cs
View file @
ebc07515
...
...
@@ -52,16 +52,15 @@ public class GameEditor
Color
[]
c
=
rd
.
png
.
GetPixels
();
rd
.
png
=
new
Texture2D
(
rd
.
png
.
width
,
rd
.
png
.
height
,
rd
.
png
.
format
,
false
);
rd
.
png
.
SetPixels
(
c
);
rd
.
png
.
Apply
();
short
[]
l
=
new
short
[
2048
*
2048
];
for
(
int
i
=
0
;
i
<
rd
.
json
.
roomDatas
.
Count
;
i
++)
{
FunDo
(
l
,
rd
.
png
,
rd
.
json
.
roomDatas
[
i
]);
}
rd
.
png
.
Apply
();
rd
.
json
.
allPos
=
l
.
ToList
();
Debug
.
Log
(
rd
.
jpg
.
EncodeToJPG
().
Length
);
File
.
WriteAllBytes
(
path
+
"/"
+
rd
.
name
+
"_png.png"
,
rd
.
png
.
EncodeToPNG
());
File
.
WriteAllBytes
(
path
+
"/"
+
rd
.
name
+
"_jpg.jpg"
,
rd
.
jpg
.
EncodeToJPG
());
File
.
WriteAllBytes
(
path
+
"/"
+
rd
.
name
+
"_preview.png"
,
rd
.
preview
.
EncodeToPNG
());
...
...
@@ -84,16 +83,16 @@ public class GameEditor
{
V2
v
=
new
V2
(
rd
.
px
,
rd
.
py
);
Stack
<
V2
>
stackVector2
=
new
Stack
<
V2
>();
if
(
v
.
x
>=
0
&&
v
.
x
<
png
.
width
&&
v
.
y
>=
0
&&
v
.
y
<
png
.
height
&&
png
.
GetPixel
(
v
.
x
,
v
.
y
).
a
<=
0.35f
)
if
(
rd
.
valid
==
0
)
{
stackVector2
.
Push
(
v
);
Debug
.
Log
(
"壞點:"
+
v
.
x
+
"-"
+
v
.
y
);
png
.
SetPixel
(
v
.
x
,
v
.
y
,
Color
.
clear
);
return
;
}
else
{
Debug
.
LogError
(
"配置像素点进不了堆栈:"
+
rd
.
id
);
stackVector2
.
Push
(
v
);
}
V2
[]
d
=
new
V2
[
8
]
{
new
V2
(
0
,
-
1
),
new
V2
(
0
,
1
),
new
V2
(-
1
,
0
),
new
V2
(
1
,
0
),
new
V2
(-
1
,
-
1
),
new
V2
(-
1
,
1
),
new
V2
(
1
,
-
1
),
new
V2
(
1
,
1
)
};
V2
v_1
;
V2
v_2
;
...
...
@@ -120,15 +119,10 @@ public class GameEditor
break
;
}
}
if
(
count
==
1
)
if
(
count
<
10
)
{
Debug
.
LogError
(
"循环次数:"
+
count
+
" rd.id:"
+
rd
.
id
);
}
else
{
Debug
.
Log
(
"循环次数:"
+
count
);
}
png
.
Apply
();
}
...
...
Assets/GameMgr/GameMgr.cs
View file @
ebc07515
...
...
@@ -207,4 +207,9 @@ public class GameMgr : MonoBehaviour
}
}
}
public
void
Save
()
{
md
.
Save
();
}
}
Assets/GameMgr/MainData.cs
View file @
ebc07515
...
...
@@ -106,7 +106,6 @@ public class MainData : MonoBehaviour
GameMgr
.
Ins
.
tiMgr
.
CircleId
(
id
);
GameMgr
.
Ins
.
miMgr
.
Play
(
v
,
id
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GropuItemChange
,
json
.
roomGroupsData
[
i
],
dynamic
);
SaveManager
.
Instance
.
SaveRes
(
key
,
dynamic
,
png
);
return
true
;
}
}
...
...
@@ -153,7 +152,7 @@ public class MainData : MonoBehaviour
}
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
dic
[
list
[
i
]],
list
[
i
]);
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
dic
[
list
[
i
]],
list
[
i
]
,
id
);
}
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_ChoiseGroupByPic
,
curGroupId
);
}
...
...
@@ -218,7 +217,12 @@ public class MainData : MonoBehaviour
}
for
(
int
i
=
0
;
i
<
dynamic
.
step
.
Count
;
i
++)
{
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
dic
[
dynamic
.
step
[
i
]],
dynamic
.
step
[
i
]);
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
dic
[
dynamic
.
step
[
i
]],
dynamic
.
step
[
i
]
,
0
);
}
}
public
void
Save
()
{
SaveManager
.
Instance
.
SaveRes
(
key
,
dynamic
,
png
);
}
}
\ No newline at end of file
Assets/GameMgr/MaskItem.cs
View file @
ebc07515
...
...
@@ -6,13 +6,13 @@ using UnityEngine.UI;
public
class
MaskItem
:
MonoBehaviour
{
public
int
id
=
-
1
;
public
int
roomId
=
-
1
;
public
int
groupId
=
-
1
;
public
float
IsUse
=
-
1
;
public
Image
SP
;
public
RectTransform
Rect
;
public
RectTransform
SPRect
;
// Update is called once per frame
void
Update
()
{
...
...
@@ -24,15 +24,17 @@ public class MaskItem : MonoBehaviour
if
(
Rect
.
sizeDelta
.
x
>
IsUse
*
1.05f
&&
Rect
.
sizeDelta
.
y
>
IsUse
*
1.5f
)
{
gameObject
.
SetActive
(
false
);
roomId
=
-
1
;
groupId
=
-
1
;
IsUse
=
-
1
;
GameMgr
.
Ins
.
miMgr
.
Circle
(
this
);
}
}
public
void
FunDo
(
MainData
md
,
ExRoomDatas
erd
,
int
_id
)
public
void
FunDo
(
MainData
md
,
ExRoomDatas
erd
,
int
_roomId
,
int
_groupId
)
{
Vector3
v
=
Vector3
.
zero
;
id
=
_id
;
roomId
=
_roomId
;
groupId
=
_groupId
;
//创建图片
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
();
...
...
@@ -75,7 +77,7 @@ public class MaskItem : MonoBehaviour
IsUse
=
-
Math
.
Max
(
a
,
b
)
*
2
;
}
internal
void
Play
(
Vector3
v
)
public
void
Play
(
Vector3
v
)
{
MainData
md
=
GameMgr
.
Ins
.
md
;
SPRect
.
SetParent
(
md
.
imgpng
.
transform
);
...
...
Assets/GameMgr/MaskItemMgr.cs
View file @
ebc07515
...
...
@@ -27,19 +27,20 @@ public class MaskItemMgr : MonoBehaviour
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
temp
.
gameObject
.
SetActive
(
false
);
}
}
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
int
i
d
)
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
int
roomId
,
int
groupI
d
)
{
MaskItem
temp
=
Get
();
temp
.
FunDo
(
md
,
erd
,
i
d
);
temp
.
FunDo
(
md
,
erd
,
roomId
,
groupI
d
);
}
public
void
Play
(
Vector3
v
,
int
id
)
{
for
(
int
i
=
0
;
i
<
useList
.
Count
;
i
++)
{
if
(
useList
[
i
].
i
d
==
id
)
if
(
useList
[
i
].
roomI
d
==
id
)
{
useList
[
i
].
Play
(
v
);
}
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin
View file @
ebc07515
No preview for this file type
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_png.png
View replaced file @
cd01177b
View file @
ebc07515
This diff is collapsed.
Click to expand it.
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