using AX.MessageSystem; using AX.NetworkSystem; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class EditorRight : MonoBehaviour { private Toggle toggle; // Use this for initialization void Start () { toggle = GetComponent(); toggle.onValueChanged.AddListener(SetEditorRight); } private void SetEditorRight(bool isOn) { DisasterManager.editorRight = isOn; MessageDispatcher.SendMessage("PlayStatusChanged"); NetworkManager.Default.SendAsync("DISASTER_EDITOR_RIGHT_SYNC", new EditorRightStruct { controlRight= isOn , disasterID= DisasterManager.disaster.Id });//单机版注释 GetComponent().SetInteractable(isOn); } // Update is called once per frame void Update () { } } public struct EditorRightStruct { public bool controlRight; public int disasterID; }