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)
|
||||||
@@ -12,11 +8,15 @@ using System.Linq;
|
|||||||
*/
|
*/
|
||||||
#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,10 +49,6 @@ 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;
|
||||||
@@ -60,6 +56,9 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
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);
|
||||||
template.GetText = () => " " + title;
|
template.GetText = () => " " + title;
|
||||||
|
|||||||
Reference in New Issue
Block a user