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
8b802181
Commit
8b802181
authored
Aug 20, 2023
by
Ever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步代码
parent
62f7b293
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
50 deletions
+104
-50
GameEditor.cs
Assets/Editor/GameEditor.cs
+1
-1
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+34
-27
MainData.cs
Assets/GameMgr/MainData.cs
+50
-10
ResJsonData.cs
Assets/GameMgr/ResJsonData.cs
+2
-2
TextItemMgr.cs
Assets/GameMgr/TextItemMgr.cs
+13
-6
cc2D9Z2w9k0evqUiCQ.bin
Assets/Resources/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.bin
+0
-0
gameScene.unity
Assets/Scenes/gameScene.unity
+4
-4
No files found.
Assets/Editor/GameEditor.cs
View file @
8b802181
...
...
@@ -52,7 +52,7 @@ public class GameEditor
{
FunDo
(
l
,
rd
.
png
,
rd
.
json
.
roomDatas
[
i
]);
}
rd
.
json
.
All
=
l
.
ToList
();
rd
.
json
.
allPos
=
l
.
ToList
();
string
savePath
=
AssetDatabase
.
GetAssetPath
(
Selection
.
activeInstanceID
)
+
"/"
+
rd
.
name
+
".bin"
;
FileStream
saveFs
=
File
.
Open
(
savePath
,
FileMode
.
Create
);
BinaryFormatter
saveBf
=
new
BinaryFormatter
();
...
...
Assets/GameMgr/GameMgr.cs
View file @
8b802181
...
...
@@ -41,30 +41,8 @@ public class GameMgr : MonoBehaviour
{
Scale
();
Click
();
Play
();
}
#
region
拖拽
//private bool isDrag = false;
//private Vector2 StartPos = Vector2.zero;
//private Vector2 EndPos = Vector2.zero;
//public void OnBeginDrag(PointerEventData eventData)
//{
// isDrag = true;
// RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, Input.mousePosition, Camera.main, out StartPos);
//}
//public void OnDrag(PointerEventData eventData)
//{
// if (!isDrag) { return; }
// RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, Input.mousePosition, Camera.main, out EndPos);
// Vector3 v = EndPos - StartPos;
// transform.localPosition += v;
//}
//public void OnEndDrag(PointerEventData eventData)
//{
// isDrag = false;
//}
#
endregion
#
region
缩放
private
Vector2
Pos_1
;
private
Vector2
Pos_2
;
...
...
@@ -136,10 +114,9 @@ public class GameMgr : MonoBehaviour
isLongPress
=
-
1
;
Vector2
v
;
RectTransformUtility
.
ScreenPointToLocalPointInRectangle
(
md
.
rect
,
Input
.
mousePosition
,
Camera
.
main
,
out
v
);
Debug
.
Log
(
"长按:"
+
v
);
v
.
x
=
v
.
x
+
md
.
png
.
width
/
2
;
v
.
y
=
v
.
y
+
md
.
png
.
height
/
2
;
Debug
.
Log
(
"长按:"
+
v
);
v
.
x
=
(
int
)
v
.
x
;
v
.
y
=
(
int
)
v
.
y
;
md
.
OnLongPressPos
(
v
);
...
...
@@ -189,8 +166,38 @@ public class GameMgr : MonoBehaviour
#
endregion
public
void
Clear_Test
()
public
void
Clear
()
{
md
.
Clear
();
md
.
Init
(
md
.
key
,
md
.
png
,
md
.
jpg
,
md
.
json
);
}
public
void
RePlay
()
{
md
.
RePlay
();
rePlayIndex
=
0
;
}
public
int
rePlayIndex
=
-
1
;
public
void
Play
()
{
if
(
rePlayIndex
==
-
1
)
{
return
;
}
for
(
int
i
=
0
;
i
<
md
.
json
.
roomDatas
.
Count
;
i
++)
{
if
(
md
.
json
.
roomDatas
[
i
].
id
==
md
.
json
.
step
[
rePlayIndex
])
{
Vector2
v
=
new
Vector2
(
md
.
json
.
roomDatas
[
i
].
px
,
md
.
json
.
roomDatas
[
i
].
py
);
md
.
OnClickPos
(
v
);
rePlayIndex
++;
if
(
rePlayIndex
>=
md
.
json
.
step
.
Count
)
{
rePlayIndex
=
-
1
;
}
break
;
}
}
}
}
Assets/GameMgr/MainData.cs
View file @
8b802181
...
...
@@ -66,7 +66,7 @@ public class MainData : MonoBehaviour
//Debug.Log("涂过了");
return
false
;
}
int
id
=
json
.
All
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
int
id
=
json
.
allPos
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
if
(
FunDo
(
id
,
v
))
{
sw
.
Stop
();
...
...
@@ -86,11 +86,11 @@ public class MainData : MonoBehaviour
ExRoomDatas
erd
=
new
ExRoomDatas
();
json
.
roomGroupsData
[
i
].
roomIds
.
Remove
(
id
);
json
.
roomGroupsData
[
i
].
roomIdsOver
.
Add
(
id
);
json
.
list
.
Add
(
id
);
json
.
step
.
Add
(
id
);
Color
[]
c_png
=
png
.
GetPixels
();
for
(
int
j
=
0
;
j
<
json
.
All
.
Count
;
j
++)
for
(
int
j
=
0
;
j
<
json
.
allPos
.
Count
;
j
++)
{
if
(
json
.
All
[
j
]
==
id
)
if
(
json
.
allPos
[
j
]
==
id
)
{
erd
.
AddData
(
j
,
png
.
width
);
c_png
[
j
]
=
Color
.
clear
;
...
...
@@ -114,7 +114,7 @@ public class MainData : MonoBehaviour
public
void
ChooseGroup
(
int
id
)
{
Debug
.
Log
(
"选中组:"
+
id
);
if
(
curGroupId
==
id
)
if
(
curGroupId
==
id
)
{
return
;
}
...
...
@@ -135,11 +135,11 @@ public class MainData : MonoBehaviour
{
dic
.
Add
(
list
[
i
],
new
ExRoomDatas
());
}
for
(
int
i
=
0
;
i
<
json
.
All
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
json
.
allPos
.
Count
;
i
++)
{
if
(
dic
.
ContainsKey
(
json
.
All
[
i
]))
if
(
dic
.
ContainsKey
(
json
.
allPos
[
i
]))
{
dic
[
json
.
All
[
i
]].
AddData
(
i
,
png
.
width
);
dic
[
json
.
allPos
[
i
]].
AddData
(
i
,
png
.
width
);
}
}
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
...
...
@@ -165,13 +165,53 @@ public class MainData : MonoBehaviour
//Debug.Log("涂过了");
return
;
}
int
id
=
json
.
All
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
int
id
=
json
.
allPos
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
{
if
(
json
.
roomGroupsData
[
i
].
roomIds
.
Contains
(
id
))
{
ChooseGroup
(
json
.
roomGroupsData
[
i
].
id
);
}
}
}
}
public
void
Clear
()
{
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
{
json
.
roomGroupsData
[
i
].
roomIds
.
AddRange
(
json
.
roomGroupsData
[
i
].
roomIdsOver
);
json
.
roomGroupsData
[
i
].
roomIdsOver
.
Clear
();
}
json
.
step
.
Clear
();
Color
[]
c
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
{
if
(
c
[
i
]
==
Color
.
clear
)
{
c
[
i
]
=
Color
.
white
;
}
}
png
.
SetPixels
(
c
);
png
.
Apply
();
SaveManager
.
Instance
.
SaveRes
(
key
,
json
,
png
);
}
public
void
RePlay
()
{
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
{
json
.
roomGroupsData
[
i
].
roomIds
.
AddRange
(
json
.
roomGroupsData
[
i
].
roomIdsOver
);
json
.
roomGroupsData
[
i
].
roomIdsOver
.
Clear
();
}
Color
[]
c
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
{
if
(
c
[
i
]
==
Color
.
clear
)
{
c
[
i
]
=
Color
.
white
;
}
}
png
.
SetPixels
(
c
);
png
.
Apply
();
}
}
\ No newline at end of file
Assets/GameMgr/ResJsonData.cs
View file @
8b802181
...
...
@@ -9,9 +9,9 @@ using UnityEngine;
[Serializable]
public
class
ResJsonData
{
public
List
<
int
>
list
=
new
List
<
int
>();
public
List
<
int
>
step
=
new
List
<
int
>();
public
List
<
short
>
All
=
new
List
<
short
>();
public
List
<
short
>
allPos
=
new
List
<
short
>();
public
List
<
RoomDatas
>
roomDatas
=
new
List
<
RoomDatas
>();
...
...
Assets/GameMgr/TextItemMgr.cs
View file @
8b802181
...
...
@@ -39,22 +39,29 @@ public class TextItemMgr : MonoBehaviour
temp
.
gameObject
.
SetActive
(
false
);
}
}
public
void
CircleAll
()
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
Circle
(
useList
[
i
]);
}
}
public
void
Init
(
ResJsonData
rjd
,
Texture2D
png
)
{
CircleAll
();
for
(
int
i
=
0
;
i
<
rjd
.
roomDatas
.
Count
;
i
++)
{
RoomDatas
rd
=
rjd
.
roomDatas
[
i
];
TextItem
temp
=
Get
();
temp
.
gameObject
.
SetActive
(
true
);
temp
.
id
=
rd
.
id
;
temp
.
Text
.
fontSize
=
rd
.
pr
;
temp
.
transform
.
localPosition
=
new
Vector3
(
rd
.
px
-
png
.
width
/
2f
,
rd
.
py
-
png
.
height
/
2f
,
0
);
for
(
int
j
=
0
;
j
<
rjd
.
roomGroupsData
.
Count
;
j
++)
{
RoomGroupsData
rgd
=
rjd
.
roomGroupsData
[
j
];
if
(
rgd
.
roomIds
.
Contains
(
rd
.
id
))
{
TextItem
temp
=
Get
();
temp
.
gameObject
.
SetActive
(
true
);
temp
.
id
=
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
();
break
;
}
...
...
Assets/Resources/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.bin
View file @
8b802181
No preview for this file type
Assets/Scenes/gameScene.unity
View file @
8b802181
...
...
@@ -1416,7 +1416,7 @@ RectTransform:
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
1
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
427
,
y
:
-82.5
}
m_AnchoredPosition
:
{
x
:
427
,
y
:
-82.5
00015
}
m_SizeDelta
:
{
x
:
87
,
y
:
91
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!114
&824212554
...
...
@@ -4354,9 +4354,9 @@ MonoBehaviour:
m_HandleRect
:
{
fileID
:
5101221413184368358
}
m_Direction
:
0
m_MinValue
:
0
m_MaxValue
:
1
m_MaxValue
:
1
00
m_WholeNumbers
:
0
m_Value
:
1
m_Value
:
1
00
m_OnValueChanged
:
m_PersistentCalls
:
m_Calls
:
[]
...
...
@@ -6408,7 +6408,7 @@ MonoBehaviour:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
3396359898559686475
}
m_Enabled
:
0
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
582a8965e0faeec4a8df7d0271769c6d
,
type
:
3
}
m_Name
:
...
...
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