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
203fedc8
Commit
203fedc8
authored
Jun 27, 2023
by
maxiaoliang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.huolea.com:shujianhe/tusegamecolor
parents
68a11b53
ac0584ef
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
44 deletions
+165
-44
gameSceneAreaGroupHandler.cs
Assets/scripts/Views/gameScene/gameSceneAreaGroupHandler.cs
+24
-0
gameSceneAreaGroupHandler.cs.meta
...scripts/Views/gameScene/gameSceneAreaGroupHandler.cs.meta
+11
-0
gameSceneLogic.cs
Assets/scripts/Views/gameScene/gameSceneLogic.cs
+47
-5
mainGameScaleMove.cs
Assets/scripts/common/mainGameScaleMove.cs
+34
-36
mainGameView.cs
Assets/scripts/common/mainGameView.cs
+2
-2
utilsTools.cs
Assets/scripts/utils/utilsTools.cs
+47
-1
No files found.
Assets/scripts/Views/gameScene/gameSceneAreaGroupHandler.cs
0 → 100644
View file @
203fedc8
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
gameSceneAreaGroupHandler
:
gridView
{
// Start is called before the first frame update
void
Start
()
{
RectTransform
rectTransform
=
transform
.
parent
.
GetComponent
<
RectTransform
>();
utilsTools
.
DisplaySize
=
new
Vector2
(
rectTransform
.
rect
.
width
,
rectTransform
.
rect
.
height
);
float
scale
=
rectTransform
.
rect
.
height
/
1920
;
var
scale1
=
transform
.
localScale
;
scale1
.
y
*=
scale
;
transform
.
localScale
=
scale1
;
}
// Update is called once per frame
void
Update
()
{
}
}
Assets/scripts/Views/gameScene/gameSceneAreaGroupHandler.cs.meta
0 → 100644
View file @
203fedc8
fileFormatVersion: 2
guid: f061d67e9390d054a91052bab714d5e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/scripts/Views/gameScene/gameSceneLogic.cs
View file @
203fedc8
using
System.Collections
;
using
System.Collections.Generic
;
using
TMPro
;
using
Unity.VisualScripting
;
using
UnityEngine
;
public
class
gameSceneLogic
:
MonoBehaviour
,
IEventHandler
...
...
@@ -11,14 +13,28 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
public
static
int
maxIdValue
=
100
;
private
int
nowSelectGroupId
=
4
;
public
float
progress
=
0
;
public
bool
showAreaId
=
true
;
private
TextMeshProUGUI
debugViewObj
=
null
;
void
Start
()
{
//GetComponent<TextMeshProUGUI>()
utilsTools
.
onEvent
(
this
,
"switchGameAreaGroupId"
);
utilsTools
.
onEvent
(
this
,
"gameViewOnInitEnd"
);
utilsTools
.
onEvent
(
this
,
"debugViewLogHandler"
);
var
debugTran
=
transform
.
Find
(
"debugView"
);
if
(
debugTran
!=
null
)
{
debugViewObj
=
debugTran
.
GetComponent
<
TextMeshProUGUI
>();
if
(
debugViewObj
==
null
)
debugTran
.
gameObject
.
SetActive
(
false
);
else
{
debugTran
.
gameObject
.
SetActive
(
utilsTools
.
IsPhone
);
}
}
var
gridViewList
=
areaGroupList
.
GetComponent
<
gameSceneAreaGroupHandler
>();
gridViewList
.
gameObject
.
SetActive
(
true
);
gameShowView
.
GetComponent
<
mainGameView
>().
loadTest
();
gridViewList
.
setDataNoGrid
(
20
,
1
00
,
100
,
5
,
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
)
=>
//
gameShowView.GetComponent<mainGameView>().loadTest();
gridViewList
.
setDataNoGrid
(
20
,
1
50
,
150
,
1
5
,
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
)
=>
{
if
(
lvbType
==
ListViewBackTypeEnum
.
create
||
ListViewBackTypeEnum
.
update
==
lvbType
)
{
...
...
@@ -47,7 +63,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
}
public
void
onEventHandler
(
string
eventName
,
List
<
Object
>
uobjects
,
List
<
o
bject
>
objects
)
public
void
onEventHandler
(
string
eventName
,
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
System
.
O
bject
>
objects
)
{
if
(
eventName
.
Equals
(
"switchGameAreaGroupId"
))
{
...
...
@@ -80,7 +96,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
gridViewList
.
gameObject
.
SetActive
(
true
);
var
maingameView
=
gameShowView
.
GetComponent
<
mainGameView
>();
var
ColorInfos
=
maingameView
.
getGroups
();
gridViewList
.
setDataNoGrid
(
ColorInfos
.
Count
,
150
,
150
,
10
0
,
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
)
=>
gridViewList
.
setDataNoGrid
(
ColorInfos
.
Count
,
150
,
150
,
2
0
,
(
GameObject
gobject
,
int
idx
,
ListViewBackTypeEnum
lvbType
)
=>
{
if
(
lvbType
==
ListViewBackTypeEnum
.
create
||
ListViewBackTypeEnum
.
update
==
lvbType
)
{
...
...
@@ -111,11 +127,37 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
print
(
"切换下表完成"
+
id
.
ToString
());
});
}
}
else
if
(
eventName
.
Equals
(
"debugViewLogHandler"
))
{
string
s
=
""
;
if
(
objects
!=
null
)
{
for
(
int
i
=
0
;
i
<
objects
.
Count
;
i
++)
{
s
=
s
+
objects
[
i
].
ToString
()
+
","
;
}
}
if
(
uobjects
!=
null
)
{
for
(
int
i
=
0
;
i
<
uobjects
.
Count
;
i
++)
{
s
=
s
+
uobjects
[
i
].
ToString
()
+
","
;
}
}
if
(
s
.
Length
==
0
)
return
;
if
(
utilsTools
.
IsPhone
==
false
||
debugViewObj
==
null
)
{
print
(
s
);
}
else
{
debugViewObj
.
text
=
s
;
}
}
}
public
void
onTestTemp1
()
{
print
(
"是否卡顿?"
);
}
}
Assets/scripts/common/mainGameScaleMove.cs
View file @
203fedc8
...
...
@@ -15,6 +15,8 @@ public class mainGameScaleMove : MonoBehaviour
public
float
OldTouchCurrDis
=
-
1000
;
public
float
minScale
=
0.25f
;
public
float
maxScale
=
8f
;
public
List
<
GameObject
>
ignoreList
=
new
List
<
GameObject
>();
private
List
<
System
.
Object
>
logTempList
=
null
;
public
Vector2
NowPos
{
get
{
return
nowPos
;
}
...
...
@@ -29,6 +31,11 @@ public class mainGameScaleMove : MonoBehaviour
// Start is called before the first frame update
void
Start
()
{
logTempList
=
new
List
<
object
>();
logTempList
.
Add
(
""
);
logTempList
.
Add
(
""
);
logTempList
.
Add
(
""
);
logTempList
.
Add
(
""
);
setCheckInput
();
Vector3
tempVector3
;
Quaternion
quaternion
;
...
...
@@ -50,24 +57,7 @@ public class mainGameScaleMove : MonoBehaviour
{
if
(
checkInput
==
null
)
{
switch
(
Application
.
platform
)
{
case
RuntimePlatform
.
WindowsEditor
:
case
RuntimePlatform
.
WindowsPlayer
:
case
RuntimePlatform
.
WebGLPlayer
:
case
RuntimePlatform
.
OSXEditor
:
case
RuntimePlatform
.
OSXPlayer
:
checkInput
=
checkInputByComputer
;
break
;
case
RuntimePlatform
.
Android
:
case
RuntimePlatform
.
IPhonePlayer
:
checkInput
=
checkInputByPhone
;
break
;
default
:
checkInput
=
checkInputByPhone
;
break
;
}
checkInput
=
utilsTools
.
IsPhone
?
checkInputByPhone
:
checkInputByComputer
;
}
}
...
...
@@ -102,9 +92,11 @@ public class mainGameScaleMove : MonoBehaviour
}
else
if
(
touchPhase
==
TouchPhase
.
Moved
)
{
if
(
utilsTools
.
ContainsKey
(
gameObject
,
"oneTouchBegin"
)
==
false
)
return
;
onOneTouchMove
(
oneTouch
.
position
,
oneTouch
.
deltaPosition
);
}
else
if
(
touchPhase
==
TouchPhase
.
Ended
)
{
if
(
utilsTools
.
ContainsKey
(
gameObject
,
"oneTouchBegin"
)
==
false
)
return
;
onOneTouchEnd
(
oneTouch
.
position
,
oneTouch
.
deltaPosition
);
}
else
if
(
touchPhase
==
TouchPhase
.
Canceled
)
{
...
...
@@ -142,6 +134,11 @@ public class mainGameScaleMove : MonoBehaviour
var
itemChild
=
transform
.
GetChild
(
i
);
itemChild
.
localScale
=
nowScale
;
}
logTempList
[
0
]
=
"scale"
;
logTempList
[
1
]
=
""
;
logTempList
[
2
]
=
nowScale
;
logTempList
[
3
]
=
nowSize
;
utilsTools
.
sendEventObjects
(
"debugViewLogHandler"
,
logTempList
);
}
void
clearOneTouchBegin
()
{
...
...
@@ -150,24 +147,15 @@ public class mainGameScaleMove : MonoBehaviour
//左键点击 右键缩放
void
checkInputByComputer
()
{
////0 1 2 鼠标 左中右
//bool RDown = Input.GetMouseButtonDown(2);
//bool LDown = Input.GetMouseButtonDown(0);
//if (RDown == LDown && RDown == true)//当作双指滑动 制造缩放
//float value = 0;
//var mouseScrollDelta = Input.mouseScrollDelta;
//if (mouseScrollDelta.y == 0) return;
//print(mouseScrollDelta.y);
//if (OldTouchCurrDis < -999)
//{
//}else if(RDown != LDown && LDown == true)
//{
// Vector3 mousePosition = Input.mousePosition;
// if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false)
// onOneTouchBegin(new Vector2(mousePosition.x, mousePosition.y));
// else
// {
// }
//}else if(LDown == false){
// if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false) return;
// OldTouchCurrDis = 0;
//}
//onDoubleTouchHandler(mouseScrollDelta.y * 200f);
}
private
void
onOneTouchBegin
(
Vector2
vector2
)
{
...
...
@@ -203,7 +191,11 @@ public class mainGameScaleMove : MonoBehaviour
if
(
delatPos
.
x
==
delatPos
.
y
&&
delatPos
.
x
==
0
)
return
;
//都不用移动就不更新坐标
tempVector3
.
x
+=
delatPos
.
x
;
tempVector3
.
y
+=
delatPos
.
y
;
logTempList
[
0
]
=
"move"
;
logTempList
[
1
]
=
tempVector3
;
logTempList
[
2
]
=
nowScale
;
logTempList
[
3
]
=
nowSize
;
utilsTools
.
sendEventObjects
(
"debugViewLogHandler"
,
logTempList
);
}
itemChild
.
SetLocalPositionAndRotation
(
tempVector3
,
quaternion
);
}
...
...
@@ -226,7 +218,13 @@ public class mainGameScaleMove : MonoBehaviour
}
private
void
onOneClick
(
Vector2
nowPos
)
{
print
(
"点击>>>>"
+
nowPos
.
ToString
());
var
localPos
=
utilsTools
.
ScreenToUILocalPos
(
transform
as
RectTransform
,
nowPos
);
logTempList
[
0
]
=
"click"
;
logTempList
[
1
]
=
nowPos
;
logTempList
[
2
]
=
localPos
;
utilsTools
.
sendEventObjects
(
"debugViewLogHandler"
,
logTempList
);
//print("点击>>>>" + nowPos.ToString());
}
// Update is called once per frame
void
Update
()
...
...
Assets/scripts/common/mainGameView.cs
View file @
203fedc8
...
...
@@ -99,7 +99,7 @@ public class mainGameView : MonoBehaviour
}
};
int
tempsetp
=
5
00
;
int
tempsetp
=
2
00
;
for
(
int
i
=
0
;
i
<
lineTexture2d
.
width
;
i
+=
tempsetp
)
{
System
.
Object
[]
objects
=
{
i
,
tempsetp
,
lineTexture2d
.
height
};
...
...
@@ -135,7 +135,7 @@ public class mainGameView : MonoBehaviour
onInitDigitMatrix
(
"select"
);
}
};
int
tempsetp
=
5
00
;
int
tempsetp
=
2
00
;
for
(
int
i
=
0
;
i
<
lowImgTexture2d
.
width
;
i
+=
tempsetp
)
{
System
.
Object
[]
taskParams
=
{
i
,
tempsetp
,
lowImgTexture2d
.
width
,
lowImgTexture2d
.
height
};
...
...
Assets/scripts/utils/utilsTools.cs
View file @
203fedc8
...
...
@@ -12,6 +12,46 @@ using UnityEngine.UI;
public
class
utilsTools
{
private
static
int
isPhone
=
0
;
private
static
Vector2
displaySize
=
new
Vector2
(
0
,
0
);
public
static
bool
IsPhone
{
get
{
if
(
isPhone
==
0
)
{
switch
(
Application
.
platform
)
{
case
RuntimePlatform
.
WindowsEditor
:
case
RuntimePlatform
.
WindowsPlayer
:
case
RuntimePlatform
.
WebGLPlayer
:
case
RuntimePlatform
.
OSXEditor
:
case
RuntimePlatform
.
OSXPlayer
:
isPhone
=
2
;
break
;
case
RuntimePlatform
.
Android
:
case
RuntimePlatform
.
IPhonePlayer
:
isPhone
=
1
;
break
;
default
:
isPhone
=
1
;
break
;
}
}
return
isPhone
==
1
;
}
}
public
static
Vector2
DisplaySize
{
get
{
return
displaySize
;
}
set
{
if
(
displaySize
.
x
>
1
)
return
;
displaySize
=
value
;
}
}
public
static
Dictionary
<
String
,
GameObject
>
dynamicMount
=
new
Dictionary
<
string
,
GameObject
>();
public
static
bool
addTimer_Sec
(
GameObject
gameObject
,
string
name
,
timeEventBack
back
,
double
intervalLen
,
uint
loopRepetitionLen
=
1
)
{
...
...
@@ -336,5 +376,11 @@ public class utilsTools
{
}
public
static
Vector2
ScreenToUILocalPos
(
RectTransform
transform
,
Vector2
mousePos
,
Camera
canvasCam
=
null
)
{
Vector2
uiLocalPos
;
RectTransformUtility
.
ScreenPointToLocalPointInRectangle
(
transform
,
mousePos
,
canvasCam
,
out
uiLocalPos
);
return
uiLocalPos
;
}
}
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