Browse Source

Added property to control icon screen position

Refactored Game property names
master
chrisgregan 11 years ago
parent
commit
9157369bd2
  1. BIN
      Assets/Fungus/Prefabs/Game.prefab
  2. 62
      Assets/Fungus/Scripts/Game.cs
  3. 0
      Assets/Fungus/Textures/SwipePanIcon.png
  4. 0
      Assets/Fungus/Textures/SwipePanIcon.png.meta
  5. BIN
      Assets/FungusExample/Scenes/Example.unity

BIN
Assets/Fungus/Prefabs/Game.prefab

Binary file not shown.

62
Assets/Fungus/Scripts/Game.cs

@ -48,30 +48,36 @@ namespace Fungus
*/
public float buttonFadeDuration = 0.25f;
/**
* Time which must elapse before buttons will automatically hide.
*/
public float autoHideButtonDuration = 5f;
/**
* Full screen texture used for screen fade effect.
*/
public Texture2D fadeTexture;
public Texture2D screenFadeTexture;
/**
* Icon to display when swipe pan mode is active.
* Position of continue and swipe icons in normalized screen space coords.
* (0,0) = top left, (1,1) = bottom right
*/
public Texture2D swipePanTexture;
public Vector2 iconPosition = new Vector2(1,1);
/**
* Icon to display when waiting for player input to continue
*/
public Texture2D continueTexture;
public Texture2D continueIcon;
/**
* Sound effect to play when buttons are clicked.
* Icon to display when swipe pan mode is active.
*/
public AudioClip buttonClickClip;
public Texture2D swipePanIcon;
/**
* Time which must elapse before buttons will automatically hide.
* Sound effect to play when buttons are clicked.
*/
public float autoHideButtonDuration = 5f;
public AudioClip buttonClickClip;
/**
* Default screen position for Page when player enters a Room.
@ -192,13 +198,20 @@ namespace Fungus
if (swipePanActive)
{
// Draw the swipe panning icon
if (swipePanTexture)
if (swipePanIcon)
{
Rect rect = new Rect(Screen.width - swipePanTexture.width,
Screen.height - swipePanTexture.height,
swipePanTexture.width,
swipePanTexture.height);
GUI.DrawTexture(rect, swipePanTexture);
float x = Screen.width * iconPosition.x;
float y = Screen.height * iconPosition.y;
float width = swipePanIcon.width;
float height = swipePanIcon.height;
x = Mathf.Max(x, 0);
y = Mathf.Max(y, 0);
x = Mathf.Min(x, Screen.width - width);
y = Mathf.Min(y, Screen.height - height);
Rect rect = new Rect(x, y, width, height);
GUI.DrawTexture(rect, swipePanIcon);
}
}
@ -206,13 +219,20 @@ namespace Fungus
activePage.FinishedWriting())
{
// Draw the continue icon
if (continueTexture)
if (continueIcon)
{
Rect rect = new Rect(Screen.width - continueTexture.width,
Screen.height - swipePanTexture.height,
continueTexture.width,
continueTexture.height);
GUI.DrawTexture(rect, continueTexture);
float x = Screen.width * iconPosition.x;
float y = Screen.height * iconPosition.y;
float width = continueIcon.width;
float height = continueIcon.height;
x = Mathf.Max(x, 0);
y = Mathf.Max(y, 0);
x = Mathf.Min(x, Screen.width - width);
y = Mathf.Min(y, Screen.height - height);
Rect rect = new Rect(x, y, width, height);
GUI.DrawTexture(rect, continueIcon);
}
}
@ -223,7 +243,7 @@ namespace Fungus
// 0 = scene fully obscured
GUI.color = new Color(1,1,1, 1f - fadeAlpha);
GUI.depth = -1000;
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), fadeTexture);
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), screenFadeTexture);
}
}

0
Assets/Fungus/Textures/SwipeIcon.png → Assets/Fungus/Textures/SwipePanIcon.png

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

0
Assets/Fungus/Textures/SwipeIcon.png.meta → Assets/Fungus/Textures/SwipePanIcon.png.meta

BIN
Assets/FungusExample/Scenes/Example.unity

Binary file not shown.
Loading…
Cancel
Save