chrisgregan
10 years ago
461 changed files with 36319 additions and 945 deletions
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8bbdbd776cccc4e1985aec1a2ee202b0 |
||||
guid: 5a4fe51b67cee49b28f6a0231dae2352 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!1 &177196 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 477196} |
||||
- 114: {fileID: 11477196} |
||||
m_Layer: 0 |
||||
m_Name: FungusTag |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!4 &477196 |
||||
Transform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 177196} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
--- !u!114 &11477196 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 177196} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 335e04fbdd5260043abb299a991dcbe8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
tagStartSymbol: '{customName}' |
||||
tagEndSymbol: '{/customName}' |
||||
replaceTagStartWith: '{color=blue}' |
||||
replaceTagEndWith: '{/color}' |
||||
--- !u!1001 &100100000 |
||||
Prefab: |
||||
m_ObjectHideFlags: 1 |
||||
serializedVersion: 2 |
||||
m_Modification: |
||||
m_TransformParent: {fileID: 0} |
||||
m_Modifications: [] |
||||
m_RemovedComponents: [] |
||||
m_ParentPrefab: {fileID: 0} |
||||
m_RootGameObject: {fileID: 177196} |
||||
m_IsPrefabParent: 1 |
||||
m_IsExploded: 1 |
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8345c33c7c8ada64083f41d452b315eb |
||||
NativeFormatImporter: |
||||
userData: |
@ -0,0 +1,33 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[ExecuteInEditMode] |
||||
public class CustomTag : MonoBehaviour |
||||
{ |
||||
public string tagStartSymbol; |
||||
public string tagEndSymbol; |
||||
public string replaceTagStartWith; |
||||
public string replaceTagEndWith; |
||||
|
||||
static public List<CustomTag> activeCustomTags = new List<CustomTag>(); |
||||
|
||||
protected virtual void OnEnable() |
||||
{ |
||||
if (!activeCustomTags.Contains(this)) |
||||
{ |
||||
activeCustomTags.Add(this); |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnDisable() |
||||
{ |
||||
activeCustomTags.Remove(this); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 335e04fbdd5260043abb299a991dcbe8 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,47 @@
|
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
/** |
||||
* Prevents saving of selected sequence and commands to avoid version control conflicts |
||||
*/ |
||||
public class AssetModProcessor : UnityEditor.AssetModificationProcessor |
||||
{ |
||||
public static string[] OnWillSaveAssets(string[] paths) |
||||
{ |
||||
string sceneName = ""; |
||||
|
||||
foreach (string path in paths) |
||||
{ |
||||
if (path.Contains(".unity")) |
||||
{ |
||||
sceneName = Path.GetFileNameWithoutExtension(path); |
||||
} |
||||
} |
||||
|
||||
if (sceneName.Length == 0) |
||||
{ |
||||
return paths; |
||||
} |
||||
|
||||
// Reset these variables before save so that they won't cause a git conflict |
||||
FungusScript[] allFungusScripts = UnityEngine.Object.FindObjectsOfType<FungusScript>(); |
||||
foreach (FungusScript fs in allFungusScripts) |
||||
{ |
||||
if (!fs.saveSelection) |
||||
{ |
||||
fs.selectedSequence = null; |
||||
fs.ClearSelectedCommands(); |
||||
} |
||||
} |
||||
|
||||
return paths; |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: b8ec97c8f203acf4fb2b799319f4c848 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 0018d8c9e4d14f043af5b7e5b48e7b50 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 36924863aa1cb9a41814e08237c0418a |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,299 @@
|
||||
using UnityEditor; |
||||
using UnityEditorInternal; |
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using Rotorz.ReorderableList; |
||||
|
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
[CustomEditor (typeof(Portrait))] |
||||
public class PortraitEditor : CommandEditor |
||||
{ |
||||
protected SerializedProperty portraitStageProp; |
||||
protected SerializedProperty displayProp; |
||||
protected SerializedProperty characterProp; |
||||
protected SerializedProperty replacedCharacterProp; |
||||
protected SerializedProperty portraitProp; |
||||
protected SerializedProperty offsetProp; |
||||
protected SerializedProperty fromPositionProp; |
||||
protected SerializedProperty toPositionProp; |
||||
protected SerializedProperty facingProp; |
||||
protected SerializedProperty useDefaultSettingsProp; |
||||
protected SerializedProperty fadeDurationProp; |
||||
protected SerializedProperty moveSpeedProp; |
||||
protected SerializedProperty shiftOffsetProp; |
||||
protected SerializedProperty waitUntilFinishedProp; |
||||
protected SerializedProperty moveProp; |
||||
protected SerializedProperty shiftIntoPlaceProp; |
||||
|
||||
protected virtual void OnEnable() |
||||
{ |
||||
portraitStageProp = serializedObject.FindProperty("portraitStage"); |
||||
displayProp = serializedObject.FindProperty("display"); |
||||
characterProp = serializedObject.FindProperty("character"); |
||||
replacedCharacterProp = serializedObject.FindProperty("replacedCharacter"); |
||||
portraitProp = serializedObject.FindProperty("portrait"); |
||||
offsetProp = serializedObject.FindProperty("offset"); |
||||
fromPositionProp = serializedObject.FindProperty("fromPosition"); |
||||
toPositionProp = serializedObject.FindProperty("toPosition"); |
||||
facingProp = serializedObject.FindProperty("facing"); |
||||
useDefaultSettingsProp = serializedObject.FindProperty("useDefaultSettings"); |
||||
fadeDurationProp = serializedObject.FindProperty("fadeDuration"); |
||||
moveSpeedProp = serializedObject.FindProperty("moveSpeed"); |
||||
shiftOffsetProp = serializedObject.FindProperty("shiftOffset"); |
||||
waitUntilFinishedProp = serializedObject.FindProperty("waitUntilFinished"); |
||||
moveProp = serializedObject.FindProperty("move"); |
||||
shiftIntoPlaceProp = serializedObject.FindProperty("shiftIntoPlace"); |
||||
} |
||||
|
||||
public override void DrawCommandGUI() |
||||
{ |
||||
serializedObject.Update(); |
||||
|
||||
Portrait t = target as Portrait; |
||||
|
||||
if (PortraitStage.activePortraitStages.Count > 1) |
||||
{ |
||||
CommandEditor.ObjectField<PortraitStage>(portraitStageProp, |
||||
new GUIContent("Portrait Stage", "Stage to display the character portraits on"), |
||||
new GUIContent("<Default>"), |
||||
PortraitStage.activePortraitStages); |
||||
} |
||||
else |
||||
{ |
||||
t.portraitStage = null; |
||||
} |
||||
// Format Enum names |
||||
string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>"); |
||||
displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels); |
||||
|
||||
string characterLabel = "Character"; |
||||
if (t.display == DisplayType.Replace) |
||||
{ |
||||
CommandEditor.ObjectField<Character>(replacedCharacterProp, |
||||
new GUIContent("Replace", "Character to replace"), |
||||
new GUIContent("<None>"), |
||||
Character.activeCharacters); |
||||
characterLabel = "With"; |
||||
} |
||||
|
||||
CommandEditor.ObjectField<Character>(characterProp, |
||||
new GUIContent(characterLabel, "Character to display"), |
||||
new GUIContent("<None>"), |
||||
Character.activeCharacters); |
||||
|
||||
bool showOptionalFields = true; |
||||
PortraitStage ps = t.portraitStage; |
||||
// Only show optional portrait fields once required fields have been filled... |
||||
if (t.character != null) // Character is selected |
||||
{ |
||||
if (t.character.portraits == null || // Character has a portraits field |
||||
t.character.portraits.Count <= 0 ) // Character has at least one portrait |
||||
{ |
||||
EditorGUILayout.HelpBox("This character has no portraits. Please add portraits to the character's prefab before using this command.", MessageType.Error); |
||||
showOptionalFields = false; |
||||
} |
||||
if (t.portraitStage == null) // If default portrait stage selected |
||||
{ |
||||
ps = t.GetFungusScript().defaultPortraitStage;; // Try to get game's default portrait stage |
||||
if (t.portraitStage == null) // If no default specified, try to get any portrait stage in the scene |
||||
{ |
||||
ps = GameObject.FindObjectOfType<PortraitStage>(); |
||||
} |
||||
} |
||||
if (ps == null) |
||||
{ |
||||
EditorGUILayout.HelpBox("No portrait stage has been set. Please create a new portrait stage using [Game Object > Fungus > Portrait > Portrait Stage].", MessageType.Error); |
||||
showOptionalFields = false; |
||||
} |
||||
} |
||||
if (t.display != DisplayType.None && t.character != null && showOptionalFields) |
||||
{ |
||||
if (t.display != DisplayType.Hide && t.display != DisplayType.MoveToFront) |
||||
{ |
||||
// PORTRAIT |
||||
CommandEditor.ObjectField<Sprite>(portraitProp, |
||||
new GUIContent("Portrait", "Portrait representing character"), |
||||
new GUIContent("<Previous>"), |
||||
t.character.portraits); |
||||
if (t.character.portraitsFace != FacingDirection.None) |
||||
{ |
||||
// FACING |
||||
// Display the values of the facing enum as <-- and --> arrows to avoid confusion with position field |
||||
string[] facingArrows = new string[] |
||||
{ |
||||
"<Previous>", |
||||
"<--", |
||||
"-->", |
||||
}; |
||||
facingProp.enumValueIndex = EditorGUILayout.Popup("Facing", (int)facingProp.enumValueIndex, facingArrows); |
||||
} |
||||
else |
||||
{ |
||||
t.facing = FacingDirection.None; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
t.portrait = null; |
||||
t.facing = FacingDirection.None; |
||||
} |
||||
string toPositionPrefix = ""; |
||||
if (t.move) |
||||
{ |
||||
// MOVE |
||||
EditorGUILayout.PropertyField(moveProp); |
||||
} |
||||
if (t.move) |
||||
{ |
||||
if (t.display != DisplayType.Hide) |
||||
{ |
||||
// START FROM OFFSET |
||||
EditorGUILayout.PropertyField(shiftIntoPlaceProp); |
||||
} |
||||
} |
||||
if (t.move) |
||||
{ |
||||
if (t.display != DisplayType.Hide) |
||||
{ |
||||
if (t.shiftIntoPlace) |
||||
{ |
||||
t.fromPosition = null; |
||||
// OFFSET |
||||
// Format Enum names |
||||
string[] offsetLabels = StringFormatter.FormatEnumNames(t.offset,"<Previous>"); |
||||
offsetProp.enumValueIndex = EditorGUILayout.Popup("From Offset", (int)offsetProp.enumValueIndex, offsetLabels); |
||||
} |
||||
else |
||||
{ |
||||
t.offset = PositionOffset.None; |
||||
// FROM POSITION |
||||
CommandEditor.ObjectField<RectTransform>(fromPositionProp, |
||||
new GUIContent("From Position", "Move the portrait to this position"), |
||||
new GUIContent("<Previous>"), |
||||
ps.positions); |
||||
} |
||||
} |
||||
toPositionPrefix = "To "; |
||||
} |
||||
else |
||||
{ |
||||
t.shiftIntoPlace = false; |
||||
t.fromPosition = null; |
||||
toPositionPrefix = "At "; |
||||
} |
||||
if (t.display == DisplayType.Show || (t.display == DisplayType.Hide && t.move) ) |
||||
{ |
||||
// TO POSITION |
||||
CommandEditor.ObjectField<RectTransform>(toPositionProp, |
||||
new GUIContent(toPositionPrefix+"Position", "Move the portrait to this position"), |
||||
new GUIContent("<Previous>"), |
||||
ps.positions); |
||||
} |
||||
else |
||||
{ |
||||
t.toPosition = null; |
||||
} |
||||
if (!t.move && t.display != DisplayType.MoveToFront) |
||||
{ |
||||
// MOVE |
||||
EditorGUILayout.PropertyField(moveProp); |
||||
} |
||||
if (t.display != DisplayType.MoveToFront) |
||||
{ |
||||
|
||||
EditorGUILayout.Separator(); |
||||
|
||||
// USE DEFAULT SETTINGS |
||||
EditorGUILayout.PropertyField(useDefaultSettingsProp); |
||||
if (!t.useDefaultSettings) { |
||||
// FADE DURATION |
||||
EditorGUILayout.PropertyField(fadeDurationProp); |
||||
if (t.move) |
||||
{ |
||||
// MOVE SPEED |
||||
EditorGUILayout.PropertyField(moveSpeedProp); |
||||
} |
||||
if (t.shiftIntoPlace) |
||||
{ |
||||
// SHIFT OFFSET |
||||
EditorGUILayout.PropertyField(shiftOffsetProp); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
t.move = false; |
||||
t.useDefaultSettings = true; |
||||
EditorGUILayout.Separator(); |
||||
} |
||||
|
||||
EditorGUILayout.PropertyField(waitUntilFinishedProp); |
||||
|
||||
|
||||
if (t.portrait != null && t.display != DisplayType.Hide) |
||||
{ |
||||
Texture2D characterTexture = t.portrait.texture; |
||||
|
||||
float aspect = (float)characterTexture.width / (float)characterTexture.height; |
||||
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true)); |
||||
|
||||
if (characterTexture != null) |
||||
{ |
||||
GUI.DrawTexture(previewRect,characterTexture,ScaleMode.ScaleToFit,true,aspect); |
||||
} |
||||
} |
||||
|
||||
if (t.display != DisplayType.Hide) |
||||
{ |
||||
string portraitName = "<Previous>"; |
||||
if (t.portrait != null) |
||||
{ |
||||
portraitName = t.portrait.name; |
||||
} |
||||
string portraitSummary = " " + portraitName; |
||||
int toolbarInt = 1; |
||||
string[] toolbarStrings = {"<--", portraitSummary, "-->"}; |
||||
toolbarInt = GUILayout.Toolbar (toolbarInt, toolbarStrings, GUILayout.MinHeight(20)); |
||||
int portraitIndex = -1; |
||||
|
||||
if (toolbarInt != 1) |
||||
{ |
||||
for(int i=0; i<t.character.portraits.Count; i++){ |
||||
if(portraitName == t.character.portraits[i].name) |
||||
{ |
||||
portraitIndex = i; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (toolbarInt == 0) |
||||
{ |
||||
if(portraitIndex > 0) |
||||
{ |
||||
t.portrait = t.character.portraits[--portraitIndex]; |
||||
} |
||||
else |
||||
{ |
||||
t.portrait = null; |
||||
} |
||||
} |
||||
if (toolbarInt == 2) |
||||
{ |
||||
if(portraitIndex < t.character.portraits.Count-1) |
||||
{ |
||||
t.portrait = t.character.portraits[++portraitIndex]; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
serializedObject.ApplyModifiedProperties(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 032df7ff81b5ed44ca49742672a12676 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,91 @@
|
||||
using UnityEditor; |
||||
using UnityEditorInternal; |
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using Rotorz.ReorderableList; |
||||
|
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
[CustomEditor (typeof(Stage))] |
||||
public class StageEditor : CommandEditor |
||||
{ |
||||
protected SerializedProperty displayProp; |
||||
protected SerializedProperty portraitStageProp; |
||||
protected SerializedProperty replacedPortraitStageProp; |
||||
protected SerializedProperty useDefaultSettingsProp; |
||||
protected SerializedProperty fadeDurationProp; |
||||
protected SerializedProperty waitUntilFinishedProp; |
||||
|
||||
protected virtual void OnEnable() |
||||
{ |
||||
displayProp = serializedObject.FindProperty("display"); |
||||
portraitStageProp = serializedObject.FindProperty("portraitStage"); |
||||
replacedPortraitStageProp = serializedObject.FindProperty("replacedPortraitStage"); |
||||
useDefaultSettingsProp = serializedObject.FindProperty("useDefaultSettings"); |
||||
fadeDurationProp = serializedObject.FindProperty("fadeDuration"); |
||||
waitUntilFinishedProp = serializedObject.FindProperty("waitUntilFinished"); |
||||
} |
||||
|
||||
public override void DrawCommandGUI() |
||||
{ |
||||
serializedObject.Update(); |
||||
|
||||
Stage t = target as Stage; |
||||
|
||||
// Format Enum names |
||||
string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>"); |
||||
displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels); |
||||
|
||||
string replaceLabel = "Portrait Stage"; |
||||
if (t.display == StageDisplayType.Swap) |
||||
{ |
||||
CommandEditor.ObjectField<PortraitStage>(replacedPortraitStageProp, |
||||
new GUIContent("Replace", "Character to swap with"), |
||||
new GUIContent("<Default>"), |
||||
PortraitStage.activePortraitStages); |
||||
replaceLabel = "With"; |
||||
} |
||||
|
||||
if (PortraitStage.activePortraitStages.Count > 1) |
||||
{ |
||||
CommandEditor.ObjectField<PortraitStage>(portraitStageProp, |
||||
new GUIContent(replaceLabel, "Stage to display the character portraits on"), |
||||
new GUIContent("<Default>"), |
||||
PortraitStage.activePortraitStages); |
||||
} |
||||
|
||||
bool showOptionalFields = true; |
||||
PortraitStage ps = t.portraitStage; |
||||
// Only show optional portrait fields once required fields have been filled... |
||||
if (t.portraitStage != null) // Character is selected |
||||
{ |
||||
ps = t.GetFungusScript().defaultPortraitStage;; // Try to get game's default portrait stage |
||||
if (t.portraitStage == null) // If no default specified, try to get any portrait stage in the scene |
||||
{ |
||||
ps = GameObject.FindObjectOfType<PortraitStage>(); |
||||
} |
||||
if (ps == null) |
||||
{ |
||||
EditorGUILayout.HelpBox("No portrait stage has been set. Please create a new portrait stage using [Game Object > Fungus > Portrait > Portrait Stage].", MessageType.Error); |
||||
showOptionalFields = false; |
||||
} |
||||
} |
||||
if (t.display != StageDisplayType.None && showOptionalFields) |
||||
{ |
||||
EditorGUILayout.PropertyField(useDefaultSettingsProp); |
||||
if (!t.useDefaultSettings) |
||||
{ |
||||
EditorGUILayout.PropertyField(fadeDurationProp); |
||||
} |
||||
EditorGUILayout.PropertyField(waitUntilFinishedProp); |
||||
} |
||||
serializedObject.ApplyModifiedProperties(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 26c89a989ebd4504d84ad27ce08064d1 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,482 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
public struct PortraitState |
||||
{ |
||||
public bool onScreen; |
||||
public bool dimmed; |
||||
public DisplayType display; |
||||
public Sprite portrait; |
||||
public RectTransform position; |
||||
public FacingDirection facing; |
||||
public GameObject portraitObj; |
||||
public Image portraitImage; |
||||
} |
||||
|
||||
public enum DisplayType |
||||
{ |
||||
None, |
||||
Show, |
||||
Hide, |
||||
Replace, |
||||
MoveToFront |
||||
} |
||||
public enum FacingDirection |
||||
{ |
||||
None, |
||||
Left, |
||||
Right |
||||
} |
||||
|
||||
public enum PositionOffset |
||||
{ |
||||
None, |
||||
OffsetLeft, |
||||
OffsetRight |
||||
} |
||||
|
||||
[CommandInfo("Portrait", |
||||
"Portrait", |
||||
"Controls a character portrait. ")] |
||||
public class Portrait : Command |
||||
{ |
||||
[Tooltip("Display type")] |
||||
public PortraitStage portraitStage; |
||||
|
||||
[Tooltip("Display type")] |
||||
public DisplayType display; |
||||
|
||||
[Tooltip("Character to display")] |
||||
public Character character; |
||||
|
||||
[Tooltip("Character to swap with")] |
||||
public Character replacedCharacter; |
||||
|
||||
[Tooltip("Portrait to display")] |
||||
public Sprite portrait; |
||||
|
||||
[Tooltip("Move the portrait from/to this offset position")] |
||||
public PositionOffset offset; |
||||
|
||||
[Tooltip("Move the portrait from this position")] |
||||
public RectTransform fromPosition; |
||||
protected RectTransform fromPositionition; |
||||
|
||||
[Tooltip("Move the portrait to this positoin")] |
||||
public RectTransform toPosition; |
||||
protected RectTransform toPositionition; |
||||
|
||||
[Tooltip("Direction character is facing")] |
||||
public FacingDirection facing; |
||||
|
||||
[Tooltip("Use Default Settings")] |
||||
public bool useDefaultSettings = true; |
||||
|
||||
[Tooltip("Fade Duration")] |
||||
public float fadeDuration; |
||||
|
||||
[Tooltip("Movement Speed")] |
||||
public float moveSpeed; |
||||
|
||||
[Tooltip("Shift Offset")] |
||||
public Vector2 shiftOffset; |
||||
|
||||
[Tooltip("Move")] |
||||
public bool move; |
||||
|
||||
[Tooltip("Start from offset")] |
||||
public bool shiftIntoPlace; |
||||
|
||||
[Tooltip("Wait until the tween has finished before executing the next command")] |
||||
public bool waitUntilFinished = false; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
// If no display specified, do nothing |
||||
if (display == DisplayType.None) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
// If no character specified, do nothing |
||||
if (character == null) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
// If Replace and no replaced character specified, do nothing |
||||
if (display == DisplayType.Replace && replacedCharacter == null) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
// Selected "use default Portrait Stage" |
||||
if (portraitStage == null) // Default portrait stage selected |
||||
{ |
||||
portraitStage = GetFungusScript().defaultPortraitStage;; // Try to get game's default portrait stage |
||||
if (portraitStage == null) // If no default specified, try to get any portrait stage in the scene |
||||
{ |
||||
portraitStage = GameObject.FindObjectOfType<PortraitStage>(); |
||||
} |
||||
} |
||||
// If portrait stage does not exist, do nothing |
||||
if (portraitStage == null) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
|
||||
if (character.state.portraitImage == null) |
||||
{ |
||||
CreatePortraitObject(character,portraitStage); |
||||
} |
||||
// if no previous portrait, use default portrait |
||||
if (character.state.portrait == null) |
||||
{ |
||||
character.state.portrait = character.profileSprite; |
||||
} |
||||
// Selected "use previous portrait" |
||||
if (portrait == null) |
||||
{ |
||||
portrait = character.state.portrait; |
||||
} |
||||
// if no previous position, use default position |
||||
if (character.state.position == null) |
||||
{ |
||||
character.state.position = portraitStage.defaultPosition.rectTransform; |
||||
} |
||||
// Selected "use previous position" |
||||
if (toPosition == null) |
||||
{ |
||||
toPosition = character.state.position; |
||||
} |
||||
if (replacedCharacter != null) |
||||
{ |
||||
// if no previous position, use default position |
||||
if (replacedCharacter.state.position == null) |
||||
{ |
||||
replacedCharacter.state.position = portraitStage.defaultPosition.rectTransform; |
||||
} |
||||
} |
||||
// If swapping, use replaced character's position |
||||
if (display == DisplayType.Replace) |
||||
{ |
||||
toPosition = replacedCharacter.state.position; |
||||
} |
||||
// Selected "use previous position" |
||||
if (fromPosition == null) |
||||
{ |
||||
fromPosition = character.state.position; |
||||
} |
||||
// if portrait not moving, use from position is same as to position |
||||
if (!move) |
||||
{ |
||||
fromPosition = toPosition; |
||||
} |
||||
if (display == DisplayType.Hide) |
||||
{ |
||||
fromPosition = character.state.position; |
||||
} |
||||
// if no previous facing direction, use default facing direction |
||||
if (character.state.facing == FacingDirection.None) |
||||
{ |
||||
character.state.facing = character.portraitsFace; |
||||
} |
||||
// Selected "use previous facing direction" |
||||
if (facing == FacingDirection.None) |
||||
{ |
||||
facing = character.state.facing; |
||||
} |
||||
// Use default settings |
||||
if (useDefaultSettings) |
||||
{ |
||||
fadeDuration = portraitStage.fadeDuration; |
||||
moveSpeed = portraitStage.moveSpeed; |
||||
shiftOffset = portraitStage.shiftOffset; |
||||
} |
||||
switch(display) |
||||
{ |
||||
case (DisplayType.Show): |
||||
Show(character,fromPosition,toPosition); |
||||
character.state.onScreen = true; |
||||
portraitStage.charactersOnStage.Add(character); |
||||
break; |
||||
case (DisplayType.Hide): |
||||
Hide(character,fromPosition,toPosition); |
||||
character.state.onScreen = false; |
||||
portraitStage.charactersOnStage.Remove(character); |
||||
break; |
||||
case (DisplayType.Replace): |
||||
Show(character,fromPosition,toPosition); |
||||
Hide(replacedCharacter, replacedCharacter.state.position, replacedCharacter.state.position); |
||||
character.state.onScreen = true; |
||||
replacedCharacter.state.onScreen = false; |
||||
portraitStage.charactersOnStage.Add(character); |
||||
portraitStage.charactersOnStage.Remove(replacedCharacter); |
||||
break; |
||||
case (DisplayType.MoveToFront): |
||||
MoveToFront(character); |
||||
break; |
||||
} |
||||
|
||||
if (display == DisplayType.Replace) |
||||
{ |
||||
character.state.display = DisplayType.Show; |
||||
replacedCharacter.state.display = DisplayType.Hide; |
||||
} |
||||
else |
||||
{ |
||||
character.state.display = display; |
||||
} |
||||
character.state.portrait = portrait; |
||||
character.state.facing = facing; |
||||
character.state.position = toPosition; |
||||
if (!waitUntilFinished) |
||||
{ |
||||
Continue(); |
||||
} |
||||
} |
||||
public static void CreatePortraitObject(Character character, PortraitStage portraitStage) |
||||
{ |
||||
GameObject portraitObj = new GameObject(character.name, typeof(RectTransform), typeof(CanvasRenderer), typeof(Image)); |
||||
portraitObj.transform.SetParent(portraitStage.portraitCanvas.transform, true); |
||||
Image portraitImage = portraitObj.GetComponent<Image>(); |
||||
portraitImage.preserveAspect = true; |
||||
portraitImage.sprite = character.profileSprite; |
||||
Material portraitMaterial = Instantiate(Resources.Load("Portrait")) as Material; |
||||
portraitImage.material = portraitMaterial; |
||||
character.state.portraitObj = portraitObj; |
||||
character.state.portraitImage = portraitImage; |
||||
character.state.portraitImage.material.SetFloat("_Alpha",0); |
||||
} |
||||
protected void SetupPortrait(Character character, RectTransform fromPosition) |
||||
{ |
||||
SetRectTransform(character.state.portraitImage.rectTransform, fromPosition); |
||||
character.state.portraitImage.material.SetFloat("_Fade",0); |
||||
character.state.portraitImage.material.SetTexture("_MainTex", character.profileSprite.texture); |
||||
Texture2D blankTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); |
||||
blankTexture.SetPixel(0, 0, new Color(0f,0f,0f,0f)); |
||||
blankTexture.Apply(); |
||||
character.state.portraitImage.material.SetTexture("_TexStart", blankTexture as Texture); |
||||
character.state.portraitImage.material.SetTexture("_TexEnd", blankTexture as Texture); |
||||
if (character.state.facing != character.portraitsFace) |
||||
{ |
||||
character.state.portraitImage.material.SetFloat("_FlipStart",1); |
||||
} |
||||
else |
||||
{ |
||||
character.state.portraitImage.material.SetFloat("_FlipStart",0); |
||||
} |
||||
if (facing != character.portraitsFace) |
||||
{ |
||||
character.state.portraitImage.material.SetFloat("_FlipEnd",1); |
||||
} |
||||
else |
||||
{ |
||||
character.state.portraitImage.material.SetFloat("_FlipEnd",0); |
||||
} |
||||
character.state.portraitImage.material.SetFloat("_Alpha",1); |
||||
} |
||||
public static void SetRectTransform(RectTransform oldRectTransform, RectTransform newRectTransform) |
||||
{ |
||||
oldRectTransform.eulerAngles = newRectTransform.eulerAngles; |
||||
oldRectTransform.position = newRectTransform.position; |
||||
oldRectTransform.rotation = newRectTransform.rotation; |
||||
oldRectTransform.anchoredPosition = newRectTransform.anchoredPosition; |
||||
oldRectTransform.sizeDelta = newRectTransform.sizeDelta; |
||||
oldRectTransform.anchorMax = newRectTransform.anchorMax; |
||||
oldRectTransform.anchorMin = newRectTransform.anchorMin; |
||||
oldRectTransform.pivot = newRectTransform.pivot; |
||||
oldRectTransform.localScale = newRectTransform.localScale; |
||||
} |
||||
protected void Show(Character character, RectTransform fromPosition, RectTransform toPosition) |
||||
{ |
||||
if (shiftIntoPlace) |
||||
{ |
||||
fromPosition = Instantiate(toPosition) as RectTransform; |
||||
if (offset == PositionOffset.OffsetLeft) |
||||
{ |
||||
fromPosition.anchoredPosition = new Vector2(fromPosition.anchoredPosition.x-Mathf.Abs(shiftOffset.x), fromPosition.anchoredPosition.y-Mathf.Abs(shiftOffset.y)); |
||||
} |
||||
else if (offset == PositionOffset.OffsetRight) |
||||
{ |
||||
fromPosition.anchoredPosition = new Vector2(fromPosition.anchoredPosition.x+Mathf.Abs(shiftOffset.x), fromPosition.anchoredPosition.y+Mathf.Abs(shiftOffset.y)); |
||||
} |
||||
else |
||||
{ |
||||
fromPosition.anchoredPosition = new Vector2(fromPosition.anchoredPosition.x, fromPosition.anchoredPosition.y); |
||||
} |
||||
} |
||||
SetupPortrait(character, fromPosition); |
||||
if (character.state.display != DisplayType.None && character.state.display != DisplayType.Hide) |
||||
{ |
||||
character.state.portraitImage.material.SetTexture("_TexStart", character.state.portrait.texture); |
||||
} |
||||
character.state.portraitImage.material.SetTexture("_TexEnd", portrait.texture); |
||||
UpdateTweens(character, fromPosition, toPosition); |
||||
} |
||||
protected void Hide(Character character, RectTransform fromPosition, RectTransform toPosition) |
||||
{ |
||||
if (character.state.display == DisplayType.None) |
||||
{ |
||||
return; |
||||
} |
||||
SetupPortrait(character, fromPosition); |
||||
character.state.portraitImage.material.SetTexture("_TexStart", character.state.portrait.texture); |
||||
UpdateTweens(character, fromPosition, toPosition); |
||||
} |
||||
protected void MoveToFront(Character character) |
||||
{ |
||||
character.state.portraitImage.transform.SetSiblingIndex(character.state.portraitImage.transform.parent.childCount); |
||||
} |
||||
protected void UpdateTweens(Character character, RectTransform fromPosition, RectTransform toPosition) |
||||
{ |
||||
if (fadeDuration == 0) fadeDuration = float.Epsilon; |
||||
LeanTween.value(character.state.portraitObj,0,1,fadeDuration).setEase(portraitStage.fadeEaseType).setOnComplete(OnComplete).setOnUpdate( |
||||
(float fadeAmount)=>{ |
||||
character.state.portraitImage.material.SetFloat("_Fade", fadeAmount); |
||||
} |
||||
); |
||||
float moveDuration = (Vector3.Distance(fromPosition.anchoredPosition,toPosition.anchoredPosition)/moveSpeed); |
||||
if (moveSpeed == 0) moveDuration = float.Epsilon; |
||||
LeanTween.value(character.state.portraitObj,fromPosition.anchoredPosition,toPosition.anchoredPosition,moveDuration).setEase(portraitStage.moveEaseType).setOnComplete(OnComplete).setOnUpdate( |
||||
(Vector3 updatePosition)=>{ |
||||
character.state.portraitImage.rectTransform.anchoredPosition = updatePosition; |
||||
} |
||||
); |
||||
} |
||||
public static void Dim(Character character, PortraitStage portraitStage) |
||||
{ |
||||
if (character.state.dimmed == false) |
||||
{ |
||||
character.state.dimmed = true; |
||||
float fadeDuration = portraitStage.fadeDuration; |
||||
if (fadeDuration == 0) fadeDuration = float.Epsilon; |
||||
LeanTween.value(character.state.portraitObj,1f,0.5f,fadeDuration).setEase(portraitStage.fadeEaseType).setOnUpdate( |
||||
(float tintAmount)=>{ |
||||
Color tint = new Color(tintAmount,tintAmount,tintAmount,1); |
||||
character.state.portraitImage.material.SetColor("_Color", tint); |
||||
} |
||||
); |
||||
} |
||||
} |
||||
public static void Undim(Character character, PortraitStage portraitStage) |
||||
{ |
||||
if (character.state.dimmed == true) |
||||
{ |
||||
character.state.dimmed = false; |
||||
float fadeDuration = portraitStage.fadeDuration; |
||||
if (fadeDuration == 0) fadeDuration = float.Epsilon; |
||||
LeanTween.value(character.state.portraitObj,0.5f,1f,fadeDuration).setEase(portraitStage.fadeEaseType).setOnUpdate( |
||||
(float tintAmount)=>{ |
||||
Color tint = new Color(tintAmount,tintAmount,tintAmount,1); |
||||
character.state.portraitImage.material.SetColor("_Color", tint); |
||||
} |
||||
); |
||||
} |
||||
} |
||||
protected void OnComplete() |
||||
{ |
||||
if (waitUntilFinished) |
||||
{ |
||||
if (!LeanTween.isTweening (character.state.portraitObj)) |
||||
{ |
||||
Continue(); |
||||
} |
||||
} |
||||
} |
||||
public override string GetSummary() |
||||
{ |
||||
if (display == DisplayType.None && character == null) |
||||
{ |
||||
return "Error: No character or display selected"; |
||||
} |
||||
else if (display == DisplayType.None) |
||||
{ |
||||
return "Error: No display selected"; |
||||
} |
||||
else if (character == null) |
||||
{ |
||||
return "Error: No character selected"; |
||||
} |
||||
string displaySummary = ""; |
||||
string characterSummary = ""; |
||||
string fromPositionSummary = ""; |
||||
string toPositionSummary = ""; |
||||
string portraitStageSummary = ""; |
||||
string portraitSummary = ""; |
||||
string facingSummary = ""; |
||||
|
||||
displaySummary = StringFormatter.SplitCamelCase(display.ToString()); |
||||
|
||||
if (display == DisplayType.Replace) |
||||
{ |
||||
if (replacedCharacter != null) |
||||
{ |
||||
displaySummary += " \"" + replacedCharacter.name + "\" with"; |
||||
} |
||||
} |
||||
characterSummary = character.name; |
||||
if (portraitStage != null) |
||||
{ |
||||
portraitStageSummary = " on \"" + portraitStage.name + "\""; |
||||
} |
||||
|
||||
if (portrait != null) |
||||
{ |
||||
portraitSummary = " " + portrait.name; |
||||
} |
||||
if (shiftIntoPlace) |
||||
{ |
||||
if (offset != 0) |
||||
{ |
||||
fromPositionSummary = offset.ToString(); |
||||
fromPositionSummary = " from " + "\"" + fromPositionSummary + "\""; |
||||
} |
||||
} |
||||
else if (fromPosition != null) |
||||
{ |
||||
fromPositionSummary = " from " + "\"" + fromPosition.name + "\""; |
||||
} |
||||
if (toPosition != null) |
||||
{ |
||||
string toPositionPrefixSummary = ""; |
||||
if (move) |
||||
toPositionPrefixSummary = " to "; |
||||
else |
||||
toPositionPrefixSummary = " at "; |
||||
toPositionSummary = toPositionPrefixSummary + "\"" + toPosition.name + "\""; |
||||
} |
||||
if (facing != FacingDirection.None) |
||||
{ |
||||
if ( facing == FacingDirection.Left ) |
||||
{ |
||||
facingSummary = "<--"; |
||||
} |
||||
if ( facing == FacingDirection.Right ) |
||||
{ |
||||
facingSummary = "-->"; |
||||
} |
||||
facingSummary = " facing \"" + facingSummary + "\""; |
||||
} |
||||
return displaySummary + " \"" + characterSummary + portraitSummary + "\"" + portraitStageSummary + facingSummary + fromPositionSummary + toPositionSummary; |
||||
} |
||||
|
||||
public override Color GetButtonColor() |
||||
{ |
||||
return new Color32(230, 200, 250, 255); |
||||
} |
||||
|
||||
public override void OnCommandAdded(Sequence parentSequence) |
||||
{ |
||||
//Default to display type: show |
||||
display = DisplayType.Show; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3ac5ce55bc698fa4290939ef6e426501 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,41 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
public class PortraitStage : MonoBehaviour |
||||
{ |
||||
public Canvas portraitCanvas; |
||||
public bool dimPortraits; |
||||
public float fadeDuration; |
||||
public float moveSpeed; |
||||
public LeanTweenType fadeEaseType; |
||||
public LeanTweenType moveEaseType; |
||||
public Vector2 shiftOffset; |
||||
public Image defaultPosition; |
||||
public List<RectTransform> positions; |
||||
public List<Character> charactersOnStage = new List<Character>(); |
||||
|
||||
[HideInInspector] |
||||
static public List<PortraitStage> activePortraitStages = new List<PortraitStage>(); |
||||
|
||||
[ExecuteInEditMode] |
||||
protected virtual void OnEnable() |
||||
{ |
||||
if (!activePortraitStages.Contains(this)) |
||||
{ |
||||
activePortraitStages.Add(this); |
||||
} |
||||
} |
||||
[ExecuteInEditMode] |
||||
protected virtual void OnDisable() |
||||
{ |
||||
activePortraitStages.Remove(this); |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 6f6478b25a400c642b2dee75f022ab12 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: bc13409addc0175478468496602b7880 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,75 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!1 &195640 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22495640} |
||||
- 222: {fileID: 22295640} |
||||
- 114: {fileID: 11495640} |
||||
m_Layer: 0 |
||||
m_Name: PortraitPosition |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!114 &11495640 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 195640} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 2100000, guid: 84ea47f59517f4ac1815f552cc8d60bc, type: 2} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!222 &22295640 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 195640} |
||||
--- !u!224 &22495640 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 195640} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: 0, y: 200} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!1001 &100100000 |
||||
Prefab: |
||||
m_ObjectHideFlags: 1 |
||||
serializedVersion: 2 |
||||
m_Modification: |
||||
m_TransformParent: {fileID: 0} |
||||
m_Modifications: [] |
||||
m_RemovedComponents: [] |
||||
m_ParentPrefab: {fileID: 0} |
||||
m_RootGameObject: {fileID: 195640} |
||||
m_IsPrefabParent: 1 |
||||
m_IsExploded: 1 |
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 7a4c270a5c18f6549a7683844dbf9f22 |
||||
NativeFormatImporter: |
||||
userData: |
@ -0,0 +1,479 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!1 &110270 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410270} |
||||
- 222: {fileID: 22210270} |
||||
- 114: {fileID: 11410270} |
||||
m_Layer: 0 |
||||
m_Name: Right |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110272 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410272} |
||||
- 222: {fileID: 22210272} |
||||
- 114: {fileID: 11410272} |
||||
m_Layer: 0 |
||||
m_Name: Offscreen Left |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110274 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 410270} |
||||
- 114: {fileID: 11410274} |
||||
m_Layer: 0 |
||||
m_Name: PortraitStage |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110276 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410274} |
||||
- 223: {fileID: 22310270} |
||||
- 114: {fileID: 11410278} |
||||
- 114: {fileID: 11410276} |
||||
- 225: {fileID: 22510270} |
||||
m_Layer: 5 |
||||
m_Name: Canvas |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110278 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410276} |
||||
- 222: {fileID: 22210274} |
||||
- 114: {fileID: 11410280} |
||||
m_Layer: 0 |
||||
m_Name: Middle |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110280 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410278} |
||||
- 222: {fileID: 22210276} |
||||
- 114: {fileID: 11410282} |
||||
m_Layer: 0 |
||||
m_Name: Offscreen Right |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!1 &110282 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 224: {fileID: 22410280} |
||||
- 222: {fileID: 22210278} |
||||
- 114: {fileID: 11410284} |
||||
m_Layer: 0 |
||||
m_Name: Left |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!4 &410270 |
||||
Transform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110274} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: -480.924713, y: -314.928009, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: |
||||
- {fileID: 22410274} |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
--- !u!114 &11410270 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110270} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 0} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!114 &11410272 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110272} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 0} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!114 &11410274 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110274} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 6f6478b25a400c642b2dee75f022ab12, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
portraitCanvas: {fileID: 22310270} |
||||
dimPortraits: 1 |
||||
fadeDuration: .5 |
||||
moveSpeed: 800 |
||||
fadeEaseType: 1 |
||||
moveEaseType: 4 |
||||
slideOffset: {x: 300, y: 0} |
||||
defaultPosition: {fileID: 11410280} |
||||
positions: |
||||
- {fileID: 22410280} |
||||
- {fileID: 22410276} |
||||
- {fileID: 22410270} |
||||
- {fileID: 22410272} |
||||
- {fileID: 22410278} |
||||
--- !u!114 &11410276 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110276} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_UiScaleMode: 1 |
||||
m_ReferencePixelsPerUnit: 100 |
||||
m_ScaleFactor: 1 |
||||
m_ReferenceResolution: {x: 1600, y: 1200} |
||||
m_ScreenMatchMode: 0 |
||||
m_MatchWidthOrHeight: 1 |
||||
m_PhysicalUnit: 3 |
||||
m_FallbackScreenDPI: 96 |
||||
m_DefaultSpriteDPI: 96 |
||||
m_DynamicPixelsPerUnit: 1 |
||||
--- !u!114 &11410278 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110276} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
ignoreReversedGraphics: 1 |
||||
blockingObjects: 0 |
||||
m_BlockingMask: |
||||
serializedVersion: 2 |
||||
m_Bits: 4294967295 |
||||
--- !u!114 &11410280 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110278} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 0} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!114 &11410282 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110280} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 0} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!114 &11410284 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110282} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
m_Material: {fileID: 0} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 0} |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Type: 0 |
||||
m_PreserveAspect: 1 |
||||
m_FillCenter: 1 |
||||
m_FillMethod: 4 |
||||
m_FillAmount: 1 |
||||
m_FillClockwise: 1 |
||||
m_FillOrigin: 0 |
||||
--- !u!222 &22210270 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110270} |
||||
--- !u!222 &22210272 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110272} |
||||
--- !u!222 &22210274 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110278} |
||||
--- !u!222 &22210276 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110280} |
||||
--- !u!222 &22210278 |
||||
CanvasRenderer: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110282} |
||||
--- !u!223 &22310270 |
||||
Canvas: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110276} |
||||
m_Enabled: 1 |
||||
serializedVersion: 2 |
||||
m_RenderMode: 0 |
||||
m_Camera: {fileID: 0} |
||||
m_PlaneDistance: 100 |
||||
m_PixelPerfect: 1 |
||||
m_ReceivesEvents: 1 |
||||
m_OverrideSorting: 0 |
||||
m_OverridePixelPerfect: 0 |
||||
m_SortingLayerID: 0 |
||||
m_SortingOrder: 0 |
||||
--- !u!224 &22410270 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110270} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 22410274} |
||||
m_RootOrder: 2 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: 449.999969, y: 200.000031} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!224 &22410272 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110272} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 22410274} |
||||
m_RootOrder: 3 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: -1000, y: 200} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!224 &22410274 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110276} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 0, y: 0, z: 0} |
||||
m_Children: |
||||
- {fileID: 22410276} |
||||
- {fileID: 22410280} |
||||
- {fileID: 22410270} |
||||
- {fileID: 22410272} |
||||
- {fileID: 22410278} |
||||
m_Father: {fileID: 410270} |
||||
m_RootOrder: 0 |
||||
m_AnchorMin: {x: 0, y: 0} |
||||
m_AnchorMax: {x: 0, y: 0} |
||||
m_AnchoredPosition: {x: 0, y: 0} |
||||
m_SizeDelta: {x: 0, y: 0} |
||||
m_Pivot: {x: 0, y: 0} |
||||
--- !u!224 &22410276 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110278} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 22410274} |
||||
m_RootOrder: 0 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: 0, y: 200} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!224 &22410278 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110280} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 22410274} |
||||
m_RootOrder: 4 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: 1000, y: 200} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!224 &22410280 |
||||
RectTransform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110282} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 22410274} |
||||
m_RootOrder: 1 |
||||
m_AnchorMin: {x: .5, y: 0} |
||||
m_AnchorMax: {x: .5, y: 0} |
||||
m_AnchoredPosition: {x: -450, y: 200} |
||||
m_SizeDelta: {x: 1000, y: 1000} |
||||
m_Pivot: {x: .5, y: 0} |
||||
--- !u!225 &22510270 |
||||
CanvasGroup: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 100100000} |
||||
m_GameObject: {fileID: 110276} |
||||
m_Enabled: 1 |
||||
m_Alpha: 1 |
||||
m_Interactable: 1 |
||||
m_BlocksRaycasts: 1 |
||||
m_IgnoreParentGroups: 0 |
||||
--- !u!1001 &100100000 |
||||
Prefab: |
||||
m_ObjectHideFlags: 1 |
||||
serializedVersion: 2 |
||||
m_Modification: |
||||
m_TransformParent: {fileID: 0} |
||||
m_Modifications: [] |
||||
m_RemovedComponents: [] |
||||
m_ParentPrefab: {fileID: 0} |
||||
m_RootGameObject: {fileID: 110274} |
||||
m_IsPrefabParent: 1 |
||||
m_IsExploded: 1 |
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: c6289d5f8fa843145a2355af9cb09719 |
||||
NativeFormatImporter: |
||||
userData: |
@ -0,0 +1,226 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using UnityEngine.Events; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
public enum StageDisplayType |
||||
{ |
||||
None, |
||||
Show, |
||||
Hide, |
||||
Swap, |
||||
MoveToFront, |
||||
UndimAllPortraits, |
||||
DimNonSpeakingPortraits |
||||
} |
||||
|
||||
[CommandInfo("Portrait", |
||||
"Stage", |
||||
"Controls the stage on which character portraits are displayed.")] |
||||
public class Stage : Command |
||||
{ |
||||
[Tooltip("Display type")] |
||||
public StageDisplayType display; |
||||
|
||||
[Tooltip("Stage to display characters on")] |
||||
public PortraitStage portraitStage; |
||||
|
||||
[Tooltip("PortraitStage to swap with")] |
||||
public PortraitStage replacedPortraitStage; |
||||
|
||||
[Tooltip("Use Default Settings")] |
||||
public bool useDefaultSettings = true; |
||||
|
||||
[Tooltip("Fade Duration")] |
||||
public float fadeDuration; |
||||
|
||||
[Tooltip("Wait until the tween has finished before executing the next command")] |
||||
public bool waitUntilFinished = false; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
// If no display specified, do nothing |
||||
if (display == StageDisplayType.None) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
// Selected "use default Portrait Stage" |
||||
if (portraitStage == null) // Default portrait stage selected |
||||
{ |
||||
portraitStage = GetFungusScript().defaultPortraitStage;; // Try to get game's default portrait stage |
||||
if (portraitStage == null) // If no default specified, try to get any portrait stage in the scene |
||||
{ |
||||
portraitStage = GameObject.FindObjectOfType<PortraitStage>(); |
||||
} |
||||
} |
||||
// If portrait stage does not exist, do nothing |
||||
if (portraitStage == null) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
// Selected "use default Portrait Stage" |
||||
if (display == StageDisplayType.Swap) // Default portrait stage selected |
||||
{ |
||||
replacedPortraitStage = GetFungusScript().defaultPortraitStage;; // Try to get game's default portrait stage |
||||
if (replacedPortraitStage == null) // If no default specified, try to get any portrait stage in the scene |
||||
{ |
||||
replacedPortraitStage = GameObject.FindObjectOfType<PortraitStage>(); |
||||
} |
||||
// If portrait stage does not exist, do nothing |
||||
if (replacedPortraitStage == null) |
||||
{ |
||||
Continue(); |
||||
return; |
||||
} |
||||
} |
||||
// Use default settings |
||||
if (useDefaultSettings) |
||||
{ |
||||
fadeDuration = portraitStage.fadeDuration; |
||||
} |
||||
switch(display) |
||||
{ |
||||
case (StageDisplayType.Show): |
||||
Show(portraitStage); |
||||
break; |
||||
case (StageDisplayType.Hide): |
||||
Hide(portraitStage); |
||||
break; |
||||
case (StageDisplayType.Swap): |
||||
Show(portraitStage); |
||||
Hide(replacedPortraitStage); |
||||
break; |
||||
case (StageDisplayType.MoveToFront): |
||||
MoveToFront(portraitStage); |
||||
break; |
||||
case (StageDisplayType.UndimAllPortraits): |
||||
UndimAllPortraits(portraitStage); |
||||
break; |
||||
case (StageDisplayType.DimNonSpeakingPortraits): |
||||
DimNonSpeakingPortraits(portraitStage); |
||||
break; |
||||
} |
||||
|
||||
if (!waitUntilFinished) |
||||
{ |
||||
Continue(); |
||||
} |
||||
} |
||||
protected void Show(PortraitStage portraitStage) |
||||
{ |
||||
if (fadeDuration == 0) |
||||
{ |
||||
fadeDuration = float.Epsilon; |
||||
} |
||||
|
||||
LeanTween.value(gameObject,0,1,fadeDuration).setOnUpdate( |
||||
(float fadeAmount)=>{ |
||||
foreach ( Character c in portraitStage.charactersOnStage) |
||||
{ |
||||
c.state.portraitImage.material.SetFloat("_Alpha",fadeAmount); |
||||
} |
||||
} |
||||
).setOnComplete( |
||||
()=>{ |
||||
foreach ( Character c in portraitStage.charactersOnStage) |
||||
{ |
||||
c.state.portraitImage.material.SetFloat("_Alpha",1); |
||||
} |
||||
OnComplete(); |
||||
} |
||||
); |
||||
} |
||||
protected void Hide(PortraitStage portraitStage) |
||||
{ |
||||
if (fadeDuration == 0) |
||||
{ |
||||
fadeDuration = float.Epsilon; |
||||
} |
||||
|
||||
LeanTween.value(gameObject,1,0,fadeDuration).setOnUpdate( |
||||
(float fadeAmount)=>{ |
||||
foreach ( Character c in portraitStage.charactersOnStage) |
||||
{ |
||||
c.state.portraitImage.material.SetFloat("_Alpha",fadeAmount); |
||||
} |
||||
} |
||||
).setOnComplete( |
||||
()=>{ |
||||
foreach ( Character c in portraitStage.charactersOnStage) |
||||
{ |
||||
c.state.portraitImage.material.SetFloat("_Alpha",0); |
||||
} |
||||
OnComplete(); |
||||
} |
||||
); |
||||
} |
||||
protected void MoveToFront(PortraitStage portraitStage) |
||||
{ |
||||
foreach (PortraitStage ps in PortraitStage.activePortraitStages) |
||||
{ |
||||
if (ps == portraitStage) |
||||
{ |
||||
ps.portraitCanvas.sortingOrder = 1; |
||||
} |
||||
else |
||||
{ |
||||
ps.portraitCanvas.sortingOrder = 0; |
||||
} |
||||
} |
||||
} |
||||
protected void UndimAllPortraits(PortraitStage portraitStage) |
||||
{ |
||||
portraitStage.dimPortraits = false; |
||||
foreach (Character character in portraitStage.charactersOnStage) |
||||
{ |
||||
Portrait.Undim(character,portraitStage); |
||||
} |
||||
} |
||||
protected void DimNonSpeakingPortraits(PortraitStage portraitStage) |
||||
{ |
||||
portraitStage.dimPortraits = true; |
||||
} |
||||
protected void OnComplete() |
||||
{ |
||||
if (waitUntilFinished) |
||||
{ |
||||
Continue(); |
||||
} |
||||
} |
||||
public override string GetSummary() |
||||
{ |
||||
string displaySummary = ""; |
||||
if (display != StageDisplayType.None) |
||||
{ |
||||
displaySummary = StringFormatter.SplitCamelCase(display.ToString()); |
||||
} |
||||
else |
||||
{ |
||||
return "Error: No display selected"; |
||||
} |
||||
string portraitStageSummary = ""; |
||||
if (portraitStage != null) |
||||
{ |
||||
portraitStageSummary = " \"" + portraitStage.name + "\""; |
||||
} |
||||
return displaySummary + portraitStageSummary; |
||||
} |
||||
|
||||
public override Color GetButtonColor() |
||||
{ |
||||
return new Color32(230, 200, 250, 255); |
||||
} |
||||
|
||||
public override void OnCommandAdded(Sequence parentSequence) |
||||
{ |
||||
//Default to display type: show |
||||
display = StageDisplayType.Show; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: f1ff0f540016ff64ab1556db6fe1e10f |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: bfdd031cf416e4f20900a580a6ffccd6 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e538b0104f03e434193a1e945ea7e39e |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8f1983c921f94c94291718e0094f1d6b |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: f40e440dde308d1429c8b03dbe1a3b8c |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 04ec89a3ffad38d4ab18f563a895c6ba |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e15cd033e8242884fa44bbbffb3635e4 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 61bed2868b732754d8642fd8cf3ea4f1 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: be122d5e134d8fb46a8f0d559bf85f08 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 72d43fdfb85cbb04187e145717cfc970 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 2c83109679b046a45a12f2ab05210351 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: a84a8e1a17e158c48b4d308292df81db |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: cf4986a7000bafc498f65f9d71ab28d1 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 682fe1817a668354d986bb418c9a75fe |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 40c43dcdccf69ed46b85dd1dc5566184 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 70f3ad5c22ae4f442a18b2784b073d44 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: d64bcc814caf23c41ba706c2d4f06724 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 08ed144a85c2c844ab568517982e0924 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 476f002f45c7655408b9e7b1fa186f26 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 7dd97c8fce954be4090b43296036bf75 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 9e747544e092d9543b6d81b14434358e |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8b619861be9f614458920a34a125727f |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: f5ffbadf97e0bd24bae41734cf28d2da |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: c467b39701f3e0644b3361508f474021 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 753c104435015c240a34199227ab10be |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e794f7f8b387c4242a6e1e61f1c85b17 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: bae673dd6cc6a3a4bba065590ad3e41c |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: afe3a8baede25d74f9a4e324c65c97bf |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: f3c866bbc4639e7409c30c71736d84a6 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: 0 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 15b7769150522a54ca7b0e5830ead528 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 48184afb80ef8194880b215ae1b13b1d |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e513fc9af808b8c438338e58bc17a700 |
||||
AudioImporter: |
||||
serializedVersion: 4 |
||||
format: -1 |
||||
quality: -1 |
||||
stream: 1 |
||||
3D: 1 |
||||
forceToMono: 0 |
||||
useHardware: 0 |
||||
loopable: 0 |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e75d2824582e33f49b9d53af12dc070c |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue