UI逻辑bug修复,准备接数据

This commit is contained in:
huyulong 2024-12-01 22:24:03 +08:00
parent 20120af3ed
commit c28cca2d95
5 changed files with 78 additions and 106 deletions

View File

@ -3557,11 +3557,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7e8b72074fc60764b8554d7067527809, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &825373660 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 51007377463830339, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
m_PrefabInstance: {fileID: 1799705458}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &856136726
PrefabInstance:
m_ObjectHideFlags: 0
@ -5655,6 +5650,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 618256459}
m_Modifications:
- target: {fileID: 7468736063766935910, guid: 90919b88a71f0054bb1cf84429cb3a1e, type: 3}
propertyPath: title
value:
objectReference: {fileID: 865567722}
- target: {fileID: 7468736063766935910, guid: 90919b88a71f0054bb1cf84429cb3a1e, type: 3}
propertyPath: MainPanel
value:
@ -6114,6 +6113,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7468736063766935915, guid: 90919b88a71f0054bb1cf84429cb3a1e, type: 3}
m_PrefabInstance: {fileID: 865567720}
m_PrefabAsset: {fileID: 0}
--- !u!114 &865567722 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7468736064578063281, guid: 90919b88a71f0054bb1cf84429cb3a1e, type: 3}
m_PrefabInstance: {fileID: 865567720}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &911824229
GameObject:
m_ObjectHideFlags: 0
@ -8716,7 +8726,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1417128757
MonoBehaviour:
m_ObjectHideFlags: 0
@ -10514,46 +10524,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 618256459}
m_Modifications:
- target: {fileID: 51007377463830339, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: 8.122314
objectReference: {fileID: 0}
- target: {fileID: 51007377463830339, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 51007377463830342, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_VerticalFit
value: 2
objectReference: {fileID: 0}
- target: {fileID: 51007377463830342, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_HorizontalFit
value: 2
objectReference: {fileID: 0}
- target: {fileID: 370120539392972246, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.000014001576
objectReference: {fileID: 0}
- target: {fileID: 380336514535910973, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 380336514535910973, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1662720451953426838, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_Content
value:
objectReference: {fileID: 825373660}
- target: {fileID: 1662720451953426838, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_Horizontal
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1662720451953426838, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_MovementType
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2102021659995593758, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -10690,10 +10660,6 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2102021661112157380, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_Horizontal
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2102021661231301985, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -10718,22 +10684,6 @@ PrefabInstance:
propertyPath: jsonReader
value:
objectReference: {fileID: 1417128757}
- target: {fileID: 2658781182633319536, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2658781182633319536, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4051613669538919690, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4051613669538919690, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchoredPosition.y
value: -8.5
objectReference: {fileID: 0}
- target: {fileID: 4764228630647718977, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -10862,10 +10812,6 @@ PrefabInstance:
propertyPath: m_SizeDelta.x
value: 249.00002
objectReference: {fileID: 0}
- target: {fileID: 4764228631278755134, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4764228631278755135, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: 629.702
@ -10918,34 +10864,6 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: -39.08695
objectReference: {fileID: 0}
- target: {fileID: 5097990001440067949, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5837674814315639197, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5837674814315639197, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5837674814315639197, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7538115214979638682, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7538115214979638682, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7538115214979638682, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9196293257107006892, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_IsActive
value: 0

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d2b637663b3f5db4fa358637e1e18f67
guid: a73dbc35051d4614a8e27d92a0830665
DefaultImporter:
externalObjects: {}
userData:

View File

@ -14,6 +14,7 @@ public class EvacuationPanel : MonoBehaviour
public Text topText;
public List<ClassItem> classItemList = new List<ClassItem>();
public List<ClassMate> classMateList = new List<ClassMate>();
[Header("学生数量")]
public InputField StuCountInputField;
@ -50,11 +51,22 @@ public class EvacuationPanel : MonoBehaviour
private void ClearData()
{
foreach(var item in classItemList)
jc.classItem.isSet = false;
foreach (var item in classItemList)
{
item.isSet = false;
item.setClassItem("");
}
jc.classMate.isBeSet = false;
foreach(var item in jc.classMateList)
{
item.isBeSet = false;
item.setName();
}
}
// Update is called once per frame

View File

@ -8,19 +8,33 @@ public class ClassMate : MonoBehaviour
{
public JueseChoicePop jueseChoicePop;
public Text classmatename;
public string s;
public Button otherButton;
public Button button;
public bool isClear = false;
public bool isBeSet = false;
// Start is called before the first frame update
void Start()
{
button.onClick.AddListener(Click);
s = classmatename.text;
}
public void Click()
{
jueseChoicePop.SetClassMate(this);
//classmatename.text +=
if(isBeSet == false)
{
jueseChoicePop.SetClassMate(this);
}
else
{
jueseChoicePop.ChangeClassMate();
}
}
public void SetJc(JueseChoicePop jc)
@ -28,6 +42,11 @@ public class ClassMate : MonoBehaviour
jueseChoicePop = jc;
}
public void setName()
{
classmatename.text = s;
}
// Update is called once per frame
void Update()
{

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
@ -12,6 +13,10 @@ public class JueseChoicePop : MonoBehaviour
public Button Surebtn;
public GameObject classmatePrefab;
public Transform content;
public List<ClassMate> classMateList = new List<ClassMate> ();
//public string s;
// Start is called before the first frame update
void Start()
{
@ -44,10 +49,12 @@ public class JueseChoicePop : MonoBehaviour
{
for (int i = 0; i < 10; i++)
{
GameObject item = GameObject.Instantiate<GameObject>(classmatePrefab, content);
ClassMate classMate = item.GetComponent<ClassMate>();
classMateList.Add(classMate);
classMate.SetJc(this);
}
}
@ -57,11 +64,27 @@ public class JueseChoicePop : MonoBehaviour
}
public void SetClassMate(ClassMate classMate)
public void SetClassMate(ClassMate classMate,string a = "")
{
classMate.isBeSet = true;
classItem.isSet = true;
this.classMate = classMate;
classItem.setClassItem(classMate.classmatename.text);
classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
//s = classMate.classmatename.text;
this.classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
}
public void ClearClassMate()
{
}
public void ChangeClassMate()
{
}
}