using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
///
/// 做成一个场景+房间的行控件
///
public class SceneRoomViewRow : StatuRowLayout
{
///
/// 场景
///
public Common.SceneRoomUI Scene = null;
///
/// 图标控件
///
private RowLeftIconView btnIcon = null;
///
/// 场景控件
///
private RowTopBlackView btnSceneName = null;
///
/// 房间控件
///
private RowBottomGrayView btnRoom = null;
///
/// 做成一个场景+房间的行控件
///
/// 列表控件,可以为空
/// 场景ID
/// 场景名
public SceneRoomViewRow(VerticalScrolViewLayout listView, int SceneId, string SceneName)
{
//获取场景
List 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);
}
}
///
/// 初始化内部控件
///
/// 场景ID
/// 场景名
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());
}
this.AddChidren(btnRoom);
}
}
}