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
0faf3ff1
Commit
0faf3ff1
authored
Aug 19, 2023
by
Ever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
2d6afbcd
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
451 additions
and
552 deletions
+451
-552
ExTextEditor.cs
Assets/Editor/ExTextEditor.cs
+0
-15
cc2D9Z2w9k0evqUiCQ.jpg.meta
...ameMgr/Art/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.jpg.meta
+26
-0
cc2D9Z2w9k0evqUiCQ.png.meta
...ameMgr/Art/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.png.meta
+26
-0
GameMgr.cs
Assets/GameMgr/GameMgr.cs
+4
-32
MainData.cs
Assets/GameMgr/MainData.cs
+23
-47
MaskItem.cs
Assets/GameMgr/MaskItem.cs
+1
-1
MaskItemMgr.cs
Assets/GameMgr/MaskItemMgr.cs
+35
-0
MaskItemMgr.cs.meta
Assets/GameMgr/MaskItemMgr.cs.meta
+1
-1
New Material.mat
Assets/GameMgr/New Material.mat
+0
-59
ResJsonData.cs
Assets/GameMgr/ResJsonData.cs
+6
-0
Test.shader
Assets/GameMgr/Test.shader
+0
-98
Test.shader.meta
Assets/GameMgr/Test.shader.meta
+0
-11
TextItem.cs
Assets/GameMgr/TextItem.cs
+12
-0
TextItem.cs.meta
Assets/GameMgr/TextItem.cs.meta
+0
-0
TextItemMgr.cs
Assets/GameMgr/TextItemMgr.cs
+82
-0
TextItemMgr.cs.meta
Assets/GameMgr/TextItemMgr.cs.meta
+11
-0
cc2D9Z2w9k0evqUiCQ.bin
Assets/Resources/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.bin
+0
-0
GameMgr.prefab
Assets/Resources/perfabs/GameMgr.prefab
+210
-6
gameScene.unity
Assets/Scenes/gameScene.unity
+12
-280
ScaleToImage.cs
Assets/scripts/ScaleToImage.cs
+1
-1
GameEnd.meta
Assets/scripts/Views/GameEnd.meta
+1
-1
No files found.
Assets/Editor/ExTextEditor.cs
deleted
100644 → 0
View file @
2d6afbcd
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEditor
;
[CustomEditor(typeof(ExText))]
public
class
ExTextEditor
:
Editor
{
public
override
void
OnInspectorGUI
()
{
ExText
t
=
target
as
ExText
;
t
.
isUseActive
=
EditorGUILayout
.
Toggle
(
"ǷӦ"
,
t
.
isUseActive
);
base
.
OnInspectorGUI
();
}
}
Assets/GameMgr/Art/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.jpg.meta
View file @
0faf3ff1
...
...
@@ -119,6 +119,32 @@ TextureImporter:
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
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: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
...
...
Assets/GameMgr/Art/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.png.meta
View file @
0faf3ff1
...
...
@@ -119,6 +119,32 @@ TextureImporter:
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
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: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
...
...
Assets/GameMgr/GameMgr.cs
View file @
0faf3ff1
...
...
@@ -12,43 +12,15 @@ public class GameMgr : MonoBehaviour
get
{
return
ins
;
}
}
private
void
Start
()
{
ins
=
this
;
}
public
MainData
md
;
public
MaskItemMgr
miMgr
;
public
TextItemMgr
tiMgr
;
public
void
Init
(
Texture2D
_png
,
Sprite
_jpg
,
ResJsonData
_json
)
{
ins
=
this
;
md
.
Init
(
_png
,
_jpg
,
_json
);
}
public
List
<
MaskItem
>
useList
=
new
List
<
MaskItem
>();
public
List
<
MaskItem
>
poolList
=
new
List
<
MaskItem
>();
public
MaskItem
item
;
public
MaskItem
Get
()
{
if
(
poolList
.
Count
==
0
)
{
MaskItem
temp
=
GameObject
.
Instantiate
<
MaskItem
>(
item
,
item
.
transform
.
parent
);
poolList
.
Add
(
temp
);
}
MaskItem
ret
=
poolList
[
0
];
poolList
.
RemoveAt
(
0
);
useList
.
Add
(
ret
);
return
ret
;
}
public
void
Circle
(
MaskItem
temp
)
{
if
(
useList
.
Contains
(
temp
))
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
}
}
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
Vector3
v
)
{
MaskItem
temp
=
Get
();
temp
.
FunDo
(
md
,
erd
,
v
);
}
}
Assets/GameMgr/MainData.cs
View file @
0faf3ff1
...
...
@@ -10,10 +10,10 @@ using UnityEngine.UI;
public
class
MainData
:
MonoBehaviour
,
IDragHandler
,
IEndDragHandler
,
IBeginDragHandler
{
public
ExRoomDatas
erd
;
public
static
int
gunSize
=
50
;
public
static
Vector4
config
=
new
Vector4
(
0
,
-
100
,
725f
,
725f
);
public
ExRoomDatas
erd
;
public
Texture2D
png
=
null
;
public
Sprite
jpg
=
null
;
public
ResJsonData
json
;
...
...
@@ -38,37 +38,17 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
imgpng
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
png
.
width
,
png
.
height
);
imgjpg
.
sprite
=
jpg
;
imgjpg
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
png
.
width
,
png
.
height
);
GoOn
();
}
private
void
TestColor
()
{
for
(
int
i
=
0
;
i
<
json
.
roomDatas
.
Count
;
i
++)
{
RoomDatas
rd
=
json
.
roomDatas
[
i
];
Vector2
v
=
new
Vector2
(
rd
.
px
,
rd
.
py
);
FunDo
(
v
);
}
}
public
void
GoOn
()
{
List
<
int
>
list
=
json
.
list
;
float
w
=
config
.
z
/
png
.
width
;
float
h
=
config
.
w
/
png
.
height
;
float
s
=
Math
.
Min
(
w
,
h
);
transform
.
parent
.
localScale
=
Vector3
.
one
*
s
;
transform
.
parent
.
localPosition
=
new
Vector3
(
config
.
x
,
config
.
y
,
0
);
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
int
id
=
list
[
i
];
for
(
int
j
=
0
;
j
<
json
.
roomDatas
.
Count
;
j
++)
{
RoomDatas
rd
=
json
.
roomDatas
[
j
];
if
(
rd
.
id
==
id
)
{
OnClickPixel
(
rd
.
px
,
rd
.
py
);
}
GameMgr
.
Ins
.
tiMgr
.
Init
(
json
,
png
);
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
s
);
EventDispatcher
.
Dispatch
(
EventName
.
Event
.
Event_GroupListCreate
,
json
.
roomGroupsData
);
}
}
}
#
region
拖拽
private
bool
isDrag
=
false
;
...
...
@@ -107,22 +87,23 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
if
(
Vector2
.
Distance
(
Pos_1
,
Pos_2
)
<
Vector2
.
Distance
(
n_Pos_1
,
n_Pos_2
))
{
transform
.
parent
.
parent
.
localScale
+=
Vector3
.
one
*
0.25f
;
if
(
transform
.
parent
.
parent
.
localScale
.
x
>
4
)
transform
.
parent
.
localScale
+=
Vector3
.
one
*
0.25f
;
if
(
transform
.
parent
.
localScale
.
x
>
4
)
{
transform
.
parent
.
parent
.
localScale
=
Vector3
.
one
*
4
;
transform
.
parent
.
localScale
=
Vector3
.
one
*
4
;
}
}
else
{
transform
.
parent
.
parent
.
localScale
-=
Vector3
.
one
*
0.25f
;
if
(
transform
.
parent
.
parent
.
localScale
.
x
<
0.6f
)
transform
.
parent
.
localScale
-=
Vector3
.
one
*
0.25f
;
if
(
transform
.
parent
.
localScale
.
x
<
0.6f
)
{
transform
.
parent
.
parent
.
localScale
=
Vector3
.
one
*
0.6f
;
transform
.
parent
.
localScale
=
Vector3
.
one
*
0.6f
;
}
}
Pos_1
=
n_Pos_1
;
Pos_2
=
n_Pos_2
;
GameMgr
.
Ins
.
tiMgr
.
SizeChange
(
transform
.
parent
.
localScale
.
x
);
}
}
}
...
...
@@ -208,17 +189,12 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
//Debug.Log("涂过了");
return
false
;
}
//System.Diagnostics.Stopwatch ts
= new System.Diagnostics.Stopwatch();
//ts
.Start();
System
.
Diagnostics
.
Stopwatch
sw
=
new
System
.
Diagnostics
.
Stopwatch
();
sw
.
Start
();
FunDo
(
v
);
//ts.Stop();
//System.Diagnostics.Stopwatch dx = new System.Diagnostics.Stopwatch();
//dx.Start();
GameMgr
.
Ins
.
Create
(
this
,
erd
,
v
);
//dx.Stop();
//Debug.Log("涂色耗时:" + ts.ElapsedMilliseconds + " 动效耗时:" + dx.ElapsedMilliseconds);
sw
.
Stop
();
Debug
.
Log
(
"耗时:"
+
sw
.
ElapsedMilliseconds
);
GameMgr
.
Ins
.
miMgr
.
Create
(
this
,
erd
,
v
);
return
true
;
}
public
void
FunDo
(
Vector2
_v
)
...
...
@@ -253,7 +229,7 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
break
;
}
}
//
Debug.Log("循环次数:" + count);
Debug
.
Log
(
"循环次数:"
+
count
);
png
.
Apply
();
}
}
...
...
Assets/GameMgr/MaskItem.cs
View file @
0faf3ff1
...
...
@@ -29,7 +29,7 @@ public class MaskItem : MonoBehaviour
{
gameObject
.
SetActive
(
false
);
IsUse
=
-
1
;
GameMgr
.
Ins
.
Circle
(
this
);
GameMgr
.
Ins
.
miMgr
.
Circle
(
this
);
}
}
...
...
Assets/GameMgr/MaskItemMgr.cs
0 → 100644
View file @
0faf3ff1
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
MaskItemMgr
:
MonoBehaviour
{
public
List
<
MaskItem
>
useList
=
new
List
<
MaskItem
>();
public
List
<
MaskItem
>
poolList
=
new
List
<
MaskItem
>();
public
MaskItem
item
;
public
MaskItem
Get
()
{
if
(
poolList
.
Count
==
0
)
{
MaskItem
temp
=
GameObject
.
Instantiate
<
MaskItem
>(
item
,
item
.
transform
.
parent
);
poolList
.
Add
(
temp
);
}
MaskItem
ret
=
poolList
[
0
];
poolList
.
RemoveAt
(
0
);
useList
.
Add
(
ret
);
return
ret
;
}
public
void
Circle
(
MaskItem
temp
)
{
if
(
useList
.
Contains
(
temp
))
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
}
}
public
void
Create
(
MainData
md
,
ExRoomDatas
erd
,
Vector3
v
)
{
MaskItem
temp
=
Get
();
temp
.
FunDo
(
md
,
erd
,
v
);
}
}
Assets/
Editor/ExTextEdito
r.cs.meta
→
Assets/
GameMgr/MaskItemMg
r.cs.meta
View file @
0faf3ff1
fileFormatVersion: 2
guid:
4df351388788e484dbfc15294f9f0e7b
guid:
0bbff69218fb22643bada9a26c88b010
MonoImporter:
externalObjects: {}
serializedVersion: 2
...
...
Assets/GameMgr/New Material.mat
deleted
100644 → 0
View file @
2d6afbcd
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!21
&2100000
Material
:
serializedVersion
:
8
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_Name
:
New Material
m_Shader
:
{
fileID
:
4800000
,
guid
:
8c9f3075cc39cfe41b9409237c27c014
,
type
:
3
}
m_Parent
:
{
fileID
:
0
}
m_ModifiedSerializedProperties
:
0
m_ValidKeywords
:
[]
m_InvalidKeywords
:
[]
m_LightmapFlags
:
4
m_EnableInstancingVariants
:
0
m_DoubleSidedGI
:
0
m_CustomRenderQueue
:
-1
stringTagMap
:
{}
disabledShaderPasses
:
[]
m_LockedProperties
:
m_SavedProperties
:
serializedVersion
:
3
m_TexEnvs
:
-
_AlphaTex
:
m_Texture
:
{
fileID
:
0
}
m_Scale
:
{
x
:
1
,
y
:
1
}
m_Offset
:
{
x
:
0
,
y
:
0
}
-
_MainTex
:
m_Texture
:
{
fileID
:
2800000
,
guid
:
5fa4e00fb3dd65d4d8a6b03a484b3161
,
type
:
3
}
m_Scale
:
{
x
:
1
,
y
:
1
}
m_Offset
:
{
x
:
0
,
y
:
0
}
-
_MaskTex
:
m_Texture
:
{
fileID
:
0
}
m_Scale
:
{
x
:
1
,
y
:
1
}
m_Offset
:
{
x
:
0
,
y
:
0
}
-
_NormalMap
:
m_Texture
:
{
fileID
:
0
}
m_Scale
:
{
x
:
1
,
y
:
1
}
m_Offset
:
{
x
:
0
,
y
:
0
}
-
_RegionTex
:
m_Texture
:
{
fileID
:
2800000
,
guid
:
c4a8d1f39b589d747ba0b9ecc99f8f5d
,
type
:
3
}
m_Scale
:
{
x
:
1
,
y
:
1
}
m_Offset
:
{
x
:
0
,
y
:
0
}
m_Ints
:
[]
m_Floats
:
-
_BlueRegionIntensity
:
2
-
_EnableExternalAlpha
:
0
-
_GreenRegionIntensity
:
0.1
-
_RedRegionIntensity
:
0.1
m_Colors
:
-
_BlueRegionCol
:
{
r
:
0
,
g
:
0
,
b
:
0
,
a
:
1
}
-
_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
-
_Flip
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
-
_GreenRegionCol
:
{
r
:
0
,
g
:
0.93772507
,
b
:
1
,
a
:
0
}
-
_RedRegionCol
:
{
r
:
0.4339623
,
g
:
0
,
b
:
0
,
a
:
1
}
-
_RendererColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_BuildTextureStacks
:
[]
Assets/GameMgr/ResJsonData.cs
View file @
0faf3ff1
...
...
@@ -53,11 +53,17 @@ public class RoomDatas
public
int
G
;
public
int
B
;
public
int
useAreaData
;
public
bool
Check
(
V2
v
)
{
return
px
==
v
.
x
&&
py
==
v
.
y
;
}
}
[Serializable]
public
class
RoomGroupsData
{
public
int
id
;
public
int
curCount
;
public
List
<
int
>
roomIds
=
new
List
<
int
>();
public
int
R
;
public
int
G
;
...
...
Assets/GameMgr/Test.shader
deleted
100644 → 0
View file @
2d6afbcd
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader
"Test"
{
Properties
{
_MainTex
(
"Texture"
,
2
D
)
=
"white"
{}
_RegionTex
(
"Region Texture"
,
2
D
)
=
"white"
{}
_RedRegionCol
(
"Region Red Color"
,
Color
)
=
(
1
,
1
,
1
,
1
)
_GreenRegionCol
(
"Region Green Color"
,
Color
)
=
(
1
,
1
,
1
,
1
)
_BlueRegionCol
(
"Region Blue Color"
,
Color
)
=
(
1
,
1
,
1
,
1
)
_RedRegionIntensity
(
"Red Region Intensity"
,
Range
(
0
.
1
,
2
.
0
))
=
1
.
0
_GreenRegionIntensity
(
"Green Region Intensity"
,
Range
(
0
.
1
,
2
.
0
))
=
1
.
0
_BlueRegionIntensity
(
"Blue Region Intensity"
,
Range
(
0
.
1
,
2
.
0
))
=
1
.
0
}
SubShader
{
//Tags { "RenderType"="Opaque" }
Tags
{
"Queue"
=
"Transparent"
"RenderType"
=
"Transparent"
}
Blend
SrcAlpha
OneMinusSrcAlpha
LOD
100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct
appdata
{
float4
vertex
:
POSITION
;
float2
uv
:
TEXCOORD0
;
};
struct
v2f
{
float2
uvMain
:
TEXCOORD0
;
float4
vertex
:
SV_POSITION
;
float2
uvRegion
:
TEXCOORD1
;
};
sampler2D
_MainTex
;
float4
_MainTex_ST
;
sampler2D
_RegionTex
;
float4
_RegionTex_ST
;
fixed4
_RedRegionCol
;
fixed4
_GreenRegionCol
;
fixed4
_BlueRegionCol
;
half
_RedRegionIntensity
;
half
_GreenRegionIntensity
;
half
_BlueRegionIntensity
;
//fixed _GreenRegionAlpha;
//const half IGNORE_GRAY = 0.05;
v2f
vert
(
appdata
v
)
{
v2f
o
;
o
.
vertex
=
UnityObjectToClipPos
(
v
.
vertex
);
o
.
uvMain
=
TRANSFORM_TEX
(
v
.
uv
,
_MainTex
);
o
.
uvRegion
=
TRANSFORM_TEX
(
v
.
uv
,
_RegionTex
);
return
o
;
}
fixed4
frag
(
v2f
i
)
:
SV_Target
{
// sample the texture
fixed4
baseCol
=
tex2D
(
_MainTex
,
i
.
uvMain
);
fixed4
adjCol
=
tex2D
(
_RegionTex
,
i
.
uvRegion
);
fixed3
tempCol
=
adjCol
.
r
*
_RedRegionCol
.
rgb
*
_RedRegionIntensity
+
adjCol
.
g
*
_GreenRegionCol
.
rgb
*
_GreenRegionIntensity
+
adjCol
.
b
*
_BlueRegionCol
.
rgb
*
_BlueRegionIntensity
+
adjCol
.
a
*
fixed3
(
1
,
1
,
1
);
fixed3
finishCol
=
baseCol
.
rgb
*
tempCol
;
return
fixed4
(
finishCol
,
baseCol
.
a
);
}
ENDCG
}
}
}
\ No newline at end of file
Assets/GameMgr/Test.shader.meta
deleted
100644 → 0
View file @
2d6afbcd
fileFormatVersion: 2
guid: 8c9f3075cc39cfe41b9409237c27c014
ShaderImporter:
externalObjects: {}
defaultTextures:
- _MainTex: {instanceID: 0}
- _RegionTex: {instanceID: 0}
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
Assets/GameMgr/TextItem.cs
0 → 100644
View file @
0faf3ff1
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
TMPro
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
TextItem
:
TextMeshProUGUI
{
}
Assets/
scripts/ExText
.cs.meta
→
Assets/
GameMgr/TextItem
.cs.meta
View file @
0faf3ff1
File moved
Assets/
scripts/ExText
.cs
→
Assets/
GameMgr/TextItemMgr
.cs
View file @
0faf3ff1
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
TMPro
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
ExText
:
TextMeshProUGUI
public
class
TextItemMgr
:
MonoBehaviour
{
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:允许显示的字号减去w值 //缩放小于x的值就全部隐藏,在大于等于x的值后,缩放每增加z的值,字号就会把y值减去w值的字体显示出来
public
List
<
TextItem
>
useList
=
new
List
<
TextItem
>();
public
List
<
TextItem
>
poolList
=
new
List
<
TextItem
>();
public
TextItem
item
;
public
TextItem
Get
()
{
if
(
poolList
.
Count
==
0
)
{
TextItem
temp
=
GameObject
.
Instantiate
<
TextItem
>(
item
,
item
.
transform
.
parent
);
poolList
.
Add
(
temp
);
}
TextItem
ret
=
poolList
[
0
];
poolList
.
RemoveAt
(
0
);
useList
.
Add
(
ret
);
return
ret
;
}
public
void
Circle
(
TextItem
temp
)
{
if
(
useList
.
Contains
(
temp
))
{
useList
.
Remove
(
temp
);
poolList
.
Add
(
temp
);
}
}
public
void
Init
(
ResJsonData
rjd
,
Texture2D
png
)
{
for
(
int
i
=
0
;
i
<
rjd
.
roomDatas
.
Count
;
i
++)
{
RoomDatas
rd
=
rjd
.
roomDatas
[
i
];
TextItem
temp
=
Get
();
temp
.
gameObject
.
SetActive
(
true
);
public
static
List
<
ExText
>
list
=
new
List
<
ExText
>();
public
static
void
SizeChange
(
float
f
)
temp
.
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
))
{
temp
.
text
=
rgd
.
id
.
ToString
();
break
;
}
}
}
}
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
void
SizeChange
(
float
f
)
{
if
(
size
==
f
)
{
return
;
}
size
=
f
;
for
(
int
i
=
0
;
i
<
l
ist
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
useL
ist
.
Count
;
i
++)
{
ExText
text
=
l
ist
[
i
];
TextItem
text
=
useL
ist
[
i
];
if
(
size
<
param
.
x
)
{
text
.
gameObject
.
SetActive
(
false
);
}
else
{
if
(
text
.
fontSize
>=
(
param
.
y
-
(
int
)((
size
-
param
.
x
)
/
param
.
z
)
*
param
.
w
))
if
(
text
.
fontSize
>=
(
param
.
y
-
(
int
)((
size
-
param
.
x
)
/
param
.
z
)
*
param
.
w
))
{
text
.
gameObject
.
SetActive
(
true
);
}
...
...
@@ -38,14 +79,4 @@ public class ExText : TextMeshProUGUI
}
}
}
public
bool
isUseActive
=
false
;
protected
override
void
Start
()
{
base
.
Start
();
if
(
isUseActive
)
{
list
.
Add
(
this
);
}
}
}
Assets/GameMgr/
New Material.mat
.meta
→
Assets/GameMgr/
TextItemMgr.cs
.meta
View file @
0faf3ff1
fileFormatVersion: 2
guid:
d42fb2947ce23de4b80fe5aded33009d
NativeFormat
Importer:
guid:
4013539cbc0b23b4e95e892444ad2066
Mono
Importer:
externalObjects: {}
mainObjectFileID: 2100000
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ.bin
View file @
0faf3ff1
No preview for this file type
Assets/Resources/perfabs/GameMgr.prefab
View file @
0faf3ff1
...
...
@@ -76,6 +76,141 @@ MonoBehaviour:
m_FillOrigin
:
0
m_UseSpriteMesh
:
0
m_PixelsPerUnitMultiplier
:
1
---
!u!1
&417385666573305620
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1203006329788771039
}
-
component
:
{
fileID
:
1404764647146932265
}
-
component
:
{
fileID
:
8128968991938406585
}
m_Layer
:
5
m_Name
:
Text
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
0
---
!u!224
&1203006329788771039
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
417385666573305620
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
[]
m_Father
:
{
fileID
:
800309816225797410
}
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
200
,
y
:
50
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!222
&1404764647146932265
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
417385666573305620
}
m_CullTransparentMesh
:
1
---
!u!114
&8128968991938406585
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
417385666573305620
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
658c6ece9bc787940918e4b7f413a037
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_RaycastTarget
:
1
m_RaycastPadding
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
m_Maskable
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_text
:
22222222
m_isRightToLeft
:
0
m_fontAsset
:
{
fileID
:
11400000
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_sharedMaterial
:
{
fileID
:
2180264
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_fontSharedMaterials
:
[]
m_fontMaterial
:
{
fileID
:
0
}
m_fontMaterials
:
[]
m_fontColor32
:
serializedVersion
:
2
rgba
:
4278190080
m_fontColor
:
{
r
:
0
,
g
:
0
,
b
:
0
,
a
:
1
}
m_enableVertexGradient
:
0
m_colorMode
:
3
m_fontColorGradient
:
topLeft
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
topRight
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
bottomLeft
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
bottomRight
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_fontColorGradientPreset
:
{
fileID
:
0
}
m_spriteAsset
:
{
fileID
:
0
}
m_tintAllSprites
:
0
m_StyleSheet
:
{
fileID
:
0
}
m_TextStyleHashCode
:
-1183493901
m_overrideHtmlColors
:
0
m_faceColor
:
serializedVersion
:
2
rgba
:
4294967295
m_fontSize
:
36
m_fontSizeBase
:
36
m_fontWeight
:
400
m_enableAutoSizing
:
0
m_fontSizeMin
:
18
m_fontSizeMax
:
72
m_fontStyle
:
1
m_HorizontalAlignment
:
2
m_VerticalAlignment
:
512
m_textAlignment
:
65535
m_characterSpacing
:
0
m_wordSpacing
:
0
m_lineSpacing
:
0
m_lineSpacingMax
:
0
m_paragraphSpacing
:
0
m_charWidthMaxAdj
:
0
m_enableWordWrapping
:
1
m_wordWrappingRatios
:
0.4
m_overflowMode
:
0
m_linkedTextComponent
:
{
fileID
:
0
}
parentLinkedComponent
:
{
fileID
:
0
}
m_enableKerning
:
1
m_enableExtraPadding
:
0
checkPaddingRequired
:
0
m_isRichText
:
1
m_parseCtrlCharacters
:
1
m_isOrthographic
:
1
m_isCullingEnabled
:
0
m_horizontalMapping
:
0
m_verticalMapping
:
0
m_uvLineOffset
:
0
m_geometrySortingOrder
:
0
m_IsTextObjectScaleStatic
:
0
m_VertexBufferAutoSizeReduction
:
0
m_useMaxVisibleDescender
:
1
m_pageToDisplay
:
1
m_margin
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
m_isUsingLegacyAnimationComponent
:
0
m_isVolumetricText
:
0
m_hasFontAssetChanged
:
0
m_baseMaterial
:
{
fileID
:
0
}
m_maskOffset
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
---
!u!1
&1272658336346988519
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -183,6 +318,8 @@ RectTransform:
m_Children
:
-
{
fileID
:
7902676659994826364
}
-
{
fileID
:
7679003703182876708
}
-
{
fileID
:
8460472138427881079
}
-
{
fileID
:
800309816225797410
}
m_Father
:
{
fileID
:
2908597137679265870
}
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -232,6 +369,59 @@ MonoBehaviour:
imgpng
:
{
fileID
:
7126587409335573646
}
imgjpg
:
{
fileID
:
2338271980406512720
}
rect
:
{
fileID
:
136994829194703267
}
---
!u!1
&2488372294624611549
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
800309816225797410
}
-
component
:
{
fileID
:
1490190831900560014
}
m_Layer
:
5
m_Name
:
TextBox
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!224
&800309816225797410
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2488372294624611549
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
1203006329788771039
}
m_Father
:
{
fileID
:
136994829194703267
}
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!114
&1490190831900560014
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2488372294624611549
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
4013539cbc0b23b4e95e892444ad2066
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
useList
:
[]
poolList
:
[]
item
:
{
fileID
:
8128968991938406585
}
---
!u!1
&5030817674743791695
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -446,7 +636,6 @@ RectTransform:
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
136994829194703267
}
-
{
fileID
:
8460472138427881079
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -468,9 +657,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
md
:
{
fileID
:
4535739684591336511
}
useList
:
[]
poolList
:
[]
item
:
{
fileID
:
2612623115589112712
}
miMgr
:
{
fileID
:
5326343875061023361
}
tiMgr
:
{
fileID
:
1490190831900560014
}
---
!u!1
&9134782076413536134
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -480,6 +668,7 @@ GameObject:
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
8460472138427881079
}
-
component
:
{
fileID
:
5326343875061023361
}
m_Layer
:
5
m_Name
:
MaskBox
m_TagString
:
Untagged
...
...
@@ -494,13 +683,13 @@ RectTransform:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
9134782076413536134
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
3859749812772851665
}
m_Father
:
{
fileID
:
2908597137679265870
}
m_Father
:
{
fileID
:
136994829194703267
}
m_RootOrder
:
-1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
...
...
@@ -508,3 +697,18 @@ RectTransform:
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!114
&5326343875061023361
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
9134782076413536134
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
0bbff69218fb22643bada9a26c88b010
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
useList
:
[]
poolList
:
[]
item
:
{
fileID
:
2612623115589112712
}
Assets/Scenes/gameScene.unity
View file @
0faf3ff1
This diff is collapsed.
Click to expand it.
Assets/scripts/ScaleToImage.cs
View file @
0faf3ff1
...
...
@@ -98,7 +98,7 @@ public class ScaleToImage : MonoBehaviour
}
private
void
ChangeFontSize
(
float
scalesize
)
{
ExText
.
SizeChange
(
scalesize
/
2f
);
//TextItem
.SizeChange(scalesize/2f);
}
private
void
Scale
()
{
...
...
Assets/scripts/Views/GameEnd.meta
View file @
0faf3ff1
fileFormatVersion: 2
guid:
804bd96816d3e4644a15363efb564de6
guid:
77c0c41e39870744f911b1759f678709
folderAsset: yes
DefaultImporter:
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