Esempio n. 1
0
        /// <summary>
        /// Initialize all the input controller .
        /// </summary>
        public virtual void InitAllControllerInputs()
        {
            //
            int ret = XDevicePlugin.Init();

            if (ret != 0)
            {
                /*...*/
            }
            //
            if (m_ControllerDataTxt != null)
            {
                s_ControllerDatabase = ControllerInfo.ParseFromText(
                    s_ControllerDatabase, m_ControllerDataTxt.text);
            }
            //
#if XDEVICE_EXT
            InitExternalControllerDevices();
#endif
            //
            int    whichBufferSize = XDevicePlugin.GetInputDeviceCount();
            int[]  whichBuffer     = new int[whichBufferSize];
            string name;
            int    handle, i = 0, imax = XDevicePlugin.GetInputDevices(1, whichBuffer, whichBufferSize);
            //
            if (controllerInputs == null)
            {
                controllerInputs = new Dictionary <string, ControllerInput>(imax);
            }
            else
            {
                controllerInputs.Clear();
            }
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendLine("ControllerInput List:");
            for (; i < imax; ++i)
            {
                handle = whichBuffer[i];
                name   = XDevicePlugin.GetInputDeviceName(handle);
                AddControllerInput(name, new ControllerInput(handle, name));
                //
                sb.AppendLine("\t{ControllerInput name=\"" + name + "\" handle=\"" + handle + "\"}");
            }
            Log.i("ControllerInputManager", sb.ToString());
            //
            m_OnInitialized.Invoke();
        }