Browse Source

Cg tespy narrative log system updates (#789)

Consolidated with existing narrative log system.
Add additional method of showing narrative log in a per entry basis with scroll view of elements generated per item.
- NarrativeLog prefab uses the new system.
master
Steve Halliwell 5 years ago committed by GitHub
parent
commit
8dcb9b0a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 434
      Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab
  2. 7
      Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab.meta
  3. 269
      Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab
  4. 7
      Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab.meta
  5. 79
      Assets/Fungus/Scripts/Components/NarrativeLog.cs
  6. 50
      Assets/Fungus/Scripts/Components/NarrativeLogEntryDisplay.cs
  7. 11
      Assets/Fungus/Scripts/Components/NarrativeLogEntryDisplay.cs.meta
  8. 94
      Assets/Fungus/Scripts/Components/NarrativeLogEntryUI.cs
  9. 11
      Assets/Fungus/Scripts/Components/NarrativeLogEntryUI.cs.meta
  10. 10
      Assets/Fungus/Scripts/Components/NarrativeLogMenu.cs
  11. 5640
      Assets/FungusExamples/Conversation/NarrativeEntryLogTest.unity
  12. 7
      Assets/FungusExamples/Conversation/NarrativeEntryLogTest.unity.meta

434
Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab

@ -0,0 +1,434 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3892339027384508655
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3892339027384508654}
- component: {fileID: 3892339027384508652}
- component: {fileID: 3892339027384508653}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3892339027384508654
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339027384508655}
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: 3892339028978780123}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3892339027384508652
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339027384508655}
m_CullTransparentMesh: 0
--- !u!114 &3892339027384508653
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339027384508655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.2783019, g: 0.50158674, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!1 &3892339028022738724
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3892339028022738723}
- component: {fileID: 3892339028022738735}
- component: {fileID: 3892339028022738720}
- component: {fileID: 3892339028022738721}
- component: {fileID: 3892339028022738722}
m_Layer: 5
m_Name: EntryDisplayHolder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3892339028022738723
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028022738724}
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: 3892339028978780123}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0.000015258789}
m_SizeDelta: {x: 600, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &3892339028022738735
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028022738724}
m_CullTransparentMesh: 0
--- !u!114 &3892339028022738720
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028022738724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.2783019, g: 0.50158674, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3892339028022738721
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028022738724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &3892339028022738722
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028022738724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &3892339028774243865
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3892339028774243842}
- component: {fileID: 3892339028774243843}
- component: {fileID: 3892339028774243844}
- component: {fileID: 3892339028774243845}
- component: {fileID: 3892339028774243846}
- component: {fileID: 3892339028774243864}
m_Layer: 5
m_Name: NarrativeLog
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3892339028774243842
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
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: 3892339028978780123}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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!223 &3892339028774243843
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &3892339028774243844
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &3892339028774243845
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!225 &3892339028774243846
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &3892339028774243864
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028774243865}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fde579c9edfbe7e469349e39e2a87a48, type: 3}
m_Name:
m_EditorClassIdentifier:
entryDisplayPrefab: {fileID: 2879084013005042991, guid: 243a94cf6d8dda84f8351f4289587571,
type: 3}
entryHolder: {fileID: 3892339028022738723}
--- !u!1 &3892339028978780124
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3892339028978780123}
- component: {fileID: 3892339028978780103}
- component: {fileID: 3892339028978780120}
- component: {fileID: 3892339028978780121}
- component: {fileID: 3892339028978780122}
m_Layer: 5
m_Name: MainWindow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3892339028978780123
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028978780124}
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:
- {fileID: 3892339027384508654}
- {fileID: 3892339028022738723}
m_Father: {fileID: 3892339028774243842}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 108.70001}
m_SizeDelta: {x: 600, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3892339028978780103
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028978780124}
m_CullTransparentMesh: 0
--- !u!114 &3892339028978780120
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028978780124}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3892339028978780121
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028978780124}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Content: {fileID: 3892339028022738723}
m_Horizontal: 0
m_Vertical: 1
m_MovementType: 2
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 0}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 0
m_VerticalScrollbarVisibility: 0
m_HorizontalScrollbarSpacing: 0
m_VerticalScrollbarSpacing: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!114 &3892339028978780122
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3892339028978780124}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1

7
Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bffd475e4bfb82f49810ceafe8d17b78
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

269
Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab

@ -0,0 +1,269 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2333275596563789949
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8885489252217067950}
- component: {fileID: 7933068750079926288}
- component: {fileID: 4379489694222926579}
m_Layer: 5
m_Name: NameText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8885489252217067950
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2333275596563789949}
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: 2481548615123137394}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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.5, y: 0.5}
--- !u!222 &7933068750079926288
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2333275596563789949}
m_CullTransparentMesh: 0
--- !u!114 &4379489694222926579
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2333275596563789949}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 64bd3e45f7a714f16b3c213f55f17fea, type: 3}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Name
--- !u!1 &3511986559566215052
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3365827255933976305}
- component: {fileID: 3857872114285753493}
- component: {fileID: 19882628764411882}
m_Layer: 5
m_Name: StoryText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3365827255933976305
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3511986559566215052}
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: 2481548615123137394}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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.5, y: 0.5}
--- !u!222 &3857872114285753493
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3511986559566215052}
m_CullTransparentMesh: 0
--- !u!114 &19882628764411882
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3511986559566215052}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 64bd3e45f7a714f16b3c213f55f17fea, type: 3}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
--- !u!1 &9061313995661533662
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2481548615123137394}
- component: {fileID: 3382758035194104851}
- component: {fileID: 819304301769093009}
- component: {fileID: 5508376540251964814}
- component: {fileID: 2879084013005042991}
m_Layer: 5
m_Name: NarrativeLogEntryDisplay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2481548615123137394
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9061313995661533662}
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:
- {fileID: 8885489252217067950}
- {fileID: 3365827255933976305}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 278}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3382758035194104851
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9061313995661533662}
m_CullTransparentMesh: 0
--- !u!114 &819304301769093009
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9061313995661533662}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!114 &5508376540251964814
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9061313995661533662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 10
m_Right: 10
m_Top: 10
m_Bottom: 10
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &2879084013005042991
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9061313995661533662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 824b58b7741a0dd4e9b43693c47b24f7, type: 3}
m_Name:
m_EditorClassIdentifier:
nameTextField: {fileID: 4379489694222926579}
storyTextField: {fileID: 19882628764411882}

7
Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 243a94cf6d8dda84f8351f4289587571
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

79
Assets/Fungus/Scripts/Components/NarrativeLog.cs

@ -1,7 +1,6 @@
// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using System;
using System.Collections.Generic;
using UnityEngine;
@ -10,26 +9,20 @@ namespace Fungus
/// <summary>
/// A single line of dialog
/// </summary>
[Serializable]
public class Line
[System.Serializable]
public class NarrativeLogEntry
{
[SerializeField] public string name;
[SerializeField] public string text;
}
/// <summary>
/// Serializable object to store Narrative Lines
/// </summary>
[Serializable]
[System.Serializable]
public class NarrativeData
{
[SerializeField] public List<Line> lines;
public NarrativeData() {
lines = new List<Line>();
}
public List<NarrativeLogEntry> entries = new List<NarrativeLogEntry>();
}
/// <summary>
@ -37,19 +30,38 @@ namespace Fungus
/// </summary>
public class NarrativeLog : MonoBehaviour
{
/// <summary>
/// NarrativeAdded signal. Sent when a line is added.
/// </summary>
public static event NarrativeAddedHandler OnNarrativeAdded;
public delegate void NarrativeAddedHandler();
public static void DoNarrativeAdded() { if (OnNarrativeAdded != null) OnNarrativeAdded(); }
public event NarrativeAddedHandler OnNarrativeAdded;
public delegate void NarrativeAddedHandler(NarrativeLogEntry data);
public void DoNarrativeAdded(NarrativeLogEntry data)
{
if (OnNarrativeAdded != null)
{
OnNarrativeAdded(data);
}
}
/// <summary>
/// Signal sent when log history is cleared or loaded
/// </summary>
public System.Action OnNarrativeLogClear;
public void DoNarrativeCleared()
{
if (OnNarrativeLogClear != null)
{
OnNarrativeLogClear();
}
}
NarrativeData history;
protected virtual void Awake()
{
history = new NarrativeData();
DoNarrativeCleared();
}
protected virtual void OnEnable()
@ -67,27 +79,28 @@ namespace Fungus
if (writerState == WriterState.End)
{
var sd = SayDialog.GetSayDialog();
var from = sd.NameText;
var line = sd.StoryText;
AddLine(from, line);
if (sd != null)
{
NarrativeLogEntry entry = new NarrativeLogEntry()
{
name = sd.NameText,
text = sd.StoryText
};
AddLine(entry);
}
}
}
#region Public Methods
/// <summary>
/// Add a line of dialog to the Narrative Log
/// </summary>
/// <param name="name">Character Name</param>
/// <param name="text">Narrative Text</param>
public void AddLine(string name, string text)
public void AddLine(NarrativeLogEntry entry)
{
Line line = new Line();
line.name = name;
line.text = text;
history.lines.Add(line);
DoNarrativeAdded();
history.entries.Add(entry);
DoNarrativeAdded(entry);
}
/// <summary>
@ -96,7 +109,9 @@ namespace Fungus
/// </summary>
public void Clear()
{
history.lines.Clear();
history.entries.Clear();
DoNarrativeCleared();
}
/// <summary>
@ -118,12 +133,12 @@ namespace Fungus
string output = "\n ";
int count;
count = previousOnly ? history.lines.Count - 1: history.lines.Count;
count = previousOnly ? history.entries.Count - 1 : history.entries.Count;
for (int i = 0; i < count; i++)
{
output += "<b>" + history.lines[i].name + "</b>\n";
output += history.lines[i].text + "\n\n";
output += "<b>" + history.entries[i].name + "</b>\n";
output += history.entries[i].text + "\n\n";
}
return output;
}
@ -140,6 +155,8 @@ namespace Fungus
return;
}
history = JsonUtility.FromJson<NarrativeData>(narrativeData);
DoNarrativeCleared();
}
#endregion
}

50
Assets/Fungus/Scripts/Components/NarrativeLogEntryDisplay.cs

@ -0,0 +1,50 @@
// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using UnityEngine.UI;
namespace Fungus
{
/// <summary>
/// Displays Narrative Log Entries in the UI.
/// </summary>
public class NarrativeLogEntryDisplay : MonoBehaviour
{
[SerializeField] protected Text nameTextField;
[SerializeField] protected Text storyTextField;
private NarrativeLogEntry toDisplay;
/// <summary>
/// The entry that this represents in the UI. The setter here alters this display's UI fields
/// to fit the new value.
/// </summary>
public virtual NarrativeLogEntry ToDisplay
{
get { return toDisplay; }
set
{
toDisplay = value;
UpdateDisplays();
}
}
/// <summary>
/// Ensures that the UI components of this display fit the NarrativeLog Entry
/// it has... if any.
/// </summary>
protected virtual void UpdateDisplays()
{
if (ToDisplay == null)
{
nameTextField.text = "";
storyTextField.text = "";
}
else
{
nameTextField.text = toDisplay.name;
storyTextField.text = toDisplay.text;
}
}
}
}

11
Assets/Fungus/Scripts/Components/NarrativeLogEntryDisplay.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 824b58b7741a0dd4e9b43693c47b24f7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

94
Assets/Fungus/Scripts/Components/NarrativeLogEntryUI.cs

@ -0,0 +1,94 @@
// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using System.Collections.Generic;
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Manages the UI aspects of the Narrative Log via EntryDisplay objects
///
/// Originally contributed by https://github.com/CG-Tespy
/// </summary>
public class NarrativeLogEntryUI : MonoBehaviour
{
[Tooltip("Contains the overall aesthetic of each entry.")]
[SerializeField] protected NarrativeLogEntryDisplay entryDisplayPrefab;
[SerializeField] protected RectTransform entryHolder;
protected CanvasGroup canvasGroup;
protected List<NarrativeLogEntryDisplay> entryDisplays = new List<NarrativeLogEntryDisplay>();
protected UnityEngine.UI.ScrollRect scrollRect;
protected virtual void Awake()
{
canvasGroup = GetComponent<CanvasGroup>();
var tmp = FungusManager.Instance.NarrativeLog;
// Make sure to update the UI when new entries are added to or
// cleared from the log.
//using the fungusmanager to ensure that the narrativeLog is inited
FungusManager.Instance.NarrativeLog.OnNarrativeAdded += OnNarrativeAdded;
FungusManager.Instance.NarrativeLog.OnNarrativeLogClear += Clear;
scrollRect = GetComponentInChildren<UnityEngine.UI.ScrollRect>();
}
public virtual void Clear()
{
for (int i = 0; i < entryDisplays.Count; i++)
{
var entryDisplay = entryDisplays[i];
Destroy(entryDisplay.gameObject);
}
entryDisplays.Clear();
}
public virtual void Open()
{
canvasGroup.alpha = 1;
canvasGroup.interactable = true;
canvasGroup.blocksRaycasts = true;
}
public virtual void Close()
{
canvasGroup.alpha = 0;
canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false;
}
protected virtual void OnNarrativeAdded(NarrativeLogEntry entryAdded)
{
// Create a display for the new entry, and have it show in the UI.
var newEntryDisplay = Instantiate(entryDisplayPrefab);
newEntryDisplay.transform.SetParent(entryHolder, false);
newEntryDisplay.ToDisplay = entryAdded;
entryDisplays.Add(newEntryDisplay);
StartCoroutine(ForceToBottom());
}
private System.Collections.IEnumerator ForceToBottom()
{
yield return null;
scrollRect.verticalNormalizedPosition = 0;
}
protected virtual void OnLogCleared()
{
Clear();
}
protected virtual void OnDestroy()
{
var fManInst = FungusManager.Instance;
// Avoid this responding to signals when being destroyed.
if (fManInst != null)
{
FungusManager.Instance.NarrativeLog.OnNarrativeAdded -= OnNarrativeAdded;
FungusManager.Instance.NarrativeLog.OnNarrativeLogClear -= Clear;
}
}
}
}

11
Assets/Fungus/Scripts/Components/NarrativeLogEntryUI.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fde579c9edfbe7e469349e39e2a87a48
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Fungus/Scripts/Components/NarrativeLogMenu.cs

@ -14,6 +14,9 @@ namespace Fungus
/// </summary>
public class NarrativeLogMenu : MonoBehaviour
{
[Tooltip("Contains the overall aesthetic of each entry.")]
[SerializeField] protected NarrativeLogEntryDisplay entryDisplayPrefab;
[Tooltip("Show the Narrative Log Menu")]
[SerializeField] protected bool showLog = true;
@ -72,7 +75,6 @@ namespace Fungus
//Clear up the lorem ipsum
UpdateNarrativeLogText();
}
protected virtual void OnEnable()
@ -81,7 +83,7 @@ namespace Fungus
SaveManagerSignals.OnSavePointLoaded += OnSavePointLoaded;
SaveManagerSignals.OnSaveReset += OnSaveReset;
BlockSignals.OnBlockEnd += OnBlockEnd;
NarrativeLog.OnNarrativeAdded += OnNarrativeAdded;
FungusManager.Instance.NarrativeLog.OnNarrativeAdded += OnNarrativeAdded;
}
protected virtual void OnDisable()
@ -90,10 +92,10 @@ namespace Fungus
SaveManagerSignals.OnSavePointLoaded -= OnSavePointLoaded;
SaveManagerSignals.OnSaveReset -= OnSaveReset;
BlockSignals.OnBlockEnd -= OnBlockEnd;
NarrativeLog.OnNarrativeAdded -= OnNarrativeAdded;
FungusManager.Instance.NarrativeLog.OnNarrativeAdded -= OnNarrativeAdded;
}
protected virtual void OnNarrativeAdded()
protected virtual void OnNarrativeAdded(NarrativeLogEntry data)
{
UpdateNarrativeLogText();
}

5640
Assets/FungusExamples/Conversation/NarrativeEntryLogTest.unity

File diff suppressed because it is too large Load Diff

7
Assets/FungusExamples/Conversation/NarrativeEntryLogTest.unity.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5f81c0037bb56f542aa6a0464022285a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save