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
9ecf27e1
Commit
9ecf27e1
authored
Aug 19, 2023
by
Ever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
d26ef371
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
343 additions
and
101 deletions
+343
-101
gameScene.unity
Assets/Scenes/gameScene.unity
+274
-47
LoadingPanel.cs
Assets/scripts/Panel/LoadingPanel.cs
+10
-2
gameSceneLogic.cs
Assets/scripts/Views/gameScene/gameSceneLogic.cs
+4
-16
GroupListManager.cs
Assets/scripts/Views/maingame/GroupListManager.cs
+28
-0
mainGameView.cs
Assets/scripts/common/mainGameView.cs
+11
-5
SaveManager.cs
Assets/scripts/utils/SaveManager.cs
+16
-31
No files found.
Assets/Scenes/gameScene.unity
View file @
9ecf27e1
This diff is collapsed.
Click to expand it.
Assets/scripts/Panel/LoadingPanel.cs
View file @
9ecf27e1
...
@@ -8,6 +8,7 @@ public class LoadingPanel : MonoBehaviour
...
@@ -8,6 +8,7 @@ public class LoadingPanel : MonoBehaviour
{
{
public
Slider
JIndu
;
public
Slider
JIndu
;
public
Transform
PicParent
;
// Start is called before the first frame update
// Start is called before the first frame update
void
Start
()
void
Start
()
{
{
...
@@ -25,11 +26,18 @@ public class LoadingPanel : MonoBehaviour
...
@@ -25,11 +26,18 @@ public class LoadingPanel : MonoBehaviour
private
void
ClosePanel
(
object
[]
values
)
private
void
ClosePanel
(
object
[]
values
)
{
{
gameObject
.
SetActive
(
false
);
StartCoroutine
(
DelayClose
()
);
}
}
IEnumerator
DelayClose
()
{
yield
return
new
WaitForSeconds
(
0.2f
);
gameObject
.
SetActive
(
false
);
}
float
jindu
=
0
;
private
void
ChangeSlider
(
object
[]
values
)
private
void
ChangeSlider
(
object
[]
values
)
{
{
//JIndu.value = value;
jindu
+=
0.1f
;
//(float)values[0];
JIndu
.
value
=
jindu
;
}
}
}
}
Assets/scripts/Views/gameScene/gameSceneLogic.cs
View file @
9ecf27e1
...
@@ -39,7 +39,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -39,7 +39,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
public
float
tempValue2
=
130f
;
public
float
tempValue2
=
130f
;
private
float
tempValue3
=
5f
;
private
float
tempValue3
=
5f
;
public
ReplayCam
cam
;
public
float
ListMoveOffSet
=
35
;
public
float
ListMoveOffSet
=
35
;
public
Transform
PlayImagePaent
;
//操作的图片的父节点
public
Transform
PlayImagePaent
;
//操作的图片的父节点
...
@@ -499,6 +498,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -499,6 +498,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
else
else
{
{
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
return
0
;
//下载完后先不操作了
return
0
;
//下载完后先不操作了
utilsTools
.
delTimeHandler
(
gameObject
,
"tryDownColorImg"
);
utilsTools
.
delTimeHandler
(
gameObject
,
"tryDownColorImg"
);
Image
image
=
transform
.
Find
(
"ingameLoad/loadImg"
).
GetComponent
<
Image
>();
Image
image
=
transform
.
Find
(
"ingameLoad/loadImg"
).
GetComponent
<
Image
>();
...
@@ -516,6 +516,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -516,6 +516,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
void
onZipFileHandler
(
GameScenUserInfo
gameScenUser
)
void
onZipFileHandler
(
GameScenUserInfo
gameScenUser
)
{
{
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//下载完成
Debug
.
Log
(
"handlerLoadingPosition hand begin"
);
Debug
.
Log
(
"handlerLoadingPosition hand begin"
);
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
if
(
utilsTools
.
IsWin
==
true
)
if
(
utilsTools
.
IsWin
==
true
)
...
@@ -555,6 +556,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -555,6 +556,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//下载和解压zip 没有下载过就去下载线稿图
//下载和解压zip 没有下载过就去下载线稿图
void
onInitViewShowDataEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
void
onInitViewShowDataEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始下载或者解压
utilsTools
.
setGDataByKey
(
"firstT"
,
utilsTools
.
getTotalMillisecond
());
utilsTools
.
setGDataByKey
(
"firstT"
,
utilsTools
.
getTotalMillisecond
());
GameScenUserInfo
gameScenUser
=
(
GameScenUserInfo
)
objects
[
0
];
GameScenUserInfo
gameScenUser
=
(
GameScenUserInfo
)
objects
[
0
];
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
...
@@ -855,21 +857,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -855,21 +857,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
},
40
);
},
40
);
}
}
/// <summary>
/// 开始录屏,调用ReplayCam.StartRecording()方法
/// </summary>
public
void
StartRectord
()
{
cam
.
StartRecording
();
}
/// <summary>
/// 结束录屏,调用ReplayCam.StopRectord()方法
/// </summary>
public
void
StopRectord
()
{
Debug
.
Log
(
$"录制结束"
);
cam
.
StopRecording
();
}
public
void
onTestTemp1
()
public
void
onTestTemp1
()
{
{
//Image image = transform.Find("ingameLoad/loadImg").GetComponent<Image>();
//Image image = transform.Find("ingameLoad/loadImg").GetComponent<Image>();
...
...
Assets/scripts/Views/maingame/GroupListManager.cs
View file @
9ecf27e1
...
@@ -38,6 +38,34 @@ public class GroupListManager : MonoBehaviour
...
@@ -38,6 +38,34 @@ public class GroupListManager : MonoBehaviour
AllProcress_Text
.
gameObject
.
SetActive
(
true
);
AllProcress_Text
.
gameObject
.
SetActive
(
true
);
}
}
private
void
Update
()
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
A
))
{
List
<
short
>
list
=
new
List
<
short
>();
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
for
(
int
j
=
0
;
j
<
2048
;
j
++)
{
list
.
Add
((
short
)
UnityEngine
.
Random
.
Range
(
0
,
1000
));
}
}
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
sw
.
Start
();
for
(
int
j
=
0
;
j
<
list
.
Count
;
j
++)
{
}
sw
.
Stop
();
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
}
}
}
private
void
ResiterEvent
(
bool
flag
)
private
void
ResiterEvent
(
bool
flag
)
{
{
EventDispatcher
.
RegisterEvent
(
EventName
.
Event
.
Event_GroupListCreate
,
CreateGroup
,
flag
);
EventDispatcher
.
RegisterEvent
(
EventName
.
Event
.
Event_GroupListCreate
,
CreateGroup
,
flag
);
...
...
Assets/scripts/common/mainGameView.cs
View file @
9ecf27e1
...
@@ -599,7 +599,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -599,7 +599,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
else
else
{
{
DownLoadFileinfos
.
Add
(
url
);
DownLoadFileinfos
.
Add
(
url
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//加载完成
if
(
DownLoadFileinfos
.
Count
>=
3
)
if
(
DownLoadFileinfos
.
Count
>=
3
)
{
{
StartGame
();
StartGame
();
...
@@ -652,6 +652,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -652,6 +652,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
}
else
else
{
{
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//加载完成
DownLoadFileinfos
.
Add
(
url
);
DownLoadFileinfos
.
Add
(
url
);
if
(
DownLoadFileinfos
.
Count
>=
3
)
if
(
DownLoadFileinfos
.
Count
>=
3
)
{
{
...
@@ -766,12 +767,15 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -766,12 +767,15 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
bytesInitDigitMatrix
(
bytes
);
bytesInitDigitMatrix
(
bytes
);
Debug
.
Log
(
"bin初始化完成--------------"
);
Debug
.
Log
(
"bin初始化完成--------------"
);
});
});
utilsTools
.
setGDataByKey
(
"loadBinEnd"
,
utilsTools
.
getTotalMillisecond
());
//utilsTools.setGDataByKey("loadBinEnd", utilsTools.getTotalMillisecond());
utilsTools
.
setGDataByKey
(
"downJson"
,
utilsTools
.
getTotalMillisecond
());
//utilsTools.setGDataByKey("downJson", utilsTools.getTotalMillisecond());
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始加载文件
loadFileInfo
(
gameUserInfo
.
json
,
jsonPath
,
3
);
loadFileInfo
(
gameUserInfo
.
json
,
jsonPath
,
3
);
utilsTools
.
setGDataByKey
(
"loadGaoQing"
,
utilsTools
.
getTotalMillisecond
());
//
utilsTools.setGDataByKey("loadGaoQing", utilsTools.getTotalMillisecond());
loadFileInfo
(
gameUserInfo
.
img
,
linePath
,
1
);
loadFileInfo
(
gameUserInfo
.
img
,
linePath
,
1
);
utilsTools
.
setGDataByKey
(
"loadJpg"
,
utilsTools
.
getTotalMillisecond
());
//
utilsTools.setGDataByKey("loadJpg", utilsTools.getTotalMillisecond());
loadFileInfo
(
gameUserInfo
.
finishImg
,
colorPath
,
2
);
loadFileInfo
(
gameUserInfo
.
finishImg
,
colorPath
,
2
);
return
true
;
return
true
;
}
}
...
@@ -1724,7 +1728,9 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1724,7 +1728,9 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
var
jsondata
=
getdata
();
var
jsondata
=
getdata
();
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始初始化
item
.
GetComponent
<
GameMgr
>().
Init
(
png
,
jpg
,
jsondata
);
item
.
GetComponent
<
GameMgr
>().
Init
(
png
,
jpg
,
jsondata
);
}
}
...
...
Assets/scripts/utils/SaveManager.cs
View file @
9ecf27e1
...
@@ -25,22 +25,28 @@ public class SaveManager : MonoBehaviour
...
@@ -25,22 +25,28 @@ public class SaveManager : MonoBehaviour
instance
=
this
;
instance
=
this
;
}
}
public
void
SaveBin
(
string
pngname
,
ResJsonData
data
)
public
void
SaveRes
(
string
key
,
ResJsonData
data
,
Texture2D
png
)
{
SaveBin
(
key
,
data
);
SavePng
(
key
,
png
);
}
public
void
SaveBin
(
string
key
,
ResJsonData
data
)
{
{
string
json
=
JsonUtility
.
ToJson
(
data
);
string
json
=
JsonUtility
.
ToJson
(
data
);
SaveBin
(
pngname
,
json
);
SaveBin
(
key
,
json
);
}
}
/// <summary>
/// <summary>
/// 保存bin文件
/// 保存bin文件
/// </summary>
/// </summary>
/// <param
name
="path"></param>
/// <param
key
="path"></param>
/// <param
name
="json"></param>
/// <param
key
="json"></param>
public
void
SaveBin
(
string
pngname
,
string
json
)
public
void
SaveBin
(
string
key
,
string
json
)
{
{
FileStream
fs
=
new
FileStream
(
SavePath
+
$"
{
name
}
.bin"
,
FileMode
.
Create
,
FileAccess
.
Write
);
FileStream
fs
=
new
FileStream
(
SavePath
+
$"
{
key
}
.bin"
,
FileMode
.
Create
,
FileAccess
.
Write
);
BinaryFormatter
saveBf
=
new
BinaryFormatter
();
BinaryFormatter
saveBf
=
new
BinaryFormatter
();
saveBf
.
Serialize
(
fs
,
json
);
saveBf
.
Serialize
(
fs
,
json
);
fs
.
Close
();
fs
.
Close
();
...
@@ -51,41 +57,20 @@ public class SaveManager : MonoBehaviour
...
@@ -51,41 +57,20 @@ public class SaveManager : MonoBehaviour
/// </summary>
/// </summary>
/// <param name="path"></param>
/// <param name="path"></param>
/// <param name="png"></param>
/// <param name="png"></param>
public
void
SavePng
(
Texture2D
png
)
public
void
SavePng
(
string
key
,
Texture2D
png
)
{
{
//var colors = png.GetPixels();
//for (int i = 0; i < png.width; i+=2)
//{
// for (int j = 0; j < png.height; j+=2)
// {
// png.SetPixel(i, j, new Color(1, 1, 1, 1));
// }
//}
//png.Apply();
byte
[]
dataBytes
=
png
.
EncodeToPNG
();
byte
[]
dataBytes
=
png
.
EncodeToPNG
();
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
png
.
name
}
.png"
,
FileMode
.
OpenOrCreate
);
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
key
}
.png"
,
FileMode
.
OpenOrCreate
);
fs
.
Write
(
dataBytes
,
0
,
dataBytes
.
Length
);
fs
.
Write
(
dataBytes
,
0
,
dataBytes
.
Length
);
fs
.
Flush
();
fs
.
Flush
();
fs
.
Close
();
fs
.
Close
();
}
}
public
void
SaveJPG
(
Texture2D
png
)
public
void
SaveJPG
(
string
key
,
Texture2D
png
)
{
{
//var colors = png.GetPixels();
//for (int i = 0; i < png.width; i+=2)
//{
// for (int j = 0; j < png.height; j+=2)
// {
// png.SetPixel(i, j, new Color(1, 1, 1, 1));
// }
//}
//png.Apply();
byte
[]
dataBytes
=
png
.
EncodeToPNG
();
byte
[]
dataBytes
=
png
.
EncodeToPNG
();
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
png
.
name
}
.jpg"
,
FileMode
.
OpenOrCreate
);
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
key
}
.jpg"
,
FileMode
.
OpenOrCreate
);
fs
.
Write
(
dataBytes
,
0
,
dataBytes
.
Length
);
fs
.
Write
(
dataBytes
,
0
,
dataBytes
.
Length
);
fs
.
Flush
();
fs
.
Flush
();
fs
.
Close
();
fs
.
Close
();
...
...
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