Commit aee5d078 authored by JiangWanZhi's avatar JiangWanZhi

屏蔽掉选中组去图片里面找区域的代码

parent ee914e11
fileFormatVersion: 2
guid: a7c9d85320d683a45b35b656d3b79465
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ba0791d5b40370c49a0a07f1ef3b7cc5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class CreateData_Test : EditorWindow
{
private string Path;
[MenuItem("Tools/测试窗口")]
public static void ShowWindow()
{
GetWindow<CreateData_Test>().Show();
}
private void OnGUI()
{
GUILayout.Label("选择文件夹", EditorStyles.boldLabel);
if (GUILayout.Button("选择文件"))
{
Path = EditorUtility.OpenFolderPanel("请选择文件", "", "");
}
if (GUILayout.Button("文件路径"))
{
Debug.LogError($"Path:{Path}");
}
}
}
fileFormatVersion: 2
guid: dd8c6202c5cdf0f41b640f72eda61c18
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -481,4 +481,9 @@ MonoBehaviour:
selectLang: 0.05
Image_DI: {fileID: 8992132832858212788}
Image_Jindu: {fileID: 6976011184890120279}
SelectScale: 0.9
NotSelectScale: 0.8
SelectAniScale: 0.95
SelectButtonDownScale: 0.85
NotSelectButtonDownScale: 0.75
CanPlayAniFlag: 0
......@@ -166,12 +166,13 @@ public class ScaleToImage : MonoBehaviour
}
private bool CanPlayLerpFlag;
private void Move()
{
if (Input.GetMouseButtonUp(0))
{
isInit_move = false;
if (MoveEndFlag && !IsPlayAniFlag)
if (CanPlayLerpFlag && !IsPlayAniFlag)
LerptoMove_End();
clickTime = 0;
}
......@@ -181,6 +182,7 @@ public class ScaleToImage : MonoBehaviour
{
MoveEndFlag = true;
nowmoustpos = Input.mousePosition;
startmoustpos = nowmoustpos;
}
else
{
......@@ -190,16 +192,15 @@ public class ScaleToImage : MonoBehaviour
if (Input.GetMouseButton(0))
{
clickTime += Time.deltaTime;
oldmoustpos = nowmoustpos;
nowmoustpos = Input.mousePosition;
if (MoveEndFlag && clickTime >= 0.1f)
if (MoveEndFlag && (clickTime >= 0.1f||Vector3.Distance(startmoustpos,nowmoustpos)>=200))
{
OnClickMove(nowmoustpos);
}
}
}
private Vector3 oldmoustpos;
private Vector3 startmoustpos;
private Vector3 nowmoustpos;
private void LerptoMove_End() //移动结束后加个缓动的效果
{
......@@ -223,6 +224,7 @@ public class ScaleToImage : MonoBehaviour
var item = target.GetChild(i);
item.DOMove(newpos, 0.3f);
}
CanPlayLerpFlag = false;
}
}
......@@ -244,6 +246,11 @@ public class ScaleToImage : MonoBehaviour
pos = new Vector3(x, y, 0);
OldPos_Move = new Vector3(target.GetChild(0).position.x, target.GetChild(0).position.y, 0);
if (OldPos_Move == pos)
{
return;
}
CanPlayLerpFlag = true;
for (int i = 0; i < target.childCount; i++)
{
var item = target.GetChild(i);
......
......@@ -167,7 +167,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
item.IdName = (group.gid).ToString();
item.GID = group.gid;
item.UseColor = group.rgb;
item.NowProgress = group.Jindu;
if(lvbType == ListViewBackTypeEnum.create || isSelect != oldIsSelect)
{
......@@ -219,13 +220,14 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
DestoryByGID = -1;
return;
}
if (nowidx >= 0)
{
item = gridViewList.getObjectById(nowidx).GetComponent<colorItem>();
item.IsSelect = false;
item.switchPlayAnimation();
}
int idx = (int)objects[0];
oldindex = nowidx;
nowidx = idx;
......@@ -233,12 +235,12 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
item = gridViewList.getObjectById(idx).GetComponent<colorItem>();
item.IsSelect = true;
item.switchPlayAnimation();
maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => {
if (isOk)
{
transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(false);
}
});
//maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => {
// if (isOk)
// {
// transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(false);
// }
//});
Transform item_obj;
Transform ItemParent = areaGroupList.transform.GetComponent<ScrollRect>().content;
......@@ -264,7 +266,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
if (targetpos > ItemParent.localPosition.x)
{
ItemParent.DOLocalMoveX(targetpos, 1f);
return;
}
}
......@@ -282,7 +283,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
IEnumerator DelayToRefreshGrid()
{
yield return new WaitForSeconds(0.3f);
yield return new WaitForSeconds(0.2f);
Transform ItemParent = areaGroupList.transform.GetComponent<ScrollRect>().content;
int itemNum = ItemParent.childCount;
Transform item;
......
......@@ -143,7 +143,6 @@ public class mainGameScaleMove : MonoBehaviour
}
else if (Input.touchCount == 1)
{
return;
var oneTouch = Input.GetTouch(0);
TouchPhase touchPhase = oneTouch.phase;
if(touchPhase == TouchPhase.Began)
......
......@@ -1438,6 +1438,18 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
return true;
}, 0.8, 10);
StartCoroutine(Delay());
}
IEnumerator Delay()
{
yield return new WaitForSeconds(10.2f);
if (utilsTools.getGDataByKey<bool>(EventName.DataName.Data_autoFillColor, false))
{
utilsTools.setGDataByKey(EventName.DataName.Data_enableZoomMove, true);
utilsTools.setGDataByKey(EventName.DataName.Data_autoFillColor, false);
}
}
//提示的查找过程
public void onTipHandler()
......
......@@ -5,9 +5,10 @@ using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class colorItem : MonoBehaviour
public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
[SerializeField]
private bool isSelect = false;
......@@ -24,6 +25,12 @@ public class colorItem : MonoBehaviour
public Image Image_Jindu;
private int gID;
public float SelectScale; //选中的缩放大小
public float NotSelectScale; //没选中的缩放大小
public float SelectAniScale; //选中的动画最大缩放
public float SelectButtonDownScale; //选中的按钮按下缩放大小
public float NotSelectButtonDownScale; //没选中的按钮按下的缩放大小
public int GID //组ID
{
get { return gID; }
......@@ -63,17 +70,22 @@ public class colorItem : MonoBehaviour
}
public void PlayInitAni()
{
transform.DOScale(Vector3.one * 0.95f, 0.3f).onComplete=()=> { transform.DOScale(Vector3.one * 0.8f, 0.2f); };
transform.DOScale(Vector3.one * SelectAniScale, 0.3f).onComplete=()=> { transform.DOScale(Vector3.one * NotSelectScale, 0.2f); };
}
public void switchPlayAnimation()
{
if (isSelect)
{
transform.DOScale(Vector3.one*0.95f, 0.5f).onComplete=()=> { CanPlayAniFlag = true; };
transform.DOScale(Vector3.one* SelectAniScale, 0.2f).SetEase(Ease.OutSine).onComplete = () =>
{
CanPlayAniFlag = true;
transform.DOScale(Vector3.one * SelectScale, 0.1f);
};
}
else
{
transform.DOScale(Vector3.one * 0.8f, 0.5f).onComplete = () => { CanPlayAniFlag = false; }; ;
transform.DOScale(Vector3.one * NotSelectScale, 0.2f).SetEase(Ease.OutSine).onComplete = () => { CanPlayAniFlag = false; };
}
}
......@@ -202,12 +214,13 @@ public class colorItem : MonoBehaviour
}
}
public void CreateMat()
{
mat = Image_Jindu.material;
mat = Instantiate(mat);
Image_Jindu.material = mat;
transform.localScale = Vector3.one * 0.8f;
transform.localScale = Vector3.one * NotSelectScale;
}
public bool isFinish()
......@@ -216,17 +229,15 @@ public class colorItem : MonoBehaviour
}
public void onClickAreaGroup()
{
if (IsSelect)
{
return;
}
//if (isSelect == false && isFinish() == false)
{
if (utilsTools.getGDataByKey<bool>(EventName.DataName.Data_autoFillColor, false)) return;
utilsTools.sendEventObjectParams(EventName.Event.Event_switchGameAreaGroupId, index);
}
if (CanPlayAniFlag)
{
var nowscale = transform.localScale;
transform.DOScale(transform.localScale * 0.9f, 0.1f).onComplete = () => { transform.DOScale(nowscale, 0.1f); };
}
}
public void SetLocalRootPos() //保存一下第一个的原始坐标
......@@ -243,12 +254,12 @@ public class colorItem : MonoBehaviour
//if (clickindex - 1 > index)
// return;
//transform.DOLocalMoveX(clickpos - 120 * (clickindex - index) - 5, 0.5f);
transform.DOLocalMoveX(LocalPos_Root.x + index * Size, 0.3f);
transform.DOLocalMoveX(LocalPos_Root.x + index * Size, 0.2f);
}
else
{
transform.DOLocalMoveX(clickpos + Size * (index - clickindex) + offset_dis, 0.3f);
transform.DOLocalMoveX(clickpos + Size * (index - clickindex) + offset_dis, 0.2f);
//transform.DOLocalMoveX(LocalPos_Root.x + 120 * index + offset_dis, 0.5f);
}
}
......@@ -258,4 +269,19 @@ public class colorItem : MonoBehaviour
transform.DOLocalMoveX(LocalPos_Root.x + index * Size, 0.1f);
}
public void OnPointerDown(PointerEventData eventData)
{
if (IsSelect)
transform.DOScale(SelectButtonDownScale, 0.2f);
else
transform.DOScale(NotSelectButtonDownScale, 0.2f);
}
public void OnPointerUp(PointerEventData eventData)
{
if(IsSelect)
transform.DOScale(SelectScale, 0.2f);
else
transform.DOScale(NotSelectScale, 0.2f);
}
}
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