static VisualElement GenerateCameraControlSection() { var cameraControlSection = EditorUIGenerator.GenerateSection(); cameraControlSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h1, "視点操作オプション")); var sensitivitySlider = EditorUIGenerator.GenerateSlider(LabelType.h2, "感度"); sensitivitySlider.lowValue = 0f; sensitivitySlider.highValue = 1f; sensitivitySlider.value = CameraControlSettings.Sensitivity; sensitivitySlider.RegisterValueChangedCallback(ev => CameraControlSettings.Sensitivity = ev.newValue); cameraControlSection.Add(sensitivitySlider); var invertVerticalToggle = EditorUIGenerator.GenerateToggle(LabelType.h2, "上下反転"); invertVerticalToggle.value = CameraControlSettings.InvertVertical; invertVerticalToggle.RegisterValueChangedCallback(ev => CameraControlSettings.InvertVertical = ev.newValue); cameraControlSection.Add(invertVerticalToggle); var invertHorizontalToggle = EditorUIGenerator.GenerateToggle(LabelType.h2, "左右反転"); invertHorizontalToggle.value = CameraControlSettings.InvertHorizontal; invertHorizontalToggle.RegisterValueChangedCallback(ev => CameraControlSettings.InvertHorizontal = ev.newValue); cameraControlSection.Add(invertHorizontalToggle); return(cameraControlSection); }
static VisualElement GenerateMainScreenSection() { var mainScreenSection = EditorUIGenerator.GenerateSection(); mainScreenSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h1, "メインスクリーン")); var sampleImageSendButton = new Button(ShowMainScreenPicture) { text = "サンプル画像を投影" }; mainScreenSection.Add(sampleImageSendButton); return(mainScreenSection); }
static VisualElement GenerateUserDataSection() { var userDataSection = EditorUIGenerator.GenerateSection(); userDataSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h1, "プレイヤー情報")); userDataSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h2, "権限")); var currentPermission = EditorUIGenerator.GenerateLabel(LabelType.h2, "現在の権限:参加者"); var permissionChangeButton = new Button(() => { if (!Bootstrap.IsInPlayMode) { Debug.LogWarning(messageWhenNotPlayMode); return; } if (Bootstrap.PlayerPresenter.PermissionType == PermissionType.Audience) { Bootstrap.PlayerPresenter.ChangePermissionType(PermissionType.Performer); currentPermission.text = "現在の権限:パフォーマー"; } else { Bootstrap.PlayerPresenter.ChangePermissionType(PermissionType.Audience); currentPermission.text = "現在の権限:参加者"; } }) { text = "権限変更" }; userDataSection.Add(currentPermission); userDataSection.Add(permissionChangeButton); userDataSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h2, "リスポーン")); var respawnButton = new Button(() => { Bootstrap.PlayerPresenter.Respawn(); }) { text = "リスポーンする" }; userDataSection.Add(respawnButton); return(userDataSection); }
static VisualElement GenerateCommentSection() { var commentSection = EditorUIGenerator.GenerateSection(); commentSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h1, "コメント")); commentSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h2, "表示名")); var displayNameField = new TextField(); commentSection.Add(displayNameField); commentSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h2, "ユーザー名")); var userNameField = new TextField(); commentSection.Add(userNameField); commentSection.Add(EditorUIGenerator.GenerateLabel(LabelType.h2, "コメント内容")); var commentContentField = new TextField(); commentContentField.style.unityTextAlign = TextAnchor.UpperLeft; commentContentField.multiline = true; commentContentField.style.height = 50; foreach (var child in commentContentField.Children()) { child.style.unityTextAlign = TextAnchor.UpperLeft; } commentSection.Add(commentContentField); var commentSendButton = new Button(() => { SendComment(displayNameField.value, userNameField.value, commentContentField.value); displayNameField.value = ""; userNameField.value = ""; commentContentField.value = ""; }) { text = "コメントを送信" }; commentSection.Add(commentSendButton); return(commentSection); }