fix it so it works when have no movies
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
@@ -10,13 +6,17 @@ using System.Linq;
|
|||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see LICENSE.
|
* see LICENSE.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class VideoPlayerDelegate : IWidgetDelegate
|
public class VideoPlayerDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
string Selected;
|
string Selected;
|
||||||
|
|
||||||
public VideoPlayerDelegate()
|
public VideoPlayerDelegate()
|
||||||
{
|
{
|
||||||
var bg = Widget.RootWidget.GetWidget("VIDEOPLAYER_MENU");
|
var bg = Widget.RootWidget.GetWidget("VIDEOPLAYER_MENU");
|
||||||
@@ -49,16 +49,15 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
var itemTemplate = vl.GetWidget<LabelWidget>("VIDEO_TEMPLATE");
|
var itemTemplate = vl.GetWidget<LabelWidget>("VIDEO_TEMPLATE");
|
||||||
int offset = itemTemplate.Bounds.Y;
|
int offset = itemTemplate.Bounds.Y;
|
||||||
|
|
||||||
Selected = Rules.Movies.Keys.FirstOrDefault();
|
|
||||||
if (Selected != null)
|
|
||||||
player.Load(Selected);
|
|
||||||
|
|
||||||
foreach (var kv in Rules.Movies)
|
foreach (var kv in Rules.Movies)
|
||||||
{
|
{
|
||||||
var video = kv.Key;
|
var video = kv.Key;
|
||||||
var title = kv.Value;
|
var title = kv.Value;
|
||||||
if (!FileSystem.Exists(video))
|
if (!FileSystem.Exists(video))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (Selected == null)
|
||||||
|
player.Load(Selected = video);
|
||||||
|
|
||||||
var template = itemTemplate.Clone() as LabelWidget;
|
var template = itemTemplate.Clone() as LabelWidget;
|
||||||
template.Id = "VIDEO_{0}".F(video);
|
template.Id = "VIDEO_{0}".F(video);
|
||||||
|
|||||||
Reference in New Issue
Block a user