Browse Source

Added SetBackground command and Background prefab.

master
chrisgregan 10 years ago
parent
commit
9e86571c9d
  1. BIN
      Assets/Example/Scenes/Example.unity
  2. 42
      Assets/Fungus/Dialog/Commands/SetBackground.cs
  3. 8
      Assets/Fungus/Dialog/Commands/SetBackground.cs.meta
  4. BIN
      Assets/Fungus/Dialog/Prefabs/Background.prefab
  5. 4
      Assets/Fungus/Dialog/Prefabs/Background.prefab.meta
  6. 22
      Assets/Fungus/Dialog/Scripts/Background.cs
  7. 8
      Assets/Fungus/Dialog/Scripts/Background.cs.meta

BIN
Assets/Example/Scenes/Example.unity

Binary file not shown.

42
Assets/Fungus/Dialog/Commands/SetBackground.cs

@ -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);
}
}
}

8
Assets/Fungus/Dialog/Commands/SetBackground.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2d0318fa6f5b342c4abfe47bfd0ee062
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

BIN
Assets/Fungus/Dialog/Prefabs/Background.prefab

Binary file not shown.

4
Assets/Fungus/Dialog/Prefabs/Background.prefab.meta

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: a276a1108d4ee4da695983af7ae56c2e
NativeFormatImporter:
userData:

22
Assets/Fungus/Dialog/Scripts/Background.cs

@ -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;
}
}
}

8
Assets/Fungus/Dialog/Scripts/Background.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 41a94ec543d634ff782c8c704e8b6eb4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save