Ejemplo n.º 1
0
        public void AddView(VisualElement parent)
        {
            selector = new VisualElement();
            var venueInfo = new VisualElement();

            parent.Add(selector);
            parent.Add(venueInfo);

            ReactiveBinder.Bind(reactiveCurrentVenue, venue =>
            {
                venueInfo.Clear();
                if (venue == null)
                {
                    return;
                }

                var thumbnailView = new DrawThumbnailView();
                venueInfo.Add(new IMGUIContainer(() =>
                {
                    EditorGUILayout.LabelField("説明");
                    EditorGUILayout.HelpBox(venue.Description, MessageType.None);

                    if (venue.ThumbnailUrls.Any())
                    {
                        thumbnailView.OverwriteDownloadUrl(venue.ThumbnailUrls.First(x => x != null));
                    }
                    thumbnailView.DrawUI(false);
                }));
            });

            RefreshVenueSelector();
        }
Ejemplo n.º 2
0
        public void DrawUI(EditorWindow parent)
        {
            if (dataStore.SelectVenue == null)
            {
                return;
            }

            EditorGUILayout.Space();

            var selectVenue = dataStore.SelectVenue;
            var editVenue   = dataStore.EditVenue ?? (dataStore.EditVenue = new EditVenue());

            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField("名前");
                editVenue.Name = EditorGUILayout.TextField(editVenue.Name ?? selectVenue.Name);
            }

            EditorGUILayout.LabelField("説明");
            var textAreaOption = new[] { GUILayout.MinHeight(64) };

            editVenue.Description = EditorGUILayout.TextArea(editVenue.Description ?? selectVenue.Description, textAreaOption);

            if (string.IsNullOrEmpty(editVenue.ThumbnailPath) && selectVenue.ThumbnailUrls.Any())
            {
                drawThumbnailView.OverwriteDownloadUrl(selectVenue.ThumbnailUrls.First(x => x != null));
            }

            drawThumbnailView.DrawUI(savingVenueThumbnail);

            if (GUILayout.Button("サムネイル画像を選択..."))
            {
                editVenue.ThumbnailPath =
                    EditorUtility.OpenFilePanelWithFilters(
                        "画像を選択",
                        "",
                        new[] { "Image files", "png,jpg,jpeg", "All files", "*" }
                        );
                drawThumbnailView.OverwriteFilePath(editVenue.ThumbnailPath);
            }

            EditorGUILayout.Space();


            if (!savingVenueThumbnail)
            {
                executeSaveVenue = GUILayout.Button("保存");
            }

            if (!string.IsNullOrEmpty(errorMessage))
            {
                EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
            }
        }
Ejemplo n.º 3
0
        public void DrawUI(EditorWindow parent)
        {
            if (dataStore.Groups != null && dataStore.Groups.List.Count == 0)
            {
                EditorGUILayout.HelpBox("clusterにてチーム登録をお願いいたします", MessageType.Warning);
                return;
            }

            Venues venues = null;

            if (dataStore.VenueMap != null && dataStore.SelectGroup != null)
            {
                dataStore.VenueMap.TryGetValue(dataStore.SelectGroup.Id, out venues);
            }

            if (dataStore.Groups != null && dataStore.SelectGroup != null && venues != null)
            {
                var teamOptions  = dataStore.Groups.List.Select(x => x.Name).ToArray();
                var currentIndex = EditorGUILayout.Popup("所属チーム", teamIdIndex, teamOptions);

                if (currentIndex != teamIdIndex)
                {
                    teamIdIndex = currentIndex;

                    dataStore.SelectGroup = dataStore.Groups.List[teamIdIndex];
                    dataStore.SelectVenue = null;
                    dataStore.EditVenue   = null;
                    venueIdIndex          = 0;
                    return;
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    var venueOptions      = venues.List.Select(x => x.Name).ToArray();
                    var currentVenueIndex = EditorGUILayout.Popup("会場一覧", venueIdIndex, venueOptions);

                    if (currentVenueIndex != venueIdIndex)
                    {
                        dataStore.SelectVenue = null;
                        dataStore.EditVenue   = null;
                    }

                    if (venues.List.Any())
                    {
                        venueIdIndex          = currentVenueIndex;
                        dataStore.SelectVenue = venues.List[venueIdIndex];
                    }

                    using (new EditorGUI.DisabledScope(venues.List.Exists(x => x.Name == "NewVenue")))
                    {
                        executeNewVenue = GUILayout.Button("新規会場追加");
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("会場情報を取得しています...", MessageType.None);
            }

            if (errorMessageRegisterVenue != null)
            {
                EditorGUILayout.HelpBox(errorMessageRegisterVenue, MessageType.Error);
            }

            if (dataStore.SelectVenue != null)
            {
                var selectVenue = dataStore.SelectVenue;

                EditorGUILayout.LabelField("説明");
                EditorGUILayout.HelpBox(selectVenue?.Description, MessageType.None);

                if (selectVenue.ThumbnailUrls.Any())
                {
                    drawThumbnailView.OverwriteDownloadUrl(selectVenue.ThumbnailUrls.First(x => x != null));
                }

                drawThumbnailView.DrawUI(false);
            }
        }