コード例 #1
0
        /// <summary>
        /// Adds an axis entry if it doesn't already exist
        /// </summary>
        /// <param name="axis"></param>
        public static void AddEntry(InputManagerEntry rAxis, bool rIgnoreDuplicates)
        {
            if (!rIgnoreDuplicates && IsDefined(rAxis.Name))
            {
                return;
            }

            SerializedObject   lSerializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
            SerializedProperty lProperty         = lSerializedObject.FindProperty("m_Axes");

            lProperty.arraySize++;
            lSerializedObject.ApplyModifiedProperties();

            SerializedProperty axisProperty = lProperty.GetArrayElementAtIndex(lProperty.arraySize - 1);

            GetChildProperty(axisProperty, "m_Name").stringValue                  = rAxis.Name;
            GetChildProperty(axisProperty, "descriptiveName").stringValue         = rAxis.DescriptiveName;
            GetChildProperty(axisProperty, "descriptiveNegativeName").stringValue = rAxis.DescriptiveNegativeName;
            GetChildProperty(axisProperty, "negativeButton").stringValue          = rAxis.NegativeButton;
            GetChildProperty(axisProperty, "positiveButton").stringValue          = rAxis.PositiveButton;
            GetChildProperty(axisProperty, "altNegativeButton").stringValue       = rAxis.AltNegativeButton;
            GetChildProperty(axisProperty, "altPositiveButton").stringValue       = rAxis.AltPositiveButton;
            GetChildProperty(axisProperty, "gravity").floatValue                  = rAxis.Gravity;
            GetChildProperty(axisProperty, "dead").floatValue        = rAxis.Dead;
            GetChildProperty(axisProperty, "sensitivity").floatValue = rAxis.Sensitivity;
            GetChildProperty(axisProperty, "snap").boolValue         = rAxis.Snap;
            GetChildProperty(axisProperty, "invert").boolValue       = rAxis.Invert;
            GetChildProperty(axisProperty, "type").intValue          = (int)rAxis.Type;
            GetChildProperty(axisProperty, "axis").intValue          = rAxis.Axis - 1;
            GetChildProperty(axisProperty, "joyNum").intValue        = rAxis.JoyNum;

            lSerializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
        /// <summary>
        /// Adds an axis entry if it doesn't already exist
        /// </summary>
        /// <param name="axis"></param>
        public static void AddEntry(InputManagerEntry rAxis, bool rIgnoreDuplicates)
        {
            if (!rIgnoreDuplicates && IsDefined(rAxis.Name)) return;

            SerializedObject lSerializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
            SerializedProperty lProperty = lSerializedObject.FindProperty("m_Axes");

            lProperty.arraySize++;
            lSerializedObject.ApplyModifiedProperties();

            SerializedProperty axisProperty = lProperty.GetArrayElementAtIndex(lProperty.arraySize - 1);

            GetChildProperty(axisProperty, "m_Name").stringValue = rAxis.Name;
            GetChildProperty(axisProperty, "descriptiveName").stringValue = rAxis.DescriptiveName;
            GetChildProperty(axisProperty, "descriptiveNegativeName").stringValue = rAxis.DescriptiveNegativeName;
            GetChildProperty(axisProperty, "negativeButton").stringValue = rAxis.NegativeButton;
            GetChildProperty(axisProperty, "positiveButton").stringValue = rAxis.PositiveButton;
            GetChildProperty(axisProperty, "altNegativeButton").stringValue = rAxis.AltNegativeButton;
            GetChildProperty(axisProperty, "altPositiveButton").stringValue = rAxis.AltPositiveButton;
            GetChildProperty(axisProperty, "gravity").floatValue = rAxis.Gravity;
            GetChildProperty(axisProperty, "dead").floatValue = rAxis.Dead;
            GetChildProperty(axisProperty, "sensitivity").floatValue = rAxis.Sensitivity;
            GetChildProperty(axisProperty, "snap").boolValue = rAxis.Snap;
            GetChildProperty(axisProperty, "invert").boolValue = rAxis.Invert;
            GetChildProperty(axisProperty, "type").intValue = (int)rAxis.Type;
            GetChildProperty(axisProperty, "axis").intValue = rAxis.Axis - 1;
            GetChildProperty(axisProperty, "joyNum").intValue = rAxis.JoyNum;

            lSerializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
 /// <summary>
 /// Adds an axis entry if it doesn't already exist
 /// </summary>
 /// <param name="axis"></param>
 public static void AddEntry(InputManagerEntry rAxis)
 {
     AddEntry(rAxis, false);
 }
コード例 #4
0
 /// <summary>
 /// Adds an axis entry if it doesn't already exist
 /// </summary>
 /// <param name="axis"></param>
 public static void AddEntry(InputManagerEntry rAxis)
 {
     AddEntry(rAxis, false);
 }