using Shared.Common;
|
using Shared.Phone.UserCenter;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.Category
|
{
|
/// <summary>
|
/// 选择本地场景图片的界面
|
/// </summary>
|
public class SelectLocalSceneImageForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 结束选择的事件(图片名字)
|
/// </summary>
|
public Action<string> FinishSelectEvent = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//初始化中部信息
|
this.InitMiddleFrame();
|
//设置头部信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.LocalPicture));
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//列表控件
|
var listView = new VerticalListControl();
|
listView.Height = bodyFrameLayout.Height;
|
bodyFrameLayout.AddChidren(listView);
|
|
int picHeight = this.GetPictrueRealSize(220);
|
int picWidth = this.GetPictrueRealSize(463);
|
int leftRightSpace = this.GetPictrueRealSize(40);
|
int space = listView.Width - leftRightSpace * 2 - picWidth * 2;
|
|
//一共14张图片
|
FrameLayout frameRow = null;
|
for (int i = 0; i < 14; i++)
|
{
|
//图片
|
var btnIcon = new ImageView();
|
btnIcon.Y = Application.GetRealHeight(58);
|
btnIcon.Width = picWidth;
|
btnIcon.Height = picHeight;
|
btnIcon.ImagePath = $"SceneIcon/{i}.png";
|
btnIcon.Radius = (uint)Application.GetRealHeight(17);
|
|
if (i % 2 == 0)
|
{
|
btnIcon.X = leftRightSpace;
|
|
//行控件
|
frameRow = new FrameLayout();
|
frameRow.Height = picHeight + Application.GetRealHeight(58);
|
listView.AddChidren(frameRow);
|
}
|
else
|
{
|
btnIcon.X = leftRightSpace + picWidth + space;
|
}
|
frameRow.AddChidren(btnIcon);
|
|
//图片遮罩
|
var btnZhezhao = new FrameLayout();
|
btnZhezhao.Width = btnIcon.Width;
|
btnZhezhao.Height = btnIcon.Height;
|
btnZhezhao.Y = btnIcon.Y;
|
btnZhezhao.X = btnIcon.X;
|
btnZhezhao.Radius = (uint)Application.GetRealHeight(17);
|
btnZhezhao.BackgroundColor = UserCenterColor.Current.PictrueZhezhaoColor;
|
frameRow.AddChidren(btnZhezhao);
|
btnZhezhao.SetViewShadow(true);
|
btnZhezhao.MouseUpEventHandler += (sender, e) =>
|
{
|
//结束选择的事件
|
this.FinishSelectEvent?.Invoke(btnIcon.ImagePath);
|
this.CloseForm();
|
};
|
}
|
|
//底部间距
|
var frameTemp = new FrameLayout();
|
frameTemp.Height = Application.GetRealHeight(58);
|
listView.AddChidren(frameTemp);
|
}
|
|
#endregion
|
|
#region ■ 界面关闭___________________________
|
|
/// <summary>
|
/// 界面关闭
|
/// </summary>
|
public override void CloseFormBefore()
|
{
|
this.FinishSelectEvent = null;
|
|
base.CloseFormBefore();
|
}
|
|
#endregion
|
}
|
}
|