Commit ee914e11 authored by JiangWanZhi's avatar JiangWanZhi

添加一个移动端的震动插件、更新列表间距、按下时间0.1秒后才会开始拖动

parent fbe1e985
...@@ -2128,6 +2128,18 @@ PrefabInstance: ...@@ -2128,6 +2128,18 @@ PrefabInstance:
propertyPath: m_Layer propertyPath: m_Layer
value: 5 value: 5
objectReference: {fileID: 0} 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} - target: {fileID: 8118021438581421258, guid: e2f00cfdb21d04b46adf17805f74f20c, type: 3}
propertyPath: m_Color.a propertyPath: m_Color.a
value: 1 value: 1
......
fileFormatVersion: 2
guid: c064a4425767a7c49a5fbc2ba5bc0b96
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8a18a006579744750bc5f62a817c99ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a8f7741f0c8fb4b3ebe08d51501d38aa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3ee19d5b94e8d485d92b70732e586af5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
#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];
}
}
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:
//
// 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
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:
//
// 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];
}
}
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:
////////////////////////////////////////////////////////////////////////////////
//
// @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
}
fileFormatVersion: 2
guid: 9a1817bb553014d4c9a665d4fa202202
timeCreated: 1474899097
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -40,6 +40,7 @@ public class ScaleToImage : MonoBehaviour ...@@ -40,6 +40,7 @@ public class ScaleToImage : MonoBehaviour
private bool IsPlayAniFlag; private bool IsPlayAniFlag;
private Vector3 SavePos_Scale; //这个是保存放大到最大的倍数的时候回正的位置 private Vector3 SavePos_Scale; //这个是保存放大到最大的倍数的时候回正的位置
private float clickTime;
private void Update() private void Update()
{ {
if (Input.touchCount == 2) if (Input.touchCount == 2)
...@@ -172,31 +173,51 @@ public class ScaleToImage : MonoBehaviour ...@@ -172,31 +173,51 @@ public class ScaleToImage : MonoBehaviour
isInit_move = false; isInit_move = false;
if (MoveEndFlag && !IsPlayAniFlag) if (MoveEndFlag && !IsPlayAniFlag)
LerptoMove_End(); LerptoMove_End();
clickTime = 0;
} }
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0))
{ {
if (IsImageArea(Input.mousePosition) && IsMidArea(Input.mousePosition)) if (IsImageArea(Input.mousePosition) && IsMidArea(Input.mousePosition))
{ {
MoveEndFlag = true; MoveEndFlag = true;
nowmoustpos = Input.mousePosition;
}
else
{
return;
} }
} }
if (Input.GetMouseButton(0)) if (Input.GetMouseButton(0))
{ {
if(MoveEndFlag) clickTime += Time.deltaTime;
OnClickMove(Input.mousePosition); oldmoustpos = nowmoustpos;
nowmoustpos = Input.mousePosition;
if (MoveEndFlag && clickTime >= 0.1f)
{
OnClickMove(nowmoustpos);
}
} }
} }
private Vector3 oldmoustpos;
private Vector3 nowmoustpos;
private void LerptoMove_End() //移动结束后加个缓动的效果 private void LerptoMove_End() //移动结束后加个缓动的效果
{ {
MoveEndFlag = false; MoveEndFlag = false;
var nowpos= new Vector3(target.GetChild(0).position.x, target.GetChild(0).position.y, 0); var nowpos= new Vector3(target.GetChild(0).position.x, target.GetChild(0).position.y, 0);
if (nowpos == OldPos_Move)
{
return;
}
if (nowpos != OldPos_Move) if (nowpos != OldPos_Move)
{ {
var tonow = (nowpos - OldPos_Move).normalized; //指向现在位置的方向向量 var tonow = (nowpos - OldPos_Move).normalized; //指向现在位置的方向向量
var newpos = tonow*0.5f + nowpos; 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++) for (int i = 0; i < target.childCount; i++)
{ {
var item = target.GetChild(i); var item = target.GetChild(i);
......
...@@ -40,9 +40,12 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -40,9 +40,12 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
private float tempValue3 = 5f; private float tempValue3 = 5f;
public ReplayCam cam; public ReplayCam cam;
public float ListMoveOffSet = 35;
private int DestoryByGID = -1; private int DestoryByGID = -1;
Dictionary<string, EventChildItemBack> childEventHandlers = new Dictionary<string, EventChildItemBack>(); Dictionary<string, EventChildItemBack> childEventHandlers = new Dictionary<string, EventChildItemBack>();
private float ChildSize;
void onEvent(string name, EventChildItemBack func) void onEvent(string name, EventChildItemBack func)
{ {
utilsTools.onEvent(this, name); utilsTools.onEvent(this, name);
...@@ -98,11 +101,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -98,11 +101,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
addHotParams<int>("TUSE_PhoneOffsetValue", EventName.DataName.Data_PhoneOffsetValue, int.TryParse); addHotParams<int>("TUSE_PhoneOffsetValue", EventName.DataName.Data_PhoneOffsetValue, int.TryParse);
return true; return true;
}, 3, 0); }, 3, 0);
//utilsTools.resetGameObjectTreeSize(gameObject, (String path) => ChildSize = areaGroupList.transform.GetComponent<ScrollRect>().content.GetComponent<GridLayoutGroup>().cellSize.x;
//{ Vibration.Init();
// if (path.IndexOf("/top/") > 0) return 1;
// return 0;
//});
} }
private void onGroupIsLoadOver(List<UnityEngine.Object> uobjects, List<object> objects) private void onGroupIsLoadOver(List<UnityEngine.Object> uobjects, List<object> objects)
...@@ -249,7 +249,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -249,7 +249,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{ {
if (nowidx >= 5) if (nowidx >= 5)
{ {
targetpos = -(120 * (nowidx - 4) - 20 + 5 * 2); targetpos = -(ChildSize * (nowidx - 4)) - ListMoveOffSet;
if (targetpos < ItemParent.localPosition.x) if (targetpos < ItemParent.localPosition.x)
{ {
...@@ -260,7 +260,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -260,7 +260,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
} }
else if (oldindex > nowidx) //点的左边的 else if (oldindex > nowidx) //点的左边的
{ {
targetpos = -(120 * (nowidx - 1) + 10); targetpos = -(ChildSize * (nowidx - 1) + 10);
if (targetpos > ItemParent.localPosition.x) if (targetpos > ItemParent.localPosition.x)
{ {
ItemParent.DOLocalMoveX(targetpos, 1f); ItemParent.DOLocalMoveX(targetpos, 1f);
...@@ -694,7 +694,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -694,7 +694,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//震动 //震动
if (vibration) if (vibration)
{ {
Handheld.Vibrate(); //Handheld.Vibrate();
Vibration.VibrateNope();
} }
if (nowidx >= 0) if (nowidx >= 0)
{ {
...@@ -750,9 +751,9 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -750,9 +751,9 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
Destroy(item.gameObject); 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 else
...@@ -761,7 +762,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -761,7 +762,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{ {
if (i > index) 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).GetComponent<colorItem>().index = i - 1;
ItemParent.GetChild(i).name = ItemParent.GetChild(i).name.Replace($"{i}", $"{i - 1}"); ItemParent.GetChild(i).name = ItemParent.GetChild(i).name.Replace($"{i}", $"{i - 1}");
......
...@@ -16,7 +16,8 @@ public class gridView : MonoBehaviour ...@@ -16,7 +16,8 @@ public class gridView : MonoBehaviour
public List<String> perfabPaths = new List<string>(); public List<String> perfabPaths = new List<string>();
private bool isFirstSetData = true; private bool isFirstSetData = true;
public bool LockCellWidthEqHeight = true;//锁定宽==高 public bool LockCellWidthEqHeight = true;//锁定宽==高
private GameObject listItem; private GameObject listItem;
private float ItemSize;
void Start() void Start()
{ {
listItem = Resources.Load<GameObject>(perfabPath); // 暂时先在这里存放列表的预制体 listItem = Resources.Load<GameObject>(perfabPath); // 暂时先在这里存放列表的预制体
...@@ -25,6 +26,8 @@ public class gridView : MonoBehaviour ...@@ -25,6 +26,8 @@ public class gridView : MonoBehaviour
{ {
perfabPaths.Add(perfabPath); perfabPaths.Add(perfabPath);
} }
ItemSize = 120;//transform.GetComponent<ScrollRect>().content.GetComponent<GridLayoutGroup>().cellSize.x;
} }
void checkFirstSetData(bool useVec) void checkFirstSetData(bool useVec)
{ {
...@@ -230,7 +233,7 @@ public class gridView : MonoBehaviour ...@@ -230,7 +233,7 @@ public class gridView : MonoBehaviour
infos.Add(new Tuple<string, float>(itemKey, itemHeight)); 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)); utilsTools.setGDataByKey(EventName.DataName.Data_listViewTempCellSize, new Vector2(widthItem,heightItem));
Vector3 vector31 = new Vector3(); Vector3 vector31 = new Vector3();
......
...@@ -143,6 +143,7 @@ public class mainGameScaleMove : MonoBehaviour ...@@ -143,6 +143,7 @@ public class mainGameScaleMove : MonoBehaviour
} }
else if (Input.touchCount == 1) else if (Input.touchCount == 1)
{ {
return;
var oneTouch = Input.GetTouch(0); var oneTouch = Input.GetTouch(0);
TouchPhase touchPhase = oneTouch.phase; TouchPhase touchPhase = oneTouch.phase;
if(touchPhase == TouchPhase.Began) if(touchPhase == TouchPhase.Began)
......
...@@ -37,6 +37,15 @@ public class colorItem : MonoBehaviour ...@@ -37,6 +37,15 @@ public class colorItem : MonoBehaviour
public bool CanPlayAniFlag; public bool CanPlayAniFlag;
private float Size
{
get
{
return transform.GetComponent<RectTransform>().sizeDelta.x;
}
}
public bool IsSelect public bool IsSelect
{ {
set { set {
...@@ -234,19 +243,19 @@ public class colorItem : MonoBehaviour ...@@ -234,19 +243,19 @@ public class colorItem : MonoBehaviour
//if (clickindex - 1 > index) //if (clickindex - 1 > index)
// return; // return;
//transform.DOLocalMoveX(clickpos - 120 * (clickindex - index) - 5, 0.5f); //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 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); //transform.DOLocalMoveX(LocalPos_Root.x + 120 * index + offset_dis, 0.5f);
} }
} }
public void ReSetPos() public void ReSetPos()
{ {
transform.DOLocalMoveX(LocalPos_Root.x + index * 120, 0.1f); transform.DOLocalMoveX(LocalPos_Root.x + index * Size, 0.1f);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment