Browse Source

Merge pull request #142 from FungusGames/#141-Reset-text-box-width

#141 Reset text box width
master
Chris Gregan 9 years ago
parent
commit
3dd3218f71
  1. 7
      Assets/Fungus/Narrative/Scripts/SayDialog.cs
  2. 122
      Assets/FungusExamples/TheHunter/TheHunter.unity
  3. 271
      Assets/Tests/Narrative/NarrativeTests.unity
  4. 63
      Assets/Tests/Narrative/OverlapTests.cs
  5. 12
      Assets/Tests/Narrative/OverlapTests.cs.meta

7
Assets/Fungus/Narrative/Scripts/SayDialog.cs

@ -282,6 +282,13 @@ namespace Fungus
else
{
characterImage.gameObject.SetActive(false);
if (startStoryTextWidth != 0)
{
storyText.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left,
startStoryTextInset,
startStoryTextWidth);
}
}
// Adjust story text box to not overlap image rect

122
Assets/FungusExamples/TheHunter/TheHunter.unity

@ -782,13 +782,8 @@ Transform:
- {fileID: 339869594}
- {fileID: 338947447}
- {fileID: 686889653}
- {fileID: 494523727}
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!4 &494523727 stripped
Transform:
m_PrefabParentObject: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
m_PrefabInternal: {fileID: 1557115304}
--- !u!1 &518300786
GameObject:
m_ObjectHideFlags: 1
@ -1421,123 +1416,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!1001 &1557115304
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 488519165}
m_Modifications:
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: portraits.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: translatedName.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalPosition.x
value: -377.012329
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalPosition.y
value: -60.5565338
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: profileSprite
value:
objectReference: {fileID: 21300000, guid: 05ccd53483a554ca9b31f685fa76154a,
type: 3}
- target: {fileID: 100000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: m_Name
value: Ciara2
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: nameText
value: Ciara
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: nameColor.r
value: .925490201
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: nameColor.g
value: .482352942
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: nameColor.b
value: .196078435
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: typingSound
value:
objectReference: {fileID: 8300000, guid: 124184555ec434aa68814be3bd116c26, type: 3}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: soundEffect
value:
objectReference: {fileID: 8300000, guid: 124184555ec434aa68814be3bd116c26, type: 3}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: portraits.Array.data[0]
value:
objectReference: {fileID: 21300000, guid: 05ccd53483a554ca9b31f685fa76154a,
type: 3}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: sayDialogBox
value:
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: chooseDialogBox
value:
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: portraits.Array.data[1]
value:
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: portraits.Array.data[2]
value:
objectReference: {fileID: 21300000, guid: f7484a661774243b193bebc6e3ae5120,
type: 3}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: portraitsFace
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: translatedName.Array.data[0].language
value: english
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
propertyPath: translatedName.Array.data[0].text
value: Ciara
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: b20518d45890e4be59ba82946f88026c, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1594072534
GameObject:
m_ObjectHideFlags: 0

271
Assets/Tests/Narrative/NarrativeTests.unity

@ -114,7 +114,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 736071350}
selectedFlowchart: {fileID: 1913435020}
--- !u!4 &11556238
Transform:
m_ObjectHideFlags: 1
@ -1153,6 +1153,10 @@ Prefab:
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 188902, guid: 8a005a9e0713f4cc1b5ad29fb07657d3, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8a005a9e0713f4cc1b5ad29fb07657d3, type: 2}
m_IsPrefabParent: 0
@ -1515,9 +1519,8 @@ GameObject:
m_Component:
- 4: {fileID: 392887985}
- 114: {fileID: 392887986}
- 114: {fileID: 392887987}
m_Layer: 0
m_Name: TestAssertions
m_Name: TestChecker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1543,40 +1546,11 @@ MonoBehaviour:
m_GameObject: {fileID: 392887984}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8bafa54482a87ac4cbd7ff1bfd1ac93a, type: 3}
m_Script: {fileID: 11500000, guid: dfa0c65e278214560ba42bc8fef024e6, type: 3}
m_Name:
m_EditorClassIdentifier:
checkAfterTime: .5
repeatCheckTime: 0
repeatEveryTime: 1
checkAfterFrames: 1
repeatCheckFrame: 1
repeatEveryFrame: 1
hasFailed: 0
checkMethods: 1
m_ActionBase: {fileID: 1408819084}
checksPerformed: 0
--- !u!114 &392887987
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 392887984}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8bafa54482a87ac4cbd7ff1bfd1ac93a, type: 3}
m_Name:
m_EditorClassIdentifier:
checkAfterTime: 3.5
repeatCheckTime: 0
repeatEveryTime: 1
checkAfterFrames: 1
repeatCheckFrame: 1
repeatEveryFrame: 1
hasFailed: 0
checkMethods: 1
m_ActionBase: {fileID: 665418248}
checksPerformed: 0
sayDialog_LeftImage: {fileID: 538232720}
sayDialog_RightImage: {fileID: 1508308453}
--- !u!1 &401634244
GameObject:
m_ObjectHideFlags: 0
@ -2214,23 +2188,6 @@ CanvasRenderer:
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 658513471}
--- !u!114 &665418248
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2586c8e41f35d2f4fadde53020bf4207, type: 3}
m_Name:
m_EditorClassIdentifier:
go: {fileID: 1382140668}
thisPropertyPath: gameObject.activeSelf
compareToType: 1
other: {fileID: 0}
otherPropertyPath:
constantValueGeneric: 1
--- !u!1 &685425358
GameObject:
m_ObjectHideFlags: 0
@ -2246,7 +2203,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &685425359
Transform:
m_ObjectHideFlags: 0
@ -2275,9 +2232,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3}
m_Name:
m_EditorClassIdentifier:
timeout: 5
timeout: 15
ignored: 0
succeedAfterAllAssertionsAreExecuted: 1
succeedAfterAllAssertionsAreExecuted: 0
expectException: 0
expectedExceptionList:
succeedWhenExceptionIsThrown: 0
@ -2529,8 +2486,7 @@ MonoBehaviour:
width: 1121
height: 870
selectedBlock: {fileID: 736071349}
selectedCommands:
- {fileID: 736071366}
selectedCommands: []
variables: []
description:
stepPause: 0
@ -5200,27 +5156,6 @@ Prefab:
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8a005a9e0713f4cc1b5ad29fb07657d3, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1382140668 stripped
GameObject:
m_PrefabParentObject: {fileID: 148914, guid: 8a005a9e0713f4cc1b5ad29fb07657d3, type: 2}
m_PrefabInternal: {fileID: 141635719}
--- !u!114 &1408819084
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2586c8e41f35d2f4fadde53020bf4207, type: 3}
m_Name:
m_EditorClassIdentifier:
go: {fileID: 1382140668}
thisPropertyPath: gameObject.activeSelf
compareToType: 1
other: {fileID: 0}
otherPropertyPath:
constantValueGeneric: 1
--- !u!224 &1439815621 stripped
RectTransform:
m_PrefabParentObject: {fileID: 22410276, guid: c6289d5f8fa843145a2355af9cb09719,
@ -6111,6 +6046,12 @@ GameObject:
- 114: {fileID: 1913435024}
- 114: {fileID: 1913435026}
- 114: {fileID: 1913435025}
- 114: {fileID: 1913435027}
- 114: {fileID: 1913435028}
- 114: {fileID: 1913435032}
- 114: {fileID: 1913435031}
- 114: {fileID: 1913435030}
- 114: {fileID: 1913435029}
m_Layer: 0
m_Name: Flowchart
m_TagString: Untagged
@ -6156,7 +6097,7 @@ MonoBehaviour:
height: 859
selectedBlock: {fileID: 1913435022}
selectedCommands:
- {fileID: 1913435025}
- {fileID: 1913435029}
variables: []
description:
stepPause: 0
@ -6214,8 +6155,14 @@ MonoBehaviour:
commandList:
- {fileID: 1913435024}
- {fileID: 1913435021}
- {fileID: 1913435032}
- {fileID: 1913435027}
- {fileID: 1913435031}
- {fileID: 1913435026}
- {fileID: 1913435025}
- {fileID: 1913435030}
- {fileID: 1913435028}
- {fileID: 1913435029}
--- !u!114 &1913435023
MonoBehaviour:
m_ObjectHideFlags: 2
@ -6259,8 +6206,8 @@ MonoBehaviour:
indentLevel: 0
storyText: A long block of text that runs all the way to the end of the text box{w=1}{x}
description:
character: {fileID: 0}
portrait: {fileID: 0}
character: {fileID: 1045375690}
portrait: {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3}
voiceOverClip: {fileID: 0}
showAlways: 1
showCount: 1
@ -6283,6 +6230,166 @@ MonoBehaviour:
errorMessage:
indentLevel: 0
sayDialog: {fileID: 538232720}
--- !u!114 &1913435027
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
storyText: No character. A long block of text that runs all the way to the end of
the text box{w=1}{x}
description:
character: {fileID: 0}
portrait: {fileID: 0}
voiceOverClip: {fileID: 0}
showAlways: 1
showCount: 1
extendPrevious: 0
fadeWhenDone: 1
waitForClick: 1
setSayDialog: {fileID: 0}
--- !u!114 &1913435028
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
storyText: No character. A long block of text that runs all the way to the end of
the text box{w=1}{x}
description:
character: {fileID: 0}
portrait: {fileID: 0}
voiceOverClip: {fileID: 0}
showAlways: 1
showCount: 1
extendPrevious: 0
fadeWhenDone: 1
waitForClick: 1
setSayDialog: {fileID: 0}
--- !u!114 &1913435029
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 688e35811870d403f9e2b1ab2a699d98, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
targetComponentFullname: UnityEngine.Component[]
targetComponentText: OverlapTests
targetMethod: Step4
targetMethodText: 'Step4 (): Void'
methodParameters: []
saveReturnValue: 0
returnValueVariableKey:
returnValueType: System.Void
showInherited: 0
callMode: 0
--- !u!114 &1913435030
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 688e35811870d403f9e2b1ab2a699d98, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
targetComponentFullname: UnityEngine.Component[]
targetComponentText: OverlapTests
targetMethod: Step3
targetMethodText: 'Step3 (): Void'
methodParameters: []
saveReturnValue: 0
returnValueVariableKey:
returnValueType: System.Void
showInherited: 0
callMode: 0
--- !u!114 &1913435031
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 688e35811870d403f9e2b1ab2a699d98, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
targetComponentFullname: UnityEngine.Component[]
targetComponentText: OverlapTests
targetMethod: Step2
targetMethodText: 'Step2 (): Void'
methodParameters: []
saveReturnValue: 0
returnValueVariableKey:
returnValueType: System.Void
showInherited: 0
callMode: 0
--- !u!114 &1913435032
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1913435018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 688e35811870d403f9e2b1ab2a699d98, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
targetComponentFullname: UnityEngine.Component[]
targetComponentText: OverlapTests
targetMethod: Step1
targetMethodText: 'Step1 (): Void'
methodParameters: []
saveReturnValue: 0
returnValueVariableKey:
returnValueType: System.Void
showInherited: 0
callMode: 0
--- !u!1 &1929911609
GameObject:
m_ObjectHideFlags: 0
@ -6298,7 +6405,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1929911610
Transform:
m_ObjectHideFlags: 0

63
Assets/Tests/Narrative/OverlapTests.cs

@ -0,0 +1,63 @@
using UnityEngine;
using System.Collections;
using Fungus;
public class OverlapTests : MonoBehaviour
{
public SayDialog sayDialog_LeftImage;
public SayDialog sayDialog_RightImage;
public void Step1()
{
if (!sayDialog_RightImage.characterImage.IsActive())
{
IntegrationTest.Fail("Character image not active");
}
if (sayDialog_RightImage.characterImage.transform.position.x < sayDialog_RightImage.storyText.transform.position.x)
{
IntegrationTest.Fail("Character image not on right hand side");
}
}
public void Step2()
{
if (sayDialog_RightImage.characterImage.IsActive())
{
IntegrationTest.Fail("Character image should not be active");
}
if (sayDialog_RightImage.storyText.rectTransform.rect.width != 1531)
{
IntegrationTest.Fail("Story text width not correct");
}
}
public void Step3()
{
if (!sayDialog_LeftImage.characterImage.IsActive())
{
IntegrationTest.Fail("Character image not active");
}
if (sayDialog_LeftImage.characterImage.transform.position.x > sayDialog_LeftImage.storyText.transform.position.x)
{
IntegrationTest.Fail("Character image not on left hand side");
}
}
public void Step4()
{
if (sayDialog_LeftImage.characterImage.IsActive())
{
IntegrationTest.Fail("Character image should not be active");
}
if (sayDialog_LeftImage.storyText.rectTransform.rect.width != 1531)
{
IntegrationTest.Fail("Story text width not correct");
}
IntegrationTest.Pass();
}
}

12
Assets/Tests/Narrative/OverlapTests.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dfa0c65e278214560ba42bc8fef024e6
timeCreated: 1441187164
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save