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
01ebe7fa
Commit
01ebe7fa
authored
Aug 22, 2023
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
性能优化版
parent
e23830ed
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
23 deletions
+40
-23
GameEditor.cs
Assets/Editor/GameEditor.cs
+1
-1
MainData.cs
Assets/GameMgr/MainData.cs
+24
-9
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+8
-6
ResJsonData.cs
Assets/GameMgr/ResJsonData.cs
+1
-1
ccgCTqoiwmXnQ1RGBb.meta
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb.meta
+1
-1
ccgCTqoiwmXnQ1RGBb_dynamic.bin.meta
...Bb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_dynamic.bin.meta
+1
-1
ccgCTqoiwmXnQ1RGBb_jpg.jpg.meta
...Q1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_jpg.jpg.meta
+1
-1
ccgCTqoiwmXnQ1RGBb_json.bin
...wmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin
+0
-0
ccgCTqoiwmXnQ1RGBb_json.bin.meta
...1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin.meta
+1
-1
ccgCTqoiwmXnQ1RGBb_png.png.meta
...Q1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_png.png.meta
+1
-1
ccgCTqoiwmXnQ1RGBb_preview.png.meta
...Bb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_preview.png.meta
+1
-1
No files found.
Assets/Editor/GameEditor.cs
View file @
01ebe7fa
...
...
@@ -103,7 +103,7 @@ public class GameEditor
{
v_1
=
stackVector2
.
Pop
();
png
.
SetPixel
(
v_1
.
x
,
v_1
.
y
,
Color
.
white
);
rd
.
posIndex
.
Add
(
(
short
)(
v_1
.
x
+
v_1
.
y
*
png
.
width
)
);
rd
.
posIndex
.
Add
(
v_1
.
x
+
v_1
.
y
*
png
.
width
);
for
(
int
i
=
0
;
i
<
d
.
Length
;
i
++)
{
v_2
=
v_1
+
d
[
i
];
...
...
Assets/GameMgr/MainData.cs
View file @
01ebe7fa
...
...
@@ -73,23 +73,23 @@ public class MainData : MonoBehaviour
if
(
FunDo
(
v
,
b
))
{
sw
.
Stop
();
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
Debug
.
Log
(
"
涂色全
耗时:"
+
sw
.
ElapsedMilliseconds
);
return
true
;
}
return
false
;
}
public
bool
FunDo
(
Vector2
v
,
bool
b
=
false
)
{
System
.
Diagnostics
.
Stopwatch
sw_1
=
new
System
.
Diagnostics
.
Stopwatch
();
sw_1
.
Start
();
RoomDatas
rd
=
null
;
int
index
=
(
int
)(
v
.
x
+
v
.
y
*
png
.
width
);
for
(
int
i
=
0
;
i
<
json
.
roomDatas
.
Count
;
i
++)
{
List
<
short
>
l
=
json
.
roomDatas
[
i
].
posIndex
;
for
(
int
j
=
0
;
j
<
l
.
Count
;
j
++)
{
if
(
l
[
j
]
==
v
.
x
+
v
.
y
*
png
.
width
)
if
(
json
.
roomDatas
[
i
].
posIndex
.
Contains
(
index
))
{
rd
=
json
.
roomDatas
[
i
];
}
break
;
}
}
if
(
rd
==
null
)
...
...
@@ -97,6 +97,8 @@ public class MainData : MonoBehaviour
Debug
.
LogError
(
"沒找到點:"
+
v
.
x
+
"-"
+
v
.
y
);
return
false
;
}
sw_1
.
Stop
();
Debug
.
Log
(
"点转区ID耗时:"
+
sw_1
.
ElapsedMilliseconds
);
if
(
dynamic
.
step
.
Contains
(
rd
.
id
))
{
Debug
.
LogError
(
"點過了:"
+
rd
.
id
);
...
...
@@ -104,7 +106,8 @@ public class MainData : MonoBehaviour
}
if
(
rd
.
groupId
==
curGroupId
||
b
)
{
dynamic
.
AddData
(
rd
.
groupId
,
rd
.
id
);
System
.
Diagnostics
.
Stopwatch
sw_2
=
new
System
.
Diagnostics
.
Stopwatch
();
sw_2
.
Start
();
Color
[]
c_png
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
rd
.
posIndex
.
Count
;
i
++)
{
...
...
@@ -112,11 +115,19 @@ public class MainData : MonoBehaviour
}
png
.
SetPixels
(
c_png
);
png
.
Apply
();
sw_2
.
Stop
();
Debug
.
Log
(
"涂色耗时:"
+
sw_2
.
ElapsedMilliseconds
);
System
.
Diagnostics
.
Stopwatch
sw_3
=
new
System
.
Diagnostics
.
Stopwatch
();
sw_3
.
Start
();
dynamic
.
AddData
(
rd
.
groupId
,
rd
.
id
);
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
.
tiMgr
.
CircleId
(
rd
.
id
);
GameMgr
.
Ins
.
miMgr
.
Play
(
v
,
rd
.
id
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GropuItemChange
,
rgd
,
dynamic
);
sw_3
.
Stop
();
Debug
.
Log
(
"效果耗时:"
+
sw_3
.
ElapsedMilliseconds
);
return
true
;
}
return
false
;
...
...
@@ -130,6 +141,8 @@ public class MainData : MonoBehaviour
GameMgr
.
Ins
.
miMgr
.
CircleAll
();
}
Debug
.
Log
(
"选中组:"
+
id
);
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
sw
.
Start
();
if
(
curGroupId
==
id
)
{
return
;
...
...
@@ -150,6 +163,8 @@ public class MainData : MonoBehaviour
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
erd
,
rd
.
id
,
rd
.
groupId
);
}
}
sw
.
Stop
();
Debug
.
Log
(
"选组耗时:"
+
sw
.
ElapsedMilliseconds
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_ChoiseGroupByPic
,
curGroupId
);
}
...
...
@@ -173,7 +188,7 @@ public class MainData : MonoBehaviour
RoomDatas
rd
=
null
;
for
(
int
i
=
0
;
i
<
json
.
roomDatas
.
Count
;
i
++)
{
List
<
shor
t
>
l
=
json
.
roomDatas
[
i
].
posIndex
;
List
<
in
t
>
l
=
json
.
roomDatas
[
i
].
posIndex
;
for
(
int
j
=
0
;
j
<
l
.
Count
;
j
++)
{
if
(
l
[
j
]
==
v
.
x
+
v
.
y
*
png
.
width
)
...
...
Assets/GameMgr/MaskItem.cs
View file @
01ebe7fa
...
...
@@ -12,7 +12,7 @@ public class MaskItem : MonoBehaviour
public
Image
SP
;
public
RectTransform
Rect
;
public
RectTransform
SPRect
;
public
Vector4
size
;
// Update is called once per frame
void
Update
()
{
...
...
@@ -20,7 +20,7 @@ public class MaskItem : MonoBehaviour
{
return
;
}
Rect
.
sizeDelta
+=
Time
.
deltaTime
*
Vector2
.
one
*
IsUse
*
2
f
;
Rect
.
sizeDelta
+=
Time
.
deltaTime
*
Vector2
.
one
*
IsUse
*
1
f
;
if
(
Rect
.
sizeDelta
.
x
>
IsUse
*
1.05f
&&
Rect
.
sizeDelta
.
y
>
IsUse
*
1.5f
)
{
gameObject
.
SetActive
(
false
);
...
...
@@ -72,9 +72,8 @@ public class MaskItem : MonoBehaviour
//初始处理
gameObject
.
SetActive
(
true
);
Rect
.
sizeDelta
=
Vector2
.
zero
;
float
a
=
Math
.
Max
(
erd
.
size
.
z
-
v
.
x
,
v
.
x
-
erd
.
size
.
x
);
float
b
=
Math
.
Max
(
erd
.
size
.
w
-
v
.
y
,
v
.
y
-
erd
.
size
.
y
);
IsUse
=
-
Math
.
Max
(
a
,
b
)
*
2
;
size
=
erd
.
size
;
}
public
void
Play
(
Vector3
v
)
...
...
@@ -89,6 +88,9 @@ public class MaskItem : MonoBehaviour
SPRect
.
SetParent
(
Rect
);
IsUse
*=
-
1
;
float
a
=
Math
.
Max
(
size
.
z
-
v
.
x
,
v
.
x
-
size
.
x
);
float
b
=
Math
.
Max
(
size
.
w
-
v
.
y
,
v
.
y
-
size
.
y
);
IsUse
=
Math
.
Max
(
a
,
b
)
*
2
;
}
}
Assets/GameMgr/ResJsonData.cs
View file @
01ebe7fa
...
...
@@ -91,7 +91,7 @@ public class ExtraMetaData //后面再看为啥json序列化失败
public
class
RoomDatas
{
public
int
groupId
=
-
1
;
public
List
<
short
>
posIndex
=
new
List
<
shor
t
>();
public
List
<
int
>
posIndex
=
new
List
<
in
t
>();
public
int
id
;
public
int
valid
;
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
9dceb814ec309594686d933949505996
guid:
5deef8a321f86c0459d749c0e87b24be
folderAsset: yes
DefaultImporter:
externalObjects: {}
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_dynamic.bin.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
c8fb47e3e3c044946b746a24bcc7aac3
guid:
dc863db1bf418db4aa501a7b4c1356ca
DefaultImporter:
externalObjects: {}
userData:
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_jpg.jpg.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
a9f2a0a08bc1c89468426e4e75dad3ba
guid:
3c8da2e0ddb5ceb4faf0b2605b091d61
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin
View file @
01ebe7fa
No preview for this file type
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_json.bin.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
443bdf89f2e136242a6868a9f657e6c6
guid:
126b61d0eeba82e4782699d7f91dbc07
DefaultImporter:
externalObjects: {}
userData:
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_png.png.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
80288066af556804fbb9659376a6d156
guid:
bf3d014937afaa64e8c89f47c46c03e7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
...
...
Assets/GameMgr/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb/ccgCTqoiwmXnQ1RGBb_preview.png.meta
View file @
01ebe7fa
fileFormatVersion: 2
guid:
9fc579f1b0a9d81429afafbf7555d3a8
guid:
100c000cdcecb6d4cb3c956344d7b903
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
...
...
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