界面UI和UI逻辑

This commit is contained in:
huyulong 2024-12-01 19:24:07 +08:00
parent 350a7e0deb
commit 474beeff04
10 changed files with 2329 additions and 14213 deletions

View File

@ -26,19 +26,19 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 51007377463830338}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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:
- {fileID: 4899758394969402038}
m_Father: {fileID: 51007377641282993}
m_RootOrder: 3
m_Father: {fileID: 1375632039527731110}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 1.5, y: -45.968414}
m_SizeDelta: {x: 3, y: -91.9368}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 399.9582}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &51007377463830336
MonoBehaviour:
@ -59,10 +59,10 @@ MonoBehaviour:
m_Bottom: 0
m_ChildAlignment: 0
m_StartCorner: 0
m_StartAxis: 1
m_StartAxis: 0
m_CellSize: {x: 393.89, y: 67.6992}
m_Spacing: {x: 77.8, y: 3.13}
m_Constraint: 0
m_Constraint: 1
m_ConstraintCount: 2
--- !u!114 &51007377463830342
MonoBehaviour:
@ -85,7 +85,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 51007377463830338}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
@ -129,7 +129,7 @@ RectTransform:
- {fileID: 51007378723563294}
- {fileID: 51007377890089288}
- {fileID: 51007378041876772}
- {fileID: 51007377463830339}
- {fileID: 8835435199157305554}
m_Father: {fileID: 4764228632217023200}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -647,6 +647,97 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &2116868123207537822
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1375632039527731110}
- component: {fileID: 3010713386216739996}
- component: {fileID: 4259230956599604295}
- component: {fileID: 8091255892096844412}
m_Layer: 5
m_Name: Viewport
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1375632039527731110
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2116868123207537822}
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:
- {fileID: 51007377463830339}
m_Father: {fileID: 8835435199157305554}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: -17}
m_Pivot: {x: 0, y: 1}
--- !u!222 &3010713386216739996
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2116868123207537822}
m_CullTransparentMesh: 1
--- !u!114 &4259230956599604295
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2116868123207537822}
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: 10917, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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!114 &8091255892096844412
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2116868123207537822}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 0
--- !u!1 &4764228630371431633
GameObject:
m_ObjectHideFlags: 0
@ -1867,13 +1958,16 @@ MonoBehaviour:
classPrefab: {fileID: 6833246911785287183, guid: eec456cfeada31d4b84c2ba45b21163e, type: 3}
content: {fileID: 51007377463830339}
topText: {fileID: 51007378041876773}
classItemList: []
StuCountInputField: {fileID: 4764228631345599138}
CountsubmitBtn: {fileID: 4764228630509561248}
rsprite: {fileID: 21300000, guid: 7121fe1df4efeda468c7013dc94ab4e4, type: 3}
fsprite: {fileID: 21300000, guid: 586c4520a2c6c8d4e9bac48ed427f617, type: 3}
JuesechoicePop: {fileID: 9196293257107006892}
jc: {fileID: 0}
redistributeBtn: {fileID: 4764228631451568080}
submitBtn: {fileID: 4764228632238488447}
npcNum: 0
--- !u!1 &4764228630847365396
GameObject:
m_ObjectHideFlags: 0
@ -4426,6 +4520,114 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &9120902962895302534
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8835435199157305554}
- component: {fileID: 5792972360468918}
- component: {fileID: 8005203880280746021}
- component: {fileID: 2459851202196809897}
m_Layer: 5
m_Name: Scroll View
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8835435199157305554
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9120902962895302534}
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:
- {fileID: 1375632039527731110}
m_Father: {fileID: 51007377641282993}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 13.204987, y: -45.967987}
m_SizeDelta: {x: -26.411, y: -91.937}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5792972360468918
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9120902962895302534}
m_CullTransparentMesh: 1
--- !u!114 &8005203880280746021
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9120902962895302534}
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: 0}
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: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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!114 &2459851202196809897
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9120902962895302534}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Content: {fileID: 51007377463830339}
m_Horizontal: 0
m_Vertical: 1
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 1375632039527731110}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_HorizontalScrollbarSpacing: -3
m_VerticalScrollbarSpacing: -3
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &9196293256195567447
GameObject:
m_ObjectHideFlags: 0
@ -5062,6 +5264,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c3c62a9e39483364a940c4e9710a0edd, type: 3}
m_Name:
m_EditorClassIdentifier:
classMate: {fileID: 0}
classItem: {fileID: 0}
CloseBtn: {fileID: 9196293256264736945}
Surebtn: {fileID: 9196293256643691025}
classmatePrefab: {fileID: 5469669078140634244, guid: 31b7a64c10e21b1498f7319ab1b0126d, type: 3}

View File

@ -12817,7 +12817,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMin.x
@ -12825,7 +12825,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_SizeDelta.x
@ -12865,11 +12865,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 194.0772
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -29.2995
objectReference: {fileID: 0}
- target: {fileID: 4204671800070690485, guid: 5e14c4abba3cf1a4099ba76ddf50a689, type: 3}
propertyPath: m_LocalEulerAnglesHint.x

View File

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

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -12,6 +13,8 @@ public class EvacuationPanel : MonoBehaviour
public Transform content;
public Text topText;
public List<ClassItem> classItemList = new List<ClassItem>();
[Header("ѧÉúÊýÁ¿")]
public InputField StuCountInputField;
public Button CountsubmitBtn;
@ -19,6 +22,8 @@ public class EvacuationPanel : MonoBehaviour
public Sprite fsprite;
public GameObject JuesechoicePop;
public JueseChoicePop jc = new JueseChoicePop();
[Header("×Ü°´Å¥")]
public Button redistributeBtn;
public Button submitBtn;
@ -29,10 +34,29 @@ public class EvacuationPanel : MonoBehaviour
// Start is called before the first frame update
void Start()
{
jc = JuesechoicePop.GetComponent<JueseChoicePop>();
redistributeBtn.onClick.AddListener(ClearData);
submitBtn.onClick.AddListener(Submit);
StuCountInputField.onEndEdit.AddListener(CheckInput);
SetClass();
}
private void Submit()
{
}
private void ClearData()
{
foreach(var item in classItemList)
{
item.isSet = false;
item.setClassItem("");
}
}
// Update is called once per frame
void Update()
{
@ -90,10 +114,10 @@ public class EvacuationPanel : MonoBehaviour
{
for (int i = 0; i < 10; i++)
{
GameObject item = GameObject.Instantiate<GameObject>(classPrefab, content);
ClassItem classItem = item.GetComponent<ClassItem>();
classItem.JuesechoicePop = JuesechoicePop;
classItemList.Add(classItem);
}
}
//Npc·ÖÅä

View File

@ -377,7 +377,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
classmatename: {fileID: 5469669078877023921}
toggle: {fileID: 2980258575476095107}
button: {fileID: 5469669078140634246}
--- !u!1 &5469669078877023935
GameObject:
m_ObjectHideFlags: 0

View File

@ -136,7 +136,9 @@ MonoBehaviour:
NoSelectedBtn: {fileID: 8299270741119412922}
SelectedBtn: {fileID: 6833246912404437832}
SelectedBtntext: {fileID: 6833246912098821495}
NoSelectedBtntext: {fileID: 8299270741362893297}
JuesechoicePop: {fileID: 0}
isSet: 0
--- !u!1 &6833246912098821489
GameObject:
m_ObjectHideFlags: 0

View File

@ -9,32 +9,41 @@ public class ClassItem : MonoBehaviour
public Button NoSelectedBtn;
public Button SelectedBtn;
public Text SelectedBtntext;
public Text NoSelectedBtntext;
public GameObject JuesechoicePop;
public bool isSet = false;
// Start is called before the first frame update
void Start()
{
NoSelectedBtn.onClick.AddListener(OpenJueseChoicePop);
SelectedBtn.onClick.AddListener(OpenJueseChoicePop);
setClassItem();
//SelectedBtn.onClick.AddListener(OpenJueseChoicePop);
setClassItem("");
}
public void setClassItem()
public void setClassItem(string s)
{
if(true)
{
SelectedBtn.gameObject.SetActive(true);
SelectedBtntext.text = "½ÇÉ«Ãû";
NoSelectedBtn.gameObject.SetActive(false);
}
else
if(!isSet)
{
NoSelectedBtn.gameObject.SetActive(true);
SelectedBtn.gameObject.SetActive(false);
}
else
{
//NoSelectedBtn.gameObject.SetActive(true);
//SelectedBtn.gameObject.SetActive(false);
SelectedBtn.gameObject.SetActive(true);
SelectedBtntext.text = s;
NoSelectedBtn.gameObject.SetActive(false);
}
}
void OpenJueseChoicePop()
{
JuesechoicePop.SetActive(true);
JueseChoicePop jueseChoicePop = JuesechoicePop.GetComponent<JueseChoicePop>();
jueseChoicePop.SetClassItem(this);
}
// Update is called once per frame
void Update()

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -5,11 +6,26 @@ using UnityEngine.UI;
public class ClassMate : MonoBehaviour
{
public JueseChoicePop jueseChoicePop;
public Text classmatename;
public Button otherButton;
public Button button;
// Start is called before the first frame update
void Start()
{
button.onClick.AddListener(Click);
}
public void Click()
{
jueseChoicePop.SetClassMate(this);
//classmatename.text +=
}
public void SetJc(JueseChoicePop jc)
{
jueseChoicePop = jc;
}
// Update is called once per frame

View File

@ -5,6 +5,9 @@ using UnityEngine.UI;
public class JueseChoicePop : MonoBehaviour
{
public ClassMate classMate;
public ClassItem classItem;
public Button CloseBtn;
public Button Surebtn;
public GameObject classmatePrefab;
@ -29,7 +32,8 @@ public class JueseChoicePop : MonoBehaviour
void SetFenguan()
{
//设置此区分的分管人员为用户选中的角色,并刷新界面信息
classItem.isSet = true;
//classItem.setClassItem();
}
// Update is called once per frame
void Update()
@ -43,6 +47,21 @@ public class JueseChoicePop : MonoBehaviour
GameObject item = GameObject.Instantiate<GameObject>(classmatePrefab, content);
ClassMate classMate = item.GetComponent<ClassMate>();
classMate.SetJc(this);
}
}
public void SetClassItem(ClassItem classItem)
{
this.classItem = classItem;
}
public void SetClassMate(ClassMate classMate)
{
classItem.isSet = true;
this.classMate = classMate;
classItem.setClassItem(classMate.classmatename.text);
classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
}
}