This commit is contained in:
舒荣森 2024-10-31 16:51:02 +08:00
commit fbacd20c4c
6 changed files with 64 additions and 17 deletions

View File

@ -68,7 +68,7 @@ MonoBehaviour:
m_Calls: []
m_Sprite: {fileID: 2074926565, guid: 67d2b1db3ae59284d89e1bdadb1945aa, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
@ -445,7 +445,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 408.30765, y: -91}
m_AnchoredPosition: {x: 407.425, y: -91}
m_SizeDelta: {x: 446.53, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5616551305545643718
@ -999,6 +999,7 @@ MonoBehaviour:
textobj: {fileID: 0}
promptobj: {fileID: 5616551305478333436}
contentobj: {fileID: 0}
iconobj: {fileID: 2063899790}
--- !u!1 &5616551307087571641
GameObject:
m_ObjectHideFlags: 0
@ -1138,7 +1139,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 719.1153, y: -91}
m_AnchoredPosition: {x: 717.35, y: -91}
m_SizeDelta: {x: 139, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5616551307277562187

View File

@ -321,6 +321,7 @@ GameObject:
- component: {fileID: 9071259163023854630}
- component: {fileID: 9071259163023854629}
- component: {fileID: 2610998525154624650}
- component: {fileID: 8306315414658366847}
m_Layer: 5
m_Name: content_list
m_TagString: Untagged
@ -345,7 +346,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 414, y: -25}
m_AnchoredPosition: {x: 414, y: -199.99922}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &9071259163023854629
@ -388,6 +389,18 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_HorizontalFit: 1
m_VerticalFit: 1
--- !u!225 &8306315414658366847
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9071259163023854631}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &9071259163357382589
GameObject:
m_ObjectHideFlags: 0

View File

@ -705,6 +705,16 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
go: {fileID: 109717923}
icons:
- {fileID: 2074926565, guid: 67d2b1db3ae59284d89e1bdadb1945aa, type: 3}
- {fileID: -564534321, guid: c0603bed087587a459e19f661e80a9b3, type: 3}
- {fileID: -1747828919, guid: 17e3fe66824e3524bbe9cdd2e3327c17, type: 3}
- {fileID: 681606087, guid: 239c172bda433554e8dd76bb66b20796, type: 3}
- {fileID: 1678500488, guid: 77b6288ddba3e0e449fdbd9840862b54, type: 3}
toolsicons:
- {fileID: 21300000, guid: d4fbb32ff8543d443b74de2652100618, type: 3}
- {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3}
- {fileID: 21300000, guid: f79faf75d4e26b748958aaaf6c64cf56, type: 3}
--- !u!114 &109717923
MonoBehaviour:
m_ObjectHideFlags: 0
@ -717,6 +727,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f60fc87924edb64ba5073ca0de5ec28, type: 3}
m_Name:
m_EditorClassIdentifier:
number: 1
--- !u!1 &138158026
GameObject:
m_ObjectHideFlags: 0

View File

@ -17,7 +17,10 @@ public class BoxType
public bool is_required = false;
public string content = "";
public int Type = 0;
public UnityEngine.UI.Image icon = null;
public Sprite icon = null;
//public Sprite icon = null;
public string details = "";
public string button_0_text = "";
public string button_1_text = "";
@ -85,11 +88,13 @@ public class input_box_pop_up_window : MonoBehaviour
{
setScrollMode(0);
}
public List<GameObject> updateUI(List<BoxType> my_boxTypes,string type = "±êÌâ")//ui¸üÐÂ
{
List<GameObject> gameObjects = new List<GameObject>();
boxTypes = my_boxTypes;
Type.GetComponent<Text>().text = type;
foreach (var boxType in boxTypes)
{
@ -121,7 +126,20 @@ public class input_box_pop_up_window : MonoBehaviour
ranking_list_item.GetComponent<input_box_pop_up_window_item>().Update_text(boxType);
gameObjects.Add(ranking_list_item);
}
SetPosY();
return gameObjects;
}
public async void SetPosY()
{
//contentList.GetComponent<CanvasGroup>().alpha = 0;
await Task.Delay(10);
float posY = -(contentList.GetComponent<RectTransform>().sizeDelta.y / 2);
Vector3 pos= new Vector3(contentList.transform.position.x, posY, contentList.transform.position.z);
contentList.transform.position = pos;
/*await Task.Delay(200);
contentList.GetComponent<CanvasGroup>().alpha = 1;*/
}
}

View File

@ -25,7 +25,7 @@ public class input_box_pop_up_window_item : MonoBehaviour
boxType = my_boxType;
if (textobj != null) textobj.GetComponent<Text>().text = boxType.textName;
if (promptobj != null) promptobj.GetComponent<Text>().text = boxType.prompt;
// if (iconobj != null) iconobj.GetComponent<Image>(). = boxType.icon;
if (iconobj != null) iconobj.GetComponent<Image>().sprite = boxType.icon;
}
private void Update()
{

View File

@ -10,6 +10,8 @@ public class jinsha : mount
public JinShaBuy go;
public List<Sprite> icons;
public List<Sprite> toolsicons;
public override void Awake()
{
intance = this;
@ -23,37 +25,39 @@ public class jinsha : mount
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第一层", Type = 4, is_required = true});
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "青精灵", Type = 3, is_required = true});
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-青", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "青精灵", Type = 3, is_required = true,icon= icons[0] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-青", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第二层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "红精灵", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-红", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "红精灵", Type = 3, is_required = true, icon = icons[1] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-红", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第三层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "绿精灵", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-绿色", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "绿精灵", Type = 3, is_required = true, icon = icons[2] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-绿色", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第四层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "蓝精灵", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-蓝", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "蓝精灵", Type = 3, is_required = true, icon = icons[3] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-蓝", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第五层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "紫精灵", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-紫", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "紫精灵", Type = 3, is_required = true, icon = icons[4] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-紫", Type = 3, is_required = true, icon = toolsicons[0] });
//boxTypes[3] = new BoxType { Name = "submit", textName = " 取消确定 ", Type = 2 };
GameObject gameObject = add_pop_up();
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动
//gameObject.GetComponent<input_box_pop_up_window>().SetPosY();
//gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//设置滚动模式为自动填充
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "购买人才");//测试输入框回调处理
gameObject.GetComponent<input_box_pop_up_window>().OnEnd += () =>
{
//关闭摄像头逻辑
//按下关闭按键,开启逻辑
Cinemachine_2dCon.SetCameraContorl(true);
};