using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 做成一个场景+房间的行控件
|
/// </summary>
|
public class SceneRoomViewRow : StatuRowLayout
|
{
|
/// <summary>
|
/// 场景
|
/// </summary>
|
public Common.SceneRoomUI Scene = null;
|
/// <summary>
|
/// 图标控件
|
/// </summary>
|
private RowLeftIconView btnIcon = null;
|
/// <summary>
|
/// 场景控件
|
/// </summary>
|
private RowTopBlackView btnSceneName = null;
|
/// <summary>
|
/// 房间控件
|
/// </summary>
|
private RowBottomGrayView btnRoom = null;
|
|
/// <summary>
|
/// 做成一个场景+房间的行控件
|
/// </summary>
|
/// <param name="listView">列表控件,可以为空</param>
|
/// <param name="SceneId">场景ID</param>
|
/// <param name="SceneName">场景名</param>
|
public SceneRoomViewRow(VerticalScrolViewLayout listView, int SceneId, string SceneName)
|
{
|
//获取场景
|
List<Common.SceneRoomUI> listScene = Common.SceneRoomUI.AllSceneRoomUIList;
|
foreach (var data in listScene)
|
{
|
if (data.sceneUI.Id == SceneId)
|
{
|
this.Scene = data;
|
if (string.IsNullOrEmpty(SceneName) == false)
|
{
|
this.Scene.sceneUI.Name = SceneName;
|
}
|
break;
|
}
|
}
|
|
if (listView != null)
|
{
|
listView.AddChidren(this);
|
//初始化内部控件
|
this.InitControl(SceneId, SceneName);
|
}
|
}
|
|
/// <summary>
|
/// 初始化内部控件
|
/// </summary>
|
/// <param name="SceneId">场景ID</param>
|
/// <param name="SceneName">场景名</param>
|
public void InitControl(int SceneId, string SceneName)
|
{
|
//图标
|
btnIcon = new RowLeftIconView();
|
btnIcon.SelectedImagePath = "Item/SceneSelected.png";
|
btnIcon.UnSelectedImagePath = "Item/Scene.png";
|
this.AddChidren(btnIcon);
|
|
//场景
|
btnSceneName = new RowTopBlackView();
|
btnSceneName.Text = SceneName;
|
this.AddChidren(btnSceneName);
|
|
//房间
|
btnRoom = new RowBottomGrayView();
|
if (this.Scene != null)
|
{
|
btnRoom.Text = this.Scene.room.Name;
|
}
|
else
|
{
|
btnRoom.Text = Common.Room.CurrentRoom.GetRoomName(new List<string>());
|
}
|
this.AddChidren(btnRoom);
|
}
|
}
|
}
|