void UpdateUI(string compassText) { if (CameraRigController.readOnlyInstancesList == null || CameraRigController.readOnlyInstancesList.Count == 0 || CameraRigController.readOnlyInstancesList[0].viewer == null || CameraRigController.readOnlyInstancesList[0].viewer.masterController == null || CameraRigController.readOnlyInstancesList[0].viewer.masterController.master == null) { return; } this.body = CameraRigController.readOnlyInstancesList[0].viewer.masterController.master.GetBody(); if (this.ui == null && this.body) { this.ui = this.body.gameObject.AddComponent <CompassUI>(); this.ui.transform.SetParent(this.body.transform); } if (this.ui) { this.ui.SetPosition(new Vector3((float)(Screen.width * x.Value / 100f), (float)(Screen.height * y.Value) / 100f, 0.0f)); this.ui.compassUI.fontSize = fontSize.Value; this.ui.compassUI.SetText(compassText); this.ui.compassUI.alignment = TextAlignmentOptions.Center; } }
public CompassPlugin() : base() { this.ui = new CompassUI(); }