protected void Awake() { //GlobalConfig config = new GlobalConfig(); //config.MaxPacketSize = 20000; //plugin initialization networkManager = Utils.Library.initPlugin(networkManager, gameObject); connector = Utils.Library.initPlugin(connector, gameObject); if (inputAxes == null) { inputAxes = (InputAxes)Resources.Load("InputAxes"); } if (architectureToCompile == CompilationArchitecture.UseCustomConnector) { uMMO.get.connector.showGUI = true; } else { uMMO.get.connector.connectAutomatically = true; } if (uMMO.get.connector.connectAutomatically) { StartCoroutine(uMMO.get.connector.connectDelayed()); } }
public float getAxis(InputAxes axis) { float result; // default float value of 0.0f is desired if key is missing axisValues.TryGetValue(axis, out result); return(result); }
public void Axis(InputAxes axis, float amt) { InputEvent ie; if (axisEvents.TryGetValue(axis, out ie)) { ie.Trigger(amt); } }
public void addAxisKey(InputAxes axis, Keys button, bool isPositive) { HashSet <Keys> axisButtons; if (!axisKeyMap.TryGetValue(axis, out axisButtons)) { axisButtons = new HashSet <Keys>(); } if (axisButtons.Add(button)) { axisKeyMap[axis] = axisButtons; axisKeyDirections.Add(button, isPositive); } }
static void Create() { string[] InputAxes = AssetDatabase.FindAssets("t:InputAxes"); if (InputAxes.Length > 0) { m_InputAxes = (InputAxes)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(InputAxes[0]), typeof(InputAxes)); //Debug.Log (AssetDatabase.GUIDToAssetPath (InputAxes [0])); } else { AssetDatabase.CreateAsset(ScriptableObject.CreateInstance <InputAxes>(), path); EditorUtility.FocusProjectWindow(); Selection.activeObject = m_InputAxes; } }
public static void ReadAxes() { var inputManager = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]; SerializedObject obj = new SerializedObject(inputManager); SerializedProperty axisArray = obj.FindProperty("m_Axes"); if (axisArray.arraySize == 0) { Debug.Log("No Axes"); } InputAxes inputAxes = (InputAxes)Resources.Load("InputAxes"); inputAxes.mouseMovementAxes.Clear(); inputAxes.keyOrMouseButtonAxes.Clear(); inputAxes.joystickAxes.Clear(); for (int i = 0; i < axisArray.arraySize; ++i) { var axis = axisArray.GetArrayElementAtIndex(i); string name = axis.FindPropertyRelative("m_Name").stringValue; int axisValue = axis.FindPropertyRelative("axis").intValue; InputType inputType = (InputType)axis.FindPropertyRelative("type").intValue; if (inputType == InputType.MouseMovement) { inputAxes.mouseMovementAxes.Add(name); } else if (inputType == InputType.KeyOrMouseButton) { inputAxes.keyOrMouseButtonAxes.Add(name); } else if (inputType == InputType.JoystickAxis) { inputAxes.joystickAxes.Add(name); } } }
private void OnEnable() { objectType = this.serializedObject.FindProperty("objectType"); inputCollectionMethod = this.serializedObject.FindProperty("inputCollectionMethod"); inputSendingMethod = this.serializedObject.FindProperty("inputSendingMethod"); inputReadingMethod = this.serializedObject.FindProperty("inputReadingMethod"); clearInputStates = this.serializedObject.FindProperty("clearInputStates"); handelScriptsBasedOnSpawnCase = this.serializedObject.FindProperty("handelScriptsBasedOnSpawnCase"); clientLocalPlayerScripts = this.serializedObject.FindProperty("clientLocalPlayerScripts"); clientRemotePlayerScripts = this.serializedObject.FindProperty("clientRemotePlayerScripts"); serverPlayerScripts = this.serializedObject.FindProperty("serverPlayerScripts"); serverNPOScripts = this.serializedObject.FindProperty("serverNPOScripts"); clientNPOScripts = this.serializedObject.FindProperty("clientNPOScripts"); handelScriptsBasedOnSpawnCaseAtRuntime = this.serializedObject.FindProperty("handelScriptsBasedOnSpawnCaseAtRuntime"); clientLocalPlayerRuntimeScripts = this.serializedObject.FindProperty("clientLocalPlayerRuntimeScripts"); clientRemotePlayerRuntimeScripts = this.serializedObject.FindProperty("clientRemotePlayerRuntimeScripts"); serverPlayerRuntimeScripts = this.serializedObject.FindProperty("serverPlayerRuntimeScripts"); serverNPORuntimeScripts = this.serializedObject.FindProperty("serverNPORuntimeScripts"); clientNPORuntimeScripts = this.serializedObject.FindProperty("clientNPORuntimeScripts"); dropdown_options = InputAxes.mergedValues(); inputFromAxesToSendToServer = this.serializedObject.FindProperty("inputFromAxesToSendToServer"); inputFromKeysToSendToServer = this.serializedObject.FindProperty("inputFromKeysToSendToServer"); inputFromMouseButtonsToSendToServer = this.serializedObject.FindProperty("inputFromMouseButtonsToSendToServer"); checkbox_options = Net.NetObject.callbackValues(); callbackOptions = this.serializedObject.FindProperty("activeCallbacks"); mecanimVarsToSync = this.serializedObject.FindProperty("mecanimVarsToSync"); messengerPlugins = this.serializedObject.FindProperty("messengerPlugins"); transformSyncingMethod = this.serializedObject.FindProperty("transformSyncingMethod"); animationSyncingMethod = this.serializedObject.FindProperty("animationSyncingMethod"); pluginShouldSyncPosition = this.serializedObject.FindProperty("pluginShouldSyncPosition"); pluginShouldSyncRotation = this.serializedObject.FindProperty("pluginShouldSyncRotation"); pluginShouldSyncAnimations = this.serializedObject.FindProperty("pluginShouldSyncAnimations"); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { object[] axesPackage = InputAxes.GetAxes(); List <string> AxisLabelList = (List <string>)axesPackage[0]; //find choice Index var choiceIndex = AxisLabelList.IndexOf(property.stringValue); if (inputAxisDropdownAttribute.hideLabel) { choiceIndex = EditorGUI.Popup(position, choiceIndex, AxisLabelList.ToArray()); } else { choiceIndex = EditorGUI.Popup(position, label.text, choiceIndex, AxisLabelList.ToArray()); } if (choiceIndex == -1) { choiceIndex = 0; } property.stringValue = AxisLabelList[choiceIndex]; }
public void RegisterEvent(InputContexts context, InputAxes axis, Action <float> callback) { currentContext.RegisterAxis(axis, callback); }
public void EnableEvent(InputContexts context, InputAxes axis) { GetByContext(context).EnableAxis(axis); }
public void EnableAxis(InputAxes axis) { axisEvents.First(a => a.Key == axis).Value.Enable(); }
public void RegisterAxis(InputAxes axis, Action <float> callback) { axisEvents.Add(axis, new InputEvent(callback)); }
public static string[] mergedValues() { InputAxes inputAxes = (InputAxes)Resources.Load("InputAxes"); return(inputAxes.mouseMovementAxes.Concat(inputAxes.keyOrMouseButtonAxes.Concat(inputAxes.joystickAxes)).ToArray()); }