This commit is contained in:
2025-12-02 18:48:32 +08:00
parent 92ba80b399
commit bf1ca60b3b
2357 changed files with 262694 additions and 7 deletions

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
using UnityEngine.UI;
namespace Mirror.Examples.AutoLANClientController
{
[AddComponentMenu("")]
public class NetworkSceneScript : NetworkBehaviour
{
public Button clientButton;
public Text textResult;
public GameObject panelClient, panelServer;
void Start()
{
clientButton.onClick.AddListener(ClientButton);
panelServer.SetActive(false);
panelClient.SetActive(false);
if (isServer)
{
panelServer.SetActive(true);
}
if (isClient)
{
panelClient.SetActive(true);
}
}
void ClientButton()
{
if (isClient)
{
CmdSendText("Text: " + Random.Range(0, 999));
}
}
[Command(requiresAuthority = false)]
public void CmdSendText(string _value)
{
textResult.text = _value;
}
}
}