From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs |  158 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 130 insertions(+), 28 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs
index 885efea..fc2bc98 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs
@@ -9,6 +9,45 @@
     /// </summary>
     public class ScenePictrueControl : FrameRowControl
     {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鍦烘櫙鍥剧墖鎺т欢
+        /// </summary>
+        public ImageView btnScenePic = null;
+        /// <summary>
+        /// 鍦烘櫙鍚嶅瓧鎺т欢
+        /// </summary>
+        public NormalViewControl btnSceneName = null;
+        /// <summary>
+        /// 鍦烘櫙瀵硅薄
+        /// </summary>
+        public Common.SceneUI scene = null;
+        /// <summary>
+        /// 鏀惰棌瑙﹀彂鐨勪簨浠� true:娣诲姞鏀惰棌 false:鍙栨秷鏀惰棌
+        /// </summary>
+        public Action<bool> CollectEvent = null;
+        /// <summary>
+        /// 閫夋嫨鎺т欢(璋冪敤AddSelectControl()鍑芥暟鍒濆鍖�)
+        /// </summary>
+        private IconViewControl btnSelect = null;
+
+        private bool m_IsSelected = false;
+        /// <summary>
+        /// 閫夋嫨鐘舵��
+        /// </summary>
+        public bool IsSelected
+        {
+            get { return m_IsSelected; }
+            set
+            {
+                m_IsSelected = value;
+                if (btnSelect != null) { btnSelect.IsSelected = m_IsSelected; }
+            }
+        }
+
+        #endregion
+
         #region 鈻� 鍒濆鍖朹____________________________
 
         /// <summary>
@@ -17,7 +56,7 @@
         public ScenePictrueControl()
         {
             this.UseClickStatu = false;
-            this.Height = Application.GetRealHeight(470);
+            this.Height = Application.GetRealHeight(440);
         }
 
         /// <summary>
@@ -26,42 +65,105 @@
         /// <param name="sceneUI">鍦烘櫙鎺т欢</param>
         public void InitControl(Common.SceneUI sceneUI)
         {
+            this.scene = sceneUI;
             //鍦烘櫙鍥剧墖
-            var btnPic = new ImageView();
-            btnPic.X = Application.GetRealWidth(179);
-            btnPic.Width = Application.GetRealWidth(844);
-            btnPic.Height = Application.GetRealHeight(420);
+            this.btnScenePic = new ImageView();
+            btnScenePic.X = Application.GetRealWidth(179);
+            btnScenePic.Width = Application.GetRealWidth(844);
+            btnScenePic.Height = Application.GetRealHeight(397);
             if (sceneUI.IconPathType == 0)
             {
-                btnPic.ImagePath = sceneUI.IconPath;
+                btnScenePic.ImagePath = sceneUI.IconPath;
             }
             else if (Common.Global.IsExistsByHomeId(sceneUI.IconPath) == true)
             {
-                btnPic.ImageBytes = Common.Global.ReadFileByHomeId(sceneUI.IconPath);
+                btnScenePic.ImageBytes = Common.Global.ReadFileByHomeId(sceneUI.IconPath);
             }
-            btnPic.Radius = (uint)Application.GetRealHeight(17);
-            this.AddChidren(btnPic, ChidrenBindMode.NotBind);
+            btnScenePic.Radius = (uint)Application.GetRealHeight(17);
+            this.AddChidren(btnScenePic, ChidrenBindMode.NotBind);
 
-            //瀹冪殑涓婇潰鏈変竴灞傞槾褰�
-            var frameBack = new FrameLayout();
-            frameBack.Width = btnPic.Width;
-            frameBack.Height = btnPic.Height;
-            frameBack.X = btnPic.X;
-            frameBack.BackgroundColor = 0x40000000;
-            frameBack.Radius = (uint)Application.GetRealHeight(17);
-            this.AddChidren(frameBack, ChidrenBindMode.BindEventOnly);
+            //闃村奖
+            var btnShadow = new PicViewControl(btnScenePic.Width + Application.GetRealWidth(14 * 2), btnScenePic.Height + Application.GetRealHeight(43), false);
+            btnShadow.X = btnScenePic.X - Application.GetRealWidth(14);
+            btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png";
+            this.AddChidren(btnShadow, ChidrenBindMode.BindEvent);
 
-            var btnName = new NormalViewControl(251, 282, true);
-            btnName.IsMoreLines = true;
-            btnName.X = ControlCommonResourse.XXLeft;
-            btnName.Y = Application.GetRealHeight(58);
-            btnName.BackgroundColor = 0xd6333333;
-            btnName.RadiusEx = 17;
-            btnName.Text = sceneUI.Name;
-            btnName.TextSize = 15;
-            btnName.TextColor = UserCenterColor.Current.White;
-            btnName.TextAlignment = TextAlignment.Center;
-            this.AddChidren(btnName, ChidrenBindMode.BindEventOnly);
+            this.btnSceneName = new NormalViewControl(251, 282, true);
+            btnSceneName.IsMoreLines = true;
+            btnSceneName.X = ControlCommonResourse.XXLeft;
+            btnSceneName.Y = Application.GetRealHeight(58);
+            btnSceneName.BackgroundColor = 0xd6333333;
+            btnSceneName.RadiusEx = 17;
+            btnSceneName.Text = sceneUI.Name;
+            btnSceneName.TextSize = 15;
+            btnSceneName.TextColor = UserCenterColor.Current.White;
+            btnSceneName.TextAlignment = TextAlignment.Center;
+            this.AddChidren(btnSceneName, ChidrenBindMode.NotBind);
+        }
+
+        #endregion
+
+        #region 鈻� 閫夋嫨鎺т欢___________________________
+
+        /// <summary>
+        /// 娣诲姞閫夋嫨鎺т欢
+        /// </summary>
+        public void AddSelectControl()
+        {
+            this.btnSelect = new IconViewControl(58);
+            btnSelect.UnSelectedImagePath = "Item/ItemUnSelected.png";
+            btnSelect.SelectedImagePath = "Item/ItemSelected.png";
+            btnSelect.X = Application.GetRealWidth(887);
+            btnSelect.Y = Application.GetRealHeight(35);
+            this.AddChidren(btnSelect, ChidrenBindMode.BindEvent);
+        }
+
+        #endregion
+
+        #region 鈻� 鏀惰棌鎺т欢___________________________
+
+        /// <summary>
+        /// 娣诲姞鏀惰棌鎺т欢(CollectEvent鏄敹钘忕殑鍥炶皟浜嬩欢)
+        /// </summary>
+        public void AddCollectionControl()
+        {
+            var btnCollection = new IconViewControl(65);
+            btnCollection.X = Application.GetRealWidth(81);
+            btnCollection.Y = Application.GetRealHeight(81);
+            btnCollection.UnSelectedImagePath = "Item/Collection.png";
+            btnCollection.SelectedImagePath = "Item/CollectionSelected.png";
+            if (HdlRoomLogic.Current.IsCollectInRoom(scene) == true)
+            {
+                btnCollection.IsSelected = true;
+            }
+            this.AddChidren(btnCollection, ChidrenBindMode.NotBind);
+            btnCollection.ButtonClickEvent += (sender, e) =>
+            {
+                btnCollection.IsSelected = !btnCollection.IsSelected;
+                if (btnCollection.IsSelected == true)
+                {
+                    HdlSceneLogic.Current.AddLoveScene(scene);
+                }
+                else
+                {
+                    HdlSceneLogic.Current.DeleteLoveScene(scene);
+                }
+                this.CollectEvent?.Invoke(btnCollection.IsSelected);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鎺т欢鎽ф瘉___________________________
+
+        /// <summary>
+        /// 鎺т欢鎽ф瘉
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            this.CollectEvent = null;
+
+            base.RemoveFromParent();
         }
 
         #endregion

--
Gitblit v1.8.0