Commit 88ea57af authored by JiangWanZhi's avatar JiangWanZhi

修改第一次缩放会乱跑的bug

parent a036130f
...@@ -412,10 +412,10 @@ MonoBehaviour: ...@@ -412,10 +412,10 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Padding: m_Padding:
m_Left: 400 m_Left: 300
m_Right: 400 m_Right: 300
m_Top: 400 m_Top: 300
m_Bottom: 400 m_Bottom: 300
m_ChildAlignment: 4 m_ChildAlignment: 4
m_Spacing: 0 m_Spacing: 0
m_ChildForceExpandWidth: 1 m_ChildForceExpandWidth: 1
...@@ -5403,7 +5403,7 @@ RectTransform: ...@@ -5403,7 +5403,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 400, y: 0} m_AnchoredPosition: {x: 300, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4535739684591336511 --- !u!114 &4535739684591336511
...@@ -5950,13 +5950,14 @@ MonoBehaviour: ...@@ -5950,13 +5950,14 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
target: {fileID: 2902754919140836122} target: {fileID: 2902754919140836122}
scaleSpeed: 1.2 scaleSpeed: 0.9
canvasCamera: {fileID: 0} canvasCamera: {fileID: 0}
scrollRect: {fileID: 1238786231969924280} scrollRect: {fileID: 1238786231969924280}
MinScale: 0.375 MinScale: 0.375
MaxScale: 7 MaxScale: 7
Min_Move: 0.23 Min_Move: 0.23
Max_Move: 8 Max_Move: 8
group: {fileID: 237648084539702437}
--- !u!1 &6884362798581633399 --- !u!1 &6884362798581633399
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -6013,6 +6014,9 @@ MonoBehaviour: ...@@ -6013,6 +6014,9 @@ MonoBehaviour:
pos: {fileID: 4755947299850074345} pos: {fileID: 4755947299850074345}
v1: {x: 0, y: 0, z: 30} v1: {x: 0, y: 0, z: 30}
v2: {x: 0, y: 5, z: 0} v2: {x: 0, y: 5, z: 0}
curCount: 0
count: 0
step: 0
--- !u!1 &8495604213876096662 --- !u!1 &8495604213876096662
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -860,7 +860,6 @@ GameObject: ...@@ -860,7 +860,6 @@ GameObject:
- component: {fileID: 414882563} - component: {fileID: 414882563}
- component: {fileID: 414882562} - component: {fileID: 414882562}
- component: {fileID: 414882561} - component: {fileID: 414882561}
- component: {fileID: 414882565}
m_Layer: 0 m_Layer: 0
m_Name: Canvas m_Name: Canvas
m_TagString: Untagged m_TagString: Untagged
...@@ -954,19 +953,6 @@ RectTransform: ...@@ -954,19 +953,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &414882565
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414882560}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c60e12901bc362d42b8b38a9e419ec96, type: 3}
m_Name:
m_EditorClassIdentifier:
AllowDebugging: 1
--- !u!1 &491076100 --- !u!1 &491076100
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -5005,7 +4991,7 @@ MonoBehaviour: ...@@ -5005,7 +4991,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 5448574956194434760} m_HandleRect: {fileID: 5448574956194434760}
m_Direction: 0 m_Direction: 0
m_MinValue: 0 m_MinValue: 0
m_MaxValue: 100 m_MaxValue: 1
m_WholeNumbers: 0 m_WholeNumbers: 0
m_Value: 0 m_Value: 0
m_OnValueChanged: m_OnValueChanged:
...@@ -8115,6 +8101,7 @@ MonoBehaviour: ...@@ -8115,6 +8101,7 @@ MonoBehaviour:
MaxScale: 10 MaxScale: 10
Min_Move: 0.2 Min_Move: 0.2
Max_Move: 12 Max_Move: 12
group: {fileID: 0}
--- !u!114 &8094727572906316438 --- !u!114 &8094727572906316438
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -8149,7 +8136,8 @@ MonoBehaviour: ...@@ -8149,7 +8136,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ReSetPos_Btn: {fileID: 3853497852481138177} ReSetPos_Btn: {fileID: 3853497852481138177}
ShowBtnScale: 1 ShowBtnScale: 0.6
AutoFille_Btn: {fileID: 3745291635547366485}
--- !u!1 &8136062125027934181 --- !u!1 &8136062125027934181
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -8560,6 +8548,10 @@ MonoBehaviour: ...@@ -8560,6 +8548,10 @@ MonoBehaviour:
AllProcress: {fileID: 1667660345673518993} AllProcress: {fileID: 1667660345673518993}
AllProcress_Text: {fileID: 4457589912443491345} AllProcress_Text: {fileID: 4457589912443491345}
OffSet_CLickMove: 35 OffSet_CLickMove: 35
bigvalue: 1
bigtime: 0.1
smalltime: 0.2
movetime: 0.3
--- !u!114 &9174292048928438190 --- !u!114 &9174292048928438190
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -31,7 +31,7 @@ public static class EventName ...@@ -31,7 +31,7 @@ public static class EventName
public const string Event_GroupListCreate = "Event_GroupListCreate";//加载组的数量 public const string Event_GroupListCreate = "Event_GroupListCreate";//加载组的数量
public const string Event_GropuItemChange = "Event_GropuItemChange";//某个组的进度改变 public const string Event_GropuItemChange = "Event_GropuItemChange";//某个组的进度改变
public const string Event_GroupItemClick = "Event_GroupItemClick";//点击某一个组 public const string Event_GroupItemSelect = "Event_GroupItemSelect";//选中某一个组
public const string Event_ChoiseGroupByPic = "Event_ChoiseGroupByPic"; //图片区域长按选择某一个组 public const string Event_ChoiseGroupByPic = "Event_ChoiseGroupByPic"; //图片区域长按选择某一个组
public const string Event_AllGroupOver = "Event_AllGroupOver";//游戏结束,全部组都涂完了 public const string Event_AllGroupOver = "Event_AllGroupOver";//游戏结束,全部组都涂完了
...@@ -42,6 +42,7 @@ public static class EventName ...@@ -42,6 +42,7 @@ public static class EventName
public const string Event_ImageScallChange = "Event_ImageScallChange"; //图片的缩放改变 public const string Event_ImageScallChange = "Event_ImageScallChange"; //图片的缩放改变
public const string Event_ReSetPicPos_Scale = "Event_ReSetPicPos_Scale"; //重新设置图片的位置和缩放 public const string Event_ReSetPicPos_Scale = "Event_ReSetPicPos_Scale"; //重新设置图片的位置和缩放
} }
public class DataName public class DataName
......
...@@ -21,6 +21,7 @@ public class ScaleToImage : MonoBehaviour ...@@ -21,6 +21,7 @@ public class ScaleToImage : MonoBehaviour
public float Min_Move; public float Min_Move;
public float Max_Move; public float Max_Move;
public HorizontalLayoutGroup group;
private Vector3 ToFigerCenter; //指向手指中间的向量 private Vector3 ToFigerCenter; //指向手指中间的向量
private float ToFigerdistance; //距离 private float ToFigerdistance; //距离
...@@ -43,10 +44,12 @@ public class ScaleToImage : MonoBehaviour ...@@ -43,10 +44,12 @@ public class ScaleToImage : MonoBehaviour
private Vector3 OnInitScale; //初始化时的缩放 private Vector3 OnInitScale; //初始化时的缩放
private Vector3 OnInitPos; private Vector3 OnInitPos;
private int groupInitSize;
private void Start() private void Start()
{ {
canvasCamera = transform.parent.GetComponent<ScaleToImage>().canvasCamera; canvasCamera = transform.parent.GetComponent<ScaleToImage>().canvasCamera;
groupInitSize = group.padding.left;
RegisterEvent(true); RegisterEvent(true);
StartCoroutine(Delay()); StartCoroutine(Delay());
} }
...@@ -74,12 +77,13 @@ public class ScaleToImage : MonoBehaviour ...@@ -74,12 +77,13 @@ public class ScaleToImage : MonoBehaviour
private void Update() private void Update()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
Editor_Scale(); MouseScale();
return;
#endif #endif
if (Input.touchCount == 2) if (Input.touchCount == 2)
{ {
RefreshScrollview();
Scale(); Scale();
flag = true; flag = true;
scrollRect.inertia = false; scrollRect.inertia = false;
...@@ -133,54 +137,76 @@ public class ScaleToImage : MonoBehaviour ...@@ -133,54 +137,76 @@ public class ScaleToImage : MonoBehaviour
} }
} }
private void Editor_Scale() private void RefreshScrollview()
{ {
var mouse = Input.GetAxis("Mouse ScrollWheel"); target.gameObject.SetActive(false);
if (mouse != 0) //向前,该放大 target.gameObject.SetActive(true);
scrollRect.inertia = true;
}
private void StopScaleToSetSize()
{
if (ScaleSize_List.Count > 0)
{
ChangeFontSize(ScaleSize_List[ScaleSize_List.Count - 1]);
ScaleSize_List.Clear();
}
}
private void ChangeFontSize(float scalesize)
{
GameMgr.Ins.tiMgr.SizeChange(scalesize);
EventDispatcher.Dispatch(EventName.Event.Event_ImageScallChange, scalesize);
float value = groupInitSize / scalesize;
group.padding.left = (int)value;
group.padding.right = (int)value;
group.padding.top = (int)value;
group.padding.bottom = (int)value;
}
private void Scale()
{
if (!isInit_Scale)
{ {
SetscrollRectEnable(false); SetscrollRectEnable(false);
var mouseposition = Input.mousePosition; //两指点位
pos = canvasCamera.ScreenToWorldPoint(mouseposition); touch1 = canvasCamera.ScreenToWorldPoint(Input.GetTouch(0).position);
pos = new Vector3(pos.x, pos.y, 0); touch2 = canvasCamera.ScreenToWorldPoint(Input.GetTouch(1).position);
touch1 = new Vector3(touch1.x, touch1.y, 0);
touch2 = new Vector3(touch2.x, touch2.y, 0);
//图片的初始点位 //图片的初始点位
oriPos = new Vector3(target.position.x, target.position.y, 0); oriPos = new Vector3(target.position.x, target.position.y, 0);
float distance = Vector2.Distance(touch1, touch2) / 2f;
//指向中心的单位向量 var normal = (touch1 - touch2).normalized;
pos = normal * distance + touch2; //两个手指中间的点
//指向手指中心的单位向量
ToFigerCenter = (pos - oriPos).normalized; ToFigerCenter = (pos - oriPos).normalized;
//距离 //距离
ToFigerdistance = Vector3.Distance(pos, oriPos); ToFigerdistance = Vector3.Distance(pos, oriPos);
oriScale = target.localScale.x;//开始的缩放值 oriScale = target.localScale.x;//开始的缩放值
isInit_Scale = true;
MoveValue = 1 / oriScale; MoveValue = 1 / oriScale;
scale = mouse; SatrtScale = target.localScale.x;
bool isBig = scale > 0; StartPos = target.position;
return;
}
//两指缩放比例
float nowdis = Vector3.Distance(canvasCamera.ScreenToWorldPoint(Input.GetTouch(0).position), canvasCamera.ScreenToWorldPoint(Input.GetTouch(1).position));
scale = nowdis / Vector3.Distance(touch1, touch2); //大于1是放大,小于是缩小
bool isBig = scale > 1;
float scale_target = 0; float scale_target = 0;
//控制缩放速度 //控制缩放速度
scale = scale * scaleSpeed; //正的话就是放大图片 scale = (scale - 1) * scaleSpeed; //正的话就是放大图片
OnScale(scale_target, isBig);
delaytime = 0;
RefreshScrollview();
}
else
{
if (delaytime >= 0.5f && !scrollRect.enabled)
{
SetscrollRectEnable(true);
}
else
{
delaytime += Time.deltaTime;
}
}
}
float delaytime = 0;
private void OnScale(float scale_target, bool isBig)
{
if (scale < 0) if (scale < 0)
{ {
scale = scale * oriScale * scaleSpeed; //缩小速度 scale = scale * oriScale * scaleSpeed; //缩小速度
...@@ -199,6 +225,10 @@ public class ScaleToImage : MonoBehaviour ...@@ -199,6 +225,10 @@ public class ScaleToImage : MonoBehaviour
} }
scale_target = (Vector3.one * (oriScale + scale)).x; scale_target = (Vector3.one * (oriScale + scale)).x;
if (scale_target < 0)
{
scale_target = MinScale;
}
Vector3 targetscale; Vector3 targetscale;
if (scale_target < MinScale) if (scale_target < MinScale)
...@@ -245,44 +275,29 @@ public class ScaleToImage : MonoBehaviour ...@@ -245,44 +275,29 @@ public class ScaleToImage : MonoBehaviour
ScaleSize_List.Clear(); ScaleSize_List.Clear();
ChangeFontSize(NowScale); ChangeFontSize(NowScale);
} }
}
private void RefreshScrollview()
{
target.gameObject.SetActive(false);
target.gameObject.SetActive(true);
scrollRect.inertia = true;
} }
private void StopScaleToSetSize() private void MouseScale()
{ {
if (ScaleSize_List.Count > 0) var mousepos = Input.mousePosition;
if (mousepos.x > Screen.width || mousepos.y > Screen.height || mousepos.x < 0 || mousepos.y < 0)
{ {
ChangeFontSize(ScaleSize_List[ScaleSize_List.Count - 1]); return;
ScaleSize_List.Clear();
}
}
private void ChangeFontSize(float scalesize)
{
GameMgr.Ins.tiMgr.SizeChange(scalesize);
} }
private void Scale() var mouse = Input.GetAxis("Mouse ScrollWheel");
{ if (mouse != 0)
if (!isInit_Scale)
{ {
SetscrollRectEnable(false); SetscrollRectEnable(false);
//两指点位 //两指点位
touch1 = canvasCamera.ScreenToWorldPoint(Input.GetTouch(0).position); mousepos = canvasCamera.ScreenToWorldPoint(mousepos);
touch2 = canvasCamera.ScreenToWorldPoint(Input.GetTouch(1).position);
touch1 = new Vector3(touch1.x, touch1.y, 0); mousepos = new Vector3(mousepos.x, mousepos.y, 0);
touch2 = new Vector3(touch2.x, touch2.y, 0);
//图片的初始点位 //图片的初始点位
oriPos = new Vector3(target.position.x, target.position.y, 0); oriPos = new Vector3(target.position.x, target.position.y, 0);
float distance = Vector2.Distance(touch1, touch2) / 2f;
var normal = (touch1 - touch2).normalized; pos = mousepos;
pos = normal * distance + touch2; //两个手指中间的点
//指向手指中心的单位向量 //指向手指中心的单位向量
ToFigerCenter = (pos - oriPos).normalized; ToFigerCenter = (pos - oriPos).normalized;
...@@ -293,20 +308,70 @@ public class ScaleToImage : MonoBehaviour ...@@ -293,20 +308,70 @@ public class ScaleToImage : MonoBehaviour
isInit_Scale = true; isInit_Scale = true;
MoveValue = 1 / oriScale; MoveValue = 1 / oriScale;
SatrtScale = target.localScale.x; //两指缩放比例
StartPos = target.position; scale = mouse;
bool isBig = mouse > 0;
float scale_target = 0;
//控制缩放速度
scale = (scale) * scaleSpeed; //正的话就是放大图片
if (scale < 0)
{
scale = scale * oriScale * scaleSpeed; //缩小速度
scale_target = (Vector3.one * (oriScale + scale)).x;
if (target.localScale.x < MinScale)
{
PlayAniFlag_Scale = true;
if (target.localScale.x > Min_Move)
target.localScale = Vector3.one * scale_target;
return; return;
} }
}
//两指缩放比例 scale_target = (Vector3.one * (oriScale + scale)).x;
float nowdis = Vector3.Distance(canvasCamera.ScreenToWorldPoint(Input.GetTouch(0).position), canvasCamera.ScreenToWorldPoint(Input.GetTouch(1).position)); if (scale_target < 0)
scale = nowdis / Vector3.Distance(touch1, touch2); //大于1是放大,小于是缩小 {
bool isBig = scale > 1; scale_target = MinScale;
float scale_target = 0; }
OnScale(scale_target, isBig); Vector3 targetscale;
if (scale_target < MinScale)
{
targetscale = Vector3.one * scale_target;
target.localScale = targetscale;
ChangeFontSize(target.localScale.x);
ScaleSize_List.Clear();
return;
}
else if (scale_target > MaxScale)
{
targetscale = Vector3.one * (oriScale + scale);
PlayAniFlag_Scale = true;
}
else
{
targetscale = Vector3.one * (oriScale + scale);
} }
target.localScale = targetscale;
//改变目标位置,让位置保持不变
var newpos = ToFigerCenter * (target.localScale.x - oriScale) * ToFigerdistance * MoveValue;
target.position = oriPos - newpos;
target.localPosition = new Vector3(target.localPosition.x, target.localPosition.y, 0);
NowScale = targetscale.x;
ChangeFontSize(NowScale);
SetscrollRectEnable(true);
RefreshScrollview();
}
}
private void SetscrollRectEnable(bool enable) private void SetscrollRectEnable(bool enable)
{ {
scrollRect.enabled = enable; scrollRect.enabled = enable;
......
...@@ -8,16 +8,27 @@ public class Gameing : MonoBehaviour ...@@ -8,16 +8,27 @@ public class Gameing : MonoBehaviour
{ {
public Button ReSetPos_Btn; public Button ReSetPos_Btn;
public float ShowBtnScale;//显示重设位置按钮的缩放值 public float ShowBtnScale;//显示重设位置按钮的缩放值
public GameObject AutoFille_Btn; //自动涂色的按钮
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
ResiterEvent(true); ResiterEvent(true);
ReSetPos_Btn.onClick.AddListener(ReSetPos_Btn_Click); ReSetPos_Btn.onClick.AddListener(ReSetPos_Btn_Click);
ReSetPos_Btn.gameObject.SetActive(false); ReSetPos_Btn.gameObject.SetActive(false);
AutoFille_Btn.SetActive(false);
} }
private void ResiterEvent(bool flag) private void ResiterEvent(bool flag)
{ {
EventDispatcher.RegisterEvent(EventName.Event.Event_ImageScallChange,ChangeScale_Pic, flag); EventDispatcher.RegisterEvent(EventName.Event.Event_ImageScallChange,ChangeScale_Pic, flag);
EventDispatcher.RegisterEvent(EventName.Event.Event_GroupItemSelect, ShowAutoFill_Btn, flag);
}
private void ShowAutoFill_Btn(object[] values)
{
if (!AutoFille_Btn.activeSelf)
{
AutoFille_Btn.SetActive(true);
}
} }
private void ChangeScale_Pic(object[] values) private void ChangeScale_Pic(object[] values)
......
...@@ -24,6 +24,7 @@ public class GroupListManager : MonoBehaviour ...@@ -24,6 +24,7 @@ public class GroupListManager : MonoBehaviour
public TextMeshProUGUI AllProcress_Text; //百分比進度 public TextMeshProUGUI AllProcress_Text; //百分比進度
public float OffSet_CLickMove = 35f; public float OffSet_CLickMove = 35f;
private float AllAreaCount; private float AllAreaCount;
private float ClickAreaCount; private float ClickAreaCount;
private List<colorItem> AllItem = new List<colorItem>(); private List<colorItem> AllItem = new List<colorItem>();
...@@ -42,6 +43,19 @@ public class GroupListManager : MonoBehaviour ...@@ -42,6 +43,19 @@ public class GroupListManager : MonoBehaviour
AllProcress_Text.gameObject.SetActive(true); AllProcress_Text.gameObject.SetActive(true);
} }
private void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
var item = AllItem[1];
if (item != null)
{
RemoveAGroup(item);
}
}
}
private void ResiterEvent(bool flag) private void ResiterEvent(bool flag)
{ {
EventDispatcher.RegisterEvent(EventName.Event.Event_GroupListCreate, CreateGroup, flag); EventDispatcher.RegisterEvent(EventName.Event.Event_GroupListCreate, CreateGroup, flag);
...@@ -80,6 +94,8 @@ public class GroupListManager : MonoBehaviour ...@@ -80,6 +94,8 @@ public class GroupListManager : MonoBehaviour
item.IsSelect = true; item.IsSelect = true;
item.switchPlayAnimation(); item.switchPlayAnimation();
EventDispatcher.Dispatch(EventName.Event.Event_GroupItemSelect);
} }
} }
...@@ -116,6 +132,7 @@ public class GroupListManager : MonoBehaviour ...@@ -116,6 +132,7 @@ public class GroupListManager : MonoBehaviour
} }
} }
SetTotalProcress(); SetTotalProcress();
EventDispatcher.Dispatch(EventName.Event.Event_GroupItemSelect);
} }
private void SetTotalProcress() private void SetTotalProcress()
...@@ -125,15 +142,22 @@ public class GroupListManager : MonoBehaviour ...@@ -125,15 +142,22 @@ public class GroupListManager : MonoBehaviour
AllProcress_Text.text = value.ToString("P0"); AllProcress_Text.text = value.ToString("P0");
} }
public float bigvalue=1;
public float bigtime=0.1f;
public float smalltime=0.2f;
public float movetime=0.3f;
private void RemoveAGroup(colorItem removeitem) private void RemoveAGroup(colorItem removeitem)
{ {
AllItem.Remove(removeitem); AllItem.Remove(removeitem);
Content.enabled = false;
removeitem.transform.DOScale(Vector3.zero, 0.3f).onComplete = () => Content.GetComponent<ContentSizeFitter>().enabled = false;
removeitem.transform.DOScale(Vector3.one * bigvalue, bigtime).onComplete = () =>
{ {
removeitem.gameObject.SetActive(false); removeitem.transform.DOScale(Vector3.zero, smalltime).onComplete = () =>
}; {
StartCoroutine(DelayToSetContent());
removeitem.gameObject.SetActive(false);
int NextItemIndex = 0; int NextItemIndex = 0;
float childsize = removeitem.transform.GetComponent<RectTransform>().sizeDelta.x; float childsize = removeitem.transform.GetComponent<RectTransform>().sizeDelta.x;
...@@ -148,7 +172,7 @@ public class GroupListManager : MonoBehaviour ...@@ -148,7 +172,7 @@ public class GroupListManager : MonoBehaviour
for (int i = 0; i < AllItem.Count; i++) for (int i = 0; i < AllItem.Count; i++)
{ {
var ite = AllItem[i]; var ite = AllItem[i];
ite.transform.DOLocalMoveX(ite.transform.localPosition.x + childsize, 0.3f); ite.transform.DOLocalMoveX(ite.transform.localPosition.x + childsize, movetime);
if (ite.index == NextItemIndex) if (ite.index == NextItemIndex)
{ {
ite.IsSelect = true; ite.IsSelect = true;
...@@ -165,7 +189,7 @@ public class GroupListManager : MonoBehaviour ...@@ -165,7 +189,7 @@ public class GroupListManager : MonoBehaviour
var ite = AllItem[i]; var ite = AllItem[i];
if (ite.index > removeitem.index) if (ite.index > removeitem.index)
{ {
ite.transform.DOLocalMoveX(ite.transform.localPosition.x - childsize, 0.3f); ite.transform.DOLocalMoveX(ite.transform.localPosition.x - childsize, movetime);
if (ite.index == NextItemIndex) if (ite.index == NextItemIndex)
{ {
ite.IsSelect = true; ite.IsSelect = true;
...@@ -175,10 +199,16 @@ public class GroupListManager : MonoBehaviour ...@@ -175,10 +199,16 @@ public class GroupListManager : MonoBehaviour
ite.index--; ite.index--;
} }
} }
};
};
} }
IEnumerator DelayToSetContent()
{
yield return new WaitForSeconds(movetime);
Content.enabled = true;
Content.GetComponent<ContentSizeFitter>().enabled = true;
}
private void CreateGroup(object[] values) private void CreateGroup(object[] values)
{ {
AllAreaCount = 0; AllAreaCount = 0;
...@@ -335,6 +365,8 @@ public class GroupListManager : MonoBehaviour ...@@ -335,6 +365,8 @@ public class GroupListManager : MonoBehaviour
} }
StartCoroutine(DelayToRefreshGrid()); StartCoroutine(DelayToRefreshGrid());
EventDispatcher.Dispatch(EventName.Event.Event_GroupItemSelect);
} }
IEnumerator DelayToRefreshGrid() IEnumerator DelayToRefreshGrid()
{ {
......
...@@ -2,6 +2,7 @@ using DG.Tweening; ...@@ -2,6 +2,7 @@ using DG.Tweening;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using TMPro; using TMPro;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
...@@ -66,8 +67,17 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler ...@@ -66,8 +67,17 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{ {
isSelect = value; isSelect = value;
Select_CirCle.SetActive(isSelect); Select_CirCle.SetActive(isSelect);
if (NowProgress > 0)
{
JIndu_Wave.gameObject.SetActive(isSelect); JIndu_Wave.gameObject.SetActive(isSelect);
Jindu_NotWave.gameObject.SetActive(!isSelect); Jindu_NotWave.gameObject.SetActive(!isSelect);
}
else
{
JIndu_Wave.gameObject.SetActive(false);
Jindu_NotWave.gameObject.SetActive(true);
}
if (NowProgress > 0) if (NowProgress > 0)
{ {
JIndu_Wave.PlayFlag = isSelect; JIndu_Wave.PlayFlag = isSelect;
...@@ -82,10 +92,10 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler ...@@ -82,10 +92,10 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
public void Init(Color color,float Jindu,int groupid) public void Init(Color color,float Jindu,int groupid)
{ {
IsSelect = false;
targetProgress = Jindu; targetProgress = Jindu;
NowProgress = Jindu; NowProgress = Jindu;
nowvalue = Jindu; nowvalue = Jindu;
IsSelect = false;
UseColor = color; UseColor = color;
GID = groupid; GID = groupid;
IdName = groupid.ToString(); IdName = groupid.ToString();
...@@ -127,6 +137,9 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler ...@@ -127,6 +137,9 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
if (isSelect && value>0) if (isSelect && value>0)
{ {
JIndu_Wave.PlayFlag = true; JIndu_Wave.PlayFlag = true;
JIndu_Wave.gameObject.SetActive(true);
Jindu_NotWave.gameObject.SetActive(false);
} }
} }
get get
......
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