Фикс отображния текста в VitrinaView. Подгонка по ширине.
This commit is contained in:
parent
0cbdaab339
commit
7b2640fccc
@ -11349,7 +11349,7 @@ Material:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 0.0495317, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 1, b: 0.56380653, a: 1}
|
||||
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
|
||||
- _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1}
|
||||
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
|
||||
@ -1582,7 +1582,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 46193421}
|
||||
- component: {fileID: 46193423}
|
||||
- component: {fileID: 46193422}
|
||||
m_Layer: 0
|
||||
m_Name: Vitrina view
|
||||
@ -1600,8 +1599,8 @@ Transform:
|
||||
m_GameObject: {fileID: 46193420}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -10.077, y: -0.11, z: 0}
|
||||
m_LocalScale: {x: 0.5951712, y: 0.5951712, z: 0.5951712}
|
||||
m_LocalPosition: {x: -9.6283, y: -0.11, z: 0}
|
||||
m_LocalScale: {x: 0.59930354, y: 0.59930354, z: 0.59930354}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 767780636}
|
||||
@ -1631,58 +1630,6 @@ MonoBehaviour:
|
||||
AvailableColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
AvailableEmptyColor: {r: 0.54901963, g: 0.7490196, b: 0.8470589, a: 1}
|
||||
NotAvailableColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
--- !u!212 &46193423
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 46193420}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 500331691
|
||||
m_SortingLayer: 3
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 2dd364ad6ada7294eac7aa4a9e3bb5f5, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 5.34, y: 10.67}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &52771945
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -19316,6 +19263,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 839089594}
|
||||
- {fileID: 52771946}
|
||||
- {fileID: 1016382999}
|
||||
- {fileID: 1537713866}
|
||||
@ -19327,7 +19275,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 4.48, y: 8.28}
|
||||
m_SizeDelta: {x: 6.25, y: 8.28}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &767780637
|
||||
MonoBehaviour:
|
||||
@ -26099,6 +26047,102 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 831537982}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &839089593
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 839089594}
|
||||
- component: {fileID: 839089597}
|
||||
- component: {fileID: 839089596}
|
||||
- component: {fileID: 839089595}
|
||||
m_Layer: 0
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &839089594
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839089593}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 767780636}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 7.51, y: 10.63}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &839089595
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839089593}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 1
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &839089596
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839089593}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 2dd364ad6ada7294eac7aa4a9e3bb5f5, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &839089597
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839089593}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &848956280
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
//Панель с результатами открытия витрины
|
||||
public class VitrinaPanel : MonoBehaviour
|
||||
{
|
||||
private bool initialized = false;
|
||||
|
||||
@ -34,11 +34,21 @@ public class VitrinaView : MonoBehaviour
|
||||
if (hasPrize && CharacterController.CurrentCharacter.prize is VitrinaPrize vitrinaPrize)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
foreach (var cell in Cells)
|
||||
|
||||
// Устанавливаем номера ячеек и базовое состояние
|
||||
for (int i = 0; i < Cells.Count; i++)
|
||||
{
|
||||
cell.sprite = NotAvailableCell;
|
||||
cell.GetComponentInChildren<TextMeshProUGUI>().color = NotAvailableColor;
|
||||
int boxNumber = i + 1;
|
||||
var text = Cells[i].GetComponentInChildren<TextMeshProUGUI>();
|
||||
if (text != null)
|
||||
{
|
||||
text.text = boxNumber.ToString(); // Устанавливаем номер ячейки
|
||||
text.color = NotAvailableColor;
|
||||
}
|
||||
Cells[i].sprite = NotAvailableCell;
|
||||
Cells[i].color = Color.white;
|
||||
}
|
||||
|
||||
SetPrizesAsync(vitrinaPrize);
|
||||
return;
|
||||
}
|
||||
@ -64,29 +74,38 @@ public class VitrinaView : MonoBehaviour
|
||||
// Проходим по всем ячейкам (индексы 0-based, номера ячеек 1-based)
|
||||
for (int i = 0; i < Cells.Count; i++)
|
||||
{
|
||||
int boxNumber = i + 1; // Преобразуем индекс в номер ячейки (1-based)
|
||||
int boxNumber = i + 1;
|
||||
var text = Cells[i].GetComponentInChildren<TextMeshProUGUI>();
|
||||
|
||||
// Убеждаемся, что номер ячейки всегда отображается
|
||||
if (text != null && string.IsNullOrEmpty(text.text))
|
||||
{
|
||||
text.text = boxNumber.ToString();
|
||||
}
|
||||
|
||||
if (boxesToGiveSet.Contains(boxNumber))
|
||||
{
|
||||
// Ячейка должна быть выдана, проверяем доступность
|
||||
if (readyBoxesSet.Contains(boxNumber))
|
||||
{
|
||||
Cells[i].sprite = AvailableCell; // Доступна для выдачи
|
||||
Cells[i].GetComponentInChildren<TextMeshProUGUI>().color = AvailableColor;
|
||||
Cells[i].sprite = AvailableCell;
|
||||
if (text != null) text.color = AvailableColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cells[i].sprite = AvailableEmptyCell; // Недоступна для выдачи
|
||||
Cells[i].GetComponentInChildren<TextMeshProUGUI>().color = AvailableEmptyColor;
|
||||
Cells[i].sprite = AvailableEmptyCell;
|
||||
if (text != null) text.color = AvailableEmptyColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ячейка не входит в список для выдачи
|
||||
Cells[i].sprite = NotAvailableCell;
|
||||
//Cells[i].GetComponentInChildren<TextMeshProUGUI>().color = NotAvailableColor;
|
||||
|
||||
Cells[i].GetComponentInChildren<TextMeshProUGUI>().color = NotAvailableColor;
|
||||
if (text != null)
|
||||
{
|
||||
text.color = NotAvailableColor;
|
||||
// НЕ ОЧИЩАЕМ ТЕКСТ! Оставляем номер ячейки
|
||||
}
|
||||
Cells[i].color = NotAvailableColor;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user