From 2c1411a48874e4033a538a9725f09c8465536fa8 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 28 八月 2023 19:03:51 +0800
Subject: [PATCH] 2023年08月28日19:03:29

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 100 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 681f9a9..54bcda7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -29,10 +29,10 @@
 
         public SceneFunctionInfoEditPage(Scene s, SceneFunction fc, Action action)
         {
-
+            
             bodyView = this;
             scene = s;
-            sceneFunction = fc.localFunction.ConvertSceneFunction();
+            sceneFunction = fc.localFunction.ConvertSceneFunction(); 
             foreach (var ll in sceneFunction.status)
             {
                 try
@@ -126,6 +126,12 @@
                         break;
                     case FunctionAttributeKey.Signal:
                         LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal));
+                        break;
+                    case FunctionAttributeKey.SongName:
+                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName));
+                        break;
+                    case FunctionAttributeKey.Volume:
+                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume));
                         break;
                 }
             }
@@ -537,6 +543,45 @@
                                 sceneStatus.value = p.GetValue(dic, valueStr);
                             });
                             break;
+                        case FunctionAttributeKey.Volume:
+                            BrightnessView(btnFunctionText.Text, btnFunctionName.Text, (volume, uintStr) =>
+                            {
+                                btnFunctionText.Text = volume;
+                                sceneStatus.value = volume;
+                            });
+                            break;
+                        case FunctionAttributeKey.SongName:
+                            MusicListView(btnFunctionText.Text, (playListName, song) =>
+                            {
+                                btnFunctionText.Text = song.name;
+                                sceneStatus.value = song.name;
+                                //杩藉姞鎺у埗灞炴��
+                                var oldList = new List<SceneFunctionStatus>();
+                                for (int i = 0; i < sceneFunction.status.Count; i++)
+                                {
+                                    var status = sceneFunction.status[i];
+                                    if (status.key == FunctionAttributeKey.PlaylistName)
+                                    {
+                                        //鎺у埗闇�瑕侊紙鐣岄潰涓嶉渶瑕佹樉绀猴級
+                                        sceneFunction.status.RemoveAt(i);
+                                        sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.PlaylistName, value = playListName });
+                                    }
+                                    else if (status.key == FunctionAttributeKey.Url)
+                                    {
+                                        //瀛樺湪url灏变竴璧峰彂閫佽繃鍘�
+                                        if (!string.IsNullOrEmpty(song.url))
+                                        {
+                                            //鎺у埗闇�瑕侊紙鐣岄潰涓嶉渶瑕佹樉绀猴級
+                                            sceneFunction.status.RemoveAt(i);
+                                            sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.Url, value = song.url });
+                                        }
+                                    }
+
+                                }
+
+                            });
+                            break;
+
                     }
                 };
 
@@ -2396,8 +2441,60 @@
             pif.SingleSelectionShow(this, list, titleName, oldStateValue, action);
         }
 
-        #endregion
+        /// <summary>
+        /// 闊充箰鍒楄〃鐣岄潰
+        /// </summary>
+        /// <param name="oldStateValue">鏃х姸鎬佸��</param>
+        ///  <param name="action">鍥炶皟</param>
+        void MusicListView(string oldStateValue, Action<string, Music.SongInfo> action)
+        {
+            Loading loading = new Loading();
+            this.AddChidren(loading);
+            loading.Start();
+            System.Threading.Tasks.Task.Run(() =>
+            {
+                try
+                {
+                    var palyList = Music.SendMethod.Current.GetSingleSongList(new Function { sid = sceneFunction.sid }, "hdl_special", "");
+                    List<string> songNameList = new List<string>();
+                    for (int i = 0; i < palyList.songs.Count; i++)
+                    {
+                        var song = palyList.songs[i];
+                        songNameList.Add(song.name);
+                    }
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        var publicInterface = new UI2.Intelligence.Automation.PublicInterface();
+                        publicInterface.FrameOrVv(this, songNameList, new List<string> { oldStateValue }, palyList.group, (index) =>
+                        {
+                            if (index > palyList.songs.Count)
+                            {
+                                index = 0;
+                            }
+                            var song = palyList.songs[index];
+                            action?.Invoke(palyList.group, song);
 
+                            //鐣岄潰鏄剧ず閫変腑鍊�
+                            //funTypeView.btnState.Text = songSelecetd.name;
+                            ////鏁版嵁灏佽
+                            //AddDictionary("playlist_name", palyList.group);//鍒楄〃鍚�
+                            //AddDictionary("song_name", songSelecetd.name);//姝屾洸鍚�
+                            //if (!string.IsNullOrEmpty(songSelecetd.url))
+                            //{
+                            //    //瀛樺湪url灏变竴璧峰彂閫佽繃鍘�
+                            //    AddDictionary("url", songSelecetd.url);
+                            //}
+
+                        }, false);
+
+                    });
+                }
+                catch { }
+
+            });
+        }
+        #endregion
     }
 }
 

--
Gitblit v1.8.0