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
ee914e11
Commit
ee914e11
authored
Aug 16, 2023
by
JiangWanZhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加一个移动端的震动插件、更新列表间距、按下时间0.1秒后才会开始拖动
parent
fbe1e985
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
630 additions
and
18 deletions
+630
-18
gameScene.unity
Assets/Scenes/gameScene.unity
+12
-0
Vibration.meta
Assets/Vibration.meta
+8
-0
Plugins.meta
Assets/Vibration/Plugins.meta
+8
-0
iOS.meta
Assets/Vibration/Plugins/iOS.meta
+8
-0
Vibration.meta
Assets/Vibration/Plugins/iOS/Vibration.meta
+8
-0
HapticFeedback.mm
Assets/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm
+64
-0
HapticFeedback.mm.meta
...ts/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta
+37
-0
Vibration.h
Assets/Vibration/Plugins/iOS/Vibration/Vibration.h
+26
-0
Vibration.h.meta
Assets/Vibration/Plugins/iOS/Vibration/Vibration.h.meta
+24
-0
Vibration.mm
Assets/Vibration/Plugins/iOS/Vibration/Vibration.mm
+73
-0
Vibration.mm.meta
Assets/Vibration/Plugins/iOS/Vibration/Vibration.mm.meta
+34
-0
Vibration.cs
Assets/Vibration/Vibration.cs
+263
-0
Vibration.cs.meta
Assets/Vibration/Vibration.cs.meta
+12
-0
ScaleToImage.cs
Assets/scripts/ScaleToImage.cs
+23
-2
gameSceneLogic.cs
Assets/scripts/Views/gameScene/gameSceneLogic.cs
+12
-11
gridView.cs
Assets/scripts/common/gridView.cs
+5
-2
mainGameScaleMove.cs
Assets/scripts/common/mainGameScaleMove.cs
+1
-0
colorItem.cs
Assets/scripts/perfabItems/colorItem.cs
+12
-3
No files found.
Assets/Scenes/gameScene.unity
View file @
ee914e11
...
...
@@ -2128,6 +2128,18 @@ PrefabInstance:
propertyPath
:
m_Layer
value
:
5
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
8111164355371235926
,
guid
:
e2f00cfdb21d04b46adf17805f74f20c
,
type
:
3
}
propertyPath
:
m_StartAxis
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
8111164355371235926
,
guid
:
e2f00cfdb21d04b46adf17805f74f20c
,
type
:
3
}
propertyPath
:
m_CellSize.x
value
:
130
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
8111164355371235926
,
guid
:
e2f00cfdb21d04b46adf17805f74f20c
,
type
:
3
}
propertyPath
:
m_CellSize.y
value
:
130
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
8118021438581421258
,
guid
:
e2f00cfdb21d04b46adf17805f74f20c
,
type
:
3
}
propertyPath
:
m_Color.a
value
:
1
...
...
Assets/Vibration.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: c064a4425767a7c49a5fbc2ba5bc0b96
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: 8a18a006579744750bc5f62a817c99ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins/iOS.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: a8f7741f0c8fb4b3ebe08d51501d38aa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins/iOS/Vibration.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: 3ee19d5b94e8d485d92b70732e586af5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm
0 → 100644
View file @
ee914e11
#import <UIKit/UIKit.h>
extern "C" {
void _impactOccurred(const char *style)
{
UIImpactFeedbackStyle feedbackStyle;
if (strcmp(style, "Heavy") == 0)
feedbackStyle = UIImpactFeedbackStyleHeavy;
else if (strcmp(style, "Medium") == 0)
feedbackStyle = UIImpactFeedbackStyleMedium;
else if (strcmp(style, "Light") == 0)
feedbackStyle = UIImpactFeedbackStyleLight;
else if (strcmp(style, "Rigid") == 0)
if (@available(iOS 13.0, *)) {
feedbackStyle = UIImpactFeedbackStyleRigid;
} else {
return;
}
else if (strcmp(style, "Soft") == 0)
if (@available(iOS 13.0, *)) {
feedbackStyle = UIImpactFeedbackStyleSoft;
} else {
return;
}
else
return;
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:feedbackStyle];
[generator prepare];
[generator impactOccurred];
}
void _notificationOccurred(const char *style)
{
UINotificationFeedbackType feedbackStyle;
if (strcmp(style, "Error") == 0)
feedbackStyle = UINotificationFeedbackTypeError;
else if (strcmp(style, "Success") == 0)
feedbackStyle = UINotificationFeedbackTypeSuccess;
else if (strcmp(style, "Warning") == 0)
feedbackStyle = UINotificationFeedbackTypeWarning;
else
return;
UINotificationFeedbackGenerator *generator = [[UINotificationFeedbackGenerator alloc] init];
[generator prepare];
[generator notificationOccurred:feedbackStyle];
}
void _selectionChanged()
{
UISelectionFeedbackGenerator *generator = [[UISelectionFeedbackGenerator alloc] init];
[generator prepare];
[generator selectionChanged];
}
}
Assets/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: 077b20d7b7a7dc14aafdb8363888b849
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins/iOS/Vibration/Vibration.h
0 → 100644
View file @
ee914e11
//
// Vibration.h
// https://videogamecreation.fr
//
// Created by Benoît Freslon on 23/03/2017.
// Copyright © 2018 Benoît Freslon. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface
Vibration
:
NSObject
//////////////////////////////////////////
#pragma mark - Vibrate
+
(
BOOL
)
hasVibrator
;
+
(
void
)
vibrate
;
+
(
void
)
vibratePeek
;
+
(
void
)
vibratePop
;
+
(
void
)
vibrateNope
;
//////////////////////////////////////////
@end
Assets/Vibration/Plugins/iOS/Vibration/Vibration.h.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: 83a187def68af42c29e1a38e747ea79a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Plugins/iOS/Vibration/Vibration.mm
0 → 100644
View file @
ee914e11
//
// Vibration.mm
// https://videogamecreation.fr
//
// Created by Benoît Freslon on 23/03/2017.
// Copyright © 2018 Benoît Freslon. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <UIKit/UIKit.h>
#import "Vibration.h"
#define USING_IPAD UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
@interface Vibration ()
@end
@implementation Vibration
//////////////////////////////////////////
#pragma mark - Vibrate
+ (BOOL) hasVibrator {
return !(USING_IPAD);
}
+ (void) vibrate {
AudioServicesPlaySystemSoundWithCompletion(1352, NULL);
}
+ (void) vibratePeek {
AudioServicesPlaySystemSoundWithCompletion(1519, NULL); // Actuate `Peek` feedback (weak boom)
}
+ (void) vibratePop {
AudioServicesPlaySystemSoundWithCompletion(1520, NULL); // Actuate `Pop` feedback (strong boom)
}
+ (void) vibrateNope {
AudioServicesPlaySystemSoundWithCompletion(1521, NULL); // Actuate `Nope` feedback (series of three weak booms)
}
@end
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - "C"
extern "C" {
//////////////////////////////////////////
// Vibrate
bool _HasVibrator () {
return [Vibration hasVibrator];
}
void _Vibrate () {
[Vibration vibrate];
}
void _VibratePeek () {
[Vibration vibratePeek];
}
void _VibratePop () {
[Vibration vibratePop];
}
void _VibrateNope () {
[Vibration vibrateNope];
}
}
Assets/Vibration/Plugins/iOS/Vibration/Vibration.mm.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: c31160a40d8f84d4395a22df26febd41
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Vibration/Vibration.cs
0 → 100644
View file @
ee914e11
////////////////////////////////////////////////////////////////////////////////
//
// @author Benoît Freslon @benoitfreslon
// https://github.com/BenoitFreslon/Vibration
// https://benoitfreslon.com
//
////////////////////////////////////////////////////////////////////////////////
using
System.Runtime.InteropServices.ComTypes
;
using
UnityEngine
;
#if UNITY_IOS
using
System.Collections
;
using
System.Runtime.InteropServices
;
#endif
public
static
class
Vibration
{
#if UNITY_IOS
[
DllImport
(
"__Internal"
)]
private
static
extern
bool
_HasVibrator
();
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_Vibrate
();
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_VibratePop
();
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_VibratePeek
();
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_VibrateNope
();
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_impactOccurred
(
string
style
);
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_notificationOccurred
(
string
style
);
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_selectionChanged
();
#endif
#if UNITY_ANDROID
public
static
AndroidJavaClass
unityPlayer
;
public
static
AndroidJavaObject
currentActivity
;
public
static
AndroidJavaObject
vibrator
;
public
static
AndroidJavaObject
context
;
public
static
AndroidJavaClass
vibrationEffect
;
#endif
private
static
bool
initialized
=
false
;
public
static
void
Init
()
{
if
(
initialized
)
return
;
#if UNITY_ANDROID
if
(
Application
.
isMobilePlatform
)
{
unityPlayer
=
new
AndroidJavaClass
(
"com.unity3d.player.UnityPlayer"
);
currentActivity
=
unityPlayer
.
GetStatic
<
AndroidJavaObject
>
(
"currentActivity"
);
vibrator
=
currentActivity
.
Call
<
AndroidJavaObject
>
(
"getSystemService"
,
"vibrator"
);
context
=
currentActivity
.
Call
<
AndroidJavaObject
>
(
"getApplicationContext"
);
if
(
AndroidVersion
>=
26
)
{
vibrationEffect
=
new
AndroidJavaClass
(
"android.os.VibrationEffect"
);
}
}
#endif
initialized
=
true
;
}
public
static
void
VibrateIOS
(
ImpactFeedbackStyle
style
)
{
#if UNITY_IOS
_impactOccurred
(
style
.
ToString
());
#endif
}
public
static
void
VibrateIOS
(
NotificationFeedbackStyle
style
)
{
#if UNITY_IOS
_notificationOccurred
(
style
.
ToString
());
#endif
}
public
static
void
VibrateIOS_SelectionChanged
()
{
#if UNITY_IOS
_selectionChanged
();
#endif
}
///<summary>
/// Tiny pop vibration
///</summary>
public
static
void
VibratePop
()
{
if
(
Application
.
isMobilePlatform
)
{
#if UNITY_IOS
_VibratePop
();
#elif UNITY_ANDROID
VibrateAndroid
(
50
);
#endif
}
}
///<summary>
/// Small peek vibration
///</summary>
public
static
void
VibratePeek
()
{
if
(
Application
.
isMobilePlatform
)
{
#if UNITY_IOS
_VibratePeek
();
#elif UNITY_ANDROID
VibrateAndroid
(
100
);
#endif
}
}
///<summary>
/// 3 small vibrations
///</summary>
public
static
void
VibrateNope
()
{
if
(
Application
.
isMobilePlatform
)
{
#if UNITY_IOS
_VibrateNope
();
#elif UNITY_ANDROID
long
[]
pattern
=
{
0
,
50
,
0
,
0
};
VibrateAndroid
(
pattern
,
-
1
);
#endif
}
}
#if UNITY_ANDROID
///<summary>
/// Only on Android
/// https://developer.android.com/reference/android/os/Vibrator.html#vibrate(long)
///</summary>
public
static
void
VibrateAndroid
(
long
milliseconds
)
{
if
(
Application
.
isMobilePlatform
)
{
if
(
AndroidVersion
>=
26
)
{
AndroidJavaObject
createOneShot
=
vibrationEffect
.
CallStatic
<
AndroidJavaObject
>
(
"createOneShot"
,
milliseconds
,
-
1
);
vibrator
.
Call
(
"vibrate"
,
createOneShot
);
}
else
{
vibrator
.
Call
(
"vibrate"
,
milliseconds
);
}
}
}
///<summary>
/// Only on Android
/// https://proandroiddev.com/using-vibrate-in-android-b0e3ef5d5e07
///</summary>
public
static
void
VibrateAndroid
(
long
[]
pattern
,
int
repeat
)
{
if
(
Application
.
isMobilePlatform
)
{
if
(
AndroidVersion
>=
26
)
{
long
[]
amplitudes
;
AndroidJavaObject
createWaveform
=
vibrationEffect
.
CallStatic
<
AndroidJavaObject
>
(
"createWaveform"
,
pattern
,
repeat
);
vibrator
.
Call
(
"vibrate"
,
createWaveform
);
}
else
{
vibrator
.
Call
(
"vibrate"
,
pattern
,
repeat
);
}
}
}
#endif
///<summary>
///Only on Android
///</summary>
public
static
void
CancelAndroid
()
{
if
(
Application
.
isMobilePlatform
)
{
#if UNITY_ANDROID
vibrator
.
Call
(
"cancel"
);
#endif
}
}
public
static
bool
HasVibrator
()
{
if
(
Application
.
isMobilePlatform
)
{
#if UNITY_ANDROID
AndroidJavaClass
contextClass
=
new
AndroidJavaClass
(
"android.content.Context"
);
string
Context_VIBRATOR_SERVICE
=
contextClass
.
GetStatic
<
string
>
(
"VIBRATOR_SERVICE"
);
AndroidJavaObject
systemService
=
context
.
Call
<
AndroidJavaObject
>
(
"getSystemService"
,
Context_VIBRATOR_SERVICE
);
if
(
systemService
.
Call
<
bool
>
(
"hasVibrator"
)
)
{
return
true
;
}
else
{
return
false
;
}
#elif UNITY_IOS
return
_HasVibrator
();
#else
return
false
;
#endif
}
else
{
return
false
;
}
}
public
static
void
Vibrate
()
{
#if UNITY_ANDROID || UNITY_IOS
if
(
Application
.
isMobilePlatform
)
{
Handheld
.
Vibrate
();
}
#endif
}
public
static
int
AndroidVersion
{
get
{
int
iVersionNumber
=
0
;
if
(
Application
.
platform
==
RuntimePlatform
.
Android
)
{
string
androidVersion
=
SystemInfo
.
operatingSystem
;
int
sdkPos
=
androidVersion
.
IndexOf
(
"API-"
);
iVersionNumber
=
int
.
Parse
(
androidVersion
.
Substring
(
sdkPos
+
4
,
2
).
ToString
()
);
}
return
iVersionNumber
;
}
}
}
public
enum
ImpactFeedbackStyle
{
Heavy
,
Medium
,
Light
,
Rigid
,
Soft
}
public
enum
NotificationFeedbackStyle
{
Error
,
Success
,
Warning
}
Assets/Vibration/Vibration.cs.meta
0 → 100644
View file @
ee914e11
fileFormatVersion: 2
guid: 9a1817bb553014d4c9a665d4fa202202
timeCreated: 1474899097
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/scripts/ScaleToImage.cs
View file @
ee914e11
...
...
@@ -40,6 +40,7 @@ public class ScaleToImage : MonoBehaviour
private
bool
IsPlayAniFlag
;
private
Vector3
SavePos_Scale
;
//这个是保存放大到最大的倍数的时候回正的位置
private
float
clickTime
;
private
void
Update
()
{
if
(
Input
.
touchCount
==
2
)
...
...
@@ -172,31 +173,51 @@ public class ScaleToImage : MonoBehaviour
isInit_move
=
false
;
if
(
MoveEndFlag
&&
!
IsPlayAniFlag
)
LerptoMove_End
();
clickTime
=
0
;
}
if
(
Input
.
GetMouseButtonDown
(
0
))
{
if
(
IsImageArea
(
Input
.
mousePosition
)
&&
IsMidArea
(
Input
.
mousePosition
))
{
MoveEndFlag
=
true
;
nowmoustpos
=
Input
.
mousePosition
;
}
else
{
return
;
}
}
if
(
Input
.
GetMouseButton
(
0
))
{
if
(
MoveEndFlag
)
OnClickMove
(
Input
.
mousePosition
);
clickTime
+=
Time
.
deltaTime
;
oldmoustpos
=
nowmoustpos
;
nowmoustpos
=
Input
.
mousePosition
;
if
(
MoveEndFlag
&&
clickTime
>=
0.1f
)
{
OnClickMove
(
nowmoustpos
);
}
}
}
private
Vector3
oldmoustpos
;
private
Vector3
nowmoustpos
;
private
void
LerptoMove_End
()
//移动结束后加个缓动的效果
{
MoveEndFlag
=
false
;
var
nowpos
=
new
Vector3
(
target
.
GetChild
(
0
).
position
.
x
,
target
.
GetChild
(
0
).
position
.
y
,
0
);
if
(
nowpos
==
OldPos_Move
)
{
return
;
}
if
(
nowpos
!=
OldPos_Move
)
{
var
tonow
=
(
nowpos
-
OldPos_Move
).
normalized
;
//指向现在位置的方向向量
var
newpos
=
tonow
*
0.5f
+
nowpos
;
CanMove
(
newpos
.
x
,
newpos
.
y
,
out
float
x
,
out
float
y
);
newpos
=
new
Vector3
(
x
,
y
,
0
);
for
(
int
i
=
0
;
i
<
target
.
childCount
;
i
++)
{
var
item
=
target
.
GetChild
(
i
);
...
...
Assets/scripts/Views/gameScene/gameSceneLogic.cs
View file @
ee914e11
...
...
@@ -40,9 +40,12 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
private
float
tempValue3
=
5f
;
public
ReplayCam
cam
;
public
float
ListMoveOffSet
=
35
;
private
int
DestoryByGID
=
-
1
;
Dictionary
<
string
,
EventChildItemBack
>
childEventHandlers
=
new
Dictionary
<
string
,
EventChildItemBack
>();
private
float
ChildSize
;
void
onEvent
(
string
name
,
EventChildItemBack
func
)
{
utilsTools
.
onEvent
(
this
,
name
);
...
...
@@ -98,11 +101,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
addHotParams
<
int
>(
"TUSE_PhoneOffsetValue"
,
EventName
.
DataName
.
Data_PhoneOffsetValue
,
int
.
TryParse
);
return
true
;
},
3
,
0
);
//utilsTools.resetGameObjectTreeSize(gameObject, (String path) =>
//{
// if (path.IndexOf("/top/") > 0) return 1;
// return 0;
//});
ChildSize
=
areaGroupList
.
transform
.
GetComponent
<
ScrollRect
>().
content
.
GetComponent
<
GridLayoutGroup
>().
cellSize
.
x
;
Vibration
.
Init
();
}
private
void
onGroupIsLoadOver
(
List
<
UnityEngine
.
Object
>
uobjects
,
List
<
object
>
objects
)
...
...
@@ -249,7 +249,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
if
(
nowidx
>=
5
)
{
targetpos
=
-(
120
*
(
nowidx
-
4
)
-
20
+
5
*
2
)
;
targetpos
=
-(
ChildSize
*
(
nowidx
-
4
))
-
ListMoveOffSet
;
if
(
targetpos
<
ItemParent
.
localPosition
.
x
)
{
...
...
@@ -260,7 +260,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
else
if
(
oldindex
>
nowidx
)
//点的左边的
{
targetpos
=
-(
120
*
(
nowidx
-
1
)
+
10
);
targetpos
=
-(
ChildSize
*
(
nowidx
-
1
)
+
10
);
if
(
targetpos
>
ItemParent
.
localPosition
.
x
)
{
ItemParent
.
DOLocalMoveX
(
targetpos
,
1f
);
...
...
@@ -694,7 +694,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//震动
if
(
vibration
)
{
Handheld
.
Vibrate
();
//Handheld.Vibrate();
Vibration
.
VibrateNope
();
}
if
(
nowidx
>=
0
)
{
...
...
@@ -750,9 +751,9 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
Destroy
(
item
.
gameObject
);
};
if
(
ItemParent
.
childCount
-
1
==
gid
&&
ItemParent
.
localPosition
.
x
<
-
120
)
//最右边的那个
if
(
ItemParent
.
childCount
-
1
==
gid
&&
ItemParent
.
localPosition
.
x
<
-
ChildSize
)
//最右边的那个
{
ItemParent
.
DOLocalMoveX
(
ItemParent
.
localPosition
.
x
+
120
,
0.5f
);
//.onComplete = () => { Rect.content.sizeDelta = new Vector2(Rect.content.sizeDelta.x - 120, Rect.content.sizeDelta.y); };
ItemParent
.
DOLocalMoveX
(
ItemParent
.
localPosition
.
x
+
ChildSize
,
0.5f
);
//.onComplete = () => { Rect.content.sizeDelta = new Vector2(Rect.content.sizeDelta.x - 120, Rect.content.sizeDelta.y); };
}
else
...
...
@@ -761,7 +762,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
if
(
i
>
index
)
{
ItemParent
.
GetChild
(
i
).
DOLocalMoveX
(
ItemParent
.
GetChild
(
i
).
localPosition
.
x
-
120
,
0.6f
);
ItemParent
.
GetChild
(
i
).
DOLocalMoveX
(
ItemParent
.
GetChild
(
i
).
localPosition
.
x
-
ChildSize
,
0.6f
);
ItemParent
.
GetChild
(
i
).
GetComponent
<
colorItem
>().
index
=
i
-
1
;
ItemParent
.
GetChild
(
i
).
name
=
ItemParent
.
GetChild
(
i
).
name
.
Replace
(
$"
{
i
}
"
,
$"
{
i
-
1
}
"
);
...
...
Assets/scripts/common/gridView.cs
View file @
ee914e11
...
...
@@ -16,7 +16,8 @@ public class gridView : MonoBehaviour
public
List
<
String
>
perfabPaths
=
new
List
<
string
>();
private
bool
isFirstSetData
=
true
;
public
bool
LockCellWidthEqHeight
=
true
;
//锁定宽==高
private
GameObject
listItem
;
private
GameObject
listItem
;
private
float
ItemSize
;
void
Start
()
{
listItem
=
Resources
.
Load
<
GameObject
>(
perfabPath
);
// 暂时先在这里存放列表的预制体
...
...
@@ -25,6 +26,8 @@ public class gridView : MonoBehaviour
{
perfabPaths
.
Add
(
perfabPath
);
}
ItemSize
=
120
;
//transform.GetComponent<ScrollRect>().content.GetComponent<GridLayoutGroup>().cellSize.x;
}
void
checkFirstSetData
(
bool
useVec
)
{
...
...
@@ -230,7 +233,7 @@ public class gridView : MonoBehaviour
infos
.
Add
(
new
Tuple
<
string
,
float
>(
itemKey
,
itemHeight
));
}
}
Vector3
vector3
=
new
Vector3
(
0
,
-
120
,
1
);
Vector3
vector3
=
new
Vector3
(
0
,
-
ItemSize
,
1
);
utilsTools
.
setGDataByKey
(
EventName
.
DataName
.
Data_listViewTempCellSize
,
new
Vector2
(
widthItem
,
heightItem
));
Vector3
vector31
=
new
Vector3
();
...
...
Assets/scripts/common/mainGameScaleMove.cs
View file @
ee914e11
...
...
@@ -143,6 +143,7 @@ public class mainGameScaleMove : MonoBehaviour
}
else
if
(
Input
.
touchCount
==
1
)
{
return
;
var
oneTouch
=
Input
.
GetTouch
(
0
);
TouchPhase
touchPhase
=
oneTouch
.
phase
;
if
(
touchPhase
==
TouchPhase
.
Began
)
...
...
Assets/scripts/perfabItems/colorItem.cs
View file @
ee914e11
...
...
@@ -37,6 +37,15 @@ public class colorItem : MonoBehaviour
public
bool
CanPlayAniFlag
;
private
float
Size
{
get
{
return
transform
.
GetComponent
<
RectTransform
>().
sizeDelta
.
x
;
}
}
public
bool
IsSelect
{
set
{
...
...
@@ -234,19 +243,19 @@ public class colorItem : MonoBehaviour
//if (clickindex - 1 > index)
// return;
//transform.DOLocalMoveX(clickpos - 120 * (clickindex - index) - 5, 0.5f);
transform
.
DOLocalMoveX
(
LocalPos_Root
.
x
+
index
*
120
,
0.3f
);
transform
.
DOLocalMoveX
(
LocalPos_Root
.
x
+
index
*
Size
,
0.3f
);
}
else
{
transform
.
DOLocalMoveX
(
clickpos
+
120
*
(
index
-
clickindex
)
+
offset_dis
,
0.3f
);
transform
.
DOLocalMoveX
(
clickpos
+
Size
*
(
index
-
clickindex
)
+
offset_dis
,
0.3f
);
//transform.DOLocalMoveX(LocalPos_Root.x + 120 * index + offset_dis, 0.5f);
}
}
public
void
ReSetPos
()
{
transform
.
DOLocalMoveX
(
LocalPos_Root
.
x
+
index
*
120
,
0.1f
);
transform
.
DOLocalMoveX
(
LocalPos_Root
.
x
+
index
*
Size
,
0.1f
);
}
}
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