using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using BestHTTP.SocketIO3;
//using BestHTTP.SocketIO3.Events;
​
public class CommsManager : MonoBehaviour
{
​
 class ButtonAction
 {
 public string actionType;
 public string actionValue;
 }
​
 public static CommsManager Instance;
​
 SocketManager socketManager;
​
 public TMP\_Text PositionLabel;
 public InputField NameInput;
 public GameObject QueuePanelObj;
 public Button EnterButton;
 public TMP\_Text EnterText;
 public Image LogoImage;
​
​
 public List toggleButtons;
 public TMP\_Text ShoeLabel;
​
 string usersName;
​
 private void Awake()
 {
 if (Instance == null)
 Instance = this;
 }
​
 // Start is called before the first frame update
 void Start()
 {
​
 //RotateSlider.onValueChanged.AddListener(OnRotateSlider);
​
​
 socketManager = new SocketManager(new Uri("https://nike-billboard-server-demo-live.glitch.me/socket.io/"));
 //socketManager.Socket.On("connect", () => Debug.Log(socketManager.Handshake.Sid));
 socketManager.Socket.On("connect", OnConnect);
 socketManager.Socket.On("user disconnected", OnUserDisconnected);
 //socketManager.Socket.On(SocketIOEventTypes.Connect, OnConnected);
 //socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}"));
 socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}"));
 socketManager.Socket.On("queue position", OnQueuePosition);
​
 EnterButton.onClick.AddListener(SetUser);
​
 //RotateLeftButton.OnPointerDown += OnRotateLeft;
 }
​
 public void SetColor (string val, string shoeName)
 {
 ButtonPressed("Color", val);
 }
​
 public void SetShoe (string val, string shoeName)
 {
 StartCoroutine(ChangingShoe(val, shoeName));
 }
​
 IEnumerator ChangingShoe (string val, string shoeName)
 {
 foreach(Toggle toggle in toggleButtons)
 {
 toggle.interactable = false;
 }
​
 ButtonPressed("Shoe", val);
​
 ShoeLabel.text = "changing";
​
 yield return new WaitForSeconds(1f);
​
 ShoeLabel.text = "changing.";
​
 yield return new WaitForSeconds(1f);
​
 ShoeLabel.text = "changing..";
​
 yield return new WaitForSeconds(1f);
​
 ShoeLabel.text = "changing...";
​
 yield return new WaitForSeconds(1f);
​
 ShoeLabel.text = "changing....";
​
 yield return new WaitForSeconds(1f);
​
 ShoeLabel.text = shoeName;
​
 foreach (Toggle toggle in toggleButtons)
 {
 toggle.interactable = true;
 }
​
​
 yield return null;
 }
​
​
 float previousRotateSent = 0f;
​
 private void OnRotateSlider(float arg0)
 {
 if (previousRotateSent == arg0) return;
​
 previousRotateSent = arg0;
​
 socketManager.Socket.Emit("action", "Rotate", arg0.ToString());
 }
​
 void OnConnect()
 {
 Debug.Log(socketManager.Handshake.Sid);
​
 ClearUser();
​
 //socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}"));
 //socketManager.Socket.On("queue position", OnQueuePosition);
 }
​
 void OnUserDisconnected ()
 {
 Debug.Log("User disconnected");
​
 socketManager.Socket.Emit("position check");
 }
​
 public void ButtonPressed (string action, string value)
 {
 Debug.Log("Button " + action + " " + value);
​
 socketManager.Socket.Emit("action", action, value);
 }
​
 public void SetUser ()
 {
 usersName = NameInput.text;
​
 Debug.Log("SetUser: " + usersName);
​
 socketManager.Socket.Emit("new user", usersName);
​
 EnterButton.gameObject.SetActive(false);
 NameInput.gameObject.SetActive(false);
 EnterText.gameObject.SetActive(false);
 LogoImage.gameObject.SetActive(false);
​
 PositionLabel.alpha = 1f; 
 }
​
 void ClearUser ()
 {
 usersName = "";
 NameInput.text = "";
 EnterButton.gameObject.SetActive(true);
 NameInput.gameObject.SetActive(true);
​
 PositionLabel.alpha = 0f;
 PositionLabel.text = "";
 }
​
​
 void OnQueuePosition (int queuePos)
 {
​
 Debug.Log("OnQueuePosition: " + queuePos);
​
 if (queuePos == 0)
 {
 QueuePanelObj.SetActive(false);
 }
 else
 {
 PositionLabel.text = String.Format("Hi {0},\nYour position is\n{1}", usersName, queuePos);
 }
 }
​
​
 //void Update()
 //{
 // if (Input.GetKeyDown(KeyCode.Space))
 // {
 // socketManager.Socket.Emit("position check");
​
 // }
 //}
}

Can you adapt this code for nextJS
System.Collections를 사용합니다;using System;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using TMPro;using BestHTTP.SocketIO3;//사용 BestHTTP.SocketIO3.Events;public class CommsManager : MonoBehaviour{  버튼 액션 클래스 { public string actionType; public 문자열 actionValue; }  공용 공용 통신 관리자 인스턴스입니다;  소켓 매니저 소켓 매니저;  public TMP\_Text PositionLabel; public InputField NameInput; public 게임 오브젝트 큐패널 오브젝트; public Button EnterButton; public TMP\_Text EnterText; public Image LogoImage;  public List toggleButtons; public TMP\_Text ShoeLabel;  문자열 사용자 이름;  private void Awake() { if (Instance == null) Instance = this; }  // Start는 첫 프레임 업데이트 전에 호출됩니다. void Start() {  //RotateSlider.onValueChanged.AddListener(OnRotateSlider);  socketManager = new SocketManager(new Uri("https://nike-billboard-server-demo-live.glitch.me/socket.io/")); //socketManager.Socket.On("connect", () => Debug.Log(socketManager.Handshake.Sid)); socketManager.Socket.On("connect", OnConnect); socketManager.Socket.On("사용자 연결 끊김", OnUserDisconnected); //socketManager.Socket.On(SocketIOEventTypes.Connect, OnConnected); //socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}")); socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}")); socketManager.Socket.On("대기열 위치", OnQueuePosition);  EnterButton.onClick.AddListener(SetUser);  //RotateLeftButton.OnPointerDown += OnRotateLeft; }  public void SetColor (문자열 val, 문자열 shoeName) { ButtonPressed("Color", val); }  public void SetShoe (문자열 val, 문자열 shoeName) { StartCoroutine(ChangingShoe(val, shoeName)); }  IEnumerator ChangingShoe (문자열 val, 문자열 shoeName) { foreach(toggleButtons에서 토글 토글) { toggle.interactable = false; }  ButtonPressed("Shoe", val);  ShoeLabel.text = "변경 중";  yield return new WaitForSeconds(1f);  ShoeLabel.text = "변경 중";  yield 반환 새로운 WaitForSeconds(1f);  ShoeLabel.text = "변경 중...";  yield 반환 새로운 WaitForSeconds(1f);  ShoeLabel.text = "변경 중...";  yield 반환 새로운 WaitForSeconds(1f);  ShoeLabel.text = "변경중....";  yield 반환 새로운 WaitForSeconds(1f);  ShoeLabel.text = 신발 이름;  foreach (toggleButtons에서 토글 토글) { toggle.interactable = true; }  반환값은 널을 반환합니다; }  float previousRotateSent = 0f;  private void OnRotateSlider(float arg0) { if (previousRotateSent == arg0) return;  이전 회전 보낸 = arg0;  socketManager.Socket.Emit("action", "Rotate", arg0.ToString()); }  void OnConnect() { Debug.Log(socketManager.Handshake.Sid);  ClearUser();  //socketManager.Socket.On("new user", (arg1, arg2) => Debug.Log($"User: {arg1} {arg2}")); //socketManager.Socket.On("대기열 위치", OnQueuePosition); }  void OnUserDisconnected () { Debug.Log("사용자 연결이 끊겼습니다");  socketManager.Socket.Emit("위치 확인"); }  공용 void ButtonPressed (문자열 액션, 문자열 값) { Debug.Log("Button " + action + " " + value);  socketManager.Socket.Emit("action", action, value); }  public void SetUser () { usersName = NameInput.text;  Debug.Log("SetUser: " + usersName);  socketManager.Socket.Emit("새 사용자", usersName);  EnterButton.게임오브젝트.SetActive(false); NameInput.게임오브젝트.SetActive(false); EnterText.게임오브젝트.SetActive(false); LogoImage.게임오브젝트.SetActive(false);  PositionLabel.alpha = 1f;  }  void ClearUser () { usersName = ""; NameInput.text = ""; EnterButton.게임오브젝트.SetActive(true); NameInput.게임오브젝트.SetActive(true);  PositionLabel.alpha = 0f; PositionLabel.text = ""; }  void OnQueuePosition (int queuePos) {  Debug.Log("OnQueuePosition: " + queuePos);  if (queuePos == 0) { QueuePanelObj.SetActive(false); } else { PositionLabel.text = String.Format("안녕하세요 {0},\n귀하의 위치는\n{1}입니다.", usersName, queuePos); } }  //void Update() //{ // if (Input.GetKeyDown(KeyCode.Space)) // { // socketManager.Socket.Emit("위치 확인");  // } //}}이 코드를 nextJS에 맞게 수정할 수 있나요?