Commit 009ec99f authored by JiangWanZhi's avatar JiangWanZhi

一些UI的适配和组的列表调整

parent f7558b48
...@@ -36,7 +36,7 @@ RectTransform: ...@@ -36,7 +36,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 120, y: 120} m_SizeDelta: {x: 125, y: 125}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &637148015308226340 --- !u!222 &637148015308226340
CanvasRenderer: CanvasRenderer:
......
This diff is collapsed.
...@@ -27,8 +27,19 @@ public class gameSceneAreaGroupHandler : gridView ...@@ -27,8 +27,19 @@ public class gameSceneAreaGroupHandler : gridView
{ {
RectTransform rectTransform = transform.parent.Find("bg").GetComponent<RectTransform>(); RectTransform rectTransform = transform.parent.Find("bg").GetComponent<RectTransform>();
utilsTools.DisplaySize = new Vector2(rectTransform.rect.width,rectTransform.rect.height); utilsTools.DisplaySize = new Vector2(rectTransform.rect.width,rectTransform.rect.height);
} }
public void SetChild_ListPosData()
{
var content = transform.GetComponent<ScrollRect>().content;
content.GetComponent<GridLayoutGroup>().enabled = false;
for (int i = 0; i < content.childCount; i++)
{
content.GetChild(i).GetComponent<colorItem>().SetLocalRootPos();
}
}
// Update is called once per frame // Update is called once per frame
void Update(){ void Update(){
} }
......
...@@ -70,16 +70,17 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -70,16 +70,17 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
onEvent("gamePlayerEndHandler", onGamePlayerEndHandlerEvent); //整个大图都涂完了 onEvent("gamePlayerEndHandler", onGamePlayerEndHandlerEvent); //整个大图都涂完了
onEvent("closeGameScene", onCloseGameSceneEvent); //关游戏 onEvent("closeGameScene", onCloseGameSceneEvent); //关游戏
onEvent("removeGroupByGid", onRemoveGroupByGidEvent); //自动涂gid不一致会调过来 onEvent("removeGroupByGid", onRemoveGroupByGidEvent); //自动涂gid不一致会调过来
onEvent("GroupIsLoadOver", onGroupIsLoadOver); //组的成员加载完成
transform.Find("ingameLoad/loadImg").gameObject.SetActive(false); transform.Find("ingameLoad/loadImg").gameObject.SetActive(false);
//gameScenUser //gameScenUser
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>(); var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
gridViewList.gameObject.SetActive(false); gridViewList.gameObject.SetActive(false);
transform.Find("groupListBg").gameObject.SetActive(false); transform.Find("groupListBg").gameObject.SetActive(false);
transform.Find("gameProgressText").gameObject.SetActive(false); transform.Find("gameProgress/gameProgressText").gameObject.SetActive(false);
transform.Find("gameProgress").gameObject.SetActive(false); transform.Find("gameProgress").gameObject.SetActive(false);
transform.Find("gameEndOperBase").gameObject.SetActive(false); transform.Find("gameEndOperBase").gameObject.SetActive(false);
transform.Find("gameEndOperBase").GetComponent<gameEndLogic>().initMember(); transform.Find("gameEndOperBase").GetComponent<gameEndLogic>().initMember();
transform.Find("tipSelectGroup").gameObject.SetActive(false); transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(false);
transform.Find("top").gameObject.SetActive(false); transform.Find("top").gameObject.SetActive(false);
utilsTools.setGDataByKey("PhoneOffsetValue", 50); utilsTools.setGDataByKey("PhoneOffsetValue", 50);
utilsTools.addTimer_Sec(gameObject, "loopGetHot", (String name) => utilsTools.addTimer_Sec(gameObject, "loopGetHot", (String name) =>
...@@ -91,11 +92,21 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -91,11 +92,21 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
addHotParams<int>("TUSE_PhoneOffsetValue", "PhoneOffsetValue", int.TryParse); addHotParams<int>("TUSE_PhoneOffsetValue", "PhoneOffsetValue", int.TryParse);
return true; return true;
}, 3, 0); }, 3, 0);
utilsTools.resetGameObjectTreeSize(gameObject, (String path) => //utilsTools.resetGameObjectTreeSize(gameObject, (String path) =>
//{
// if (path.IndexOf("/top/") > 0) return 1;
// return 0;
//});
}
private void onGroupIsLoadOver(List<UnityEngine.Object> uobjects, List<object> objects)
{ {
if (path.IndexOf("/top/") > 0) return 1; StartCoroutine(TestDelay());
return 0; }
}); IEnumerator TestDelay()
{
yield return new WaitForSeconds(0.5f);
areaGroupList.GetComponent<gameSceneAreaGroupHandler>().SetChild_ListPosData();
} }
void addHotParams<T>(string netKey,string localKey, StringOutTValue<T> back, NotifyBoolParam notifyBoolParam = null) void addHotParams<T>(string netKey,string localKey, StringOutTValue<T> back, NotifyBoolParam notifyBoolParam = null)
...@@ -183,7 +194,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -183,7 +194,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
item = gridViewList.getObjectById(nowidx).GetComponent<colorItem>(); item = gridViewList.getObjectById(nowidx).GetComponent<colorItem>();
item.IsSelect = false; item.IsSelect = false;
item.transform.GetLocalPositionAndRotation(out vector3, out quaternion); item.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = vector3.y - 14; //vector3.y = vector3.y - 14;
item.transform.SetLocalPositionAndRotation(vector3, quaternion); item.transform.SetLocalPositionAndRotation(vector3, quaternion);
item.updateOneUI(); item.updateOneUI();
item.switchPlayAnimation(); item.switchPlayAnimation();
...@@ -195,15 +206,27 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -195,15 +206,27 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
item = gridViewList.getObjectById(idx).GetComponent<colorItem>(); item = gridViewList.getObjectById(idx).GetComponent<colorItem>();
item.IsSelect = true; item.IsSelect = true;
item.transform.GetLocalPositionAndRotation(out vector3, out quaternion); item.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = vector3.y + 14; //vector3.y = vector3.y + 14;
item.transform.SetLocalPositionAndRotation(vector3, quaternion); item.transform.SetLocalPositionAndRotation(vector3, quaternion);
item.switchPlayAnimation(); item.switchPlayAnimation();
maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => { maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => {
if (isOk) if (isOk)
{ {
transform.Find("tipSelectGroup").gameObject.SetActive(false); transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(false);
} }
}); });
Transform item_obj;
for (int i = 0; i < areaGroupList.transform.GetComponent<ScrollRect>().content.childCount; i++)
{
if (i == nowidx)
continue;
item_obj = areaGroupList.transform.GetComponent<ScrollRect>().content.GetChild(i);
item_obj.GetComponent<colorItem>().ChangeLocalPos_Select(i < nowidx, nowidx, item.transform.localPosition.x);
}
} }
//游戏图片初始化完成 //游戏图片初始化完成
private void onEvent_gameViewOnInitEnd_Handler(List<UnityEngine.Object> uobjects, List<System.Object> objects) private void onEvent_gameViewOnInitEnd_Handler(List<UnityEngine.Object> uobjects, List<System.Object> objects)
...@@ -249,13 +272,15 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -249,13 +272,15 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}); });
} }
//RectTransform rectTransform1 = gridViewList.GetComponent<RectTransform>(); //RectTransform rectTransform1 = gridViewList.GetComponent<RectTransform>();
RectTransform rectTransform2 = transform.Find("tipSelectGroup").GetComponent<RectTransform>(); RectTransform rectTransform2 = transform.Find("areaGroupList/tipSelectGroup").GetComponent<RectTransform>();
if (autoSwitchGroup == false) if (autoSwitchGroup == false)
{ {
rectTransform2.gameObject.SetActive(true); rectTransform2.gameObject.SetActive(true);
maingameView.GetComponent<mainGameScaleMove>().setCheckInput(); maingameView.GetComponent<mainGameScaleMove>().setCheckInput();
utilsTools.sendEventObjectParams("inGameLoadingValue", 100f, true); utilsTools.sendEventObjectParams("inGameLoadingValue", 100f, true);
} }
} }
private bool phoneClickByPos(ref mainGameView mainview, short x, short y, short faulTolerant, bool isFirst) private bool phoneClickByPos(ref mainGameView mainview, short x, short y, short faulTolerant, bool isFirst)
{ {
...@@ -335,7 +360,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -335,7 +360,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
short y = (short)objects[1]; short y = (short)objects[1];
if(nowidx < 0) if(nowidx < 0)
{ {
transform.Find("tipSelectGroup").gameObject.SetActive(true); transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(true);
return; return;
} }
var maingameView = gameShowView.GetComponent<mainGameView>(); var maingameView = gameShowView.GetComponent<mainGameView>();
...@@ -357,7 +382,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -357,7 +382,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
transform.Find("ingameLoad").gameObject.SetActive(false); transform.Find("ingameLoad").gameObject.SetActive(false);
transform.Find("top").gameObject.SetActive(true); transform.Find("top").gameObject.SetActive(true);
utilsTools.setGDataByKey("loadingEnd", utilsTools.getTotalMillisecond()); utilsTools.setGDataByKey("loadingEnd", utilsTools.getTotalMillisecond());
RectTransform transform1 = transform.Find("gameProgressText").GetComponent<RectTransform>(); RectTransform transform1 = transform.Find("gameProgress/gameProgressText").GetComponent<RectTransform>();
transform1.gameObject.SetActive(true); transform1.gameObject.SetActive(true);
transform1 = transform.Find("gameProgress").GetComponent<RectTransform>(); transform1 = transform.Find("gameProgress").GetComponent<RectTransform>();
transform1.gameObject.SetActive(true); transform1.gameObject.SetActive(true);
...@@ -418,7 +443,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -418,7 +443,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
Sprite sprite = Sprite.Create(texture2d, new Rect(0, 0, texture2d.width, texture2d.height), new Vector2(0.5f, 0.5f)); Sprite sprite = Sprite.Create(texture2d, new Rect(0, 0, texture2d.width, texture2d.height), new Vector2(0.5f, 0.5f));
image.sprite = sprite; image.sprite = sprite;
image.color = new Color(1,1,1,1); image.color = new Color(1,1,1,1);
autoSwitchGroup = Boolean.Parse(utilsTools.getGDataByKey<string>("auto_switch", autoSwitchGroup.ToString())); autoSwitchGroup = true;//Boolean.Parse(utilsTools.getGDataByKey<string>("auto_switch", autoSwitchGroup.ToString()));
if (autoSwitchGroup == false) nowidx = -1; if (autoSwitchGroup == false) nowidx = -1;
vibration = Boolean.Parse(utilsTools.getGDataByKey<string>("vibration", vibration.ToString())); vibration = Boolean.Parse(utilsTools.getGDataByKey<string>("vibration", vibration.ToString()));
this.handlerLoadingPosition(image); this.handlerLoadingPosition(image);
...@@ -533,7 +558,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -533,7 +558,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
void onChangeGameUserProgressEvent(List<UnityEngine.Object> uobjects,List<System.Object> objects) { void onChangeGameUserProgressEvent(List<UnityEngine.Object> uobjects,List<System.Object> objects) {
int pro = (int)objects[0]; int pro = (int)objects[0];
transform.Find("ingameLoad").gameObject.SetActive(false); transform.Find("ingameLoad").gameObject.SetActive(false);
TextMeshProUGUI textMeshPro = transform.Find("gameProgressText").GetComponent<TextMeshProUGUI>(); TextMeshProUGUI textMeshPro = transform.Find("gameProgress/gameProgressText").GetComponent<TextMeshProUGUI>();
textMeshPro.text = pro.ToString() + "%"; textMeshPro.text = pro.ToString() + "%";
UnityEngine.UI.Slider slider = transform.Find("gameProgress").GetComponent<UnityEngine.UI.Slider>(); UnityEngine.UI.Slider slider = transform.Find("gameProgress").GetComponent<UnityEngine.UI.Slider>();
slider.value = pro; slider.value = pro;
...@@ -575,7 +600,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -575,7 +600,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
short x = (short)objects[1]; short x = (short)objects[1];
short y = (short)objects[2]; short y = (short)objects[2];
short nowAidByGid = gameArea.gid; short nowAidByGid = gameArea.gid;
if (nowAidByGid != nowidx) return; if (groupInfos.Count.Equals(0) || nowidx < 0) return;
if (groupInfos[nowidx].gid.Equals(nowAidByGid) == false) return;
if (groupInfos != null) if (groupInfos != null)
{ {
int operId = -1; int operId = -1;
...@@ -691,6 +717,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -691,6 +717,8 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
Debug.Log(tempJsondata); Debug.Log(tempJsondata);
} }
gameShowView.GetComponent<mainGameView>().onClear(); gameShowView.GetComponent<mainGameView>().onClear();
int index = utilsTools.getGDataByKey<int>("testIdx", 0);
utilsTools.setGDataByKey("testIdx", ++index);
SceneManager.LoadScene("Scenes/MainGame"); SceneManager.LoadScene("Scenes/MainGame");
return false; return false;
}, 40); }, 40);
......
This diff is collapsed.
...@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices; ...@@ -5,6 +5,7 @@ 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;
public class gridView : MonoBehaviour public class gridView : MonoBehaviour
{ {
...@@ -213,19 +214,35 @@ public class gridView : MonoBehaviour ...@@ -213,19 +214,35 @@ public class gridView : MonoBehaviour
childTransform.SetParent(null); childTransform.SetParent(null);
GameObject.Destroy(childTransform.gameObject); GameObject.Destroy(childTransform.gameObject);
} }
//if (transform.name== "areaGroupList")
//{
// StartCoroutine(TestDelay());
//}
}
IEnumerator TestDelay()
{
yield return new WaitForSeconds(0.5f);
var content = transform.GetComponent<ScrollRect>().content;
content.GetComponent<GridLayoutGroup>().gameObject.SetActive(false);
for (int i = 0; i < content.childCount; i++)
{
content.GetChild(i).GetComponent<colorItem>().SetLocalRootPos();
}
} }
//只支持一个预制体 //只支持一个预制体
virtual public void setDataNoGrid(int size,float widthItem,float heightItem,float interval,gradViewBack back, bool useVec = true, GetGradViewInfo getGradViewInfo = null,float offset1 = 0.0f) virtual public void setDataNoGrid(int size,float widthItem,float heightItem,float interval,gradViewBack back, bool useVec = true, GetGradViewInfo getGradViewInfo = null,float offset1 = 0.0f)
{ {
Vector2 shipei = new Vector2 (widthItem,heightItem); //Vector2 shipei = new Vector2 (widthItem,heightItem);
utilsTools.DeviceAdaptationSize(ref shipei); //utilsTools.DeviceAdaptationSize(ref shipei);
widthItem = shipei.x; //widthItem = shipei.x;
heightItem = shipei.y; //heightItem = shipei.y;
shipei.x = interval; //shipei.x = interval;
shipei.y = offset1; //shipei.y = offset1;
utilsTools.DeviceAdaptationSize(ref shipei); //utilsTools.DeviceAdaptationSize(ref shipei);
interval = shipei.x; //interval = shipei.x;
offset1 = shipei.y; //offset1 = shipei.y;
if (perfabPaths.Count == 0) if (perfabPaths.Count == 0)
{ {
perfabPaths.Add(perfabPath); perfabPaths.Add(perfabPath);
...@@ -367,5 +384,6 @@ public class gridView : MonoBehaviour ...@@ -367,5 +384,6 @@ public class gridView : MonoBehaviour
childTransform.SetParent(null); childTransform.SetParent(null);
GameObject.Destroy(childTransform.gameObject); GameObject.Destroy(childTransform.gameObject);
} }
utilsTools.sendEventObjectParams("GroupIsLoadOver", null);
} }
} }
...@@ -469,6 +469,10 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -469,6 +469,10 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
for (int i = 0; i < gameidJsondata.roomDatas.Count; i++) for (int i = 0; i < gameidJsondata.roomDatas.Count; i++)
{ {
var item = gameidJsondata.roomDatas[i]; var item = gameidJsondata.roomDatas[i];
if (item.IsValid() == false)
{
continue;
}
if (digitMatrix.Data[item.px, item.py] >= 20) if (digitMatrix.Data[item.px, item.py] >= 20)
{ {
item.tempExKey = "idFlg_" + item.gid.ToString() + "_"+item.id.ToString(); item.tempExKey = "idFlg_" + item.gid.ToString() + "_"+item.id.ToString();
...@@ -1103,43 +1107,43 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -1103,43 +1107,43 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
{ {
baseUpdate(); baseUpdate();
if (Input.mouseScrollDelta.y < 0) //滚轮向前滚动 //if (Input.mouseScrollDelta.y < 0) //滚轮向前滚动
{ //{
var scal = new Vector3(transform.localScale.x - Input.mouseScrollDelta.y, transform.localScale.y - Input.mouseScrollDelta.y, 0); // var scal = new Vector3(transform.localScale.x - Input.mouseScrollDelta.y, transform.localScale.y - Input.mouseScrollDelta.y, 0);
if (scal.x > 5) // if (scal.x > 5)
scal = Vector3.one * 5; // scal = Vector3.one * 5;
transform.localScale = scal; // transform.localScale = scal;
} //}
if (Input.mouseScrollDelta.y > 0) //滚轮向后滚动 //if (Input.mouseScrollDelta.y > 0) //滚轮向后滚动
{ //{
var scal = new Vector3(transform.localScale.x + Input.mouseScrollDelta.y, transform.localScale.y + Input.mouseScrollDelta.y, 0); // var scal = new Vector3(transform.localScale.x + Input.mouseScrollDelta.y, transform.localScale.y + Input.mouseScrollDelta.y, 0);
if (scal.x < 1) // if (scal.x < 1)
scal = Vector3.one; // scal = Vector3.one;
transform.localScale = scal; // transform.localScale = scal;
} //}
if (Input.GetMouseButton(0)) //暂时先这样实现编辑器里的鼠标拖动 //if (Input.GetMouseButton(0)) //暂时先这样实现编辑器里的鼠标拖动
{ //{
if (flag) // if (flag)
{ // {
mouse_oldpos = mouse_nowpos; // mouse_oldpos = mouse_nowpos;
mouse_nowpos = Input.mousePosition; // mouse_nowpos = Input.mousePosition;
var pos_x = mouse_nowpos.x - mouse_oldpos.x; // var pos_x = mouse_nowpos.x - mouse_oldpos.x;
var pos_y=mouse_nowpos.y- mouse_oldpos.y; // var pos_y=mouse_nowpos.y- mouse_oldpos.y;
transform.localPosition = new Vector3(transform.localPosition.x + pos_x, transform.localPosition.y + pos_y, 0); // transform.localPosition = new Vector3(transform.localPosition.x + pos_x, transform.localPosition.y + pos_y, 0);
} // }
else // else
{ // {
mouse_oldpos = Input.mousePosition; // mouse_oldpos = Input.mousePosition;
} // }
mouse_nowpos = Input.mousePosition; // mouse_nowpos = Input.mousePosition;
flag = true; // flag = true;
} //}
if (Input.GetMouseButtonUp(0)) if (Input.GetMouseButtonUp(0))
{ {
flag = false; flag = false;
......
using DG.Tweening;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -23,6 +24,8 @@ public class colorItem : MonoBehaviour ...@@ -23,6 +24,8 @@ public class colorItem : MonoBehaviour
private List<Vector2> initScaleSize = new List<Vector2>(); private List<Vector2> initScaleSize = new List<Vector2>();
private float offset = 0; private float offset = 0;
private Vector3 LocalPos_Root;//记录实例化出来后在本地的原始坐标
void initMember() void initMember()
{ {
if(effectImg == null) if(effectImg == null)
...@@ -34,6 +37,7 @@ public class colorItem : MonoBehaviour ...@@ -34,6 +37,7 @@ public class colorItem : MonoBehaviour
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
{ {
...@@ -58,31 +62,39 @@ public class colorItem : MonoBehaviour ...@@ -58,31 +62,39 @@ public class colorItem : MonoBehaviour
if (transform == null) return; if (transform == null) return;
RectTransform rectTransform = (RectTransform)transform; RectTransform rectTransform = (RectTransform)transform;
float x = transform.localPosition.x; float x = transform.localPosition.x;
//if (isSelect)
//{
// transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset);
// transform.localScale = normalScale;
// ActionManages.addMoveByScale(gameObject, normalScale * 1.2f, 0.25f);
//}
//else
//{
// transform.localScale = normalScale * 1.2f;
// transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset);
// ActionManages.addMoveByScale(gameObject, normalScale, 0.25f);
//}
if (isSelect) if (isSelect)
{ {
transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset); transform.DOScale(Vector3.one * 0.9f, 0.5f);
transform.localScale = normalScale;
ActionManages.addMoveByScale(gameObject, normalScale * 1.2f, 0.25f);
} }
else else
{ {
transform.localScale = normalScale * 1.2f; transform.DOScale(Vector3.one * 0.8f, 0.5f);
transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset);
ActionManages.addMoveByScale(gameObject, normalScale, 0.25f);
} }
//ActionManages.addCallBackByLen(gameObject, 1000, 0.25f, (float _) =>
ActionManages.addCallBackByLen(gameObject, 1000, 0.25f, (float _) => //{
{ // //transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset);
//transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset); // rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, 0);
rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, 0); //}, (GameObject gobject, int id) =>
}, (GameObject gobject, int id) => //{
{ // //float a = transform.localScale.y * rectTransform.rect.height;
//float a = transform.localScale.y * rectTransform.rect.height; // //transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset);
//transform.localPosition = new Vector2(x, 0 - (transform.localScale.y * rectTransform.rect.height) / 2 - offset); // rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, 0);
rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, 0); //});
});
} }
public void switchPlayAnimation1() public void switchPlayAnimation1()
{ {
...@@ -204,7 +216,6 @@ public class colorItem : MonoBehaviour ...@@ -204,7 +216,6 @@ public class colorItem : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
Debug.LogError($"Test{transform.name}");
initMember(); initMember();
//IsSelect = isSelect; //IsSelect = isSelect;
//IdName = idName; //IdName = idName;
...@@ -236,4 +247,23 @@ public class colorItem : MonoBehaviour ...@@ -236,4 +247,23 @@ public class colorItem : MonoBehaviour
public void resetSize(float x,float y) public void resetSize(float x,float y)
{ {
} }
public void SetLocalRootPos() //保存一下本地的原始坐标
{
LocalPos_Root = transform.localPosition;
}
public void ChangeLocalPos_Select(bool left,int clickindex,float clickpos) //当点击组的时候,其它往外面偏移一段
{
if (left) //左边
{
transform.DOLocalMoveX(clickpos - 120 * (clickindex - index) - 20, 0.5f);
//transform.DOLocalMoveX(LocalPos_Root.x - 10, 0.5f);
}
else
{
transform.DOLocalMoveX(clickpos + 120 * (index - clickindex) + 20, 0.5f);
//transform.DOLocalMoveX(LocalPos_Root.x + 10, 0.5f);
}
}
} }
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