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
3b4b25f7
Commit
3b4b25f7
authored
Aug 09, 2023
by
JiangWanZhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加一些备注
parent
ac8baf3f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
235 additions
and
232 deletions
+235
-232
GameScenUserInfo.cs
Assets/scripts/Datas/GameScenUserInfo.cs
+1
-1
gameAreaGroupItem.cs
Assets/scripts/Datas/gameAreaGroupItem.cs
+1
-1
gameAreaItem.cs
Assets/scripts/Datas/gameAreaItem.cs
+4
-4
gameIdJsonData.cs
Assets/scripts/Datas/gameIdJsonData.cs
+1
-1
gameSceneLogic.cs
Assets/scripts/Views/gameScene/gameSceneLogic.cs
+29
-57
replayerBack.cs
Assets/scripts/Views/replayerScene/replayerBack.cs
+7
-7
checkRootFirstRun.cs
Assets/scripts/common/checkRootFirstRun.cs
+6
-6
mainGameOneImageView.cs
Assets/scripts/common/mainGameOneImageView.cs
+15
-14
mainGameScaleMove.cs
Assets/scripts/common/mainGameScaleMove.cs
+12
-4
mainGameView.cs
Assets/scripts/common/mainGameView.cs
+143
-121
DigitMatrixShort.cs
Assets/scripts/utils/DigitMatrixShort.cs
+10
-10
mainGameViewHelp.cs
Assets/scripts/utils/mainGameViewHelp.cs
+6
-6
No files found.
Assets/scripts/Datas/GameScenUserInfo.cs
View file @
3b4b25f7
...
@@ -24,7 +24,7 @@ public class GameScenUserInfo
...
@@ -24,7 +24,7 @@ public class GameScenUserInfo
//以上是url
//以上是url
public
int
status
=
0
;
//0 未开始 1 这个id进过游戏 2 至少有一个区域点亮 3完成
public
int
status
=
0
;
//0 未开始 1 这个id进过游戏 2 至少有一个区域点亮 3完成
public
double
progress
=
0
;
//0 -- 1 具体自己算百分比
public
double
progress
=
0
;
//0 -- 1 具体自己算百分比
public
List
<
AreaInfoUseData
>
areaInfoUseData
=
new
List
<
AreaInfoUseData
>();
public
List
<
AreaInfoUseData
>
areaInfoUseData
=
new
List
<
AreaInfoUseData
>();
//涂的区域的顺序
private
string
getUrlByLocalPath
(
string
url
)
private
string
getUrlByLocalPath
(
string
url
)
{
{
if
(
url
.
StartsWith
(
"http"
)
==
false
)
return
""
;
if
(
url
.
StartsWith
(
"http"
)
==
false
)
return
""
;
...
...
Assets/scripts/Datas/gameAreaGroupItem.cs
View file @
3b4b25f7
...
@@ -6,7 +6,7 @@ using UnityEngine;
...
@@ -6,7 +6,7 @@ using UnityEngine;
public
class
gameAreaGroupItem
public
class
gameAreaGroupItem
{
{
public
short
id
;
public
short
id
;
public
List
<
short
>
roomIds
;
public
List
<
short
>
roomIds
;
//属于这个组的区域id‘集合
public
float
R
;
public
float
R
;
public
float
G
;
public
float
G
;
public
float
B
;
public
float
B
;
...
...
Assets/scripts/Datas/gameAreaItem.cs
View file @
3b4b25f7
...
@@ -12,10 +12,10 @@ public class gameAreaItem
...
@@ -12,10 +12,10 @@ public class gameAreaItem
public
float
G
;
public
float
G
;
public
float
B
;
public
float
B
;
public
short
id
;
public
short
id
;
public
short
gid
=
-
1
;
//
组
id
public
short
gid
=
-
1
;
//
��i
d
public
short
valid
;
//未知
含义 未启用
public
short
valid
;
//δ֪
���� ���
public
short
useAreaData
;
//未知
含义 未启用
public
short
useAreaData
;
//δ֪
���� ���
public
bool
notPaintCol
;
//未
启用
public
bool
notPaintCol
;
//δ
����
public
string
tempExKey
=
""
;
public
string
tempExKey
=
""
;
public
bool
isShow
=
false
;
public
bool
isShow
=
false
;
public
int
threadHandState
=
0
;
public
int
threadHandState
=
0
;
...
...
Assets/scripts/Datas/gameIdJsonData.cs
View file @
3b4b25f7
...
@@ -3,7 +3,7 @@ using System.Collections.Generic;
...
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using
Unity.VisualScripting
;
using
Unity.VisualScripting
;
using
UnityEngine
;
using
UnityEngine
;
public
class
gameIdJsonData
public
class
gameIdJsonData
//json文件的所有数据
{
{
public
string
nowId
=
""
;
public
string
nowId
=
""
;
public
short
width
=
0
;
public
short
width
=
0
;
...
...
Assets/scripts/Views/gameScene/gameSceneLogic.cs
View file @
3b4b25f7
...
@@ -17,6 +17,7 @@ class DebugNetHotData
...
@@ -17,6 +17,7 @@ class DebugNetHotData
public
bool
isFile
;
public
bool
isFile
;
public
string
msg
;
public
string
msg
;
}
}
//初始化、下载、解压
public
class
gameSceneLogic
:
MonoBehaviour
,
IEventHandler
public
class
gameSceneLogic
:
MonoBehaviour
,
IEventHandler
{
{
// Start is called before the first frame update
// Start is called before the first frame update
...
@@ -58,18 +59,18 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -58,18 +59,18 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
Application
.
SetStackTraceLogType
(
LogType
.
Log
,
StackTraceLogType
.
None
);
Application
.
SetStackTraceLogType
(
LogType
.
Log
,
StackTraceLogType
.
None
);
onEvent
(
"switchGameAreaGroupId"
,
this
.
onEvent_switchGameAreaGroupId_Handler
);
onEvent
(
"switchGameAreaGroupId"
,
this
.
onEvent_switchGameAreaGroupId_Handler
);
//切换组的ID
onEvent
(
"gameViewOnInitEnd"
,
this
.
onEvent_gameViewOnInitEnd_Handler
);
onEvent
(
"gameViewOnInitEnd"
,
this
.
onEvent_gameViewOnInitEnd_Handler
);
//游戏图片初始化完成
onEvent
(
"gameClickPos"
,
this
.
onEvent_gameClickPos_Handler
);
onEvent
(
"gameClickPos"
,
this
.
onEvent_gameClickPos_Handler
);
//灰色的点击回掉
onEvent
(
"inGameLoadingBarEnd"
,
this
.
onEvent_inGameLoadingBarEnd_Handler
);
onEvent
(
"inGameLoadingBarEnd"
,
this
.
onEvent_inGameLoadingBarEnd_Handler
);
//进入游戏的进度条加载完成
onEvent
(
"showAreaEventOk"
,
onSelectAreaEvent
);
onEvent
(
"showAreaEventOk"
,
onSelectAreaEvent
);
//当前组的都涂完了
onEvent
(
"initViewShowData"
,
onInitViewShowDataEvent
);
onEvent
(
"initViewShowData"
,
onInitViewShowDataEvent
);
//初始化数据完成
onEvent
(
"changeGameUserProgress"
,
onChangeGameUserProgressEvent
);
onEvent
(
"changeGameUserProgress"
,
onChangeGameUserProgressEvent
);
//整体进度改变
onEvent
(
"tipShowPosMaxScale"
,
onTipShowPosMaxScaleEvent
);
onEvent
(
"tipShowPosMaxScale"
,
onTipShowPosMaxScaleEvent
);
// 点提示,当前组随机一个没涂的位置放大
onEvent
(
"gamePlayerEndHandler"
,
onGamePlayerEndHandlerEvent
);
onEvent
(
"gamePlayerEndHandler"
,
onGamePlayerEndHandlerEvent
);
//整个大图都涂完了
onEvent
(
"closeGameScene"
,
onCloseGameSceneEvent
);
onEvent
(
"closeGameScene"
,
onCloseGameSceneEvent
);
//关游戏
onEvent
(
"removeGroupByGid"
,
onRemoveGroupByGidEvent
);
onEvent
(
"removeGroupByGid"
,
onRemoveGroupByGidEvent
);
//自动涂gid不一致会调过来
transform
.
Find
(
"ingameLoad/loadImg"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"ingameLoad/loadImg"
).
gameObject
.
SetActive
(
false
);
//gameScenUser
//gameScenUser
var
gridViewList
=
areaGroupList
.
GetComponent
<
gameSceneAreaGroupHandler
>();
var
gridViewList
=
areaGroupList
.
GetComponent
<
gameSceneAreaGroupHandler
>();
gridViewList
.
gameObject
.
SetActive
(
false
);
gridViewList
.
gameObject
.
SetActive
(
false
);
...
@@ -86,8 +87,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -86,8 +87,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
addHotParams
<
float
>(
"TUSE_doubleTouchScale"
,
"doubleTouchScale"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_doubleTouchScale"
,
"doubleTouchScale"
,
float
.
TryParse
);
addHotParams
<
short
>(
"TUSE_areaOutValue"
,
"areaOutValue"
,
short
.
TryParse
);
addHotParams
<
short
>(
"TUSE_areaOutValue"
,
"areaOutValue"
,
short
.
TryParse
);
addHotParams
<
float
>(
"TUSE_MoveScale"
,
"moveScale"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_MoveScale"
,
"moveScale"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_doubleTouchScale"
,
"doubleTouchScale"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_doubleTouchScale"
,
"doubleTouchScale"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_dyMinShowFontSize"
,
"dyMinShowFontSize"
,
float
.
TryParse
);
addHotParams
<
float
>(
"TUSE_dyMinShowFontSize"
,
"dyMinShowFontSize"
,
float
.
TryParse
);
addHotParams
<
int
>(
"TUSE_PhoneOffsetValue"
,
"PhoneOffsetValue"
,
int
.
TryParse
);
addHotParams
<
int
>(
"TUSE_PhoneOffsetValue"
,
"PhoneOffsetValue"
,
int
.
TryParse
);
return
true
;
return
true
;
...
@@ -101,7 +100,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -101,7 +100,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
void
addHotParams
<
T
>(
string
netKey
,
string
localKey
,
StringOutTValue
<
T
>
back
,
NotifyBoolParam
notifyBoolParam
=
null
)
void
addHotParams
<
T
>(
string
netKey
,
string
localKey
,
StringOutTValue
<
T
>
back
,
NotifyBoolParam
notifyBoolParam
=
null
)
{
{
string
url
=
string
.
Format
(
"http://www.xn--3-y50c.com:8560/keysOper?key={0}"
,
netKey
)
;
string
url
=
$"http://www.xn--3-y50c.com:8560/keysOper?key=
{
netKey
}
"
;
utilsTools
.
setGDataByKey
(
url
,
localKey
);
utilsTools
.
setGDataByKey
(
url
,
localKey
);
utilsTools
.
httpGET
(
this
,
url
,
true
,
(
string
id
,
string
url
,
bool
isSuccess
,
System
.
Object
data
)
=>
utilsTools
.
httpGET
(
this
,
url
,
true
,
(
string
id
,
string
url
,
bool
isSuccess
,
System
.
Object
data
)
=>
{
{
...
@@ -131,6 +130,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -131,6 +130,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
{
ActionManages
.
update
();
ActionManages
.
update
();
}
}
//创建列表item的时候回调并设置、初始化和刷新
private
void
onUpdateGroupGridHandler
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
,
TempGroupInfos
group
,
bool
isFirst
=
false
)
private
void
onUpdateGroupGridHandler
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
,
TempGroupInfos
group
,
bool
isFirst
=
false
)
{
{
if
(
lvbType
==
ListViewBackTypeEnum
.
create
||
ListViewBackTypeEnum
.
update
==
lvbType
)
if
(
lvbType
==
ListViewBackTypeEnum
.
create
||
ListViewBackTypeEnum
.
update
==
lvbType
)
...
@@ -170,6 +171,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -170,6 +171,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
childEventHandlers
[
eventName
](
uobjects
,
objects
);
childEventHandlers
[
eventName
](
uobjects
,
objects
);
}
}
}
}
//切换组的id
private
void
onEvent_switchGameAreaGroupId_Handler
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
private
void
onEvent_switchGameAreaGroupId_Handler
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
Vector3
vector3
;
Vector3
vector3
;
...
@@ -203,6 +205,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -203,6 +205,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
});
});
}
}
//游戏图片初始化完成
private
void
onEvent_gameViewOnInitEnd_Handler
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
private
void
onEvent_gameViewOnInitEnd_Handler
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
var
gridViewList
=
areaGroupList
.
GetComponent
<
gameSceneAreaGroupHandler
>();
var
gridViewList
=
areaGroupList
.
GetComponent
<
gameSceneAreaGroupHandler
>();
...
@@ -364,7 +367,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -364,7 +367,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//rectTransform2.localPosition = new Vector3(rectTransform2.localPosition.x, transform1.localPosition.y - 10);
//rectTransform2.localPosition = new Vector3(rectTransform2.localPosition.x, transform1.localPosition.y - 10);
}
}
private
void
handlerLoadingPosition
(
Image
image
)
private
void
handlerLoadingPosition
(
Image
image
)
//进度条上面的图缩放一下
{
{
Debug
.
Log
(
"handlerLoadingPosition hand endl"
);
Debug
.
Log
(
"handlerLoadingPosition hand endl"
);
image
.
gameObject
.
SetActive
(
true
);
image
.
gameObject
.
SetActive
(
true
);
...
@@ -427,11 +430,11 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -427,11 +430,11 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
{
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
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
gameScenUser
.
createWorkDirectory
();
gameScenUser
.
createWorkDirectory
();
string
outPath
=
GameScenUserInfo
.
getAllRoot
();
string
outPath
=
GameScenUserInfo
.
getAllRoot
();
if
(
utilsTools
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
{
{
outPath
=
outPath
.
Replace
(
"/"
,
"\\"
);
outPath
=
outPath
.
Replace
(
"/"
,
"\\"
);
}
}
...
@@ -447,51 +450,14 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -447,51 +450,14 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
utilsTools
.
setGDataByKey
(
"downGaoQing"
,
utilsTools
.
getTotalMillisecond
());
utilsTools
.
setGDataByKey
(
"downGaoQing"
,
utilsTools
.
getTotalMillisecond
());
gameShowView
.
GetComponent
<
mainGameView
>().
loadGameImgId
();
gameShowView
.
GetComponent
<
mainGameView
>().
loadGameImgId
();
if
(
utilsTools
.
IsExistIO
(
lineImg
)
==
false
)
{
//utilsTools.httpDOWNIMG(this, gameScenUser.img, lineImg, (string id, string url, bool isSuccess, System.Object data) =>
//{
// return onDownColorImgHandler(id, url, isSuccess, data, lineImg);
//});
}
else
{
//if (utilsTools.IsExistIO(suoluetu) == false)
//{
// //utilsTools.loadLocalImage(this, image, lineImg, (bool isOk) =>
// //{
// // if (isOk)
// // {
// // Debug.Log("sdfdsfds " + (utilsTools.getTotalMillisecond() - temp1).ToSafeString());
// // image.color = Color.white;
// // handlerLoadingPosition(image);
// // }
// //});
//}
//else
//{
// int temp1 = utilsTools.getTotalMillisecond();
// utilsTools.loadLocalImage(this, image, suoluetu, (bool isOk) =>
// {
// if (isOk)
// {
// Debug.Log("sdfdsfds " + (utilsTools.getTotalMillisecond() - temp1).ToSafeString());
// image.color = Color.white;
// handlerLoadingPosition(image);
// }
// });
//}
}
}
}
//下载和解压zip 没有下载过就去下载线稿图
void
onInitViewShowDataEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
void
onInitViewShowDataEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
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"
);
if
(
utilsTools
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
string
suoluetu
=
gameScenUser
.
getLocalThumbnailPath
();
string
suoluetu
=
gameScenUser
.
getLocalThumbnailPath
();
Image
image
=
transform
.
Find
(
"ingameLoad/loadImg"
).
GetComponent
<
Image
>();
Image
image
=
transform
.
Find
(
"ingameLoad/loadImg"
).
GetComponent
<
Image
>();
...
@@ -563,6 +529,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -563,6 +529,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
}
}
//整体的进度改变
void
onChangeGameUserProgressEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
void
onChangeGameUserProgressEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
int
pro
=
(
int
)
objects
[
0
];
int
pro
=
(
int
)
objects
[
0
];
transform
.
Find
(
"ingameLoad"
).
gameObject
.
SetActive
(
false
);
transform
.
Find
(
"ingameLoad"
).
gameObject
.
SetActive
(
false
);
...
@@ -571,6 +538,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -571,6 +538,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
UnityEngine
.
UI
.
Slider
slider
=
transform
.
Find
(
"gameProgress"
).
GetComponent
<
UnityEngine
.
UI
.
Slider
>();
UnityEngine
.
UI
.
Slider
slider
=
transform
.
Find
(
"gameProgress"
).
GetComponent
<
UnityEngine
.
UI
.
Slider
>();
slider
.
value
=
pro
;
slider
.
value
=
pro
;
}
}
//点提示,当前组随机一个没涂的位置放大
void
onTipShowPosMaxScaleEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
void
onTipShowPosMaxScaleEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
System
.
Object
obj
=
objects
[
0
];
System
.
Object
obj
=
objects
[
0
];
...
@@ -579,6 +547,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -579,6 +547,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
gameAreaItem
gameAreaItem1
=
obj
as
gameAreaItem
;
gameAreaItem
gameAreaItem1
=
obj
as
gameAreaItem
;
gameShowView
.
GetComponent
<
mainGameScaleMove
>().
onTipShowPosMaxScale
(
gameAreaItem1
,
width
,
height
);
gameShowView
.
GetComponent
<
mainGameScaleMove
>().
onTipShowPosMaxScale
(
gameAreaItem1
,
width
,
height
);
}
}
//整个大图都涂完了
void
onGamePlayerEndHandlerEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
void
onGamePlayerEndHandlerEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
//Debug.Log("游戏完成,播放结束动画");
//Debug.Log("游戏完成,播放结束动画");
...
@@ -597,6 +567,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
...
@@ -597,6 +567,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
// return false;
// return false;
// }, 10);
// }, 10);
}
}
//当前组的都涂完了
void
onSelectAreaEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
void
onSelectAreaEvent
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
Object
>
objects
)
{
{
gameAreaItem
gameArea
=
(
gameAreaItem
)
objects
[
0
];
gameAreaItem
gameArea
=
(
gameAreaItem
)
objects
[
0
];
...
...
Assets/scripts/Views/replayerScene/replayerBack.cs
View file @
3b4b25f7
...
@@ -44,7 +44,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -44,7 +44,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
initData
();
initData
();
return
false
;
return
false
;
},
5
);
},
5
);
//string tuijian = "{\"status\":200,\"msg\":\"
请求成功\
",\"sign\":\"\",\"result\":{\"data\":[";
//string tuijian = "{\"status\":200,\"msg\":\"
����ɹ�\",
\"sign\":\"\",\"result\":{\"data\":[";
//for (int i = 0; i < 8; i++)
//for (int i = 0; i < 8; i++)
//{
//{
// tuijian = tuijian + json + ",";
// tuijian = tuijian + json + ",";
...
@@ -132,7 +132,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -132,7 +132,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
keyValuePairs
.
Add
(
idx
,
true
);
keyValuePairs
.
Add
(
idx
,
true
);
}
}
List
<
Vector2Int
>
removeLists
=
new
List
<
Vector2Int
>();
List
<
Vector2Int
>
removeLists
=
new
List
<
Vector2Int
>();
foreach
(
var
item
in
GroupByAreaPtInfos
.
mapAllDatas
)
//
因为有特意裁处空白保持圆角和长的非1
:2
foreach
(
var
item
in
GroupByAreaPtInfos
.
mapAllDatas
)
//
��Ϊ������ô��հױ���Բ�Ǻͳ��ķ�1:2
{
{
for
(
int
i
=
0
;
i
<
item
.
Value
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
item
.
Value
.
Count
;
i
++)
{
{
...
@@ -159,11 +159,11 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -159,11 +159,11 @@ public class replayerBack : MonoBehaviour, IEventHandler
GameScenUserInfo
gameScenUser
=
(
GameScenUserInfo
)
objects
[
0
];
GameScenUserInfo
gameScenUser
=
(
GameScenUserInfo
)
objects
[
0
];
nowGameScenUser
=
gameScenUser
;
nowGameScenUser
=
gameScenUser
;
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
string
zpath
=
utilsTools
.
getWritableByPath
(
"outFiles/"
+
gameScenUser
.
id
+
".zip"
);
if
(
utilsTools
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
zpath
=
zpath
.
Replace
(
"/"
,
"\\"
);
string
suoluetu
=
gameScenUser
.
getColorImgLocalPath
();
//gameScenUser.getLocalThumbnailPath();
string
suoluetu
=
gameScenUser
.
getColorImgLocalPath
();
//gameScenUser.getLocalThumbnailPath();
Image
image
=
mainShowView
.
GetComponent
<
Image
>();
Image
image
=
mainShowView
.
GetComponent
<
Image
>();
image
.
color
=
new
Color
(
1
,
1
,
1
,
0
);
//未
加载出来时候就透明化
image
.
color
=
new
Color
(
1
,
1
,
1
,
0
);
//δ
���س���ʱ�������
string
key
=
gameScenUser
.
id
+
"_showAd"
;
string
key
=
gameScenUser
.
id
+
"_showAd"
;
showAd
=
utilsDB
.
getDBBoolDataByKey
(
key
,
showAd
);
showAd
=
utilsDB
.
getDBBoolDataByKey
(
key
,
showAd
);
if
(
utilsTools
.
IsExistIO
(
suoluetu
)
==
false
)
if
(
utilsTools
.
IsExistIO
(
suoluetu
)
==
false
)
...
@@ -319,7 +319,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -319,7 +319,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
utilsTools
.
sendEvent
(
"CloseScenePrve"
);
utilsTools
.
sendEvent
(
"CloseScenePrve"
);
utilsTools
.
addTimer_Update
(
gameObject
,
"close"
,
(
String
name
)
=>
utilsTools
.
addTimer_Update
(
gameObject
,
"close"
,
(
String
name
)
=>
{
{
Debug
.
Log
(
"
关闭
"
);
Debug
.
Log
(
"
�ر�"
);
var
gameBackJavaData
=
utilsTools
.
getGDataByKey
<
GameBackJavaData
>(
"gameBackJavaData"
,
null
);
var
gameBackJavaData
=
utilsTools
.
getGDataByKey
<
GameBackJavaData
>(
"gameBackJavaData"
,
null
);
gameBackJavaData
.
name
=
"replayer"
;
gameBackJavaData
.
name
=
"replayer"
;
if
(
gameBackJavaData
==
null
)
if
(
gameBackJavaData
==
null
)
...
@@ -499,7 +499,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -499,7 +499,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
{
{
if
(
mp4OperNext
==
1
)
if
(
mp4OperNext
==
1
)
{
{
Debug
.
Log
(
"
分享中
"
);
Debug
.
Log
(
"
������"
);
gameObject
.
transform
.
Find
(
"inSaveProgress"
).
gameObject
.
SetActive
(
false
);
gameObject
.
transform
.
Find
(
"inSaveProgress"
).
gameObject
.
SetActive
(
false
);
utilsTools
.
share
(
""
,
gameObject
.
name
,
""
);
utilsTools
.
share
(
""
,
gameObject
.
name
,
""
);
}
}
...
@@ -507,7 +507,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
...
@@ -507,7 +507,7 @@ public class replayerBack : MonoBehaviour, IEventHandler
{
{
gameObject
.
transform
.
Find
(
"inSaveProgress/fore"
).
gameObject
.
SetActive
(
false
);
gameObject
.
transform
.
Find
(
"inSaveProgress/fore"
).
gameObject
.
SetActive
(
false
);
gameObject
.
transform
.
Find
(
"inSaveProgress/end"
).
gameObject
.
SetActive
(
true
);
gameObject
.
transform
.
Find
(
"inSaveProgress/end"
).
gameObject
.
SetActive
(
true
);
Debug
.
Log
(
"
保存完成
"
);
Debug
.
Log
(
"
�������"
);
}
}
}
}
}
}
...
...
Assets/scripts/common/checkRootFirstRun.cs
View file @
3b4b25f7
...
@@ -6,7 +6,7 @@ using Unity.VisualScripting;
...
@@ -6,7 +6,7 @@ using Unity.VisualScripting;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
//
这个节点必须在现实的下边
//
����ڵ��������ʵ���±�
class
PosChecks
class
PosChecks
{
{
public
Vector2
pos
;
public
Vector2
pos
;
...
@@ -122,7 +122,7 @@ public class checkRootFirstRun : MonoBehaviour
...
@@ -122,7 +122,7 @@ public class checkRootFirstRun : MonoBehaviour
var
an1
=
new
Vector2
(
x1
,
y1
);
var
an1
=
new
Vector2
(
x1
,
y1
);
Debug
.
Log
(
an1
);
Debug
.
Log
(
an1
);
utilsTools
.
setAnchor
(
gobject
,
an1
);
utilsTools
.
setAnchor
(
gobject
,
an1
);
if
(
utilsTools
.
Is
Phone
==
fals
e
){
if
(
utilsTools
.
Is
Win
==
tru
e
){
gobject
.
localScale
=
new
Vector2
(
0.2f
,
0.2f
);
gobject
.
localScale
=
new
Vector2
(
0.2f
,
0.2f
);
ActionManages
.
addMoveByScale
(
gobject
.
gameObject
,
9
,
5f
,
(
GameObject
_
,
int
id
)
=>{
ActionManages
.
addMoveByScale
(
gobject
.
gameObject
,
9
,
5f
,
(
GameObject
_
,
int
id
)
=>{
gobject
.
localScale
=
new
Vector2
(
0.2f
,
0.2f
);
gobject
.
localScale
=
new
Vector2
(
0.2f
,
0.2f
);
...
@@ -134,7 +134,7 @@ public class checkRootFirstRun : MonoBehaviour
...
@@ -134,7 +134,7 @@ public class checkRootFirstRun : MonoBehaviour
int
i
=
posChecks
[
0
].
isUse
==
false
?
0
:
(
posChecks
[
1
].
isUse
==
false
?
1
:
-
1
);
int
i
=
posChecks
[
0
].
isUse
==
false
?
0
:
(
posChecks
[
1
].
isUse
==
false
?
1
:
-
1
);
if
(
i
==
-
1
)
if
(
i
==
-
1
)
{
{
//
先清理一边老的的
//
������һ���ϵĵ�
drawBlock
(
posChecks
[
0
].
pos
,
backColor
);
drawBlock
(
posChecks
[
0
].
pos
,
backColor
);
posChecks
[
0
].
isUse
=
false
;
posChecks
[
0
].
isUse
=
false
;
drawBlock
(
posChecks
[
1
].
pos
,
backColor
);
drawBlock
(
posChecks
[
1
].
pos
,
backColor
);
...
@@ -167,7 +167,7 @@ public class checkRootFirstRun : MonoBehaviour
...
@@ -167,7 +167,7 @@ public class checkRootFirstRun : MonoBehaviour
}
}
private
void
LateUpdate
()
private
void
LateUpdate
()
{
{
if
(
utilsTools
.
Is
Phone
)
if
(
utilsTools
.
Is
Win
)
{
{
if
(
Input
.
touchCount
==
2
)
if
(
Input
.
touchCount
==
2
)
{
{
...
@@ -271,13 +271,13 @@ public class checkRootFirstRun : MonoBehaviour
...
@@ -271,13 +271,13 @@ public class checkRootFirstRun : MonoBehaviour
Vector2
vector
=
utilsTools
.
ScreenToUILocalPos
(
rectTransform
,
tempPos
.
pos
);
Vector2
vector
=
utilsTools
.
ScreenToUILocalPos
(
rectTransform
,
tempPos
.
pos
);
if
(
rectTransform
.
rect
.
Contains
(
vector
))
if
(
rectTransform
.
rect
.
Contains
(
vector
))
{
{
Debug
.
Log
(
"
在区域内
"
);
Debug
.
Log
(
"
��������"
);
tempPos
.
pos
=
vector
;
tempPos
.
pos
=
vector
;
pushDrawPos
();
pushDrawPos
();
}
}
else
else
{
{
Debug
.
Log
(
"
不在区域内
"
);
Debug
.
Log
(
"
����������"
);
}
}
}
}
}
}
...
...
Assets/scripts/common/mainGameOneImageView.cs
View file @
3b4b25f7
...
@@ -7,7 +7,7 @@ using Unity.VisualScripting;
...
@@ -7,7 +7,7 @@ using Unity.VisualScripting;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
public
class
mainGameOneImageView
:
mainGameView
public
class
mainGameOneImageView
:
mainGameView
//回放上面,回放用的是一张图片
{
{
// Start is called before the first frame update
// Start is called before the first frame update
public
GameObject
oneImg
=
null
;
public
GameObject
oneImg
=
null
;
...
@@ -169,7 +169,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -169,7 +169,7 @@ public class mainGameOneImageView : mainGameView
});
});
if
(
cout
==
0
)
if
(
cout
==
0
)
{
{
//没
有可渲染区域
//û
�п���Ⱦ����
removeAids
.
Add
(
item
.
m_aid
);
removeAids
.
Add
(
item
.
m_aid
);
List
<
Vector2Short
>
tempLineColors
=
new
List
<
Vector2Short
>();
List
<
Vector2Short
>
tempLineColors
=
new
List
<
Vector2Short
>();
groupPtInfo
.
getLineByAid
(
item
.
m_aid
,
ref
tempLineColors
);
groupPtInfo
.
getLineByAid
(
item
.
m_aid
,
ref
tempLineColors
);
...
@@ -207,7 +207,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -207,7 +207,7 @@ public class mainGameOneImageView : mainGameView
if
(
removeAids
.
Count
>
0
)
if
(
removeAids
.
Count
>
0
)
{
{
//
移除已经播放完成
//
�Ƴ��Ѿ��������
foreach
(
var
aid
in
removeAids
)
foreach
(
var
aid
in
removeAids
)
{
{
for
(
int
i
=
0
;
i
<
showAreaAnimationDatas
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
showAreaAnimationDatas
.
Count
;
i
++)
...
@@ -222,7 +222,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -222,7 +222,7 @@ public class mainGameOneImageView : mainGameView
drawThumbnailByAid
(
removeAids
);
drawThumbnailByAid
(
removeAids
);
if
(
showAreaAnimationDatas
.
Count
==
0
)
if
(
showAreaAnimationDatas
.
Count
==
0
)
{
{
//
保存一次缩略遮罩
图
//
����һ����������ͼ
if
(
utilsTools
.
isEqualByValue
(
gameScenUseInfo
.
progress
,
1.0
,
0.0000002f
))
if
(
utilsTools
.
isEqualByValue
(
gameScenUseInfo
.
progress
,
1.0
,
0.0000002f
))
{
{
TaskManages
.
getInstance
().
addTask
(
this
,
(
System
.
Object
[]
parma
)
=>
TaskManages
.
getInstance
().
addTask
(
this
,
(
System
.
Object
[]
parma
)
=>
...
@@ -249,7 +249,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -249,7 +249,7 @@ public class mainGameOneImageView : mainGameView
},
4
);
},
4
);
return
;
return
;
}
}
//为
缩略图准备
//Ϊ
����ͼ��
Vector2Short
vector2Short
=
allColorSize
[
"final"
];
Vector2Short
vector2Short
=
allColorSize
[
"final"
];
Vector2Short
vector2ShortOut
=
allColorSize
[
"outColor"
];
Vector2Short
vector2ShortOut
=
allColorSize
[
"outColor"
];
Color
[]
colors
=
new
Color
[
vector2Short
.
x
*
vector2Short
.
y
];
Color
[]
colors
=
new
Color
[
vector2Short
.
x
*
vector2Short
.
y
];
...
@@ -308,7 +308,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -308,7 +308,7 @@ public class mainGameOneImageView : mainGameView
lineImg
.
SetActive
(
false
);
lineImg
.
SetActive
(
false
);
return
;
return
;
}
}
//
显示指定区域
//
��ʾָ������
if
(
GroupByAreaPtInfos
.
mapAllDatas
.
ContainsKey
((
short
)
areaId
))
if
(
GroupByAreaPtInfos
.
mapAllDatas
.
ContainsKey
((
short
)
areaId
))
{
{
gameAreaItem
areaItem1
=
gameidJsondata
.
getAid
((
short
)
areaId
);
gameAreaItem
areaItem1
=
gameidJsondata
.
getAid
((
short
)
areaId
);
...
@@ -329,7 +329,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -329,7 +329,7 @@ public class mainGameOneImageView : mainGameView
allColor2
[
"outColor"
][
idx
]
=
color
;
allColor2
[
"outColor"
][
idx
]
=
color
;
allColor2
[
"thumbnail"
][
y
*
size2
.
x
+
x
]
=
color
;
allColor2
[
"thumbnail"
][
y
*
size2
.
x
+
x
]
=
color
;
}
}
//
边缘怎
么弄?
//
��Ե��ôŪ
?
if
(
isApply
==
true
)
if
(
isApply
==
true
)
{
{
Apply
();
Apply
();
...
@@ -341,7 +341,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -341,7 +341,7 @@ public class mainGameOneImageView : mainGameView
}
}
}
}
//
回放使用
//
�ط�ʹ��
public
void
showAreaPrveClear
(
bool
isfirst
)
{
public
void
showAreaPrveClear
(
bool
isfirst
)
{
if
(
InitEndIsShowLine
==
false
)
if
(
InitEndIsShowLine
==
false
)
{
{
...
@@ -373,7 +373,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -373,7 +373,7 @@ public class mainGameOneImageView : mainGameView
}
}
public
override
void
resetSize
()
public
override
void
resetSize
()
{
{
//
怎么保持宽高比
//
��ô���ֿ��߱�
if
(
InitEndIsShowLine
==
true
)
if
(
InitEndIsShowLine
==
true
)
{
{
float
width
=
gameidJsondata
.
width
;
float
width
=
gameidJsondata
.
width
;
...
@@ -391,7 +391,7 @@ public class mainGameOneImageView : mainGameView
...
@@ -391,7 +391,7 @@ public class mainGameOneImageView : mainGameView
width
=
utilsTools
.
DisplaySize
.
x
*
0.65f
;
width
=
utilsTools
.
DisplaySize
.
x
*
0.65f
;
height
=
width
*
2
;
height
=
width
*
2
;
}
}
//确
定好宽高后赋
值
//ȷ
���ÿ��ߺ�ֵ
GameObject
[]
gameObjects
=
{
oneImg
,
areaIdBase
};
GameObject
[]
gameObjects
=
{
oneImg
,
areaIdBase
};
Vector3
tempPos
=
rectTransform
.
localPosition
;
Vector3
tempPos
=
rectTransform
.
localPosition
;
if
(
width
.
Equals
(
height
)
==
false
)
if
(
width
.
Equals
(
height
)
==
false
)
...
@@ -533,10 +533,11 @@ public class mainGameOneImageView : mainGameView
...
@@ -533,10 +533,11 @@ public class mainGameOneImageView : mainGameView
});
});
}
}
}
}
public
void
idHashPosToArrayPosEx
()
public
void
idHashPosToArrayPosEx
()
{
{
idHashPosToArrayPos
();
idHashPosToArrayPos
();
//
将边缘重复放入周边区域
//
����Ե�ظ������ܱ����� 将边缘重复放入周边区域
for
(
int
i
=
0
;
i
<
allBianLun
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
allBianLun
.
Count
();
i
++)
{
{
int
idx
=
allBianLun
[
i
];
int
idx
=
allBianLun
[
i
];
...
@@ -729,13 +730,13 @@ public class mainGameOneImageView : mainGameView
...
@@ -729,13 +730,13 @@ public class mainGameOneImageView : mainGameView
}
}
utilsTools
.
setGDataByKey
(
"loadBinBegin"
,
utilsTools
.
getTotalMillisecond
());
utilsTools
.
setGDataByKey
(
"loadBinBegin"
,
utilsTools
.
getTotalMillisecond
());
string
binpath
=
colorPath
.
Substring
(
0
,
linePath
.
Length
-
4
)
+
".bin"
;
string
binpath
=
colorPath
.
Substring
(
0
,
linePath
.
Length
-
4
)
+
".bin"
;
if
(
utilsTools
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
{
{
binpath
=
binpath
.
Replace
(
"/"
,
"\\"
);
binpath
=
binpath
.
Replace
(
"/"
,
"\\"
);
}
}
Byte
[]
bytes
=
File
.
ReadAllBytes
(
binpath
);
Byte
[]
bytes
=
File
.
ReadAllBytes
(
binpath
);
bytesInitDigitMatrix
(
bytes
);
bytesInitDigitMatrix
(
bytes
);
Debug
.
Log
(
"bin
初始化完成
--------------"
);
Debug
.
Log
(
"bin
��ʼ�����---
-----------"
);
int
start
=
0
;
int
start
=
0
;
int
step
=
BitConverter
.
GetBytes
((
short
)
2
).
Length
;
int
step
=
BitConverter
.
GetBytes
((
short
)
2
).
Length
;
int
stepInt
=
BitConverter
.
GetBytes
(
65539
).
Length
;
int
stepInt
=
BitConverter
.
GetBytes
(
65539
).
Length
;
...
...
Assets/scripts/common/mainGameScaleMove.cs
View file @
3b4b25f7
...
@@ -68,6 +68,8 @@ public class mainGameScaleMove : MonoBehaviour
...
@@ -68,6 +68,8 @@ public class mainGameScaleMove : MonoBehaviour
resetBtn
.
SetActive
(
false
);
resetBtn
.
SetActive
(
false
);
}
}
}
}
public
void
setCheckInput
()
public
void
setCheckInput
()
{
{
if
(
checkInput
==
null
)
if
(
checkInput
==
null
)
...
@@ -273,11 +275,17 @@ public class mainGameScaleMove : MonoBehaviour
...
@@ -273,11 +275,17 @@ public class mainGameScaleMove : MonoBehaviour
}
}
Vector2
diff
=
new
Vector2
(
Input
.
mousePosition
.
x
+
winPrvePos
.
x
,
Input
.
mousePosition
.
y
+
winPrvePos
.
y
);
Vector2
diff
=
new
Vector2
(
Input
.
mousePosition
.
x
+
winPrvePos
.
x
,
Input
.
mousePosition
.
y
+
winPrvePos
.
y
);
onOneTouchMove
(
Input
.
mousePosition
,
diff
);
onOneTouchMove
(
Input
.
mousePosition
,
diff
);
}
else
if
(
utilsTools
.
ContainsKey
(
gameObject
,
"oneTouchBegin"
))
}
else
if
(
utilsTools
.
ContainsKey
(
gameObject
,
"oneTouchBegin"
))
{
{
Vector2
diff
=
new
Vector2
(
Input
.
mousePosition
.
x
+
winPrvePos
.
x
,
Input
.
mousePosition
.
y
+
winPrvePos
.
y
);
Vector2
diff
=
new
Vector2
(
Input
.
mousePosition
.
x
+
winPrvePos
.
x
,
Input
.
mousePosition
.
y
+
winPrvePos
.
y
);
onOneTouchEnd
(
Input
.
mousePosition
,
diff
);
onOneTouchEnd
(
Input
.
mousePosition
,
diff
);
}
}
}
}
private
void
onOneTouchBegin
(
Vector2
vector2
)
private
void
onOneTouchBegin
(
Vector2
vector2
)
{
{
...
@@ -367,7 +375,7 @@ public class mainGameScaleMove : MonoBehaviour
...
@@ -367,7 +375,7 @@ public class mainGameScaleMove : MonoBehaviour
// Update is called once per frame
// Update is called once per frame
void
Update
()
void
Update
()
{
{
if
(
checkInput
!=
null
)
if
(
checkInput
!=
null
)
{
{
if
(
utilsTools
.
getGDataByKey
<
bool
>(
"enableZoomMove"
,
false
))
if
(
utilsTools
.
getGDataByKey
<
bool
>(
"enableZoomMove"
,
false
))
...
@@ -375,7 +383,6 @@ public class mainGameScaleMove : MonoBehaviour
...
@@ -375,7 +383,6 @@ public class mainGameScaleMove : MonoBehaviour
checkInput
();
checkInput
();
}
}
}
}
}
}
private
void
updateScaleView
()
private
void
updateScaleView
()
{
{
...
@@ -406,12 +413,13 @@ public class mainGameScaleMove : MonoBehaviour
...
@@ -406,12 +413,13 @@ public class mainGameScaleMove : MonoBehaviour
Vector3
pos
=
new
Vector3
();
Vector3
pos
=
new
Vector3
();
float
ptx
=
areaItem
.
px
/
width
*
1.0f
;
//百分比
float
ptx
=
areaItem
.
px
/
width
*
1.0f
;
//百分比
float
pty
=
areaItem
.
py
/
height
*
1.0f
;
float
pty
=
areaItem
.
py
/
height
*
1.0f
;
for
(
int
i
=
0
;
i
<
transform
.
childCount
;
i
++)
for
(
int
i
=
0
;
i
<
transform
.
childCount
;
i
++)
{
{
var
itemChild
=
transform
.
GetChild
(
i
);
var
itemChild
=
transform
.
GetChild
(
i
);
itemChild
.
localScale
=
nowScale
;
itemChild
.
localScale
=
nowScale
;
}
}
Debug
.
Log
(
areaItem
.
ToString
());
Debug
.
Log
(
areaItem
.
ToString
());
RectTransform
idAreaRectTransform
=
transform
.
Find
(
"areaIdBase/"
+
areaItem
.
tempExKey
).
GetComponent
<
RectTransform
>();
RectTransform
idAreaRectTransform
=
transform
.
Find
(
"areaIdBase/"
+
areaItem
.
tempExKey
).
GetComponent
<
RectTransform
>();
pos
=
idAreaRectTransform
.
localPosition
*
-
1
*
nowScale
/
initScale
;
pos
=
idAreaRectTransform
.
localPosition
*
-
1
*
nowScale
/
initScale
;
...
...
Assets/scripts/common/mainGameView.cs
View file @
3b4b25f7
...
@@ -13,40 +13,40 @@ using System.Threading;
...
@@ -13,40 +13,40 @@ using System.Threading;
using
TMPro
;
using
TMPro
;
using
Unity.VisualScripting
;
using
Unity.VisualScripting
;
public
class
mainGameView
:
MonoBehaviour
public
class
mainGameView
:
MonoBehaviour
//大图的处理、具体的玩法
{
{
protected
gameIdJsonData
gameidJsondata
=
null
;
protected
gameIdJsonData
gameidJsondata
=
null
;
private
string
progresName
=
""
;
private
string
progresName
=
""
;
public
GameObject
lineImg
=
null
;
//线图
public
GameObject
lineImg
=
null
;
//线图
public
GameObject
colorImg
=
null
;
//颜色图
public
GameObject
colorImg
=
null
;
//颜色图
public
GameObject
lowImg
=
null
;
//底图
public
GameObject
lowImg
=
null
;
//底图
public
GameObject
areaIdBase
=
null
;
public
GameObject
areaIdBase
=
null
;
//显示的区域数字的父节点
[
Header
(
"区域id的预制体"
)]
[
Header
(
"区域id的预制体"
)]
public
string
perfabPath
=
""
;
public
string
perfabPath
=
""
;
private
GameObject
areaIdperfabObj
=
null
;
private
GameObject
areaIdperfabObj
=
null
;
//加载出来的区域的数字预制体
public
DigitMatrixShort
digitMatrix
=
null
;
public
DigitMatrixShort
digitMatrix
=
null
;
public
float
minShowFontSize
=
20f
;
public
float
minShowFontSize
=
20f
;
public
float
showFontSizeMax
=
30f
;
public
float
showFontSizeMax
=
30f
;
protected
Texture2D
lineTexture2d
=
null
;
protected
Texture2D
lineTexture2d
=
null
;
//线
private
Texture2D
lowImgTexture2d
=
null
;
private
Texture2D
lowImgTexture2d
=
null
;
//底
private
Texture2D
colorTexure2d
=
null
;
private
Texture2D
colorTexure2d
=
null
;
//彩
protected
short
nowSelectgid
=
-
1
;
protected
short
nowSelectgid
=
-
1
;
//当前选中的组id
protected
bool
fillAnimation
=
true
;
protected
bool
fillAnimation
=
true
;
//填充动画开关
private
string
[]
initDigitMatrixs
=
{
""
,
""
,
""
};
private
string
[]
initDigitMatrixs
=
{
""
,
""
,
""
};
//选中图,高清图,线稿图 这个三个都不为空就是初始化完了
protected
Dictionary
<
short
,
short
>
aid2selectOrderIdx
=
new
Dictionary
<
short
,
short
>();
protected
Dictionary
<
short
,
short
>
aid2selectOrderIdx
=
new
Dictionary
<
short
,
short
>();
//已经涂的区域 key是aid(区域id),value是json数组的下标
protected
GameScenUserInfo
gameScenUseInfo
=
null
;
protected
GameScenUserInfo
gameScenUseInfo
=
null
;
//x,y aid 当前帧向量 起点终点 等宽度计算扩散
//x,y aid 当前帧向量 起点终点 等宽度计算扩散
protected
List
<
AreaAnimationDiffuse
>
showAreaAnimationDatas
=
new
List
<
AreaAnimationDiffuse
>();
protected
List
<
AreaAnimationDiffuse
>
showAreaAnimationDatas
=
new
List
<
AreaAnimationDiffuse
>();
//等待显示动画的区域
protected
Dictionary
<
short
,
GroupByAreaPtInfos
>
groupPtInfos
=
new
Dictionary
<
short
,
GroupByAreaPtInfos
>();
protected
Dictionary
<
short
,
GroupByAreaPtInfos
>
groupPtInfos
=
new
Dictionary
<
short
,
GroupByAreaPtInfos
>();
protected
Dictionary
<
short
,
GroupByAreaPtInfos
>
groupPtInfos_All
=
new
Dictionary
<
short
,
GroupByAreaPtInfos
>();
//不管是否涂色都会记录
protected
Dictionary
<
short
,
GroupByAreaPtInfos
>
groupPtInfos_All
=
new
Dictionary
<
short
,
GroupByAreaPtInfos
>();
//不管是否涂色都会记录
protected
short
bianlun
=
-
1
;
protected
short
bianlun
=
-
1
;
//表示这个是线
protected
short
fullShow
=
-
2
;
protected
short
fullShow
=
-
2
;
//标记已经涂过的
protected
Texture2D
thumbnailTexture2d
=
null
;
protected
Texture2D
thumbnailTexture2d
=
null
;
//缩略图,无动画
private
bool
isDebugTestToEnd
=
false
;
private
bool
isDebugTestToEnd
=
false
;
public
GameObject
clickPosEff
=
null
;
public
GameObject
clickPosEff
=
null
;
Dictionary
<
string
,
Color
[
]>
allColor
=
new
Dictionary
<
string
,
Color
[
]>
();
Dictionary
<
string
,
Color
[
]>
allColor
=
new
Dictionary
<
string
,
Color
[
]>
();
//key: line color thumbnail
[
SerializeField
]
[
SerializeField
]
protected
int
selectTextureIdx
=
1
;
protected
int
selectTextureIdx
=
1
;
static
protected
string
[]
allSelectTexturePaths
=
{
static
protected
string
[]
allSelectTexturePaths
=
{
"scenes/game/cells/grayCell"
,
"scenes/game/cells/grayCell"
,
"scenes/game/cells/buleCell"
,
"scenes/game/cells/buleCell"
,
...
@@ -106,7 +106,7 @@ public class mainGameView : MonoBehaviour
...
@@ -106,7 +106,7 @@ public class mainGameView : MonoBehaviour
}
}
}
}
}
}
public
void
onInitDigitMatrix
(
string
name
)
public
void
onInitDigitMatrix
(
string
name
)
//判断选中、高清、线稿图有没有初始化完
{
{
Debug
.
Log
(
"onInitDigitMatrix >> "
+
name
);
Debug
.
Log
(
"onInitDigitMatrix >> "
+
name
);
...
@@ -195,26 +195,12 @@ public class mainGameView : MonoBehaviour
...
@@ -195,26 +195,12 @@ public class mainGameView : MonoBehaviour
nowSelectgid
=
-
1
;
nowSelectgid
=
-
1
;
resetSize
();
resetSize
();
onInitEndHandler
();
onInitEndHandler
();
if
(
thumbnailTexture2d
!=
null
)
{
//utilsTools.addTimer_Update(gameObject, "shouhuThumbnailIsChange", (String _) =>
//{
// if (thumbnailIsChange == true)
// {
// thumbnailIsChange = false;
// thumbnailTexture2d.SetPixels(allColor["thumbnail"]);
// string path = gameScenUseInfo.getLocalThumbnailPath();
// var sltTextureSize = utilsTools.getGDataByKey<Vector2>("sltTextureSize", Vector2.one);
// utilsTools.saveByteToPath(utilsTools.ScaleTexture(thumbnailTexture2d, Convert.ToInt32(sltTextureSize.x), Convert.ToInt32(sltTextureSize.y)).EncodeToJPG(), path);
// utilsTools.saveByteToPath(thumbnailTexture2d.EncodeToJPG(), path);
// }
// return true;
//}, 120, 0);
}
}
}
protected
string
getSelectPathByGid
(
int
gid
)
protected
string
getSelectPathByGid
(
int
gid
)
{
{
return
gameScenUseInfo
.
getPathByFormath
(
"groupId_{0}.png"
,
gid
);
return
gameScenUseInfo
.
getPathByFormath
(
"groupId_{0}.png"
,
gid
);
}
}
public
void
saveGroupTexture
(
int
pgid
,
Texture2D
nowGroupIdTexture
,
bool
isDestroy
=
true
)
public
void
saveGroupTexture
(
int
pgid
,
Texture2D
nowGroupIdTexture
,
bool
isDestroy
=
true
)
{
{
string
temppath
=
getSelectPathByGid
(
pgid
);
string
temppath
=
getSelectPathByGid
(
pgid
);
...
@@ -256,7 +242,6 @@ public class mainGameView : MonoBehaviour
...
@@ -256,7 +242,6 @@ public class mainGameView : MonoBehaviour
GroupByAreaPtInfos
.
width
=
gameidJsondata
.
width
;
GroupByAreaPtInfos
.
width
=
gameidJsondata
.
width
;
GroupByAreaPtInfos
.
height
=
gameidJsondata
.
height
;
GroupByAreaPtInfos
.
height
=
gameidJsondata
.
height
;
int
t1
=
utilsTools
.
getTotalMillisecond
();
int
t1
=
utilsTools
.
getTotalMillisecond
();
Dictionary
<
short
,
RectInt
>
aidByRect
=
fillAnimation
?
new
Dictionary
<
short
,
RectInt
>()
:
null
;
float
maxWidth
=
(
float
)(
gameidJsondata
.
width
+
1f
);
float
maxWidth
=
(
float
)(
gameidJsondata
.
width
+
1f
);
float
maxHeight
=
(
float
)(
gameidJsondata
.
height
+
1f
);
float
maxHeight
=
(
float
)(
gameidJsondata
.
height
+
1f
);
RectInt
model
=
new
RectInt
();
RectInt
model
=
new
RectInt
();
...
@@ -271,10 +256,6 @@ public class mainGameView : MonoBehaviour
...
@@ -271,10 +256,6 @@ public class mainGameView : MonoBehaviour
aidToIndex
.
Add
(
item
,
fid
);
aidToIndex
.
Add
(
item
,
fid
);
var
temp2
=
new
List
<
int
>(
2400
);
var
temp2
=
new
List
<
int
>(
2400
);
AidVersions2
.
Add
(
item
,
temp2
);
AidVersions2
.
Add
(
item
,
temp2
);
if
(
aidByRect
!=
null
)
{
aidByRect
.
Add
(
item
,
new
RectInt
(
model
));
}
}
}
groupPtInfos_All
.
Add
(
gid
,
groupByAreaPtInfos
);
groupPtInfos_All
.
Add
(
gid
,
groupByAreaPtInfos
);
}
}
...
@@ -295,14 +276,7 @@ public class mainGameView : MonoBehaviour
...
@@ -295,14 +276,7 @@ public class mainGameView : MonoBehaviour
short
aid
=
(
short
)(
cell
-
20
);
short
aid
=
(
short
)(
cell
-
20
);
cout1
++;
cout1
++;
AidVersions2
[
aid
].
Add
(
y
*
digitMatrix
.
RowCount
+
x
);
AidVersions2
[
aid
].
Add
(
y
*
digitMatrix
.
RowCount
+
x
);
if
(
aidByRect
!=
null
)
{
RectInt
rectInt
=
aidByRect
[
aid
];
if
(
rectInt
.
left
>
x
)
rectInt
.
left
=
x
;
if
(
rectInt
.
right
<
x
)
rectInt
.
right
=
x
;
if
(
rectInt
.
top
>
y
)
rectInt
.
top
=
y
;
if
(
rectInt
.
dowm
<
y
)
rectInt
.
dowm
=
y
;
}
}
}
}
}
}
}
...
@@ -320,6 +294,9 @@ public class mainGameView : MonoBehaviour
...
@@ -320,6 +294,9 @@ public class mainGameView : MonoBehaviour
}
}
}
}
}
}
}
}
public
void
onLineColorHandlerEnd
()
public
void
onLineColorHandlerEnd
()
{
{
...
@@ -333,7 +310,7 @@ public class mainGameView : MonoBehaviour
...
@@ -333,7 +310,7 @@ public class mainGameView : MonoBehaviour
}
}
Color
[]
colors
=
lineTexture2d
.
GetPixels
(
0
,
0
,
lineTexture2d
.
width
,
lineTexture2d
.
height
);
Color
[]
colors
=
lineTexture2d
.
GetPixels
(
0
,
0
,
lineTexture2d
.
width
,
lineTexture2d
.
height
);
List
<
Vector2Short
>
temp
=
null
;
List
<
Vector2Short
>
temp
=
null
;
foreach
(
var
item
in
aid2selectOrderIdx
)
foreach
(
var
item
in
aid2selectOrderIdx
)
//显示已经涂过的区域,将线稿图的对应区域变为彩色
{
{
var
aidData
=
gameidJsondata
.
getAid
(
item
.
Key
);
var
aidData
=
gameidJsondata
.
getAid
(
item
.
Key
);
if
(
groupPtInfos_All
[
aidData
.
gid
].
getDataByAid
(
item
.
Key
,
ref
temp
)
&&
temp
.
Count
>
0
)
if
(
groupPtInfos_All
[
aidData
.
gid
].
getDataByAid
(
item
.
Key
,
ref
temp
)
&&
temp
.
Count
>
0
)
...
@@ -368,7 +345,7 @@ public class mainGameView : MonoBehaviour
...
@@ -368,7 +345,7 @@ public class mainGameView : MonoBehaviour
}
}
public
void
onLoadFileOk
(
int
typeId
)
public
void
onLoadFileOk
(
int
typeId
)
{
{
if
(
typeId
==
1
)
if
(
typeId
==
1
)
// 1(线稿图)、2(彩色图)是一张图片
{
{
lineTexture2d
=
lineImg
.
GetComponent
<
Image
>().
sprite
.
texture
;
lineTexture2d
=
lineImg
.
GetComponent
<
Image
>().
sprite
.
texture
;
TaskManages
taskManages
=
TaskManages
.
getInstance
();
TaskManages
taskManages
=
TaskManages
.
getInstance
();
...
@@ -422,7 +399,7 @@ public class mainGameView : MonoBehaviour
...
@@ -422,7 +399,7 @@ public class mainGameView : MonoBehaviour
return
false
;
return
false
;
},
5
,
100000
);
},
5
,
100000
);
}
}
else
if
(
typeId
==
4
)
else
if
(
typeId
==
4
)
// 选中的图
{
{
TaskManages
tm
=
TaskManages
.
getInstance
();
TaskManages
tm
=
TaskManages
.
getInstance
();
TaskItemBack
checkPtNextHandler
=
null
;
TaskItemBack
checkPtNextHandler
=
null
;
...
@@ -478,7 +455,7 @@ public class mainGameView : MonoBehaviour
...
@@ -478,7 +455,7 @@ public class mainGameView : MonoBehaviour
}
}
}
}
}
}
protected
void
checkAddAreaId
()
protected
void
checkAddAreaId
()
//显示图上面的数字(区域id)
{
{
float
width
=
gameidJsondata
.
width
;
float
width
=
gameidJsondata
.
width
;
float
height
=
gameidJsondata
.
height
;
float
height
=
gameidJsondata
.
height
;
...
@@ -532,14 +509,14 @@ public class mainGameView : MonoBehaviour
...
@@ -532,14 +509,14 @@ public class mainGameView : MonoBehaviour
}
}
}
}
}
}
public
void
updateScaleView
()
public
void
updateScaleView
()
//更新缩放视图大小
{
{
if
(
areaIdBase
==
null
)
return
;
if
(
areaIdBase
==
null
)
return
;
Vector3
vector3
=
areaIdBase
.
transform
.
localScale
;
Vector3
vector3
=
areaIdBase
.
transform
.
localScale
;
float
dyMinShowFontSize
=
utilsTools
.
getGDataByKey
<
float
>(
"dyMinShowFontSize"
,
minShowFontSize
);
float
dyMinShowFontSize
=
utilsTools
.
getGDataByKey
<
float
>(
"dyMinShowFontSize"
,
minShowFontSize
);
if
(
areaIdBase
!=
null
&&
perfabPath
.
Equals
(
""
)
==
false
)
if
(
areaIdBase
!=
null
&&
perfabPath
.
Equals
(
""
)
==
false
)
{
{
//倍数怎么弄
//倍数怎么弄
,后面需要根据相机距离和区域大小去调整字体的大小
for
(
int
i
=
0
;
i
<
gameidJsondata
.
roomDatas
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
gameidJsondata
.
roomDatas
.
Count
;
i
++)
{
{
var
item
=
gameidJsondata
.
roomDatas
[
i
];
var
item
=
gameidJsondata
.
roomDatas
[
i
];
...
@@ -689,7 +666,7 @@ public class mainGameView : MonoBehaviour
...
@@ -689,7 +666,7 @@ public class mainGameView : MonoBehaviour
});
});
}
}
}
}
protected
virtual
void
bytesInitDigitMatrix
(
Byte
[]
bytes
)
protected
virtual
void
bytesInitDigitMatrix
(
Byte
[]
bytes
)
//转bin文件为二维数组
{
{
int
start
=
0
;
int
start
=
0
;
int
step
=
BitConverter
.
GetBytes
((
short
)
2
).
Length
;
int
step
=
BitConverter
.
GetBytes
((
short
)
2
).
Length
;
...
@@ -740,10 +717,11 @@ public class mainGameView : MonoBehaviour
...
@@ -740,10 +717,11 @@ public class mainGameView : MonoBehaviour
TaskManages
.
getInstance
().
insertTask
(
this
,
(
System
.
Object
[]
_
)
=>
TaskManages
.
getInstance
().
insertTask
(
this
,
(
System
.
Object
[]
_
)
=>
{
{
string
binpath
=
colorPath
.
Substring
(
0
,
linePath
.
Length
-
4
)
+
".bin"
;
string
binpath
=
colorPath
.
Substring
(
0
,
linePath
.
Length
-
4
)
+
".bin"
;
if
(
utilsTools
.
Is
Phone
==
fals
e
)
if
(
utilsTools
.
Is
Win
==
tru
e
)
{
{
binpath
=
binpath
.
Replace
(
"/"
,
"\\"
);
binpath
=
binpath
.
Replace
(
"/"
,
"\\"
);
}
}
Byte
[]
bytes
=
File
.
ReadAllBytes
(
binpath
);
Byte
[]
bytes
=
File
.
ReadAllBytes
(
binpath
);
bytesInitDigitMatrix
(
bytes
);
bytesInitDigitMatrix
(
bytes
);
Debug
.
Log
(
"bin初始化完成--------------"
);
Debug
.
Log
(
"bin初始化完成--------------"
);
...
@@ -834,6 +812,8 @@ public class mainGameView : MonoBehaviour
...
@@ -834,6 +812,8 @@ public class mainGameView : MonoBehaviour
}
}
});
});
}
}
//
public
virtual
void
showArea
(
int
areaId
,
OnAreaHandler
onAreaHandler
=
null
,
bool
isApply
=
true
)
public
virtual
void
showArea
(
int
areaId
,
OnAreaHandler
onAreaHandler
=
null
,
bool
isApply
=
true
)
{
{
if
(
areaId
==
-
1
)
if
(
areaId
==
-
1
)
...
@@ -860,6 +840,7 @@ public class mainGameView : MonoBehaviour
...
@@ -860,6 +840,7 @@ public class mainGameView : MonoBehaviour
}
}
}
}
//切换显示的组
public
virtual
bool
switchShowAreaGroup
(
short
gid
,
OnAreaHandler
onAreaHandler
=
null
)
public
virtual
bool
switchShowAreaGroup
(
short
gid
,
OnAreaHandler
onAreaHandler
=
null
)
{
{
if
(
gid
.
Equals
(
nowSelectgid
))
if
(
gid
.
Equals
(
nowSelectgid
))
...
@@ -1031,7 +1012,7 @@ public class mainGameView : MonoBehaviour
...
@@ -1031,7 +1012,7 @@ public class mainGameView : MonoBehaviour
{
{
if
(
showBack
!=
null
)
if
(
showBack
!=
null
)
showBack
(-
1
,
false
);
showBack
(-
1
,
false
);
return
-
1
;
return
-
1
;
//还没初始化
}
}
short
oldValue
=
digitMatrix
.
Data
[
x
,
y
];
short
oldValue
=
digitMatrix
.
Data
[
x
,
y
];
if
(
oldValue
<
20
)
if
(
oldValue
<
20
)
...
@@ -1039,7 +1020,7 @@ public class mainGameView : MonoBehaviour
...
@@ -1039,7 +1020,7 @@ public class mainGameView : MonoBehaviour
if
(
showBack
!=
null
)
if
(
showBack
!=
null
)
showBack
(-
1
,
false
);
showBack
(-
1
,
false
);
return
oldValue
.
Equals
(
bianlun
)
?
-
2
:
-
3
;
return
oldValue
.
Equals
(
bianlun
)
?
-
2
:
-
3
;
//已经涂上色的再点
}
}
short
aid
=
(
short
)(
oldValue
-
20
);
short
aid
=
(
short
)(
oldValue
-
20
);
foreach
(
var
item
in
showAreaAnimationDatas
)
//边界判定 卡顿并且尚未重置中心点时候
foreach
(
var
item
in
showAreaAnimationDatas
)
//边界判定 卡顿并且尚未重置中心点时候
...
@@ -1047,14 +1028,14 @@ public class mainGameView : MonoBehaviour
...
@@ -1047,14 +1028,14 @@ public class mainGameView : MonoBehaviour
if
(
item
.
m_aid
.
Equals
(
aid
))
if
(
item
.
m_aid
.
Equals
(
aid
))
{
{
if
(
showBack
!=
null
)
showBack
(-
1
,
false
);
if
(
showBack
!=
null
)
showBack
(-
1
,
false
);
return
-
3
;
return
-
3
;
//已经点过了,但还没处理
}
}
}
}
var
areaItem
=
gameidJsondata
.
roomDatas
[
aid
];
var
areaItem
=
gameidJsondata
.
roomDatas
[
aid
];
if
(
gameidJsondata
.
getRoomGroup
(
nowSelectgid
).
roomIds
.
IndexOf
(
aid
)
<
0
&&
ignoreGid
.
Equals
(
false
))
if
(
gameidJsondata
.
getRoomGroup
(
nowSelectgid
).
roomIds
.
IndexOf
(
aid
)
<
0
&&
ignoreGid
.
Equals
(
false
))
{
{
if
(
showBack
!=
null
)
showBack
(
aid
,
false
);
if
(
showBack
!=
null
)
showBack
(
aid
,
false
);
return
-
4
;
return
-
4
;
//点的不是这个组的色块
}
}
if
(
areaItem
.
isShow
)
if
(
areaItem
.
isShow
)
{
{
...
@@ -1113,9 +1094,52 @@ public class mainGameView : MonoBehaviour
...
@@ -1113,9 +1094,52 @@ public class mainGameView : MonoBehaviour
showBack
(
aid
,
true
);
showBack
(
aid
,
true
);
return
1
;
return
1
;
}
}
Vector3
mouse_oldpos
;
Vector3
mouse_nowpos
;
bool
flag
;
private
void
Update
()
private
void
Update
()
{
{
baseUpdate
();
baseUpdate
();
if
(
Input
.
mouseScrollDelta
.
y
<
0
)
//滚轮向前滚动
{
var
scal
=
new
Vector3
(
transform
.
localScale
.
x
-
Input
.
mouseScrollDelta
.
y
,
transform
.
localScale
.
y
-
Input
.
mouseScrollDelta
.
y
,
0
);
if
(
scal
.
x
>
5
)
scal
=
Vector3
.
one
*
5
;
transform
.
localScale
=
scal
;
}
if
(
Input
.
mouseScrollDelta
.
y
>
0
)
//滚轮向后滚动
{
var
scal
=
new
Vector3
(
transform
.
localScale
.
x
-
Input
.
mouseScrollDelta
.
y
,
transform
.
localScale
.
y
-
Input
.
mouseScrollDelta
.
y
,
0
);
if
(
scal
.
x
<
1
)
scal
=
Vector3
.
one
;
transform
.
localScale
=
scal
;
}
if
(
Input
.
GetMouseButton
(
0
))
//暂时先这样实现编辑器里的鼠标拖动
{
if
(
flag
)
{
mouse_nowpos
=
Camera
.
main
.
ScreenToWorldPoint
(
Input
.
mousePosition
);
if
(
mouse_nowpos
!=
mouse_oldpos
)
{
float
pos_x
=
(
mouse_oldpos
.
x
-
mouse_nowpos
.
x
)*
transform
.
localScale
.
x
;
float
pos_y
=
(
mouse_oldpos
.
y
-
mouse_nowpos
.
y
)*
transform
.
localScale
.
x
;
transform
.
localPosition
=
new
Vector3
(
transform
.
localPosition
.
x
-
pos_x
,
transform
.
localPosition
.
y
-
pos_y
,
0
);
}
}
else
{
mouse_oldpos
=
Camera
.
main
.
ScreenToWorldPoint
(
Input
.
mousePosition
);
}
mouse_nowpos
=
Camera
.
main
.
ScreenToWorldPoint
(
Input
.
mousePosition
);
flag
=
true
;
}
if
(
Input
.
GetMouseButtonUp
(
0
))
{
flag
=
false
;
}
}
}
// Update is called once per frame
// Update is called once per frame
protected
void
baseUpdate
()
protected
void
baseUpdate
()
...
@@ -1126,7 +1150,7 @@ public class mainGameView : MonoBehaviour
...
@@ -1126,7 +1150,7 @@ public class mainGameView : MonoBehaviour
{
{
TaskManages
.
getInstance
().
updateTask
(
this
);
TaskManages
.
getInstance
().
updateTask
(
this
);
}
}
protected
virtual
void
onShowAnimationHandler
()
protected
virtual
void
onShowAnimationHandler
()
//对点击色块区域后的处理
{
{
if
(
showAreaAnimationDatas
.
Count
>
0
)
if
(
showAreaAnimationDatas
.
Count
>
0
)
...
@@ -1140,6 +1164,7 @@ public class mainGameView : MonoBehaviour
...
@@ -1140,6 +1164,7 @@ public class mainGameView : MonoBehaviour
short
nowCheckId
=
(
short
)(
item
.
m_aid
+
20
);
short
nowCheckId
=
(
short
)(
item
.
m_aid
+
20
);
var
groupPtInfo
=
groupPtInfos
[
gid
];
var
groupPtInfo
=
groupPtInfos
[
gid
];
int
cout
=
0
;
int
cout
=
0
;
//这儿播放上色的动画效果
utilsTools
.
Ring
(
item
.
m_x
,
item
.
m_y
,
item
.
m_fpsEnd
,
item
.
m_fpsStart
,
gameidJsondata
.
width
,
gameidJsondata
.
height
,(
int
x
,
int
y
,
int
idx
)
=>
utilsTools
.
Ring
(
item
.
m_x
,
item
.
m_y
,
item
.
m_fpsEnd
,
item
.
m_fpsStart
,
gameidJsondata
.
width
,
gameidJsondata
.
height
,(
int
x
,
int
y
,
int
idx
)
=>
{
{
short
nowValue
=
digitMatrix
.
Data
[
x
,
y
];
short
nowValue
=
digitMatrix
.
Data
[
x
,
y
];
...
@@ -1216,7 +1241,6 @@ public class mainGameView : MonoBehaviour
...
@@ -1216,7 +1241,6 @@ public class mainGameView : MonoBehaviour
drawThumbnailByAid
(
removeAids
);
drawThumbnailByAid
(
removeAids
);
if
(
showAreaAnimationDatas
.
Count
==
0
)
if
(
showAreaAnimationDatas
.
Count
==
0
)
{
{
//保存一次缩略遮罩图
if
(
utilsTools
.
isEqualByValue
(
gameScenUseInfo
.
progress
,
1.0
,
0.0000002f
))
if
(
utilsTools
.
isEqualByValue
(
gameScenUseInfo
.
progress
,
1.0
,
0.0000002f
))
{
{
...
@@ -1415,8 +1439,6 @@ public class mainGameView : MonoBehaviour
...
@@ -1415,8 +1439,6 @@ public class mainGameView : MonoBehaviour
//提示的查找过程
//提示的查找过程
public
void
onTipHandler
()
public
void
onTipHandler
()
{
{
if
(
isDebugTestToEnd
==
false
)
{
if
(
nowSelectgid
>=
0
)
if
(
nowSelectgid
>=
0
)
{
{
var
roomGroup
=
gameidJsondata
.
getRoomGroup
(
nowSelectgid
);
var
roomGroup
=
gameidJsondata
.
getRoomGroup
(
nowSelectgid
);
...
@@ -1452,65 +1474,64 @@ public class mainGameView : MonoBehaviour
...
@@ -1452,65 +1474,64 @@ public class mainGameView : MonoBehaviour
}
}
}
}
}
}
}
//else if (nowSelectgid >= 0)
else
if
(
nowSelectgid
>=
0
)
//{
{
// var roomGroup = gameidJsondata.getRoomGroup(nowSelectgid);
var
roomGroup
=
gameidJsondata
.
getRoomGroup
(
nowSelectgid
);
// if (groupPtInfos.ContainsKey(nowSelectgid) == false)
if
(
groupPtInfos
.
ContainsKey
(
nowSelectgid
)
==
false
)
// {
{
// return;
return
;
// }
}
// var aidpts = groupPtInfos[nowSelectgid];
var
aidpts
=
groupPtInfos
[
nowSelectgid
];
// short[] noshowAids = aidpts.getDataAllKey();
short
[]
noshowAids
=
aidpts
.
getDataAllKey
();
// List<short> aids = new List<short>();
List
<
short
>
aids
=
new
List
<
short
>();
// if (noshowAids.Length > 0)
if
(
noshowAids
.
Length
>
0
)
// {
{
// short aid = -1;
short
aid
=
-
1
;
// for (int i = 0; i < noshowAids.Length; i++)
for
(
int
i
=
0
;
i
<
noshowAids
.
Length
;
i
++)
// {
{
// aid = noshowAids[i];
aid
=
noshowAids
[
i
];
// foreach (var item in showAreaAnimationDatas)
foreach
(
var
item
in
showAreaAnimationDatas
)
// {
{
// if (aid.Equals(item.m_aid))
if
(
aid
.
Equals
(
item
.
m_aid
))
// {
{
// aid = -1;
aid
=
-
1
;
// break;
break
;
// }
}
// }
}
// if (aid > -1)
if
(
aid
>
-
1
)
// {
{
// aids.Add(aid);
aids
.
Add
(
aid
);
// }
}
// }
}
// }
}
// if (aids.Count > 0)
if
(
aids
.
Count
>
0
)
// {
{
// TaskManages.getInstance().addTask(this, (System.Object[] p) =>
TaskManages
.
getInstance
().
addTask
(
this
,
(
System
.
Object
[]
p
)
=>
// {
{
// List<short> showAids = (List<short>)p[0];
List
<
short
>
showAids
=
(
List
<
short
>)
p
[
0
];
// foreach (var item in showAids)
foreach
(
var
item
in
showAids
)
// {
{
// var tipAidInfo = gameidJsondata.getAid(item);
var
tipAidInfo
=
gameidJsondata
.
getAid
(
item
);
// showAreaByPos(tipAidInfo.px, tipAidInfo.py, null);
showAreaByPos
(
tipAidInfo
.
px
,
tipAidInfo
.
py
,
null
);
// break;
break
;
// }
}
// utilsTools.addTimer_Update(gameObject, "sdcdvc", (String name) =>
utilsTools
.
addTimer_Update
(
gameObject
,
"sdcdvc"
,
(
String
name
)
=>
// {
{
// utilsTools.setGDataByKey("enableZoomMove", false);
utilsTools
.
setGDataByKey
(
"enableZoomMove"
,
false
);
// if (lowImg != null) lowImg.SetActive(false);
if
(
lowImg
!=
null
)
lowImg
.
SetActive
(
false
);
// if (areaIdBase != null) areaIdBase.SetActive(false);
if
(
areaIdBase
!=
null
)
areaIdBase
.
SetActive
(
false
);
// utilsTools.sendEventObjectParams("gamePlayerEndHandler");
utilsTools
.
sendEventObjectParams
(
"gamePlayerEndHandler"
);
// return false;
return
false
;
// },15);
},
15
);
// }, aids);
},
aids
);
// }
}
//}
}
//else{ //直接进回放
else
{
// utilsTools.setGDataByKey("enableZoomMove", false);
utilsTools
.
setGDataByKey
(
"enableZoomMove"
,
false
);
// if (lowImg != null) lowImg.SetActive(false);
if
(
lowImg
!=
null
)
lowImg
.
SetActive
(
false
);
// if (areaIdBase != null) areaIdBase.SetActive(false);
if
(
areaIdBase
!=
null
)
areaIdBase
.
SetActive
(
false
);
// utilsTools.sendEventObjectParams("gamePlayerEndHandler"); //直接发送这个事件
utilsTools
.
sendEventObjectParams
(
"gamePlayerEndHandler"
);
//}
}
}
}
//加载小的选中图的保存过程,如果需要三合一的方式mainGameOneImageView的处理方式
//加载小的选中图的保存过程,如果需要三合一的方式mainGameOneImageView的处理方式
protected
virtual
void
loadSelectImageTexture
(
Texture2D
nowSelectTexture
,
NotifyEmptParam
notify
,
int
width
=
0
,
int
height
=
0
)
protected
virtual
void
loadSelectImageTexture
(
Texture2D
nowSelectTexture
,
NotifyEmptParam
notify
,
int
width
=
0
,
int
height
=
0
)
...
@@ -1572,7 +1593,7 @@ public class mainGameView : MonoBehaviour
...
@@ -1572,7 +1593,7 @@ public class mainGameView : MonoBehaviour
},
objects2
);
},
objects2
);
}
}
protected
void
loadSelectImageTextureId
(
int
idx
=
0
,
NotifyEmptParam
notify
=
null
)
protected
void
loadSelectImageTextureId
(
int
idx
=
0
,
NotifyEmptParam
notify
=
null
)
//加载选中的组对应的区域的颜色块
{
{
string
path
=
allSelectTexturePaths
[
idx
];
string
path
=
allSelectTexturePaths
[
idx
];
var
req
=
Resources
.
LoadAsync
<
Texture2D
>(
path
);
var
req
=
Resources
.
LoadAsync
<
Texture2D
>(
path
);
...
@@ -1636,4 +1657,5 @@ public class mainGameView : MonoBehaviour
...
@@ -1636,4 +1657,5 @@ public class mainGameView : MonoBehaviour
},
5
);
},
5
);
}
}
}
}
}
}
Assets/scripts/utils/DigitMatrixShort.cs
View file @
3b4b25f7
...
@@ -5,21 +5,21 @@ using System;
...
@@ -5,21 +5,21 @@ using System;
using
UnityEngine.UIElements
;
using
UnityEngine.UIElements
;
using
Unity.VisualScripting
;
using
Unity.VisualScripting
;
/// <summary>
/// <summary>
///
数字矩阵
///
���־���
/// </summary>
/// </summary>
public
class
DigitMatrixShort
public
class
DigitMatrixShort
//泛洪算法 颜料桶算法
{
{
#
region
属性
#
region
����
public
DigitMatrixSetBack
back
=
null
;
public
DigitMatrixSetBack
back
=
null
;
public
DigitMatrixIsEqual
<
short
>
isEqualItem
=
null
;
public
DigitMatrixIsEqual
<
short
>
isEqualItem
=
null
;
public
bool
isPause
=
false
;
public
bool
isPause
=
false
;
/// <summary>
/// <summary>
///
行数
///
����
/// </summary>
/// </summary>
public
short
RowCount
{
get
;
private
set
;
}
public
short
RowCount
{
get
;
private
set
;
}
/// <summary>
/// <summary>
///
列数
///
����
/// </summary>
/// </summary>
public
short
ColumnCount
{
get
;
private
set
;
}
public
short
ColumnCount
{
get
;
private
set
;
}
...
@@ -72,15 +72,15 @@ public class DigitMatrixShort
...
@@ -72,15 +72,15 @@ public class DigitMatrixShort
},
bianLun
,
false
);
},
bianLun
,
false
);
//foreach (var item in tempPts)
//foreach (var item in tempPts)
//{
//{
// Data[item.Item1, item.Item2] = oldValue;//
恢复
// Data[item.Item1, item.Item2] = oldValue;//
�ָ�
//}
//}
}
}
#
region
FloodFill8WithStack
#
region
FloodFill8WithStack
/// <summary>
/// <summary>
///
漫水填充(基于堆的8邻域填充
)
///
��ˮ���(���ڶѵ�8�������)
/// </summary>
/// </summary>
/// <param name="r">
行
</param>
/// <param name="r">
��<
/param>
/// <param name="c">
列
</param>
/// <param name="c">
��<
/param>
/// <param name="newValue"></param>
/// <param name="newValue"></param>
/// <param name="oldValue"></param>
/// <param name="oldValue"></param>
/// <param name="matrix"></param>
/// <param name="matrix"></param>
...
@@ -135,7 +135,7 @@ public class DigitMatrixShort
...
@@ -135,7 +135,7 @@ public class DigitMatrixShort
CheckNewSeed
(
r
-
1
,
c
+
1
);
CheckNewSeed
(
r
-
1
,
c
+
1
);
CheckNewSeed
(
r
+
1
,
c
-
1
);
CheckNewSeed
(
r
+
1
,
c
-
1
);
tryValues
=
tryValues
+
1
;
tryValues
=
tryValues
+
1
;
if
(
tryValues
>
4096
*
4096
*
10
)
break
;
//
基本死循环了
if
(
tryValues
>
4096
*
4096
*
10
)
break
;
//
������ѭ����
}
}
}
}
#
endregion
#
endregion
...
...
Assets/scripts/utils/mainGameViewHelp.cs
View file @
3b4b25f7
...
@@ -26,7 +26,7 @@ public class AreaAnimationDiffuse
...
@@ -26,7 +26,7 @@ public class AreaAnimationDiffuse
public
short
m_y
;
public
short
m_y
;
public
short
m_aid
;
public
short
m_aid
;
public
short
m_fpsStart
=
1
;
//r 开始
public
short
m_fpsStart
=
1
;
//r 开始
public
short
m_fpsEnd
=
100
;
//r 结束
public
short
m_fpsEnd
=
50
;
//r 结束 这个值调大了可以让动画效果变快,小了就是变慢
//key beginStart 值 value 这个圆环的像素
//key beginStart 值 value 这个圆环的像素
public
ConcurrentDictionary
<
short
,
List
<
short
>>
m_datas
=
new
ConcurrentDictionary
<
short
,
List
<
short
>>();
public
ConcurrentDictionary
<
short
,
List
<
short
>>
m_datas
=
new
ConcurrentDictionary
<
short
,
List
<
short
>>();
public
int
nowState
=
0
;
//0 尚未开始 1 处理中 2 处理完成
public
int
nowState
=
0
;
//0 尚未开始 1 处理中 2 处理完成
...
@@ -71,12 +71,12 @@ public class RectInt
...
@@ -71,12 +71,12 @@ public class RectInt
dowm
=
rectInt
.
dowm
;
dowm
=
rectInt
.
dowm
;
}
}
}
}
public
class
GroupByAreaPtInfos
public
class
GroupByAreaPtInfos
//把组和大图对应的区域关联起来
{
{
//public Dictionary<short, List<Vector2Short>> datas = new Dictionary<short, List<Vector2Short>>();
//public Dictionary<short, List<Vector2Short>> datas = new Dictionary<short, List<Vector2Short>>();
public
Dictionary
<
short
,
bool
>
datasBool
=
new
Dictionary
<
short
,
bool
>();
public
Dictionary
<
short
,
bool
>
datasBool
=
new
Dictionary
<
short
,
bool
>();
//key 区域id bool true:没涂
private
Dictionary
<
short
,
bool
>
lines
=
new
Dictionary
<
short
,
bool
>();
private
Dictionary
<
short
,
bool
>
lines
=
new
Dictionary
<
short
,
bool
>();
//key:区域id true没涂
public
static
Dictionary
<
short
,
List
<
int
>>
mapAllDatas
=
new
Dictionary
<
short
,
List
<
int
>>();
public
static
Dictionary
<
short
,
List
<
int
>>
mapAllDatas
=
new
Dictionary
<
short
,
List
<
int
>>();
//key:区域id value:全部的像素点坐标
public
static
int
width
;
public
static
int
width
;
public
static
int
height
;
public
static
int
height
;
public
bool
getDataByAid
(
short
aid
,
ref
List
<
Vector2Short
>
data
,
bool
isReBack
=
false
)
public
bool
getDataByAid
(
short
aid
,
ref
List
<
Vector2Short
>
data
,
bool
isReBack
=
false
)
...
@@ -203,7 +203,7 @@ public class ColorIndexTables
...
@@ -203,7 +203,7 @@ public class ColorIndexTables
color
=
new
Color
(
temp
.
r
,
temp
.
g
,
temp
.
b
,
temp
.
a
);
color
=
new
Color
(
temp
.
r
,
temp
.
g
,
temp
.
b
,
temp
.
a
);
return
true
;
return
true
;
}
}
public
bool
getTiledColor
(
int
x
,
int
y
,
ref
Color
color
)
public
bool
getTiledColor
(
int
x
,
int
y
,
ref
Color
color
)
//选中区域整个铺满
{
{
if
(
x
<
0
)
if
(
x
<
0
)
{
{
...
...
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