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
a8e85062
Commit
a8e85062
authored
Aug 19, 2023
by
Ever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步代码
parent
9ecf27e1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
581 additions
and
252 deletions
+581
-252
bar_base.png.meta
Assets/Art/GameEnd/bar_base.png.meta
+26
-0
gameSelectGroupHuan.png.meta
Assets/Art/GameEnd/gameSelectGroupHuan.png.meta
+26
-0
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+3
-2
GrayItem.cs
Assets/GameMgr/GrayItem.cs
+43
-0
GrayItem.cs.meta
Assets/GameMgr/GrayItem.cs.meta
+11
-0
GrayItemMgr.cs
Assets/GameMgr/GrayItemMgr.cs
+55
-0
GrayItemMgr.cs.meta
Assets/GameMgr/GrayItemMgr.cs.meta
+11
-0
MainData.cs
Assets/GameMgr/MainData.cs
+73
-56
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+34
-39
MaskItemMgr.cs
Assets/GameMgr/MaskItemMgr.cs
+2
-2
ResJsonData.cs
Assets/GameMgr/ResJsonData.cs
+31
-0
TextItem.cs
Assets/GameMgr/TextItem.cs
+3
-2
TextItemMgr.cs
Assets/GameMgr/TextItemMgr.cs
+20
-9
GameMgr.prefab
Assets/Resources/perfabs/GameMgr.prefab
+178
-93
gameScene.unity
Assets/Scenes/gameScene.unity
+2
-2
GameEndPanel.cs
Assets/scripts/Views/GameEnd/GameEndPanel.cs
+11
-26
gameSceneLogic.cs
Assets/scripts/Views/gameScene/gameSceneLogic.cs
+19
-7
mainGameView.cs
Assets/scripts/common/mainGameView.cs
+1
-1
SaveManager.cs
Assets/scripts/utils/SaveManager.cs
+32
-13
No files found.
Assets/Art/GameEnd/bar_base.png.meta
View file @
a8e85062
...
@@ -119,6 +119,32 @@ TextureImporter:
...
@@ -119,6 +119,32 @@ TextureImporter:
ignorePlatformSupport: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
spriteSheet:
serializedVersion: 2
serializedVersion: 2
sprites: []
sprites: []
...
...
Assets/Art/GameEnd/gameSelectGroupHuan.png.meta
View file @
a8e85062
...
@@ -119,6 +119,32 @@ TextureImporter:
...
@@ -119,6 +119,32 @@ TextureImporter:
ignorePlatformSupport: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
spriteSheet:
serializedVersion: 2
serializedVersion: 2
sprites: []
sprites: []
...
...
Assets/GameMgr/GameMgr.cs
View file @
a8e85062
...
@@ -15,11 +15,12 @@ public class GameMgr : MonoBehaviour
...
@@ -15,11 +15,12 @@ public class GameMgr : MonoBehaviour
public
MainData
md
;
public
MainData
md
;
public
MaskItemMgr
miMgr
;
public
MaskItemMgr
miMgr
;
public
TextItemMgr
tiMgr
;
public
TextItemMgr
tiMgr
;
public
GrayItemMgr
giMgr
;
public
void
Init
(
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_
json
)
public
void
Init
(
string
key
,
Texture2D
png
,
Sprite
jpg
,
ResJsonData
json
)
{
{
ins
=
this
;
ins
=
this
;
md
.
Init
(
_png
,
_jpg
,
_
json
);
md
.
Init
(
key
,
png
,
jpg
,
json
);
}
}
public
void
ChooseGroup
(
int
id
)
public
void
ChooseGroup
(
int
id
)
...
...
Assets/GameMgr/GrayItem.cs
0 → 100644
View file @
a8e85062
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
GrayItem
:
MonoBehaviour
{
public
Image
SP
;
public
RectTransform
Rect
;
public
int
id
=
-
1
;
public
Texture2D
png
;
public
void
FunDo
(
MainData
md
,
ExRoomDatas
erd
,
int
_id
)
{
id
=
_id
;
//创建图片
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
();
for
(
int
i
=
0
;
i
<
colors
.
Length
;
i
++)
{
colors
[
i
].
a
=
0f
;
}
te
.
SetPixels
(
colors
);
for
(
int
i
=
0
;
i
<
erd
.
list
.
Count
;
i
++)
{
te
.
SetPixel
((
int
)(
erd
.
list
[
i
].
x
-
erd
.
size
.
x
),
(
int
)(
erd
.
list
[
i
].
y
-
erd
.
size
.
y
),
Color
.
black
);
}
te
.
Apply
();
Sprite
sp
=
Sprite
.
Create
(
te
,
new
Rect
(
0
,
0
,
te
.
width
,
te
.
height
),
Vector2
.
zero
);
SP
.
sprite
=
sp
;
SP
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
te
.
width
,
te
.
height
);
//坐标计算
Transform
p
=
Rect
.
parent
;
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
Rect
.
localPosition
=
new
Vector3
(
erd
.
size
.
x
+
(
erd
.
size
.
z
+
1
-
erd
.
size
.
x
)
/
2
-
(
md
.
png
.
width
+
1
)
/
2
,
erd
.
size
.
y
+
(
erd
.
size
.
w
+
1
-
erd
.
size
.
y
)
/
2
-
(
md
.
png
.
height
+
1
)
/
2
,
0
);
Rect
.
SetParent
(
p
);
Rect
.
localScale
=
Vector2
.
one
;
//初始处理
gameObject
.
SetActive
(
true
);
}
}
Assets/GameMgr/GrayItem.cs.meta
0 → 100644
View file @
a8e85062
fileFormatVersion: 2
guid: 692ea8e8a27de1a48bb515e70693bc54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/GameMgr/GrayItemMgr.cs
0 → 100644
View file @
a8e85062
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
GrayItemMgr
:
MonoBehaviour
{
public
List
<
GrayItem
>
useList
=
new
List
<
GrayItem
>();
public
List
<
GrayItem
>
poolList
=
new
List
<
GrayItem
>();
public
GrayItem
item
;
public
GrayItem
Get
()
{
if
(
poolList
.
Count
==
0
)
{
GrayItem
temp
=
GameObject
.
Instantiate
<
GrayItem
>(
item
,
item
.
transform
.
parent
);
poolList
.
Add
(
temp
);
}
GrayItem
ret
=
poolList
[
0
];
poolList
.
RemoveAt
(
0
);
useList
.
Add
(
ret
);
return
ret
;
}
public
void
CircleId
(
int
id
)
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
if
(
useList
[
i
].
id
==
id
)
{
Circle
(
useList
[
i
]);
}
}
}
public
void
Circle
(
GrayItem
temp
)
{
if
(
useList
.
Contains
(
temp
))
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
temp
.
gameObject
.
SetActive
(
false
);
}
}
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
int
id
)
{
GrayItem
temp
=
Get
();
temp
.
FunDo
(
md
,
erd
,
id
);
}
public
void
CircleAll
()
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
Circle
(
useList
[
i
]);
}
}
}
Assets/GameMgr/GrayItemMgr.cs.meta
0 → 100644
View file @
a8e85062
fileFormatVersion: 2
guid: 91c7be77cabb742489857f4d7904d1fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/GameMgr/MainData.cs
View file @
a8e85062
...
@@ -11,30 +11,29 @@ using UnityEngine.UI;
...
@@ -11,30 +11,29 @@ using UnityEngine.UI;
public
class
MainData
:
MonoBehaviour
,
IDragHandler
,
IEndDragHandler
,
IBeginDragHandler
public
class
MainData
:
MonoBehaviour
,
IDragHandler
,
IEndDragHandler
,
IBeginDragHandler
{
{
public
static
int
gunSize
=
50
;
public
static
int
gunSize
=
50
;
public
static
Vector4
config
=
new
Vector4
(
0
,
-
100
,
725f
,
725f
);
public
static
Vector4
config
=
new
Vector4
(
0
,
150
,
725f
,
725f
);
public
string
key
=
""
;
public
Texture2D
png
=
null
;
public
Texture2D
png
=
null
;
public
Sprite
jpg
=
null
;
public
Sprite
jpg
=
null
;
public
ResJsonData
json
;
public
ResJsonData
json
;
public
Texture2D
mask
=
null
;
public
Texture2D
gray
=
null
;
public
Image
imgpng
;
public
Image
imgpng
;
public
Image
imgjpg
;
public
Image
imgjpg
;
public
Image
imgmask
;
public
RectTransform
rect
;
public
RectTransform
rect
;
public
int
curGroupId
=
-
1
;
void
Update
()
void
Update
()
{
{
//
Scale();
Scale
();
//
Click();
Click
();
}
}
public
void
Init
(
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_json
)
public
void
Init
(
string
_key
,
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_json
)
{
{
key
=
_key
;
png
=
_png
;
png
=
_png
;
jpg
=
_jpg
;
jpg
=
_jpg
;
json
=
_json
;
json
=
_json
;
...
@@ -51,17 +50,6 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
...
@@ -51,17 +50,6 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
png
);
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
png
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
);
mask
=
new
Texture2D
(
png
.
width
,
png
.
height
);
Color
[]
c
=
mask
.
GetPixels
();
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
{
c
[
i
].
a
=
0
;
}
mask
.
SetPixels
(
c
);
mask
.
Apply
();
imgmask
.
sprite
=
Sprite
.
Create
(
mask
,
new
Rect
(
0
,
0
,
png
.
width
,
png
.
height
),
new
Vector2
(
0.5f
,
0.5f
));
imgmask
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
png
.
width
,
png
.
height
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
);
}
}
...
@@ -130,23 +118,23 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
...
@@ -130,23 +118,23 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
public
void
Click
()
public
void
Click
()
{
{
//
if (Input.GetMouseButtonDown(0))
if
(
Input
.
GetMouseButtonDown
(
0
))
//
{
{
//
pos = Input.mousePosition;
pos
=
Input
.
mousePosition
;
//
time = Time.unscaledTime;
time
=
Time
.
unscaledTime
;
//
}
}
//
if (Input.GetMouseButtonUp(0))
if
(
Input
.
GetMouseButtonUp
(
0
))
//
{
{
//
float f = Time.unscaledTime - time;
float
f
=
Time
.
unscaledTime
-
time
;
//
float d = Vector2.Distance(pos, Input.mousePosition);
float
d
=
Vector2
.
Distance
(
pos
,
Input
.
mousePosition
);
//
Vector2 v;
Vector2
v
;
//
RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, Input.mousePosition, Camera.main, out v);
RectTransformUtility
.
ScreenPointToLocalPointInRectangle
(
rect
,
Input
.
mousePosition
,
Camera
.
main
,
out
v
);
//
if (f < 0.5f && d < 10)
if
(
f
<
0.5f
&&
d
<
10
)
//
{
{
//
Debug.Log("点击:" + v);
Debug
.
Log
(
"点击:"
+
v
);
//
UseGun(v);
UseGun
(
v
);
//
}
}
//
}
}
}
}
public
void
UseGun
(
Vector2
v
)
public
void
UseGun
(
Vector2
v
)
{
{
...
@@ -204,31 +192,57 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
...
@@ -204,31 +192,57 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
//Debug.Log("涂过了");
//Debug.Log("涂过了");
return
false
;
return
false
;
}
}
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
sw
.
Start
();
int
id
=
json
.
All
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
int
id
=
json
.
All
[(
int
)(
v
.
x
+
v
.
y
*
png
.
width
)];
FunDo
(
id
);
if
(
FunDo
(
id
,
v
))
//GameMgr.Ins.miMgr.Create(this, erd, v);
{
sw
.
Stop
();
//TODO保存点
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
return
true
;
return
true
;
}
}
public
void
FunDo
(
int
id
)
return
false
;
}
public
bool
FunDo
(
int
id
,
Vector2
v
)
{
{
Color
[]
c
=
png
.
GetPixels
();
for
(
int
i
=
0
;
i
<
json
.
roomGroupsData
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
json
.
All
.
Count
;
i
++)
{
{
if
(
json
.
All
[
i
]
==
id
)
if
(
json
.
roomGroupsData
[
i
].
roomIds
.
Contains
(
id
)
)
{
{
c
[
i
]
=
Color
.
clear
;
if
(
json
.
roomGroupsData
[
i
].
id
==
curGroupId
)
{
ExRoomDatas
erd
=
new
ExRoomDatas
();
json
.
roomGroupsData
[
i
].
roomIds
.
Remove
(
id
);
json
.
roomGroupsData
[
i
].
roomIdsOver
.
Add
(
id
);
json
.
list
.
Add
(
id
);
Color
[]
c_png
=
png
.
GetPixels
();
for
(
int
j
=
0
;
j
<
json
.
All
.
Count
;
j
++)
{
if
(
json
.
All
[
j
]
==
id
)
{
erd
.
AddData
(
j
,
png
.
width
);
c_png
[
j
]
=
Color
.
clear
;
}
}
}
}
png
.
SetPixels
(
c
);
png
.
SetPixels
(
c_png
);
png
.
Apply
();
png
.
Apply
();
GameMgr
.
Ins
.
giMgr
.
CircleId
(
id
);
GameMgr
.
Ins
.
tiMgr
.
CircleId
(
id
);
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
erd
,
v
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GropuItemChange
,
json
.
roomGroupsData
[
i
]);
SaveManager
.
Instance
.
SaveRes
(
key
,
json
,
png
);
return
true
;
}
}
}
return
false
;
}
}
public
void
ChooseGroup
(
int
id
)
public
void
ChooseGroup
(
int
id
)
{
{
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
sw
.
Start
();
sw
.
Start
();
curGroupId
=
id
;
List
<
int
>
list
=
new
List
<
int
>();
List
<
int
>
list
=
new
List
<
int
>();
List
<
RoomGroupsData
>
l
=
json
.
roomGroupsData
;
List
<
RoomGroupsData
>
l
=
json
.
roomGroupsData
;
for
(
int
i
=
0
;
i
<
l
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
l
.
Count
;
i
++)
...
@@ -239,20 +253,23 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
...
@@ -239,20 +253,23 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
break
;
break
;
}
}
}
}
Color
[]
c
=
mask
.
GetPixels
();
GameMgr
.
Ins
.
giMgr
.
CircleAll
();
for
(
int
i
=
0
;
i
<
c
.
Length
;
i
++)
Dictionary
<
int
,
ExRoomDatas
>
dic
=
new
Dictionary
<
int
,
ExRoomDatas
>();
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
{
c
[
i
].
a
=
0
;
dic
.
Add
(
list
[
i
],
new
ExRoomDatas
())
;
}
}
for
(
int
i
=
0
;
i
<
json
.
All
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
json
.
All
.
Count
;
i
++)
{
{
if
(
list
.
Contains
(
json
.
All
[
i
]))
if
(
dic
.
ContainsKey
(
json
.
All
[
i
]))
{
{
c
[
i
].
a
=
1
;
dic
[
json
.
All
[
i
]].
AddData
(
i
,
png
.
width
);
}
}
}
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
GameMgr
.
Ins
.
giMgr
.
Create
(
this
,
dic
[
list
[
i
]],
list
[
i
]);
}
}
mask
.
SetPixels
(
c
);
mask
.
Apply
();
sw
.
Stop
();
sw
.
Stop
();
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
}
}
...
...
Assets/GameMgr/MaskItem.cs
View file @
a8e85062
...
@@ -10,12 +10,7 @@ public class MaskItem : MonoBehaviour
...
@@ -10,12 +10,7 @@ public class MaskItem : MonoBehaviour
public
Image
SP
;
public
Image
SP
;
public
RectTransform
Rect
;
public
RectTransform
Rect
;
public
RectTransform
SPRect
;
public
RectTransform
SPRect
;
// Start is called before the first frame update
void
Start
()
{
Rect
=
GetComponent
<
RectTransform
>();
SPRect
=
SP
.
gameObject
.
GetComponent
<
RectTransform
>();
}
// Update is called once per frame
// Update is called once per frame
void
Update
()
void
Update
()
...
@@ -33,42 +28,42 @@ public class MaskItem : MonoBehaviour
...
@@ -33,42 +28,42 @@ public class MaskItem : MonoBehaviour
}
}
}
}
public
void
FunDo
(
MainData
md
,
Vector3
v
)
public
void
FunDo
(
MainData
md
,
ExRoomDatas
erd
,
Vector3
v
)
{
//创建图片
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
();
for
(
int
i
=
0
;
i
<
colors
.
Length
;
i
++)
{
{
////创建图片
colors
[
i
].
a
=
0f
;
//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();
te
.
SetPixels
(
colors
);
//for (int i = 0; i < colors.Length; i++)
for
(
int
i
=
0
;
i
<
erd
.
list
.
Count
;
i
++)
//{
{
// colors[i].a = 0f;
te
.
SetPixel
((
int
)(
erd
.
list
[
i
].
x
-
erd
.
size
.
x
),
(
int
)(
erd
.
list
[
i
].
y
-
erd
.
size
.
y
),
Color
.
white
);
//}
}
//te.SetPixels(colors);
te
.
Apply
();
//for (int i = 0; i < erd.list.Count; i++)
Sprite
sp
=
Sprite
.
Create
(
te
,
new
Rect
(
0
,
0
,
te
.
width
,
te
.
height
),
Vector2
.
zero
);
//{
SP
.
sprite
=
sp
;
// te.SetPixel((int)(erd.list[i].x - erd.size.x), (int)(erd.list[i].y - erd.size.y), Color.white);
SP
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
te
.
width
,
te
.
height
);
//}
//te.Apply();
//Sprite sp = Sprite.Create(te, new Rect(0, 0, te.width, te.height), Vector2.zero);
//SP.sprite = sp;
//SP.GetComponent<RectTransform>().sizeDelta = new Vector2(te.width, te.height);
//
//
坐标计算
//坐标计算
//
Transform p = Rect.parent;
Transform
p
=
Rect
.
parent
;
//
Rect.SetParent(md.imgpng.transform);
Rect
.
SetParent
(
md
.
imgpng
.
transform
);
//
Rect.localPosition = v - new Vector3(md.png.width / 2, md.png.height / 2);
Rect
.
localPosition
=
v
-
new
Vector3
(
md
.
png
.
width
/
2
,
md
.
png
.
height
/
2
);
//
Rect.SetParent(p);
Rect
.
SetParent
(
p
);
//
Rect.localScale = Vector2.one;
Rect
.
localScale
=
Vector2
.
one
;
//
SPRect.SetParent(md.imgpng.transform);
SPRect
.
SetParent
(
md
.
imgpng
.
transform
);
//
SPRect.localPosition = new Vector3(erd.size.x + (erd.size.z + 1 - erd.size.x) / 2 - (md.png.width + 1) / 2, erd.size.y + (erd.size.w + 1 - erd.size.y) / 2 - (md.png.height + 1) / 2, 0);
SPRect
.
localPosition
=
new
Vector3
(
erd
.
size
.
x
+
(
erd
.
size
.
z
+
1
-
erd
.
size
.
x
)
/
2
-
(
md
.
png
.
width
+
1
)
/
2
,
erd
.
size
.
y
+
(
erd
.
size
.
w
+
1
-
erd
.
size
.
y
)
/
2
-
(
md
.
png
.
height
+
1
)
/
2
,
0
);
//
SPRect.SetParent(Rect);
SPRect
.
SetParent
(
Rect
);
//
SPRect.localScale = Vector2.one;
SPRect
.
localScale
=
Vector2
.
one
;
//
//
初始处理
//初始处理
//
gameObject.SetActive(true);
gameObject
.
SetActive
(
true
);
//
Rect.sizeDelta = Vector2.zero;
Rect
.
sizeDelta
=
Vector2
.
zero
;
//
float a = Math.Max(erd.size.z - v.x, v.x - erd.size.x);
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);
float
b
=
Math
.
Max
(
erd
.
size
.
w
-
v
.
y
,
v
.
y
-
erd
.
size
.
y
);
//
IsUse = Math.Max(a, b) * 2;
IsUse
=
Math
.
Max
(
a
,
b
)
*
2
;
}
}
}
}
Assets/GameMgr/MaskItemMgr.cs
View file @
a8e85062
...
@@ -27,9 +27,9 @@ public class MaskItemMgr : MonoBehaviour
...
@@ -27,9 +27,9 @@ public class MaskItemMgr : MonoBehaviour
poolList
.
Add
(
temp
);
poolList
.
Add
(
temp
);
}
}
}
}
public
void
Create
(
MainData
md
,
Vector3
v
)
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
Vector3
v
)
{
{
MaskItem
temp
=
Get
();
MaskItem
temp
=
Get
();
temp
.
FunDo
(
md
,
v
);
temp
.
FunDo
(
md
,
erd
,
v
);
}
}
}
}
Assets/GameMgr/ResJsonData.cs
View file @
a8e85062
...
@@ -87,3 +87,34 @@ public struct V2
...
@@ -87,3 +87,34 @@ public struct V2
return
new
V2
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
return
new
V2
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
}
}
}
}
[Serializable]
public
class
ExRoomDatas
{
public
Vector4
size
=
-
Vector4
.
one
;
public
List
<
V2
>
list
=
new
List
<
V2
>();
public
void
AddData
(
int
index
,
int
width
)
{
int
x
=
index
%
width
;
int
y
=
index
/
width
;
V2
v
=
new
V2
(
x
,
y
);
if
(
size
.
x
==
-
1
||
size
.
x
>
v
.
x
)
{
size
.
x
=
v
.
x
;
}
if
(
size
.
y
==
-
1
||
size
.
y
>
v
.
y
)
{
size
.
y
=
v
.
y
;
}
if
(
size
.
z
==
-
1
||
size
.
z
<
v
.
x
)
{
size
.
z
=
v
.
x
;
}
if
(
size
.
w
==
-
1
||
size
.
w
<
v
.
y
)
{
size
.
w
=
v
.
y
;
}
list
.
Add
(
v
);
}
}
\ No newline at end of file
Assets/GameMgr/TextItem.cs
View file @
a8e85062
...
@@ -6,7 +6,8 @@ using TMPro;
...
@@ -6,7 +6,8 @@ using TMPro;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
public
class
TextItem
:
TextMeshProUGUI
public
class
TextItem
:
MonoBehaviour
{
{
public
int
id
=
-
1
;
public
TextMeshProUGUI
Text
;
}
}
Assets/GameMgr/TextItemMgr.cs
View file @
a8e85062
...
@@ -12,7 +12,7 @@ public class TextItemMgr : MonoBehaviour
...
@@ -12,7 +12,7 @@ public class TextItemMgr : MonoBehaviour
{
{
if
(
poolList
.
Count
==
0
)
if
(
poolList
.
Count
==
0
)
{
{
TextItem
temp
=
GameObject
.
Instantiate
<
TextItem
>(
item
,
item
.
transform
.
parent
);
TextItem
temp
=
Instantiate
<
TextItem
>(
item
,
item
.
transform
.
parent
);
poolList
.
Add
(
temp
);
poolList
.
Add
(
temp
);
}
}
TextItem
ret
=
poolList
[
0
];
TextItem
ret
=
poolList
[
0
];
...
@@ -20,12 +20,23 @@ public class TextItemMgr : MonoBehaviour
...
@@ -20,12 +20,23 @@ public class TextItemMgr : MonoBehaviour
useList
.
Add
(
ret
);
useList
.
Add
(
ret
);
return
ret
;
return
ret
;
}
}
public
void
CircleId
(
int
id
)
{
for
(
int
i
=
useList
.
Count
-
1
;
i
>=
0
;
i
--)
{
if
(
useList
[
i
].
id
==
id
)
{
Circle
(
useList
[
i
]);
}
}
}
public
void
Circle
(
TextItem
temp
)
public
void
Circle
(
TextItem
temp
)
{
{
if
(
useList
.
Contains
(
temp
))
if
(
useList
.
Contains
(
temp
))
{
{
useList
.
Remove
(
temp
);
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
poolList
.
Add
(
temp
);
temp
.
gameObject
.
SetActive
(
false
);
}
}
}
}
...
@@ -36,15 +47,15 @@ public class TextItemMgr : MonoBehaviour
...
@@ -36,15 +47,15 @@ public class TextItemMgr : MonoBehaviour
RoomDatas
rd
=
rjd
.
roomDatas
[
i
];
RoomDatas
rd
=
rjd
.
roomDatas
[
i
];
TextItem
temp
=
Get
();
TextItem
temp
=
Get
();
temp
.
gameObject
.
SetActive
(
true
);
temp
.
gameObject
.
SetActive
(
true
);
temp
.
id
=
rd
.
id
;
temp
.
fontSize
=
rd
.
pr
;
temp
.
Text
.
fontSize
=
rd
.
pr
;
temp
.
transform
.
localPosition
=
new
Vector3
(
rd
.
px
-
png
.
width
/
2f
,
rd
.
py
-
png
.
height
/
2f
,
0
);
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
++)
for
(
int
j
=
0
;
j
<
rjd
.
roomGroupsData
.
Count
;
j
++)
{
{
RoomGroupsData
rgd
=
rjd
.
roomGroupsData
[
j
];
RoomGroupsData
rgd
=
rjd
.
roomGroupsData
[
j
];
if
(
rgd
.
roomIds
.
Contains
(
rd
.
id
))
if
(
rgd
.
roomIds
.
Contains
(
rd
.
id
))
{
{
temp
.
text
=
rgd
.
id
.
ToString
();
temp
.
Text
.
text
=
rgd
.
id
.
ToString
();
break
;
break
;
}
}
}
}
...
@@ -61,20 +72,20 @@ public class TextItemMgr : MonoBehaviour
...
@@ -61,20 +72,20 @@ public class TextItemMgr : MonoBehaviour
size
=
f
;
size
=
f
;
for
(
int
i
=
0
;
i
<
useList
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
useList
.
Count
;
i
++)
{
{
TextItem
text
=
useList
[
i
];
TextItem
item
=
useList
[
i
];
if
(
size
<
param
.
x
)
if
(
size
<
param
.
x
)
{
{
text
.
gameObject
.
SetActive
(
false
);
item
.
gameObject
.
SetActive
(
false
);
}
}
else
else
{
{
if
(
t
ext
.
fontSize
>=
(
param
.
y
-
(
int
)((
size
-
param
.
x
)
/
param
.
z
)
*
param
.
w
))
if
(
item
.
T
ext
.
fontSize
>=
(
param
.
y
-
(
int
)((
size
-
param
.
x
)
/
param
.
z
)
*
param
.
w
))
{
{
text
.
gameObject
.
SetActive
(
true
);
item
.
gameObject
.
SetActive
(
true
);
}
}
else
else
{
{
text
.
gameObject
.
SetActive
(
false
);
item
.
gameObject
.
SetActive
(
false
);
}
}
}
}
}
}
...
...
Assets/Resources/perfabs/GameMgr.prefab
View file @
a8e85062
This diff is collapsed.
Click to expand it.
Assets/Scenes/gameScene.unity
View file @
a8e85062
...
@@ -2963,7 +2963,6 @@ MonoBehaviour:
...
@@ -2963,7 +2963,6 @@ MonoBehaviour:
scrollRect
:
{
fileID
:
1921562645
}
scrollRect
:
{
fileID
:
1921562645
}
ItemParent
:
{
fileID
:
1994532034
}
ItemParent
:
{
fileID
:
1994532034
}
item_obj
:
{
fileID
:
1219722612
}
item_obj
:
{
fileID
:
1219722612
}
cam
:
{
fileID
:
244830826
}
---
!u!1
&1994532031
---
!u!1
&1994532031
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -7114,7 +7113,7 @@ RectTransform:
...
@@ -7114,7 +7113,7 @@ RectTransform:
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
10
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
}
---
!u!1
&7432927552733396289
---
!u!1
&7432927552733396289
...
@@ -7492,6 +7491,7 @@ MonoBehaviour:
...
@@ -7492,6 +7491,7 @@ MonoBehaviour:
showAreaId
:
1
showAreaId
:
1
tempValue1
:
120
tempValue1
:
120
tempValue2
:
120
tempValue2
:
120
cam
:
{
fileID
:
0
}
ListMoveOffSet
:
35
ListMoveOffSet
:
35
PlayImagePaent
:
{
fileID
:
1943337312
}
PlayImagePaent
:
{
fileID
:
1943337312
}
---
!u!1
&8136062125027934181
---
!u!1
&8136062125027934181
...
...
Assets/scripts/Views/GameEnd/GameEndPanel.cs
View file @
a8e85062
using
NatSuite.Examples
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
...
@@ -15,9 +17,6 @@ public class GameEndPanel : MonoBehaviour
...
@@ -15,9 +17,6 @@ public class GameEndPanel : MonoBehaviour
public
HorizontalLayoutGroup
ItemParent
;
public
HorizontalLayoutGroup
ItemParent
;
public
GameObject
item_obj
;
public
GameObject
item_obj
;
public
ReplayCam
cam
;
private
void
Start
()
private
void
Start
()
{
{
ResiterEvent
(
true
);
ResiterEvent
(
true
);
...
@@ -28,18 +27,8 @@ public class GameEndPanel : MonoBehaviour
...
@@ -28,18 +27,8 @@ public class GameEndPanel : MonoBehaviour
Continue_Btn
.
onClick
.
AddListener
(
Continue_Btn_Click
);
Continue_Btn
.
onClick
.
AddListener
(
Continue_Btn_Click
);
}
}
private
void
ResiterEvent
(
bool
flag
)
{
EventDispatcher
.
RegisterEvent
(
EventName
.
Event
.
Event_AllGroupOver
,
GameEnd
,
flag
);
}
private
void
GameEnd
(
object
[]
values
)
private
void
CreateItem
()
//创建列表item
{
BG
.
SetActive
(
true
);
CreateItem
();
}
private
void
CreateItem
()
//创建推荐图片的列表item
{
{
int
childNum
=
10
;
int
childNum
=
10
;
for
(
int
i
=
0
;
i
<
childNum
;
i
++)
for
(
int
i
=
0
;
i
<
childNum
;
i
++)
...
@@ -73,19 +62,15 @@ public class GameEndPanel : MonoBehaviour
...
@@ -73,19 +62,15 @@ public class GameEndPanel : MonoBehaviour
{
{
Debug
.
Log
(
"点击保存视频"
);
Debug
.
Log
(
"点击保存视频"
);
}
}
/// <summary>
/// 开始录屏,调用ReplayCam.StartRecording()方法
private
void
ResiterEvent
(
bool
flag
)
/// </summary>
public
void
StartRectord
()
{
{
cam
.
StartRecording
(
);
EventDispatcher
.
RegisterEvent
(
EventName
.
Event
.
Event_AllGroupOver
,
GameEnd
,
flag
);
}
}
/// <summary>
/// 结束录屏,调用ReplayCam.StopRectord()方法
private
void
GameEnd
(
object
[]
values
)
/// </summary>
public
void
StopRectord
()
{
{
Debug
.
Log
(
$"录制结束"
);
BG
.
SetActive
(
true
);
cam
.
StopRecording
();
CreateItem
();
}
}
}
}
Assets/scripts/Views/gameScene/gameSceneLogic.cs
View file @
a8e85062
...
@@ -39,6 +39,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -39,6 +39,7 @@ 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
;
//操作的图片的父节点
...
@@ -83,13 +84,13 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -83,13 +84,13 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
onEvent
(
EventName
.
Event
.
Event_GroupIsLoadOver
,
onGroupIsLoadOver
);
//组的成员加载完成,就是组列表下的item
onEvent
(
EventName
.
Event
.
Event_GroupIsLoadOver
,
onGroupIsLoadOver
);
//组的成员加载完成,就是组列表下的item
transform
.
Find
(
"ingameLoad/loadImg"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"ingameLoad/loadImg"
).
gameObject
.
SetActive
(
false
);
//gameScenUser
//gameScenUser
//
transform.Find("areaGroupList/groupListBg").gameObject.SetActive(false);
transform
.
Find
(
"areaGroupList/groupListBg"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"areaGroupList/gameProgress/gameProgressText"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"areaGroupList/gameProgress/gameProgressText"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"areaGroupList/gameProgress"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"areaGroupList/gameProgress"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"gameEndOperBase"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"gameEndOperBase"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"gameEndOperBase"
).
GetComponent
<
gameEndLogic
>().
initMember
();
transform
.
Find
(
"gameEndOperBase"
).
GetComponent
<
gameEndLogic
>().
initMember
();
transform
.
Find
(
"areaGroupList/tipSelectGroup"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"areaGroupList/tipSelectGroup"
).
gameObject
.
SetActive
(
false
);
//
transform.Find("top").gameObject.SetActive(false);
transform
.
Find
(
"top"
).
gameObject
.
SetActive
(
false
);
utilsTools
.
setGDataByKey
(
EventName
.
DataName
.
Data_PhoneOffsetValue
,
50
);
utilsTools
.
setGDataByKey
(
EventName
.
DataName
.
Data_PhoneOffsetValue
,
50
);
utilsTools
.
addTimer_Sec
(
gameObject
,
"loopGetHot"
,
(
String
name
)
=>
utilsTools
.
addTimer_Sec
(
gameObject
,
"loopGetHot"
,
(
String
name
)
=>
{
{
...
@@ -440,7 +441,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -440,7 +441,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
areaGroupList
.
SetActive
(
true
);
areaGroupList
.
SetActive
(
true
);
RectTransform
rectTransform
=
areaGroupList
.
GetComponent
<
RectTransform
>();
RectTransform
rectTransform
=
areaGroupList
.
GetComponent
<
RectTransform
>();
transform
.
Find
(
"ingameLoad"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"ingameLoad"
).
gameObject
.
SetActive
(
false
);
//
transform.Find("top").gameObject.SetActive(true);
transform
.
Find
(
"top"
).
gameObject
.
SetActive
(
true
);
utilsTools
.
setGDataByKey
(
"loadingEnd"
,
utilsTools
.
getTotalMillisecond
());
utilsTools
.
setGDataByKey
(
"loadingEnd"
,
utilsTools
.
getTotalMillisecond
());
RectTransform
transform1
=
transform
.
Find
(
"areaGroupList/gameProgress/gameProgressText"
).
GetComponent
<
RectTransform
>();
RectTransform
transform1
=
transform
.
Find
(
"areaGroupList/gameProgress/gameProgressText"
).
GetComponent
<
RectTransform
>();
transform1
.
gameObject
.
SetActive
(
true
);
transform1
.
gameObject
.
SetActive
(
true
);
...
@@ -498,7 +499,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -498,7 +499,6 @@ 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,7 +516,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -516,7 +516,6 @@ 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
)
...
@@ -556,7 +555,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -556,7 +555,6 @@ 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"
);
...
@@ -857,7 +855,21 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -857,7 +855,21 @@ 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/common/mainGameView.cs
View file @
a8e85062
...
@@ -1729,7 +1729,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
...
@@ -1729,7 +1729,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
var
jsondata
=
getdata
();
var
jsondata
=
getdata
();
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始初始化
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_LoadingChange
);
//开始初始化
item
.
GetComponent
<
GameMgr
>().
Init
(
png
,
jpg
,
jsondata
);
item
.
GetComponent
<
GameMgr
>().
Init
(
"cc2D9Z2w9k0evqUiCQ"
,
png
,
jpg
,
jsondata
);
}
}
...
...
Assets/scripts/utils/SaveManager.cs
View file @
a8e85062
...
@@ -25,28 +25,26 @@ public class SaveManager : MonoBehaviour
...
@@ -25,28 +25,26 @@ public class SaveManager : MonoBehaviour
instance
=
this
;
instance
=
this
;
}
}
public
void
SaveRes
(
string
key
,
ResJsonData
data
,
Texture2D
png
)
public
void
SaveRes
(
string
key
,
ResJsonData
data
,
Texture2D
png
)
{
{
SaveBin
(
key
,
data
);
SavePng
(
key
,
png
);
}
}
public
void
SaveBin
(
string
key
,
ResJsonData
data
)
public
void
SaveBin
(
string
pngname
,
ResJsonData
data
)
{
{
string
json
=
JsonUtility
.
ToJson
(
data
);
string
json
=
JsonUtility
.
ToJson
(
data
);
SaveBin
(
key
,
json
);
SaveBin
(
pngname
,
json
);
}
}
/// <summary>
/// <summary>
/// 保存bin文件
/// 保存bin文件
/// </summary>
/// </summary>
/// <param
key
="path"></param>
/// <param
name
="path"></param>
/// <param
key
="json"></param>
/// <param
name
="json"></param>
public
void
SaveBin
(
string
key
,
string
json
)
public
void
SaveBin
(
string
pngname
,
string
json
)
{
{
FileStream
fs
=
new
FileStream
(
SavePath
+
$"
{
key
}
.bin"
,
FileMode
.
Create
,
FileAccess
.
Write
);
FileStream
fs
=
new
FileStream
(
SavePath
+
$"
{
name
}
.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
();
...
@@ -57,20 +55,41 @@ public class SaveManager : MonoBehaviour
...
@@ -57,20 +55,41 @@ 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
(
string
key
,
Texture2D
png
)
public
void
SavePng
(
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
+
$"
{
key
}
.png"
,
FileMode
.
OpenOrCreate
);
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
png
.
name
}
.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
(
string
key
,
Texture2D
png
)
public
void
SaveJPG
(
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
+
$"
{
key
}
.jpg"
,
FileMode
.
OpenOrCreate
);
FileStream
fs
=
File
.
Open
(
SavePath
+
$"
{
png
.
name
}
.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