private void OnDestroy() { m_serializer = null; if (m_gState != null) { m_gState.SetValue("LocalGameServer.m_replay", null); } if (m_players != null) { m_players.Remove(m_neutralPlayer.Id); } if (m_room != null) { m_room.Players.Remove(m_neutralPlayer.Id); } if (m_bots != null) { for (int i = 0; i < m_bots.Length; ++i) { IBotController bot = m_bots[i]; if (bot != null) { MatchFactory.DestroyBotController(bot); } } } if (m_engine != null) { MatchFactory.DestroyMatchEngine(m_engine); } }
public void ActivateAll() { if (m_devices == null) { m_devices = new List <InputDevice>(); m_gState.SetValue(DevicesPersistentKey, m_devices); } m_devices.Clear(); for (int i = 0; i < InputManager.Devices.Count; ++i) { InputDevice device = InputManager.Devices[i]; device.IsSuspended = false; m_devices.Add(device); if (DeviceEnabled != null) { DeviceEnabled(m_devices.Count - 1); } } }
private void Start() { m_gState = Dependencies.State; m_progress = Dependencies.Progress; m_eventSystemManager = Dependencies.EventSystemManager; for (int i = 0; i < m_eventSystemManager.EventSystemCount; ++i) { IndependentEventSystem eventSystem = m_eventSystemManager.GetEventSystem(i); eventSystem.EventSystemUpdate += OnEventSystemUpdate; } if (m_eventSystemManager.CommonEventSystem != null) { m_eventSystemManager.CommonEventSystem.EventSystemUpdate += OnCommonEventSystemUpdate; } m_isPointerOverGameObject = new bool[m_eventSystemManager.EventSystemCount]; m_isInputFieldSelected = new bool[m_eventSystemManager.EventSystemCount]; m_selectedGameObject = new GameObject[m_eventSystemManager.EventSystemCount]; InputManager.OnDeviceAttached += OnDeviceAttached; InputManager.OnDeviceDetached += OnDeviceDetached; InputManager.OnActiveDeviceChanged += OnActiveDeviceChanged; if (!m_gState.HasKey(DevicesPersistentKey)) { m_devices = new List <InputDevice>(InputManager.Devices.Count); m_gState.SetValue(DevicesPersistentKey, m_devices); } else { m_devices = m_gState.GetValue <List <InputDevice> >(DevicesPersistentKey); for (int i = 0; i < m_devices.Count; ++i) { UnityInputDevice device = m_devices[i] as UnityInputDevice; if (device == null) { if (m_devices[i] != null) { m_devices[i].IsSuspended = true; } m_devices[i] = null; } else { InputDevice replacementDevice = InputManager.Devices.OfType <UnityInputDevice>().Where(dev => dev.JoystickId == device.JoystickId).FirstOrDefault(); if (replacementDevice != null) { replacementDevice.IsSuspended = false; m_devices[i] = replacementDevice; } else { if (m_devices[i] != null) { m_devices[i].IsSuspended = true; } m_devices[i] = null; } } } } LogDevices(); }