Example #1
0
        public Client(string host, int port, OnSetup setup = null)
        {
            _host   = host;
            _port   = port;
            _setup  = false;
            onSetup = setup;

            try
            {
                connection = new Connection(host, port);
                _connected = true;
            }
            catch (ConnectionException)
            {
                _connected = false;
            }
        }
Example #2
0
        public Client(string host, int port, OnSetup setup = null)
        {
            _host = host;
            _port = port;
            _setup = false;
            onSetup = setup;

            try
            {
                connection = new Connection(host, port);
                _connected = true;
            }
            catch(ConnectionException)
            {
                _connected = false;
            }
        }
Example #3
0
        internal static void SetupInternal()
        {
            if (isSetup)
            {
                return;
            }

            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();

            initialTime    = 0.0f;
            currentTime    = 0.0f;
            lastUpdateTime = 0.0f;
            currentTick    = 0;

            deviceManagers.Clear();
            deviceManagerTable.Clear();
            devices.Clear();
            Devices      = new ReadOnlyCollection <InputDevice>(devices);
            activeDevice = InputDevice.Null;

            isSetup = true;

                        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (enableXInput)
            {
                XInputDeviceManager.Enable();
            }
                        #endif

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            var addUnityInputDeviceManager = true;

                        #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR
            addUnityInputDeviceManager = false;
                        #endif

            if (addUnityInputDeviceManager)
            {
                AddDeviceManager <UnityInputDeviceManager>();
            }
        }
        /// <summary>
        /// Called when this effect is first created.
        /// </summary>
        /// <param name="myEffectCode">My effect code.</param>
        internal void Setup(string myEffectCode)
        {
            MyEffectCode     = myEffectCode;
            CachedTransform  = base.transform;
            CachedGameObject = base.gameObject;
            CachedShuriken   = base.gameObject.GetComponent <ParticleSystem>();
            if (CachedShuriken)
            {
                StartSpeed = CachedShuriken.startSpeed;
                StartSize  = CachedShuriken.startSize;
            }
            if (OnSetup.IsNotNull())
            {
                OnSetup();
            }
            GameObject.DontDestroyOnLoad(CachedGameObject);

            defaultScale = CachedTransform.localScale;
        }
Example #5
0
        private void UpdateInternal()
        {
            AssertIsSetup();
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            UpdateDeviceManagers();
            CommitDeviceManagers();

            UpdateActiveDevice();

            if (OnUpdate != null)
            {
                OnUpdate.Invoke();
            }
        }
Example #6
0
        void Update()
        {
            if (!isReady)
            {
                return;
            }

            var currentScreenSize = new Vector2(Screen.width, Screen.height);

            if (screenSize != currentScreenSize)
            {
                UpdateScreenSize(currentScreenSize);
            }

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }
        }
Example #7
0
        private bool SetupInternal()
        {
            if (IsSetup)
            {
                return(false);
            }

            deviceManagers.Clear();
            deviceManagerTable.Clear();
            activeDevice = InputDevice.Null;

            IsSetup = true;

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            return(true);
        }
Example #8
0
        internal static void UpdateInternal()
        {
            AssertIsSetup();
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            if (!enabled)
            {
                return;
            }

            if (SuspendInBackground && !applicationIsFocused)
            {
                return;
            }

            currentTick++;
            UpdateCurrentTime();
            var deltaTime = currentTime - lastUpdateTime;

            UpdateDeviceManagers(deltaTime);

            CommandWasPressed = false;
            UpdateDevices(deltaTime);
            CommitDevices(deltaTime);

            UpdateActiveDevice();

            UpdatePlayerActionSets(deltaTime);

            if (OnUpdate != null)
            {
                OnUpdate.Invoke(currentTick, deltaTime);
            }

            lastUpdateTime = currentTime;
        }
        public static void Setup()
        {
            if (isSetup)
            {
                return;
            }

            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();

            initialTime    = 0.0f;
            currentTime    = 0.0f;
            lastUpdateTime = 0.0f;
            currentTick    = 0;

            inputDeviceManagers.Clear();
            devices.Clear();
            Devices      = new ReadOnlyCollection <InputDevice>(devices);
            activeDevice = InputDevice.Null;

            isSetup = true;

                        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (enableXInput)
            {
                XInputDeviceManager.Enable();
            }
                        #endif
#if UNITY_WIIU
            WiiUDeviceManager.Enable();
#endif

            AddDeviceManager(new UnityInputDeviceManager());

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }
        }
Example #10
0
        internal static void SetupInternal()
        {
            if (_isSetup)
            {
                return;
            }

            Platform = "{0} {1}".With(SystemInfo.operatingSystem, SystemInfo.deviceModel).ToUpper();

            _initialTime    = 0.0f;
            _currentTime    = 0.0f;
            _lastUpdateTime = 0.0f;
            _currentTick    = 0;

            DeviceManagers.Clear();
            devices.Clear();
            Devices       = new ReadOnlyCollection <InputDevice>(devices);
            _activeDevice = InputDevice.Null;

            _isSetup = true;

#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            if (EnableXInput)
            {
                XInputDeviceManager.Enable();
            }
#endif

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

#if !(UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR)
            AddDeviceManager <UnityInputDeviceManager>();
#endif
        }
Example #11
0
        public static void Update()
        {
            AssertIsSetup();
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            currentTick++;

            UpdateCurrentTime();
            UpdateDeviceManagers();
            UpdateDevices();
            UpdateActiveDevice();

            if (OnUpdate != null)
            {
                OnUpdate.Invoke(currentTick, currentTime - lastUpdateTime);
            }

            lastUpdateTime = currentTime;
        }
        internal static void UpdateInternal()
        {
            AssertIsSetup();
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            currentTick++;
            UpdateCurrentTime();
            var deltaTime = currentTime - lastUpdateTime;

            UpdateDeviceManagers(deltaTime);

            PreUpdateDevices(deltaTime);
            UpdateDevices(deltaTime);
            PostUpdateDevices(deltaTime);

            UpdateActiveDevice();

            lastUpdateTime = currentTime;
        }
Example #13
0
        public static void Setup()
        {
            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();

            initialTime    = 0.0f;
            currentTime    = 0.0f;
            lastUpdateTime = 0.0f;

            currentTick = 0;

            inputDeviceManagers.Clear();
            Devices.Clear();
            activeDevice = InputDevice.Null;

            isSetup = true;

                        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (enableXInput)
            {
                if (Application.platform == RuntimePlatform.WindowsPlayer ||
                    Application.platform == RuntimePlatform.WindowsEditor)
                {
                    HideDevicesWithProfile(typeof(Xbox360WinProfile));
                    HideDevicesWithProfile(typeof(LogitechF710ModeXWinProfile));
                    InputManager.AddDeviceManager(new XInputDeviceManager());
                }
            }
                        #endif

            AddDeviceManager(new UnityInputDeviceManager());

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }
        }
Example #14
0
 public void Setup()
 {
     this.gameObject.SetActive(true);
     OnSetup?.Invoke();
 }
Example #15
0
        internal static bool SetupInternal()
        {
            if (IsSetup)
            {
                return(false);
            }

#if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
            Platform = Utility.GetWindowsVersion().ToUpper();
#else
            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();
#endif

            enabled = true;

            initialTime          = 0.0f;
            currentTime          = 0.0f;
            lastUpdateTime       = 0.0f;
            currentTick          = 0;
            applicationIsFocused = true;

            deviceManagers.Clear();
            deviceManagerTable.Clear();
            devices.Clear();
            Devices      = new ReadOnlyCollection <InputDevice>(devices);
            activeDevice = InputDevice.Null;

            playerActionSets.Clear();

            // TODO: Can this move further down along with the OnSetup callback?
            IsSetup = true;

            var enableUnityInput = true;

            var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable();
            if (nativeInputIsEnabled)
            {
                enableUnityInput = false;
            }

#if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (EnableXInput && enableUnityInput)
            {
                XInputDeviceManager.Enable();
            }
#endif

#if UNITY_IOS
            if (EnableICade)
            {
                ICadeDeviceManager.Enable();
            }
#endif

#if UNITY_XBOXONE
            if (XboxOneInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
#endif

            // TODO: Can this move further down after the UnityInputDeviceManager is added?
            // Currently, it allows use of InputManager.HideDevicesWithProfile()
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

#if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR
            enableUnityInput = false;
#endif

            if (enableUnityInput)
            {
                AddDeviceManager <UnityInputDeviceManager>();
            }

            return(true);
        }
Example #16
0
 public override void Setup(IEntity entity)
 {
     OnSetup?.Invoke(entity);
 }
Example #17
0
        internal static bool SetupInternal()
        {
            if (IsSetup)
            {
                return(false);
            }

            Platform = Utility.GetPlatformName();

            enabled = true;

            initialTime          = 0.0f;
            currentTime          = 0.0f;
            lastUpdateTime       = 0.0f;
            currentTick          = 0;
            applicationIsFocused = true;

            deviceManagers.Clear();
            deviceManagerTable.Clear();

            devices.Clear();
            Devices = devices.AsReadOnly();

            activeDevice = InputDevice.Null;
            activeDevices.Clear();
            ActiveDevices = activeDevices.AsReadOnly();

            playerActionSets.Clear();

            MouseProvider = new UnityMouseProvider();
            MouseProvider.Setup();

            KeyboardProvider = new UnityKeyboardProvider();
            KeyboardProvider.Setup();

            // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive?
            // Currently it's used to verify we're in or after setup for various functions that are
            // called during manager initialization. There should be a safer way... maybe add IsReset?
            IsSetup = true;

            var enableUnityInput = true;

            var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable();

            if (nativeInputIsEnabled)
            {
                enableUnityInput = false;
            }

                        #if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR
            if (UWPDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
                        #endif

                        #if UNITY_XBOXONE
            if (XboxOneInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
                        #endif

                        #if UNITY_GAMECORE
            if (GameCoreInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
                        #endif

                        #if UNITY_SWITCH
            if (NintendoSwitchInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
                        #endif

                        #if UNITY_STADIA
            if (StadiaInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
                        #endif

                        #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            if (EnableXInput && enableUnityInput)
            {
                XInputDeviceManager.Enable();
            }
                        #endif

                        #if UNITY_IOS || UNITY_TVOS
            if (EnableICade)
            {
                ICadeDeviceManager.Enable();
            }
                        #endif

            // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive?
            // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful?
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

                        #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR
            enableUnityInput = false;
                        #endif

            if (enableUnityInput)
            {
                                #if INCONTROL_USE_NEW_UNITY_INPUT
                AddDeviceManager <NewUnityInputDeviceManager>();
                                #else
                AddDeviceManager <UnityInputDeviceManager>();
                                #endif
            }

            return(true);
        }
Example #18
0
        internal static bool SetupInternal()
        {
            if (IsSetup)
            {
                return(false);
            }

#if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
            Platform = Utility.GetWindowsVersion().ToUpper();
#else
            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();
#endif

            enabled = true;

            initialTime          = 0.0f;
            currentTime          = 0.0f;
            lastUpdateTime       = 0.0f;
            currentTick          = 0;
            applicationIsFocused = true;

            deviceManagers.Clear();
            deviceManagerTable.Clear();

            devices.Clear();
            Devices = devices.AsReadOnly();

            activeDevice = InputDevice.Null;
            activeDevices.Clear();
            ActiveDevices = activeDevices.AsReadOnly();

            playerActionSets.Clear();

            // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive?
            // Currently it's used to verify we're in or after setup for various functions that are
            // called during manager initialization. There should be a safer way... maybe add IsReset?
            IsSetup = true;

            var enableUnityInput = true;

            var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable();
            if (nativeInputIsEnabled)
            {
                enableUnityInput = false;
            }

#if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR
            if (UWPDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
#endif

#if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (EnableXInput && enableUnityInput)
            {
                XInputDeviceManager.Enable();
            }
#endif

#if UNITY_IOS || UNITY_TVOS
            if (EnableICade)
            {
                ICadeDeviceManager.Enable();
            }
#endif

#if UNITY_XBOXONE
            if (XboxOneInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
#endif

#if UNITY_SWITCH
            if (NintendoSwitchInputDeviceManager.Enable())
            {
                enableUnityInput = false;
            }
#endif

            // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive?
            // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful?
            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

#if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR
            enableUnityInput = false;
#endif

            if (enableUnityInput)
            {
                AddDeviceManager <UnityInputDeviceManager>();
            }

            return(true);
        }
Example #19
0
        internal static bool SetupInternal()
        {
            if (IsSetup)
            {
                return(false);
            }

                        #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
            Platform = (Utility.GetWindowsVersion() + " " + SystemInfo.deviceModel).ToUpper();
                        #else
            Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper();
                        #endif

            initialTime    = 0.0f;
            currentTime    = 0.0f;
            lastUpdateTime = 0.0f;
            currentTick    = 0;

            deviceManagers.Clear();
            deviceManagerTable.Clear();
            devices.Clear();
            Devices      = new ReadOnlyCollection <InputDevice>(devices);
            activeDevice = InputDevice.Null;

            playerActionSets.Clear();

            IsSetup = true;

                        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (EnableXInput)
            {
                XInputDeviceManager.Enable();
            }
                        #endif

                        #if UNITY_IOS
            if (EnableICade)
            {
                ICadeDeviceManager.Enable();
            }
                        #endif

            if (OnSetup != null)
            {
                OnSetup.Invoke();
                OnSetup = null;
            }

            var addUnityInputDeviceManager = true;

                        #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR
            addUnityInputDeviceManager = false;
                        #endif

            if (addUnityInputDeviceManager)
            {
                AddDeviceManager <UnityInputDeviceManager>();
            }

            return(true);
        }