old mode 100755
new mode 100644
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 场景图片的控件
|
| | | /// </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>
|
| | | /// 场景图片的控件(拥有桌布)
|
| | | /// </summary>
|
| | | public ScenePictrueControl()
|
| | | {
|
| | | this.UseClickStatu = false;
|
| | | this.Height = Application.GetRealHeight(440);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="sceneUI">场景控件</param>
|
| | | public void InitControl(Common.SceneUI sceneUI)
|
| | | {
|
| | | this.scene = sceneUI;
|
| | | //场景图片
|
| | | this.btnScenePic = new ImageView();
|
| | | btnScenePic.X = Application.GetRealWidth(179);
|
| | | btnScenePic.Width = Application.GetRealWidth(844);
|
| | | btnScenePic.Height = Application.GetRealHeight(397);
|
| | | if (sceneUI.IconPathType == 0)
|
| | | {
|
| | | btnScenePic.ImagePath = sceneUI.IconPath;
|
| | | }
|
| | | else if (Common.Global.IsExistsByHomeId(sceneUI.IconPath) == true)
|
| | | {
|
| | | btnScenePic.ImageBytes = Common.Global.ReadFileByHomeId(sceneUI.IconPath);
|
| | | }
|
| | | btnScenePic.Radius = (uint)Application.GetRealHeight(17);
|
| | | this.AddChidren(btnScenePic, ChidrenBindMode.NotBind);
|
| | |
|
| | | //阴影
|
| | | 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);
|
| | |
|
| | | 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
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 场景图片的控件 |
| | | /// </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> |
| | | /// 场景图片的控件(拥有桌布) |
| | | /// </summary> |
| | | public ScenePictrueControl() |
| | | { |
| | | this.UseClickStatu = false; |
| | | this.Height = Application.GetRealHeight(440); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="sceneUI">场景控件</param> |
| | | public void InitControl(Common.SceneUI sceneUI) |
| | | { |
| | | this.scene = sceneUI; |
| | | //场景图片 |
| | | this.btnScenePic = new ImageView(); |
| | | btnScenePic.X = Application.GetRealWidth(179); |
| | | btnScenePic.Width = Application.GetRealWidth(844); |
| | | btnScenePic.Height = Application.GetRealHeight(397); |
| | | if (sceneUI.IconPathType == 0) |
| | | { |
| | | btnScenePic.ImagePath = sceneUI.IconPath; |
| | | } |
| | | else if (Common.Global.IsExistsByHomeId(sceneUI.IconPath) == true) |
| | | { |
| | | btnScenePic.ImageBytes = Common.Global.ReadFileByHomeId(sceneUI.IconPath); |
| | | } |
| | | btnScenePic.Radius = (uint)Application.GetRealHeight(17); |
| | | this.AddChidren(btnScenePic, ChidrenBindMode.NotBind); |
| | | |
| | | //阴影 |
| | | 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); |
| | | |
| | | 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 |
| | | } |
| | | } |