add
This commit is contained in:
parent
017ab85ac0
commit
4fda1fbb7c
@ -311,7 +311,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 3145268759521990836}
|
||||
m_Father: {fileID: 3145268760560762038}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -631,6 +631,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8974144926583687908}
|
||||
- {fileID: 3145268760064504697}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -751,3 +752,85 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Mode: 0
|
||||
Title: {fileID: 0}
|
||||
contentList: {fileID: 3145268759409834734}
|
||||
--- !u!1 &5748990112681471550
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8974144926583687908}
|
||||
- component: {fileID: 8360380688318706704}
|
||||
- component: {fileID: 8281317698932617217}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8974144926583687908
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5748990112681471550}
|
||||
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: 3145268760560762038}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8360380688318706704
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5748990112681471550}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8281317698932617217
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5748990112681471550}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 32
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6807\u9898"
|
||||
|
@ -2,11 +2,18 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
public enum ModeEnum//窗口模式枚举
|
||||
{
|
||||
autofill = 0,//自动填充
|
||||
fixedSize = 1,//固定大小
|
||||
}
|
||||
public class BoxTypeItem//注册窗体物体类
|
||||
{
|
||||
public int type;//窗体类型
|
||||
public string title = "测试窗体标题";//窗体标题
|
||||
public string content = "测试窗体内容";//窗体内容
|
||||
}
|
||||
public class NormalPopUpWindow : MonoBehaviour
|
||||
{
|
||||
|
||||
@ -25,13 +32,39 @@ public class NormalPopUpWindow : MonoBehaviour
|
||||
Debug.Log(GetComponent<LayoutElement>().minWidth);
|
||||
}
|
||||
private int minimumWidth = -1;//最小宽度
|
||||
|
||||
void Start()
|
||||
|
||||
public GameObject Title;//窗口标题对象
|
||||
public GameObject contentList;//窗口内容对象
|
||||
|
||||
private List<GameObject> gameObjects = new List<GameObject>();//注册的全部窗体
|
||||
public List<GameObject> newPopup(List<BoxTypeItem> my_boxTypes, string title = "标题")//ui更新返回数组
|
||||
{
|
||||
List<GameObject> gameObjectitem = new List<GameObject>();
|
||||
Title.GetComponent<Text>().text = title;
|
||||
float posY = 0;
|
||||
foreach (BoxTypeItem boxType in my_boxTypes)
|
||||
{
|
||||
GameObject gameObject = AddItem(boxType);
|
||||
gameObjects.Add(gameObject);
|
||||
gameObjectitem.Add(gameObject);
|
||||
posY += gameObject.GetComponent<RectTransform>().sizeDelta.y;
|
||||
|
||||
}
|
||||
//scroll_view.GetComponent<ScrollRect>().verticalNormalizedPosition = 1.0f;
|
||||
return gameObjectitem;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private GameObject AddItem(BoxTypeItem boxType)
|
||||
{
|
||||
GameObject ranking_list_item = null;
|
||||
switch (boxType.type)
|
||||
{
|
||||
case 0:
|
||||
ranking_list_item = Instantiate(popUpsCanvas.popUpsCanvasobj.buttonItem, contentList.transform);
|
||||
break;
|
||||
}
|
||||
|
||||
ranking_list_item.GetComponent<PopUpWindowitem>().UpdateBoxTypeItem(boxType);
|
||||
return ranking_list_item;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public class popUpsCanvas : MonoBehaviour
|
||||
public GameObject VerNormalPopUpWindow;//ÆÕͨµ¯´°
|
||||
public GameObject tabPopUpWindow;//Ñ¡Ïµ¯´°
|
||||
|
||||
public GameObject buttonItem;//°΄Ε₯΄°Με
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
popUpsCanvasobj = this;
|
||||
|
@ -8,7 +8,7 @@ public class test : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
GameObject gameObject = popUpsCanvas.popUpsCanvasobj.addPopUp(popUpsCanvas.popUpsCanvasobj.VerNormalPopUpWindow);//²âÊÔ
|
||||
gameObject.GetComponent<NormalPopUpWindow>().setMinimumHeight(200);
|
||||
Debug.Log(gameObject);
|
||||
List<BoxTypeItem> light = new List<BoxTypeItem>();
|
||||
gameObject.GetComponent<NormalPopUpWindow>().newPopup(light,"˛âĘÔąęĚâ");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user