2024-12-17 16:28:38 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
using TMPro;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
using UnityEditor.Rendering.LookDev;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class FreePanelManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD>")]
|
|
|
|
|
public Sprite TestImage;
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD>")]
|
2024-12-18 23:13:30 +08:00
|
|
|
|
//ְҵѡ<D2B5><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public GameObject OccupationPanel;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public GameObject TipPanel;
|
|
|
|
|
public GameObject AccidentIPanel;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
//ְҵ<D6B0><D2B5><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
|
|
|
|
|
public GameObject OpcTip1;
|
|
|
|
|
public GameObject OpcTip2;
|
|
|
|
|
public GameObject OpcTip3;
|
|
|
|
|
public GameObject OpcTip4;
|
|
|
|
|
public GameObject OpcTip5;
|
|
|
|
|
public GameObject OpcTip6;
|
|
|
|
|
public GameObject OpcTip7;
|
|
|
|
|
public GameObject OpcTip8;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
[Header("ͼ<><CDBC>")]
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
|
|
|
|
|
public Image TipBg;
|
|
|
|
|
//<2F>¹ʵ<C2B9><CAB5><EFBFBD>ͼ
|
|
|
|
|
public Image AccidentImage;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
[Header("<22><>ť")]
|
|
|
|
|
public Button AccidentButton;
|
|
|
|
|
public Button OpcLeft;
|
|
|
|
|
public Button OpcRight;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
[Header("<22>ı<EFBFBD>")]
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>
|
|
|
|
|
public Text TipText;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
//ְҵ<D6B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public Text Ocp1;
|
|
|
|
|
public Text Ocp2;
|
|
|
|
|
public Text Ocp3;
|
|
|
|
|
public Text Ocp4;
|
|
|
|
|
public Text Ocp5;
|
|
|
|
|
public Text Ocp6;
|
|
|
|
|
public Text Ocp7;
|
|
|
|
|
public Text Ocp8;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
[Header("һЩ<D2BB><D0A9><EFBFBD><EFBFBD><EFBFBD>ֵֹĶ<D6B5><C4B6><EFBFBD>")]
|
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵭<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
|
|
|
|
|
public float fadeInDuration = 1f; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
public float fadeOutDuration = 1f; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
public float displayDuration = 2f; // 2<><32><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
private bool isFadingIn = true;
|
|
|
|
|
private bool isFadingOut = false;
|
|
|
|
|
// ָʾ<D6B8>ı<EFBFBD><C4B1><EFBFBD>ǰ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private bool isFading = false;
|
|
|
|
|
private bool isFadeEnd = false;
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>еĵ<D0B5><C4B5>뵭<EFBFBD><EBB5AD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private Coroutine fadeCoroutine;
|
|
|
|
|
#endregion
|
2024-12-18 23:13:30 +08:00
|
|
|
|
|
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public List<GameObject> createdItems = new List<GameObject>();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>б<EFBFBD>
|
|
|
|
|
public GameObject content1; // Scroll View <20><> Content <20><><EFBFBD><EFBFBD>
|
|
|
|
|
public GameObject content2;
|
|
|
|
|
public GameObject content3;
|
|
|
|
|
public GameObject content4;
|
|
|
|
|
public GameObject content5;
|
|
|
|
|
public GameObject content6;
|
|
|
|
|
public GameObject content7;
|
|
|
|
|
public GameObject content8;
|
|
|
|
|
|
|
|
|
|
public List<string> OpcName = new List<string>(); //<2F><><EFBFBD><EFBFBD>ְҵ<D6B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private int itemCount=1; // Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public GameObject itemPrefab; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD>Ƽ<EFBFBD>
|
|
|
|
|
public JSONReader JSONReader;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
OcpName(8002, 1);
|
|
|
|
|
OcpName(8003, 2);
|
|
|
|
|
OcpName(8004, 3);
|
|
|
|
|
OcpName(8006, 4);
|
|
|
|
|
//ְҵ<D6B0><D2B5><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
|
|
OpcLeft.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
LeftRight(1);
|
|
|
|
|
});
|
|
|
|
|
//ְҵ<D6B0><D2B5><EFBFBD>ܿ<EFBFBD><DCBF>Ұ<EFBFBD>ť
|
|
|
|
|
OpcRight.onClick.AddListener(() => {
|
|
|
|
|
LeftRight(2);
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-12-17 16:28:38 +08:00
|
|
|
|
public void Update()
|
|
|
|
|
{
|
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (Input.GetKeyDown("j"))
|
|
|
|
|
{
|
2024-12-18 23:13:30 +08:00
|
|
|
|
// PopAccident(TestImage);
|
2024-12-17 16:28:38 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
if (isFadeEnd)
|
|
|
|
|
{
|
|
|
|
|
StopCoroutine(FadeInOutRoutine());
|
|
|
|
|
isFadeEnd = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void PopTipPanel()
|
|
|
|
|
{
|
|
|
|
|
TipPanel.SetActive(true);
|
|
|
|
|
StopCoroutine(FadeInOutRoutine());
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>¹ʿ<C2B9><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="image"><3E><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>¹<EFBFBD>ͼƬ<CDBC><C6AC>Spite<74><65></param>
|
|
|
|
|
public void PopAccident(Sprite image)
|
|
|
|
|
{
|
2024-12-18 23:13:30 +08:00
|
|
|
|
AccidentImage.sprite = image;
|
2024-12-17 16:28:38 +08:00
|
|
|
|
AccidentIPanel.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ʾ<EFBFBD><CABE><EFBFBD>嵭<EFBFBD>뵭<EFBFBD><EBB5AD><EFBFBD><EFBFBD>Я<EFBFBD><D0AF>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
IEnumerator FadeInOutRoutine()
|
|
|
|
|
{
|
|
|
|
|
isFading = true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>뵭<EFBFBD><EBB5AD><EFBFBD><EFBFBD>־
|
|
|
|
|
|
|
|
|
|
//// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
float elapsedTime = 0f;
|
|
|
|
|
while (elapsedTime < fadeInDuration)
|
|
|
|
|
{
|
|
|
|
|
elapsedTime += Time.deltaTime;
|
|
|
|
|
//Color textColor = TipText.color;
|
|
|
|
|
//textColor.a = elapsedTime / fadeInDuration; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>alphaֵ
|
|
|
|
|
//TipText.color = textColor;
|
|
|
|
|
//TipBg.color = textColor;
|
|
|
|
|
|
|
|
|
|
yield return null; // <20>ȴ<EFBFBD><C8B4><EFBFBD>һ֡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD>ı<EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1>
|
|
|
|
|
yield return new WaitForSeconds(displayDuration);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
elapsedTime = 0f;
|
|
|
|
|
while (elapsedTime < fadeOutDuration)
|
|
|
|
|
{
|
|
|
|
|
elapsedTime += Time.deltaTime;
|
|
|
|
|
Color textColor = TipText.color;
|
|
|
|
|
textColor.a = 1f - (elapsedTime / fadeOutDuration); // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>alphaֵ
|
|
|
|
|
TipText.color = textColor;
|
|
|
|
|
TipBg.color = textColor;
|
|
|
|
|
yield return null; // <20>ȴ<EFBFBD><C8B4><EFBFBD>һ֡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isFading = false; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>뵭<EFBFBD><EBB5AD><EFBFBD><EFBFBD>־
|
|
|
|
|
isFadeEnd = true;//<2F><><EFBFBD><EFBFBD>Я<EFBFBD>̽<EFBFBD><CCBD><EFBFBD><EFBFBD>ı<EFBFBD>־
|
|
|
|
|
TipPanel.SetActive(false);
|
|
|
|
|
}
|
2024-12-18 23:13:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20>ر<F2BFAAB9>ְҵѡ<D2B5><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void OpenOccupation()
|
|
|
|
|
{
|
|
|
|
|
bool isActive = OccupationPanel.activeSelf;
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD><EEA3AC><EFBFBD>رգ<D8B1><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
OccupationPanel.SetActive(!isActive);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡְҵ<D6B0><D2B5><EFBFBD>ֲ<EFBFBD><D6B2>Ҹ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ID">ְҵ<D6B0><D2B5>ID</param>
|
|
|
|
|
/// <param name="a"><3E>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>1<EFBFBD><31>ʼ)</param>
|
|
|
|
|
public void OcpName(int ID, int index)
|
|
|
|
|
{
|
|
|
|
|
string str = JSONReader.GetOcpName(ID);
|
|
|
|
|
switch (index)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
CreateOcpText(ID.ToString(), content1);
|
|
|
|
|
Ocp1.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
CreateOcpText(ID.ToString(), content2);
|
|
|
|
|
Ocp2.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
CreateOcpText(ID.ToString(), content3);
|
|
|
|
|
Ocp3.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
CreateOcpText(ID.ToString(), content4);
|
|
|
|
|
Ocp4.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
CreateOcpText(ID.ToString(), content5);
|
|
|
|
|
Ocp5.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
CreateOcpText(ID.ToString(), content6);
|
|
|
|
|
Ocp6.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
CreateOcpText(ID.ToString(), content7);
|
|
|
|
|
Ocp7.text = str;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
CreateOcpText(ID.ToString(), content8);
|
|
|
|
|
Ocp8.text = str;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>ְҵ<D6B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>OcpName<6D><65><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ID">ְҵ<D6B0><D2B5>ID</param>
|
|
|
|
|
/// <param name="content"><3E><><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
public void CreateOcpText(string ID,GameObject content)
|
|
|
|
|
{
|
|
|
|
|
OpcName.Clear();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> SelectDictionaryctsDictionary.Count);
|
|
|
|
|
foreach (var kvp in JSONReader.ZZSelectsDictionary)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> kvp.Key <20><><EFBFBD>ֵ<EFBFBD><D6B5>ļ<EFBFBD><C4BC><EFBFBD>kvp.Value <20><> Select <20><><EFBFBD><EFBFBD>
|
|
|
|
|
Select select = kvp.Value;
|
|
|
|
|
|
|
|
|
|
// <20>ж<EFBFBD> UIDetails <20>Ƿ<EFBFBD>ƥ<EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (select.UIDetails == ID.ToString())
|
|
|
|
|
{
|
|
|
|
|
// <20><> Note <20><><EFBFBD>ӵ<EFBFBD> OpcName <20>б<EFBFBD>
|
|
|
|
|
OpcName.Add(select.Note);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>岢<EFBFBD><E5B2A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < OpcName.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
GameObject newItem = Instantiate(itemPrefab, content.transform);
|
|
|
|
|
Text left = newItem.transform.Find("Text").GetComponent<Text>();
|
|
|
|
|
left.text = OpcName[i];
|
|
|
|
|
|
|
|
|
|
createdItems.Add(newItem); // <20><><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void LeftRight(int a)
|
|
|
|
|
{
|
|
|
|
|
if(a==1)
|
|
|
|
|
{
|
|
|
|
|
OpcTip1.SetActive(true);
|
|
|
|
|
OpcTip2.SetActive(true);
|
|
|
|
|
OpcTip3.SetActive(true);
|
|
|
|
|
OpcTip4.SetActive(true);
|
|
|
|
|
OpcTip5.SetActive(false);
|
|
|
|
|
OpcTip6.SetActive(false);
|
|
|
|
|
OpcTip7.SetActive(false);
|
|
|
|
|
OpcTip8.SetActive(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OpcTip1.SetActive(false);
|
|
|
|
|
OpcTip2.SetActive(false);
|
|
|
|
|
OpcTip3.SetActive(false);
|
|
|
|
|
OpcTip4.SetActive(false);
|
|
|
|
|
OpcTip5.SetActive(true);
|
|
|
|
|
OpcTip6.SetActive(true);
|
|
|
|
|
OpcTip7.SetActive(true);
|
|
|
|
|
OpcTip8.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-17 16:28:38 +08:00
|
|
|
|
}
|