コード例 #1
0
 private bool ContainsController(Rewired.Player p)
 {
     foreach (var controller in activeControllers)
     {
         if (controller.ControllerNumber == p.id) return true;
     }
     return false;
 }
コード例 #2
0
 private void AddController(Rewired.Player p)
 {
     print("add player");
     MultiplayerUIController controller = Instantiate(controllerPrefab);
     controller.ControllerNumber = p.id;
     controller.ChangeSelected(firstSelected);
     activeControllers.Add(controller);
 }
コード例 #3
0
 private void RemoveController(Rewired.Player p)
 {
     for (int i = 0; i < activeControllers.Count; i++)
     {
         if (activeControllers[i].ControllerNumber == p.id)
         {
             Destroy(activeControllers[i].gameObject);
             activeControllers.RemoveAt(i);
         }
     }
 }
コード例 #4
0
ファイル: InputMapping.cs プロジェクト: GameDiffs/TheForest
 private void ClearJoystickCalibrationMapXml(Rewired.Joystick joystick)
 {
     string text = "UserRemapping_v3";
     text += "&dataType=CalibrationMap";
     text = text + "&controllerType=" + joystick.type.ToString();
     text = text + "&hardwareIdentifier=" + joystick.hardwareIdentifier;
     text = text + "&hardwareGuid=" + joystick.hardwareTypeGuid.ToString();
     if (PlayerPrefs.HasKey(text))
     {
         PlayerPrefs.DeleteKey(text);
     }
 }
コード例 #5
0
ファイル: InputMapping.cs プロジェクト: GameDiffs/TheForest
 private string GetJoystickCalibrationMapXml(Rewired.Joystick joystick)
 {
     string text = "UserRemapping_v3";
     text += "&dataType=CalibrationMap";
     text = text + "&controllerType=" + joystick.type.ToString();
     text = text + "&hardwareIdentifier=" + joystick.hardwareIdentifier;
     text = text + "&hardwareGuid=" + joystick.hardwareTypeGuid.ToString();
     if (!PlayerPrefs.HasKey(text))
     {
         return string.Empty;
     }
     return PlayerPrefs.GetString(text);
 }
コード例 #6
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 private void CreateText(GameObject prefab, ref Text textComponent, string name, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset)
 {
     if (prefab == null || this.content == null)
     {
         return;
     }
     if (textComponent != null)
     {
         UnityEngine.Debug.LogError("Window already has " + name + "!");
         return;
     }
     GameObject gameObject = UITools.InstantiateGUIObject<Text>(prefab, this.content.transform, name, pivot, anchor.min, anchor.max, offset);
     if (gameObject == null)
     {
         return;
     }
     textComponent = gameObject.GetComponent<Text>();
 }
コード例 #7
0
 public Calibration(Player player, Rewired.Joystick joystick, CalibrationMap calibrationMap)
     : base(ControlRemappingDemo1.QueueActionType.Calibrate)
 {
     this.player = player;
     this.joystick = joystick;
     this.calibrationMap = calibrationMap;
     this.selectedElementIdentifierId = -1;
 }
コード例 #8
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 private GameObject CreateButton(GameObject prefab, string name, Rewired.UI.UIAnchor anchor, UIPivot pivot, Vector2 offset, out ButtonInfo buttonInfo)
 {
     buttonInfo = null;
     if (prefab == null)
     {
         return null;
     }
     GameObject gameObject = UITools.InstantiateGUIObject<ButtonInfo>(prefab, this.content.transform, name, pivot, anchor.min, anchor.max, offset);
     if (gameObject == null)
     {
         return null;
     }
     buttonInfo = gameObject.GetComponent<ButtonInfo>();
     UnityEngine.UI.Button component = gameObject.GetComponent<UnityEngine.UI.Button>();
     if (component == null)
     {
         UnityEngine.Debug.Log("Button prefab is missing Button component!");
         return null;
     }
     if (buttonInfo == null)
     {
         UnityEngine.Debug.Log("Button prefab is missing ButtonInfo component!");
         return null;
     }
     return gameObject;
 }
コード例 #9
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 private void CreateImage(GameObject prefab, string name, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset)
 {
     if (prefab == null || this.content == null)
     {
         return;
     }
     UITools.InstantiateGUIObject<Image>(prefab, this.content.transform, name, pivot, anchor.min, anchor.max, offset);
 }
コード例 #10
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 public void AddContentText(GameObject prefab, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset, string text)
 {
     this.AddContentText(prefab, pivot, anchor, offset);
     this.SetContentText(text, this._contentText.Count - 1);
 }
コード例 #11
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 public void CreateButton(GameObject prefab, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset, string buttonText, UnityAction confirmCallback, UnityAction cancelCallback, bool setDefault)
 {
     if (prefab == null)
     {
         return;
     }
     ButtonInfo buttonInfo;
     GameObject gameObject = this.CreateButton(prefab, "Button", anchor, pivot, offset, out buttonInfo);
     if (gameObject == null)
     {
         return;
     }
     UnityEngine.UI.Button component = gameObject.GetComponent<UnityEngine.UI.Button>();
     if (confirmCallback != null)
     {
         component.onClick.AddListener(confirmCallback);
     }
     CustomButton customButton = component as CustomButton;
     if (cancelCallback != null && customButton != null)
     {
         customButton.CancelEvent += cancelCallback;
     }
     if (buttonInfo.text != null)
     {
         buttonInfo.text.text = buttonText;
     }
     if (setDefault)
     {
         this._defaultUIElement = gameObject;
     }
 }
コード例 #12
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 public void AddContentText(GameObject prefab, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset)
 {
     Text item = null;
     this.CreateText(prefab, ref item, "Content Text", pivot, anchor, offset);
     this._contentText.Add(item);
 }
コード例 #13
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 public void AddContentImage(GameObject prefab, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset, string text)
 {
     this.AddContentImage(prefab, pivot, anchor, offset);
 }
コード例 #14
0
ファイル: Window.cs プロジェクト: GameDiffs/TheForest
 public void AddContentImage(GameObject prefab, UIPivot pivot, Rewired.UI.UIAnchor anchor, Vector2 offset)
 {
     this.CreateImage(prefab, "Image", pivot, anchor, offset);
 }
コード例 #15
0
 private void SaveJoystickCalibrationData(Rewired.Joystick joystick)
 {
     if (joystick == null)
     {
         return;
     }
     JoystickCalibrationMapSaveData calibrationMapSaveData = joystick.GetCalibrationMapSaveData();
     string joystickCalibrationMapPlayerPrefsKey = this.GetJoystickCalibrationMapPlayerPrefsKey(calibrationMapSaveData);
     PlayerPrefs.SetString(joystickCalibrationMapPlayerPrefsKey, calibrationMapSaveData.map.ToXmlString());
 }
コード例 #16
0
 private void LoadJoystickCalibrationData(Rewired.Joystick joystick)
 {
     if (joystick == null)
     {
         return;
     }
     joystick.ImportCalibrationMapFromXmlString(this.GetJoystickCalibrationMapXml(joystick));
 }