7 changed files with 84 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,42 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Camera", |
||||||
|
"Set Background", |
||||||
|
"Draws a fullscreen background texture using a Background UI object.")] |
||||||
|
public class SetBackground : Command |
||||||
|
{ |
||||||
|
public Background background; |
||||||
|
|
||||||
|
public Sprite backgroundImage; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (background != null) |
||||||
|
{ |
||||||
|
background.SetBackgroundImage(backgroundImage); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (backgroundImage == null) |
||||||
|
{ |
||||||
|
return "<None>"; |
||||||
|
} |
||||||
|
|
||||||
|
return backgroundImage.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(216, 228, 170, 255); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2d0318fa6f5b342c4abfe47bfd0ee062 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
Binary file not shown.
@ -0,0 +1,4 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a276a1108d4ee4da695983af7ae56c2e |
||||||
|
NativeFormatImporter: |
||||||
|
userData: |
@ -0,0 +1,22 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.UI; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
public class Background : MonoBehaviour |
||||||
|
{ |
||||||
|
public Canvas backgroundCanvas; |
||||||
|
public Image backgroundImage; |
||||||
|
|
||||||
|
public void SetBackgroundImage(Sprite imageSprite) |
||||||
|
{ |
||||||
|
if (backgroundCanvas != null) |
||||||
|
{ |
||||||
|
backgroundCanvas.gameObject.SetActive(imageSprite != null); |
||||||
|
} |
||||||
|
|
||||||
|
if (backgroundImage != null) |
||||||
|
{ |
||||||
|
backgroundImage.sprite = imageSprite; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue