Commit b24009f7 authored by shujianhe's avatar shujianhe

调整分组文字大小和尝试动态调整分组单元大小

parent be58a4d2
......@@ -169,13 +169,13 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 30
m_fontSizeBase: 30
m_fontSize: 40
m_fontSizeBase: 40
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
......
......@@ -28,7 +28,7 @@ RectTransform:
m_GameObject: {fileID: 5397047662947055783}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.025, y: 0.025, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
......
......@@ -315,7 +315,7 @@ MonoBehaviour:
m_StartCorner: 0
m_StartAxis: 0
m_CellSize: {x: 280, y: 280}
m_Spacing: {x: 5, y: 0}
m_Spacing: {x: 30, y: 0}
m_Constraint: 2
m_ConstraintCount: 1
--- !u!1001 &1821187684178258737
......
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class gameSceneAreaGroupHandler : gridView
{
......@@ -19,8 +20,9 @@ public class gameSceneAreaGroupHandler : gridView
//{
// get { return itemInterval; }
//}
// Start is called before the first frame update
public float sceneShowSize = 6.0f;
void Start()
{
RectTransform rectTransform = transform.parent.Find("bg").GetComponent<RectTransform>();
......@@ -30,6 +32,32 @@ public class gameSceneAreaGroupHandler : gridView
// Update is called once per frame
void Update(){
}
public void autoResetCellSize()
{
float sceneWidth = utilsTools.DisplaySize.x;
GameObject gameObjectContext = GetComponent<ScrollRect>().content.gameObject;
var gridLayout = gameObjectContext.GetComponent<GridLayoutGroup>();
if (gridLayout != null)
{
float width1 = sceneWidth / sceneShowSize - gridLayout.spacing.x;
if(width1 * sceneShowSize > sceneWidth)
{
sceneShowSize = sceneShowSize - 1;
autoResetCellSize();
return;
}
float bet = gridLayout.cellSize.x / width1;
float height1 = gridLayout.cellSize.y / bet;
float desHeight = GetComponent<RectTransform>().rect.height;
while (height1 > desHeight)
{
bet = bet * 0.90f;
height1 = gridLayout.cellSize.y / bet;
}
width1 = gridLayout.cellSize.x / bet;
gridLayout.cellSize = new Vector2(width1, height1);
}
}
public void setDataNoGrid(int cout, gradViewBack gradView)
{
setData(cout,(GameObject obj,int idx,ListViewBackTypeEnum lvb) =>
......
......@@ -192,7 +192,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
private void onEvent_gameViewOnInitEnd_Handler(List<UnityEngine.Object> uobjects, List<System.Object> objects)
{
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
gridViewList.autoResetCellSize();
var maingameView = gameShowView.GetComponent<mainGameView>();
var groupInfos1 = maingameView.getGroups();
groupInfos = new List<TempGroupInfos>();
......@@ -232,8 +232,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
//RectTransform rectTransform1 = gridViewList.GetComponent<RectTransform>();
RectTransform rectTransform2 = transform.Find("tipSelectGroup").GetComponent<RectTransform>();
//float y = (utilsTools.DisplaySize.y / 2 - rectTransform1.rect.height / 2) * -1 + rectTransform2.rect.height + 25;
//rectTransform2.localPosition = new Vector3(rectTransform2.localPosition.x, y);
if (autoSwitchGroup == false)
{
rectTransform2.gameObject.SetActive(true);
......@@ -289,7 +287,9 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//transform1.localPosition = new Vector2(transform1.localPosition.x, offsetY + 35);
gameShowView.GetComponent<mainGameScaleMove>().setCheckInput();
gameShowView.GetComponent<mainGameView>().showTimes();
RectTransform rectTransform2 = transform.Find("tipSelectGroup").GetComponent<RectTransform>();
rectTransform2.localPosition = new Vector3(rectTransform2.localPosition.x, transform1.localPosition.y - 10);
}
private void handlerLoadingPosition(Image image)
{
......
......@@ -123,6 +123,7 @@ public class colorItem : MonoBehaviour
else
{
s = s - 10;
v = v - 10;
}
}
s = s / 100f;
......@@ -130,7 +131,6 @@ public class colorItem : MonoBehaviour
Color color1 = Color.HSVToRGB(h, s, v);
effectImg.color2 = color1;
effectImg.color1 = useColor;
Debug.Log("id = " + idName + " color1 = " + (color1 * 255).ToString() + " color2 = " + (useColor * 255));
}
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