Commit 835ea7bb authored by JiangWanZhi's avatar JiangWanZhi

更新点击组的表现

parent a23aca39
...@@ -421,4 +421,4 @@ MonoBehaviour: ...@@ -421,4 +421,4 @@ MonoBehaviour:
idName: 12 idName: 12
useColor: {r: 0.9612525, g: 0.9811321, b: 0, a: 1} useColor: {r: 0.9612525, g: 0.9811321, b: 0, a: 1}
index: 0 index: 0
selectLang: 0.25 selectLang: 0.05
...@@ -2971,11 +2971,11 @@ MonoBehaviour: ...@@ -2971,11 +2971,11 @@ MonoBehaviour:
m_Bottom: 0 m_Bottom: 0
m_ChildAlignment: 0 m_ChildAlignment: 0
m_StartCorner: 0 m_StartCorner: 0
m_StartAxis: 0 m_StartAxis: 1
m_CellSize: {x: 120, y: 120} m_CellSize: {x: 120, y: 120}
m_Spacing: {x: 0, y: 0} m_Spacing: {x: 0, y: 0}
m_Constraint: 0 m_Constraint: 2
m_ConstraintCount: 2 m_ConstraintCount: 1
--- !u!1 &6769909122946713645 --- !u!1 &6769909122946713645
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
using ICSharpCode.SharpZipLib;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using static UnityEngine.Rendering.DebugUI.Table; using static UnityEngine.Rendering.DebugUI.Table;
using Debug = UnityEngine.Debug;
public class gridView : MonoBehaviour public class gridView : MonoBehaviour
{ {
...@@ -70,6 +73,19 @@ public class gridView : MonoBehaviour ...@@ -70,6 +73,19 @@ public class gridView : MonoBehaviour
} }
return transfromitem.gameObject; return transfromitem.gameObject;
} }
//根据组的ID获取列表对应的物体
public Transform GetObjByGID(int Gid)
{
Transform parent = transform.GetComponent<ScrollRect>().content;
for (int i = 0; i < parent.childCount; i++)
{
var item = parent.GetChild(i).GetComponent<colorItem>();
if (item.GID == Gid)
return item.transform;
}
return null;
}
virtual public Vector2 getOffset() virtual public Vector2 getOffset()
{ {
var gameObjectContext = GetComponent<ScrollRect>(); var gameObjectContext = GetComponent<ScrollRect>();
...@@ -170,9 +186,8 @@ public class gridView : MonoBehaviour ...@@ -170,9 +186,8 @@ public class gridView : MonoBehaviour
{ {
w = width - w; w = width - w;
} }
rectTransform.sizeDelta = new Vector2(w,rectTransform.sizeDelta.y); rectTransform.sizeDelta = new Vector2(w, rectTransform.sizeDelta.y);
} }
Vector3 vector3 = new Vector3();
utilsTools.setGDataByKey("listViewTempCellSize", new Vector2(gridLayout.cellSize.x, gridLayout.cellSize.y)); utilsTools.setGDataByKey("listViewTempCellSize", new Vector2(gridLayout.cellSize.x, gridLayout.cellSize.y));
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
...@@ -285,7 +300,7 @@ public class gridView : MonoBehaviour ...@@ -285,7 +300,7 @@ public class gridView : MonoBehaviour
startY = 0 - h / 2 + heightItem / 2 - (heightItem / 2 + interval / 2); startY = 0 - h / 2 + heightItem / 2 - (heightItem / 2 + interval / 2);
vector3.x = 0 - rectTransform.sizeDelta.x / 2 - offset1; vector3.x = 0 - rectTransform.sizeDelta.x / 2 - offset1;
float spacingLen =interval * (size - 1); float spacingLen =interval * (size - 1);
float height = spacingLen + coutPixel; float height = coutPixel;
if (height > h) if (height > h)
{ {
h = height; h = height;
...@@ -298,7 +313,7 @@ public class gridView : MonoBehaviour ...@@ -298,7 +313,7 @@ public class gridView : MonoBehaviour
vector3.y = 0 - rectTransform.sizeDelta.y / 2 - offset1;//0 - rectTransform.sizeDelta.y / 2 - offset1; vector3.y = 0 - rectTransform.sizeDelta.y / 2 - offset1;//0 - rectTransform.sizeDelta.y / 2 - offset1;
startX = 0 - w / 2 + widthItem / 2 - (widthItem / 2 + interval / 2); startX = 0 - w / 2 + widthItem / 2 - (widthItem / 2 + interval / 2);
float spacingLen = interval * (size - 1); float spacingLen = interval * (size - 1);
float width = spacingLen + coutPixel; float width = coutPixel;
if (width > w) if (width > w)
{ {
w = width - w; w = width - w;
......
...@@ -19,6 +19,15 @@ public class colorItem : MonoBehaviour ...@@ -19,6 +19,15 @@ public class colorItem : MonoBehaviour
private Color useColor = new Color(); private Color useColor = new Color();
public int index = 0; public int index = 0;
public float selectLang = 0.05f; public float selectLang = 0.05f;
private int gID;
public int GID //组ID
{
get { return gID; }
set { gID = value; }
}
private gameGroupEffect effectImg = null; private gameGroupEffect effectImg = null;
private Vector3 normalScale = Vector3.one; private Vector3 normalScale = Vector3.one;
private List<Vector2> initScaleSize = new List<Vector2>(); private List<Vector2> initScaleSize = new List<Vector2>();
...@@ -28,16 +37,15 @@ public class colorItem : MonoBehaviour ...@@ -28,16 +37,15 @@ public class colorItem : MonoBehaviour
void initMember() void initMember()
{ {
if(effectImg == null) if (effectImg == null)
{ {
Vector2 listViewTempCellSize = utilsTools.getGDataByKey<Vector2>("listViewTempCellSize", Vector2.zero); Vector2 listViewTempCellSize = utilsTools.getGDataByKey<Vector2>("listViewTempCellSize", Vector2.zero);
Vector2 listViewContextCellSize = utilsTools.getGDataByKey<Vector2>("listViewContextCellSize", Vector2.zero); Vector2 listViewContextCellSize = utilsTools.getGDataByKey<Vector2>("listViewContextCellSize", Vector2.zero);
offset = (listViewContextCellSize.y - listViewTempCellSize.y)/2f; offset = (listViewContextCellSize.y - listViewTempCellSize.y) / 2f;
effectImg = transform.Find("circle").GetComponent<gameGroupEffect>(); effectImg = transform.Find("circle").GetComponent<gameGroupEffect>();
normalScale = transform.localScale * 0.85f; normalScale = transform.localScale * 0.85f;
transform.localScale = normalScale; transform.localScale = normalScale;
} }
transform.localScale = Vector3.one * 0.8f;
} }
public bool IsSelect public bool IsSelect
{ {
...@@ -149,7 +157,8 @@ public class colorItem : MonoBehaviour ...@@ -149,7 +157,8 @@ public class colorItem : MonoBehaviour
} }
nowProgress = value; nowProgress = value;
bool isend = this.isFinish(); bool isend = this.isFinish();
effectImg.Height = 1.0f - nowProgress; //effectImg.Height = 1.0f - nowProgress;
effectImg.Height = nowProgress;
transform.Find("idname").gameObject.SetActive(!isend); transform.Find("idname").gameObject.SetActive(!isend);
if (isend) if (isend)
{ {
......
...@@ -784,7 +784,7 @@ PlayerSettings: ...@@ -784,7 +784,7 @@ PlayerSettings:
embeddedLinuxEnableGamepadInput: 1 embeddedLinuxEnableGamepadInput: 1
hmiLogStartupTiming: 0 hmiLogStartupTiming: 0
hmiCpuConfiguration: hmiCpuConfiguration:
apiCompatibilityLevel: 6 apiCompatibilityLevel: 3
activeInputHandler: 0 activeInputHandler: 0
windowsGamepadBackendHint: 0 windowsGamepadBackendHint: 0
cloudProjectId: cloudProjectId:
......
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