_xiaofang/xiaofang/Assets/Res/gsj/scripts/Panel3.cs

68 lines
2.2 KiB
C#
Raw Normal View History

2024-12-20 10:10:19 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Panel3 : MonoBehaviour
{
private Button cancel;
private Button online;//Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
private Button follow;//<2F><><EFBFBD><EFBFBD><EFBFBD>鰴ť
private Dropdown dropdown;
private int optionCount; // <20><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>Dropdownѡ<6E><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
2024-12-23 14:46:56 +08:00
private GameObject peopleposition;
2024-12-24 20:21:15 +08:00
private Camera godview;
2024-12-20 10:10:19 +08:00
// Start is called before the first frame update
void Start()
{
cancel=transform.Find("left/btn_enddrill").GetComponent<Button>();
cancel.onClick.AddListener(OnCancelBtn);
online=transform.Find("onlineBtn").GetComponent <Button>();
online.onClick.AddListener(OnClickOnlineBtn);
dropdown=transform.Find("left/Dropdown").GetComponent<Dropdown>();
follow = transform.Find("left/Follow").GetComponent<Button>();
follow.onClick.AddListener(FollowBtn);
2024-12-23 14:46:56 +08:00
peopleposition = GameObject.Find("peopleposition").gameObject;
2024-12-24 20:21:15 +08:00
peopleposition.SetActive(false);
godview=GameObject.Find("TopCamera").GetComponent<Camera>();
2024-12-20 10:10:19 +08:00
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dropdownѡ<6E><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
public void SetOptionCount(int count)
{
optionCount = count;
dropdown.ClearOptions();
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var options = new System.Collections.Generic.List<string>();
for (int i = 0; i < optionCount; i++)
{
options.Add("<22><>ɫ " + (i + 1)); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><>ɫ 1"<22><>"<22><>ɫ 2"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3>ɰ<EFBFBD><C9B0><EFBFBD><EFBFBD>޸<EFBFBD>
}
dropdown.AddOptions(options);
}
// Update is called once per frame
void Update()
{
}
void OnCancelBtn()
{
2024-12-23 14:46:56 +08:00
peopleposition.gameObject.SetActive(true);
2024-12-20 10:10:19 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>ӽǽ<D3BD><C7BD><EFBFBD>
2024-12-24 20:21:15 +08:00
godview.enabled = true;
2024-12-20 10:10:19 +08:00
Game.uiManager.ShowUI<Image>("Panel1_2");
Game.uiManager.CloseUI("Panel1_3");
}
void OnClickOnlineBtn()
{
//<2F><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>״̬,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Game.uiManager.ShowUI<Image>("Panel");
}
void FollowBtn()
{
//ת<><D7AA><EFBFBD><EFBFBD>ɫ<EFBFBD>ӽ<EFBFBD>
int selectedIndex = dropdown.value;
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ" + (selectedIndex+1) + "<22>ӽ<EFBFBD>");
}
}