From c26c06ef4a22d6fb9e59dc734abca92fa8a23c47 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 05 六月 2020 17:41:00 +0800
Subject: [PATCH] 2020-06-05-02
---
HDL_ON/UI/Music/View/DialogView.cs | 320 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 295 insertions(+), 25 deletions(-)
diff --git a/HDL_ON/UI/Music/View/DialogView.cs b/HDL_ON/UI/Music/View/DialogView.cs
index e4654dd..ebc8951 100644
--- a/HDL_ON/UI/Music/View/DialogView.cs
+++ b/HDL_ON/UI/Music/View/DialogView.cs
@@ -342,10 +342,9 @@
TextColor = Color.TextColor,
TextSize = TextSize.Text14,
TextAlignment = TextAlignment.CenterLeft,
- Text = player.Name,
+ Text = NamePlayer(player),
};
PlayRow.AddChidren(PlayNameBtn);
-
//閫変腑鍥炬爣鎺т欢
Button selectedIconBtn = new Button
@@ -404,6 +403,20 @@
if (playList1.Count <= 1)
{
new PublicAssmebly().TipMsgAutoClose("鑷冲皯閫変腑涓や釜浠ヤ笂鎾斁鍣�", false);
+ return;
+ }
+ int number = 0;
+ foreach (var musin in playList1)
+ {
+ if (musin.ServerClientType == 1)
+ {
+ number++;
+ }
+ }
+ if (number >= 2)
+ {
+ new PublicAssmebly().TipMsgAutoClose("涓嶈兘閫変腑涓や釜鎴栦袱涓互涓婁富鎾斁鍣ㄨ繘琛岀粍鍚�", false);
+ //濡傛灉閮芥槸涓绘挱鏀炬垜灏变笉鑳界粍鍚�;
return;
}
///鏌ヨ鏄惁宸茬粡瀛樺湪涓绘挱鏀�;
@@ -548,19 +561,66 @@
};
verticalScrolViewLayout.AddChidren(addFlieRow);
- //鎾斁鍣ㄥ悕绉版帶浠�
- Button PlayNameBtn = new Button
+ if (player.A31PlayStatus.status == "play")
{
- X = Application.GetRealWidth(20),
- Y = Application.GetRealHeight(15),
- Width = Application.GetRealWidth(150),
- Height = Application.GetRealHeight(20),
- TextColor = Color.TextColor,
- TextSize = TextSize.Text14,
- TextAlignment = TextAlignment.CenterLeft,
- Text = player.Name,
- };
- addFlieRow.AddChidren(PlayNameBtn);
+ Button songNameBtn = new Button
+ {
+ X = Application.GetRealWidth(20),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(150),
+ Height = Application.GetRealHeight(20),
+ TextColor = Color.TextColor,
+ TextSize = TextSize.Text14,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = player.A31PlayStatus.Title,
+ };
+ addFlieRow.AddChidren(songNameBtn);
+
+ var wText = songNameBtn.GetTextWidth();//鑾峰彇鏂囨湰瀹藉害
+ if (wText > 280)
+ {
+ songNameBtn.Width = Application.GetRealWidth(280);
+ }
+ else
+ {
+ songNameBtn.Width = wText + 5;
+ }
+ //姝屾墜鎺т欢
+ Button singerBtn = new Button
+ {
+ X = songNameBtn.Right,
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(280 - songNameBtn.Width),
+ Height = Application.GetRealHeight(20),
+ TextColor = Color.MusicNoTxetColor,
+ TextSize = TextSize.Text12,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = "-" + player.A31PlayStatus.Artist.Trim(),
+ };
+ addFlieRow.AddChidren(singerBtn);
+ if (wText > 280)
+ {
+ ///姝屽悕闀垮害灏忎簬250鎵嶅彲浠ユ樉绀烘瓕鎵嬪嚭鏉�
+ singerBtn.Width = Application.GetRealWidth(0);
+ }
+ }
+ else
+ {
+ //鎾斁鍣ㄥ悕绉版帶浠�
+ Button PlayNameBtn = new Button
+ {
+ X = Application.GetRealWidth(20),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(150),
+ Height = Application.GetRealHeight(20),
+ TextColor = Color.TextColor,
+ TextSize = TextSize.Text14,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = NamePlayer(player),
+ };
+ addFlieRow.AddChidren(PlayNameBtn);
+
+ }
//閫変腑鍥炬爣鎺т欢
Button selectedIconBtn = new Button
@@ -608,7 +668,7 @@
}
dialogF.Close();
dialog.Close();
-
+
var serverMusic = selectedBtn.Tag as A31MusicModel;
MergeThreading(serverMusic, musicList1);
};
@@ -680,8 +740,8 @@
TextSize = TextSize.Text16,
TextAlignment = TextAlignment.Center,
//TextID = StringId.selectedMergence,
+ Text = "閫変腑瑙i櫎鎾斁鍣�",
IsBold = true,
- Text= a31player.Name,
};
topFra.AddChidren(txetBtn);
@@ -743,7 +803,7 @@
TextColor = Color.TextColor,
TextSize = TextSize.Text14,
TextAlignment = TextAlignment.CenterLeft,
- Text = player.Name,
+ Text = NamePlayer(player),
};
PlayRow.AddChidren(PlayNameBtn);
@@ -772,7 +832,7 @@
{
clickBtn.IsSelected = !clickBtn.IsSelected;
selectedIconBtn.IsSelected = clickBtn.IsSelected;
- var uuid = playList2.Find((obj) => obj.UniqueDeviceName== clickBtn.Tag.ToString());
+ var uuid = playList2.Find((obj) => obj.UniqueDeviceName == clickBtn.Tag.ToString());
if (selectedIconBtn.IsSelected)
{
if (uuid == null)
@@ -810,7 +870,7 @@
dialog.Close();
RemoveThreading(a31player, playList2);
};
- }
+ }
/// <summary>
/// 鍙戦�佺粍鍚堝懡浠ら�昏緫澶勭悊鐨勬柟娉�
/// </summary>
@@ -941,7 +1001,7 @@
MusicMain.loading.Start("瑙i櫎涓�...");
var slaveList = new List<Slave>();
slaveList.AddRange(a31player.Slave.slave_list);
- bool host_If = false; //琛ㄧず鏄惁鏄剧ず瑙i櫎鐨勬挱鏀�
+ // bool host_If = false; //琛ㄧず鏄惁鏄剧ず瑙i櫎鐨勬挱鏀�
bool _if = false;
System.Threading.Tasks.Task.Run(() =>
{
@@ -950,7 +1010,6 @@
var play_If = playList1.Find((obj) => obj.UniqueDeviceName == a31player.UniqueDeviceName);
if (play_If == null)
{
- host_If = false;
//瀛愰煶绠变笌涓婚煶绠辨柇寮�鐨勫懡浠�
for (int i = 0; i < playList1.Count; i++)
{
@@ -968,7 +1027,6 @@
}
else
{
- host_If = true;
//瑙f暎缁勭殑鍛戒护
if (null == SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:Ungroup"))
{
@@ -990,7 +1048,7 @@
var tmepSlaves = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result);
if (tmepSlaves != null)
{
- if (host_If && tmepSlaves.slave_list.Count == 0)
+ if (tmepSlaves.slave_list.Count == 0)
{
var host_music = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == a31player.UniqueDeviceName);
@@ -1013,9 +1071,9 @@
}
else
{
- for (int a = 0; a < playList1.Count; a++)
+ for (int b = 0; b < tmepSlaves.slave_list.Count; b++)
{
- var uuid = playList1[a].UniqueDeviceName;
+ var uuid = tmepSlaves.slave_list[b].uuid.Replace("uuid:", "");
var music = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == uuid);
if (music != null)
{
@@ -1024,6 +1082,7 @@
music.IsOnLine = false;//鍏堜笉鍏佽璇诲彇
}
}
+
}
var host_a31player = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == a31player.UniqueDeviceName);
@@ -1064,6 +1123,217 @@
});
}
+
+ public string NamePlayer(A31MusicModel a31player)
+ {
+ if (a31player.ServerClientType == 1)
+ {
+ return a31player.MainPlayName;
+ }
+ else
+ {
+ return a31player.Name;
+ }
+ }
+ /// <summary>
+ /// 鎾斁鍣ㄩ煶閲忕殑鐣岄潰
+ /// </summary>
+ /// <param name="a31player">涓绘挱鏀惧櫒</param>
+ public void PlayerVolumeView(A31MusicModel a31player)
+ {
+ #region
+ //涓绘帶浠�
+ Dialog dialog = new Dialog()
+ {
+ //BackgroundColor = Color.PopupBackgroundColor,
+ };
+ dialog.Show();
+ //鐖舵帶浠�
+ FrameLayout frame = new FrameLayout { };
+ dialog.AddChidren(frame);
+ frame.MouseUpEventHandler += (sen, e) =>
+ {
+ dialog.Close();
+ };
+ //鐧借壊蹇埗鎺т欢
+ FrameLayout dialogFra = new FrameLayout()
+ {
+ X = Application.GetRealWidth(16),
+ Y = Application.GetRealHeight(397),
+ Width = Application.GetRealWidth(344),
+ Height = Application.GetRealHeight(250),
+ BackgroundColor = Color.WhiteColor,
+ Radius = (uint)Application.GetRealHeight(12),
+ };
+ frame.AddChidren(dialogFra);
+ //鏄剧ず澶撮儴淇℃伅鐖舵帶浠�
+ FrameLayout topFra = new FrameLayout()
+ {
+ Width = Application.GetRealWidth(344),
+ Height = Application.GetRealHeight(58),
+ };
+ dialogFra.AddChidren(topFra);
+ //鍙栨秷鎺т欢
+ Button cancelnBtn = new Button
+ {
+ X = Application.GetRealWidth(20),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(60),
+ Height = Application.GetRealHeight(20),
+ TextID = StringId.cancelMusic,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = Color.MusicNoTxetColor,
+ TextSize = TextSize.Text14,
+ };
+ topFra.AddChidren(cancelnBtn);
+ cancelnBtn.MouseUpEventHandler += (sen, e) =>
+ {
+ dialog.Close();
+ };
+ //鏍囬鎺т欢
+ Button txetBtn = new Button
+ {
+ X = cancelnBtn.Right + Application.GetRealWidth(20),
+ Y = Application.GetRealHeight(14),
+ Width = Application.GetRealWidth(152),
+ Height = Application.GetRealHeight(22),
+ TextColor = Color.TextColor,
+ TextSize = TextSize.Text16,
+ TextAlignment = TextAlignment.Center,
+ //TextID = StringId.readyPlay,
+ Text="璋冭妭闊抽噺",
+ IsBold = true,
+ };
+ topFra.AddChidren(txetBtn);
+ //纭鎺т欢
+ Button confirmBtn = new Button
+ {
+ X = Application.GetRealWidth(344 - 60 - 20),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(60),
+ Height = Application.GetRealHeight(20),
+ TextID = StringId.confirmMusic,
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = Color.SelectedColor,
+ TextSize = TextSize.Text14,
+ };
+ topFra.AddChidren(confirmBtn);
+ confirmBtn.MouseUpEventHandler += (sen, e) =>
+ {
+ dialog.Close();
+ };
+
+ VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout
+ {
+ Y = Application.GetRealHeight(58),
+ Height = dialogFra.Height - Application.GetRealHeight(58),
+ Width = Application.GetRealWidth(343),
+ };
+ dialogFra.AddChidren(verticalScrolViewLayout);
+
+ var playList = new List<A31MusicModel>();
+ for (int i = 0; i < a31player.Slave.slave_list.Count; i++)
+ {
+ var slave = a31player.Slave.slave_list[i];
+ var music_If = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == slave.uuid.Replace("uuid:", ""));
+ if (music_If != null)
+ {
+ music_If.ServerClientType = -1;
+ music_If.A31PlayStatus.vol = slave.volume;
+ playList.Add(music_If);
+ }
+ }
+ playList.Add(a31player);
+
+ for (int i = 0; i < playList.Count; i++)
+ {
+ var player = playList[i];
+ FrameLayout volumeFra = new FrameLayout
+ {
+ Height = Application.GetRealHeight(64),
+ };
+ verticalScrolViewLayout.AddChidren(volumeFra);
+ Button volumeTextBtn = new Button
+ {
+ X = Application.GetRealWidth(28),
+ Y = Application.GetRealHeight(8),
+ Width = Application.GetRealWidth(200),
+ Height = Application.GetRealHeight(14),
+ TextColor = Color.MusicNoTxetColor,
+ TextSize = TextSize.Text10,
+ TextAlignment = TextAlignment.CenterLeft,
+
+ };
+ volumeFra.AddChidren(volumeTextBtn);
+ if (player.ServerClientType == -1)
+ {
+ volumeTextBtn.Text = player.Name + "闊抽噺";
+ }
+ else if (player.ServerClientType == 1)
+ {
+ volumeTextBtn.Text = "鎬婚煶閲�";
+ }
+
+ DiyImageSeekBar volSeekBar = new DiyImageSeekBar
+ {
+ Y = Application.GetRealHeight(12),
+ X = Application.GetRealWidth(28),
+ Width = Application.GetRealWidth(240),
+ Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢鑳屾櫙楂樺害
+ IsProgressTextShow = false,//鏄剧ず鐧惧垎姣�
+ IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔�
+ ProgressBarColor = Color.SelectedColor,//閫変腑杩涘害鏉¢鑹�
+ ThumbImagePath = "MusicIcon/progressIcon.png",//杩涘害鏉℃寜閽浘鏍�
+ ThumbImageHeight = Application.GetMinRealAverage(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
+ SeekBarViewHeight = Application.GetMinRealAverage(8),//杩涘害鏉$殑楂樺害
+ Progress=int.Parse(player.A31PlayStatus.vol),
+ //ProgressChangeDelayTime=
+ };
+ volumeFra.AddChidren(volSeekBar);
+
+ Button valueBtn = new Button
+ {
+ X = Application.GetRealWidth(289),
+ Y = Application.GetRealHeight(31),
+ Width = Application.GetRealWidth(26),
+ Height = Application.GetRealHeight(17),
+ TextColor = Color.MusicNoTxetColor,
+ TextSize = TextSize.Text12,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = player.A31PlayStatus.vol + "%",
+ };
+ volumeFra.AddChidren(valueBtn);
+
+ ///闊抽噺杩涘害鏉$偣鍑讳簨浠�
+ EventHandler<int> progressClick = (sender, e) =>
+ {
+ if (player.ServerClientType == -1)
+ {
+ valueBtn.Text = volSeekBar.Progress + "%";
+ SendMethod.ControlVolume(volSeekBar.Progress, player);
+ }
+ else if (player.ServerClientType == 1)
+ {
+ for (int j = 0; j < playList.Count; j++)
+ {
+ var music = playList[j];
+ var frameLayout = (FrameLayout)verticalScrolViewLayout.GetChildren(j);
+ var diyImageSeekBar = (DiyImageSeekBar)frameLayout.GetChildren(1);
+ var button = (Button)frameLayout.GetChildren(2);
+ diyImageSeekBar.Progress = volSeekBar.Progress;
+ button.Text = volSeekBar.Progress + "%";
+ SendMethod.ControlVolume(volSeekBar.Progress, music);
+ }
+ }
+ };
+ volSeekBar.OnProgressChangedEvent += progressClick;
+ volSeekBar.OnStopTrackingTouchEvent += progressClick;
+ }
+ #endregion
+
+ }
+
+
}
[System.Serializable]
public class A31Wifi鈥� {
--
Gitblit v1.8.0