Browse Source
Can now set the Game.activePageStyle property to control the currently active Page rendering style. Added a SetPageStyle() command to set the style in a command sequence. Added 2 PageStyle prefabs assets. Renamed Room classes to be consistent.master
20 changed files with 192 additions and 61 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 25812898d7e74407b94d0216027d5876 |
||||
NativeFormatImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: cdd7a3dba1d864bb78106f6d917a70ae |
||||
NativeFormatImporter: |
||||
userData: |
@ -0,0 +1,48 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
/** |
||||
* Defines visual appearance of a Page. |
||||
* Usage: |
||||
* 1. Add this component to an empty game object |
||||
* 2. Customize the style properties |
||||
* 3. Assign the style object to the pageStyle property of the Page you wish to style |
||||
*/ |
||||
public class PageStyle : MonoBehaviour |
||||
{ |
||||
// The font size for title, say and option text is calculated by multiplying the screen height |
||||
// by the corresponding font scale. Text appears the same size across all device resolutions. |
||||
|
||||
/// Title font size as a fraction of screen height. |
||||
public float titleFontScale = 1f / 20f; |
||||
|
||||
/// Say font size as a fraction of screen height. |
||||
public float sayFontScale = 1f / 25f; |
||||
|
||||
/// Option font size as a fraction of screen height. |
||||
public float optionFontScale = 1f / 25f; |
||||
|
||||
/// Style for title text |
||||
public GUIStyle titleStyle; |
||||
|
||||
/// Style for say text |
||||
public GUIStyle sayStyle; |
||||
|
||||
/// Style for option text |
||||
public GUIStyle optionStyle; |
||||
|
||||
/// Style for text box |
||||
public GUIStyle boxStyle; |
||||
|
||||
void Update() |
||||
{ |
||||
// Override the font size to compensate for varying device resolution |
||||
// Font size is calculated as a fraction of the current screen height |
||||
titleStyle.fontSize = Mathf.RoundToInt((float)Screen.height * titleFontScale); |
||||
sayStyle.fontSize = Mathf.RoundToInt((float)Screen.height * sayFontScale); |
||||
optionStyle.fontSize = Mathf.RoundToInt((float)Screen.height * optionFontScale); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 1f1a1fd7fb09d46438885139f2364a93 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
Binary file not shown.
Loading…
Reference in new issue