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
42e43354
Commit
42e43354
authored
Aug 21, 2023
by
Ever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
優化重播邏輯
parent
465bb344
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
24 deletions
+40
-24
GameEditor.cs
Assets/Editor/GameEditor.cs
+13
-0
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+2
-2
MainData.cs
Assets/GameMgr/MainData.cs
+5
-5
TextItemMgr.cs
Assets/GameMgr/TextItemMgr.cs
+2
-2
GameMgr.prefab
Assets/Resources/perfabs/GameMgr.prefab
+7
-4
mainGameView.cs
Assets/scripts/common/mainGameView.cs
+11
-11
No files found.
Assets/Editor/GameEditor.cs
View file @
42e43354
...
@@ -95,6 +95,19 @@ public class GameEditor
...
@@ -95,6 +95,19 @@ public class GameEditor
Debug
.
Log
(
"循环次数:"
+
count
);
Debug
.
Log
(
"循环次数:"
+
count
);
png
.
Apply
();
png
.
Apply
();
}
}
[
MenuItem
(
"Tools/清理缓存"
)]
public
static
void
清理缓存
()
{
string
path
=
Application
.
persistentDataPath
+
$"/MyPic"
;
if
(
Directory
.
Exists
(
path
))
{
Directory
.
Delete
(
path
,
true
);
}
}
}
}
Assets/GameMgr/GameMgr.cs
View file @
42e43354
...
@@ -178,7 +178,7 @@ public class GameMgr : MonoBehaviour
...
@@ -178,7 +178,7 @@ public class GameMgr : MonoBehaviour
}
}
public
List
<
int
>
rePlayList
=
new
List
<
int
>();
public
List
<
int
>
rePlayList
=
new
List
<
int
>();
public
float
maxTime
=
1
;
public
float
maxTime
=
0.1f
;
public
float
curTime
=
0
;
public
float
curTime
=
0
;
public
void
Play
()
public
void
Play
()
{
{
...
@@ -197,7 +197,7 @@ public class GameMgr : MonoBehaviour
...
@@ -197,7 +197,7 @@ public class GameMgr : MonoBehaviour
Debug
.
Log
(
"进入:"
+
rePlayList
[
0
]
+
"_rePlayList.Count="
+
rePlayList
.
Count
);
Debug
.
Log
(
"进入:"
+
rePlayList
[
0
]
+
"_rePlayList.Count="
+
rePlayList
.
Count
);
Vector2
v
=
new
Vector2
(
md
.
json
.
roomDatas
[
i
].
px
,
md
.
json
.
roomDatas
[
i
].
py
);
Vector2
v
=
new
Vector2
(
md
.
json
.
roomDatas
[
i
].
px
,
md
.
json
.
roomDatas
[
i
].
py
);
Debug
.
Log
(
"模拟点击:"
+
v
);
Debug
.
Log
(
"模拟点击:"
+
v
);
md
.
OnClickPos
(
v
);
md
.
OnClickPos
(
v
,
true
);
rePlayList
.
RemoveAt
(
0
);
rePlayList
.
RemoveAt
(
0
);
break
;
break
;
}
}
...
...
Assets/GameMgr/MainData.cs
View file @
42e43354
...
@@ -42,13 +42,13 @@ public class MainData : MonoBehaviour
...
@@ -42,13 +42,13 @@ public class MainData : MonoBehaviour
transform
.
parent
.
localScale
=
Vector3
.
one
*
s
;
transform
.
parent
.
localScale
=
Vector3
.
one
*
s
;
transform
.
parent
.
localPosition
=
new
Vector3
(
config
.
x
,
config
.
y
,
0
);
transform
.
parent
.
localPosition
=
new
Vector3
(
config
.
x
,
config
.
y
,
0
);
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
png
);
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
png
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
,
true
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
);
}
}
public
bool
OnClickPos
(
Vector2
v
)
public
bool
OnClickPos
(
Vector2
v
,
bool
b
=
false
)
{
{
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
sw
.
Start
();
sw
.
Start
();
...
@@ -68,7 +68,7 @@ public class MainData : MonoBehaviour
...
@@ -68,7 +68,7 @@ public class MainData : MonoBehaviour
return
false
;
return
false
;
}
}
int
id
=
json
.
allPos
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
int
id
=
json
.
allPos
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
if
(
FunDo
(
id
,
v
))
if
(
FunDo
(
id
,
v
,
b
))
{
{
sw
.
Stop
();
sw
.
Stop
();
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
...
@@ -76,13 +76,13 @@ public class MainData : MonoBehaviour
...
@@ -76,13 +76,13 @@ public class MainData : MonoBehaviour
}
}
return
false
;
return
false
;
}
}
public
bool
FunDo
(
int
id
,
Vector2
v
)
public
bool
FunDo
(
int
id
,
Vector2
v
,
bool
b
=
false
)
{
{
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
{
{
if
(
json
.
roomGroupsData
[
i
].
roomIds
.
Contains
(
id
))
if
(
json
.
roomGroupsData
[
i
].
roomIds
.
Contains
(
id
))
{
{
if
(
json
.
roomGroupsData
[
i
].
id
==
curGroupId
)
if
(
json
.
roomGroupsData
[
i
].
id
==
curGroupId
||
b
)
{
{
ExRoomDatas
erd
=
new
ExRoomDatas
();
ExRoomDatas
erd
=
new
ExRoomDatas
();
json
.
roomGroupsData
[
i
].
roomIds
.
Remove
(
id
);
json
.
roomGroupsData
[
i
].
roomIds
.
Remove
(
id
);
...
...
Assets/GameMgr/TextItemMgr.cs
View file @
42e43354
...
@@ -70,9 +70,9 @@ public class TextItemMgr : MonoBehaviour
...
@@ -70,9 +70,9 @@ public class TextItemMgr : MonoBehaviour
}
}
public
static
float
size
=
1
;
//当前缩放倍数
public
static
float
size
=
1
;
//当前缩放倍数
public
static
Vector4
param
=
new
Vector4
(
0.3f
,
25
,
0.1f
,
1
);
// x的值以下隐藏 y:缩放等于x的缩放倍数的时候,大于等于y这个字号的字显示 z:基于x、y 每增加z值的缩放,w:允许显示的字
public
static
Vector4
param
=
new
Vector4
(
0.3f
,
25
,
0.1f
,
1
);
// x的值以下隐藏 y:缩放等于x的缩放倍数的时候,大于等于y这个字号的字显示 z:基于x、y 每增加z值的缩放,w:允许显示的字
public
void
SizeChange
(
float
f
)
public
void
SizeChange
(
float
f
,
bool
b
=
false
)
{
{
if
(
size
==
f
)
if
(
size
==
f
&&
b
==
false
)
{
{
return
;
return
;
}
}
...
...
Assets/Resources/perfabs/GameMgr.prefab
View file @
42e43354
...
@@ -36,8 +36,8 @@ RectTransform:
...
@@ -36,8 +36,8 @@ RectTransform:
m_Father
:
{
fileID
:
136994829194703267
}
m_Father
:
{
fileID
:
136994829194703267
}
m_RootOrder
:
-1
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
1
}
m_AnchorMax
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
...
@@ -609,8 +609,8 @@ MonoBehaviour:
...
@@ -609,8 +609,8 @@ MonoBehaviour:
png
:
{
fileID
:
0
}
png
:
{
fileID
:
0
}
jpg
:
{
fileID
:
0
}
jpg
:
{
fileID
:
0
}
json
:
json
:
list
:
step
:
All
:
allPos
:
roomDatas
:
[]
roomDatas
:
[]
roomGroupsData
:
[]
roomGroupsData
:
[]
colorDiff
:
0
colorDiff
:
0
...
@@ -1023,6 +1023,9 @@ MonoBehaviour:
...
@@ -1023,6 +1023,9 @@ MonoBehaviour:
tiMgr
:
{
fileID
:
1490190831900560014
}
tiMgr
:
{
fileID
:
1490190831900560014
}
giMgr
:
{
fileID
:
2042267472393982796
}
giMgr
:
{
fileID
:
2042267472393982796
}
gray
:
{
fileID
:
2800000
,
guid
:
cfe63fc6a2e3edc409d653cefd205fb7
,
type
:
3
}
gray
:
{
fileID
:
2800000
,
guid
:
cfe63fc6a2e3edc409d653cefd205fb7
,
type
:
3
}
rePlayList
:
maxTime
:
1
curTime
:
0
---
!u!1
&8927003478227325637
---
!u!1
&8927003478227325637
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
...
Assets/scripts/common/mainGameView.cs
View file @
42e43354
...
@@ -1763,13 +1763,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1763,13 +1763,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
public
void
StartGame
()
public
void
StartGame
()
{
{
var
obj
=
Resources
.
Load
<
GameObject
>(
"perfabs/GameMgr"
);
GameMgr
obj
=
Resources
.
Load
<
GameMgr
>(
"perfabs/GameMgr"
);
var
item
=
GameObject
.
Instantiate
(
obj
).
transform
;
GameMgr
item
=
Instantiate
<
GameMgr
>(
obj
)
;
item
.
SetParent
(
MrgParent
);
item
.
transform
.
SetParent
(
MrgParent
);
item
.
localPosition
=
Vector3
.
zero
;
item
.
transform
.
localPosition
=
Vector3
.
zero
;
item
.
localRotation
=
Quaternion
.
Euler
(
0
,
0
,
0
);
item
.
transform
.
localRotation
=
Quaternion
.
Euler
(
0
,
0
,
0
);
item
.
localScale
=
Vector3
.
one
;
item
.
transform
.
localScale
=
Vector3
.
one
;
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始初始化
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始初始化
string
path
=
Application
.
persistentDataPath
+
$"/MyPic/cc2D9Z2w9k0evqUiCQ/"
;
string
path
=
Application
.
persistentDataPath
+
$"/MyPic/cc2D9Z2w9k0evqUiCQ/"
;
...
@@ -1784,12 +1784,12 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1784,12 +1784,12 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
var
jsondata
=
getdata
(
"cc2D9Z2w9k0evqUiCQ"
);
var
jsondata
=
getdata
(
"cc2D9Z2w9k0evqUiCQ"
);
item
.
GetComponent
<
GameMgr
>().
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
item
.
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
SaveManager
.
Instance
.
SaveRes
(
"cc2D9Z2w9k0evqUiCQ"
,
jsondata
,
png
);
SaveManager
.
Instance
.
SaveRes
(
"cc2D9Z2w9k0evqUiCQ"
,
jsondata
,
png
);
//SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", jpg_texture);
//SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", jpg_texture);
}
}
IEnumerator
LoadPic
(
string
dirpath
,
string
name
,
Transform
item
)
IEnumerator
LoadPic
(
string
dirpath
,
string
name
,
GameMgr
item
)
{
{
Texture2D
png
=
null
;
Texture2D
png
=
null
;
Sprite
jpg
=
null
;
Sprite
jpg
=
null
;
...
@@ -1834,13 +1834,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1834,13 +1834,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
if
(
localflag
)
//加载本地的到这里就回去了,下面是第一次
if
(
localflag
)
//加载本地的到这里就回去了,下面是第一次
{
{
item
.
GetComponent
<
GameMgr
>().
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
item
.
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
yield
break
;
yield
break
;
}
}
SaveManager
.
Instance
.
SaveRes
(
"cc2D9Z2w9k0evqUiCQ"
,
jsondata
,
png
);
SaveManager
.
Instance
.
SaveRes
(
"cc2D9Z2w9k0evqUiCQ"
,
jsondata
,
png
);
SaveManager
.
Instance
.
SaveJPG
(
"cc2D9Z2w9k0evqUiCQ"
,
item
.
GetComponent
<
GameMgr
>().
md
.
jpg
.
texture
);
SaveManager
.
Instance
.
SaveJPG
(
"cc2D9Z2w9k0evqUiCQ"
,
jpg_
texture
);
while
(!
SaveManager
.
Instance
.
IsSaveOver
)
while
(!
SaveManager
.
Instance
.
IsSaveOver
)
{
{
...
@@ -1861,7 +1861,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1861,7 +1861,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
}
jsondata
=
getdata
(
"cc2D9Z2w9k0evqUiCQ"
);
jsondata
=
getdata
(
"cc2D9Z2w9k0evqUiCQ"
);
item
.
GetComponent
<
GameMgr
>().
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
item
.
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
}
}
...
...
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