Add Panels and Dialogue module

This commit is contained in:
kabix09 2022-10-16 19:40:44 +02:00
parent eef1697737
commit 09058f1451
22 changed files with 1827 additions and 0 deletions

View File

@ -0,0 +1,199 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7804396124948926029
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7804396124948926028}
- component: {fileID: 7804396124948926030}
- component: {fileID: 7804396124948926031}
- component: {fileID: 2630723174740830644}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7804396124948926028
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396124948926029}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 4.5, z: 1}
m_Children: []
m_Father: {fileID: 7804396125553486711}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7804396124948926030
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396124948926029}
m_CullTransparentMesh: 1
--- !u!114 &7804396124948926031
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396124948926029}
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.63529414, g: 0.44705883, b: 0.2901961, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: << yes >>
--- !u!114 &2630723174740830644
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396124948926029}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c996be5c675ec4eb062e7ae1509118, type: 3}
m_Name:
m_EditorClassIdentifier:
textEnglish: << yes >>
textPolish: << tak >>
displayText: {fileID: 7804396124948926031}
--- !u!1 &7804396125553486708
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7804396125553486711}
- component: {fileID: 7804396125553486665}
- component: {fileID: 7804396125553486710}
m_Layer: 5
m_Name: AcceptButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7804396125553486711
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396125553486708}
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: 7804396124948926028}
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: 90, y: 270}
m_SizeDelta: {x: 100, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7804396125553486665
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396125553486708}
m_CullTransparentMesh: 1
--- !u!114 &7804396125553486710
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7804396125553486708}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: NPCDialogue, Assembly-CSharp
m_MethodName: QuestAccepted
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2

View File

@ -0,0 +1,183 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5110571134455525712
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5110571134455525713}
- component: {fileID: 5110571134455525715}
- component: {fileID: 5110571134455525714}
m_Layer: 5
m_Name: BaseButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5110571134455525713
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134455525712}
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: 5110571134592049265}
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: 105, y: 155}
m_SizeDelta: {x: 130, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5110571134455525715
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134455525712}
m_CullTransparentMesh: 1
--- !u!114 &5110571134455525714
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134455525712}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: NPCDialogue, Assembly-CSharp
m_MethodName: EndDialogue
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &5110571134592049264
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5110571134592049265}
- component: {fileID: 5110571134592049267}
- component: {fileID: 5110571134592049266}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5110571134592049265
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134592049264}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 4.5, z: 1}
m_Children: []
m_Father: {fileID: 5110571134455525713}
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: 0}
m_SizeDelta: {x: 130, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5110571134592049267
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134592049264}
m_CullTransparentMesh: 1
--- !u!114 &5110571134592049266
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5110571134592049264}
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.63529414, g: 0.44705883, b: 0.2901961, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:

View File

@ -0,0 +1,183 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1848719199912094900
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1848719199912094899}
- component: {fileID: 1848719199912094897}
- component: {fileID: 1848719199912094898}
m_Layer: 5
m_Name: ContinueButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1848719199912094899
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719199912094900}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.2, y: 1.2, z: 1}
m_Children:
- {fileID: 1848719200192448991}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -100, y: 150}
m_SizeDelta: {x: 115, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1848719199912094897
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719199912094900}
m_CullTransparentMesh: 1
--- !u!114 &1848719199912094898
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719199912094900}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: NPCDialogue, Assembly-CSharp
m_MethodName: DisplayNextSentence
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &1848719200192448960
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1848719200192448991}
- component: {fileID: 1848719200192448989}
- component: {fileID: 1848719200192448990}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1848719200192448991
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719200192448960}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 4.5, z: 1}
m_Children: []
m_Father: {fileID: 1848719199912094899}
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 &1848719200192448989
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719200192448960}
m_CullTransparentMesh: 1
--- !u!114 &1848719200192448990
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1848719200192448960}
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.63529414, g: 0.44705883, b: 0.2901961, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: continue >>

View File

@ -0,0 +1,237 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2835830909972040042
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2835830909972040045}
- component: {fileID: 2835830909972040047}
- component: {fileID: 2835830909972040044}
m_Layer: 5
m_Name: Header
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2835830909972040045
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830909972040042}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.2, y: 6, z: 1}
m_Children: []
m_Father: {fileID: 2835830911057077560}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 140, y: -154.71451}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2835830909972040047
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830909972040042}
m_CullTransparentMesh: 1
--- !u!114 &2835830909972040044
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830909972040042}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_Color: {r: 0.63529414, g: 0.44705886, b: 0.2901961, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: NPC NAME
--- !u!1 &2835830910843601523
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2835830910843601522}
- component: {fileID: 2835830910843601524}
- component: {fileID: 2835830910843601525}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2835830910843601522
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830910843601523}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 5, z: 1}
m_Children: []
m_Father: {fileID: 2835830911057077560}
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: 394, y: -412}
m_SizeDelta: {x: 700, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2835830910843601524
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830910843601523}
m_CullTransparentMesh: 1
--- !u!114 &2835830910843601525
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830910843601523}
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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Here is what the dialogue says
--- !u!1 &2835830911057077561
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2835830911057077560}
- component: {fileID: 2835830911057077562}
- component: {fileID: 2835830911057077563}
m_Layer: 5
m_Name: DialoguePanel
m_TagString: UIPanel
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2835830911057077560
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830911057077561}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 0.2, z: 1}
m_Children:
- {fileID: 2835830909972040045}
- {fileID: 2835830910843601522}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 75}
m_SizeDelta: {x: 800, y: 665}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2835830911057077562
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830911057077561}
m_CullTransparentMesh: 1
--- !u!114 &2835830911057077563
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2835830911057077561}
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: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 99ef742ea21894b4d995d1bc6209bd91, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@ -0,0 +1,199 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3843350996313346458
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3843350996313346459}
- component: {fileID: 3843350996313346457}
- component: {fileID: 3843350996313346456}
- component: {fileID: 9050739336549364503}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3843350996313346459
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996313346458}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 4.5, z: 1}
m_Children: []
m_Father: {fileID: 3843350996714111163}
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: 0}
m_SizeDelta: {x: 130, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3843350996313346457
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996313346458}
m_CullTransparentMesh: 1
--- !u!114 &3843350996313346456
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996313346458}
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.63529414, g: 0.44705883, b: 0.2901961, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: << not now >>
--- !u!114 &9050739336549364503
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996313346458}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c996be5c675ec4eb062e7ae1509118, type: 3}
m_Name:
m_EditorClassIdentifier:
textEnglish: << not now >>
textPolish: << nie teraz >>
displayText: {fileID: 3843350996313346456}
--- !u!1 &3843350996714111162
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3843350996714111163}
- component: {fileID: 3843350996714111161}
- component: {fileID: 3843350996714111160}
m_Layer: 5
m_Name: RejectButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3843350996714111163
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996714111162}
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: 3843350996313346459}
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: 105, y: 155}
m_SizeDelta: {x: 130, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3843350996714111161
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996714111162}
m_CullTransparentMesh: 1
--- !u!114 &3843350996714111160
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3843350996714111162}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: NPCDialogue, Assembly-CSharp
m_MethodName: EndDialogue
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2

View File

@ -0,0 +1,88 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
[Serializable]
public class DialogueController
{
public Queue<DialogueModel> listOfDialogue = new Queue<DialogueModel>();
private UnityEvent EndOfDialogueStepAction = new UnityEvent();
[SerializeField]
public GameObject CurrentPanel;
/// <summary>
/// Set panel info (panel, coords, text, buttons)
/// </summary>
/// <param name="dialogueModel"></param>
public void AddSentence(DialogueModel dialogueModel)
{
listOfDialogue.Enqueue(dialogueModel);
}
/*
* TODO add endpoints to setup button sctions via others scripyts ! ! !
public void AddButton(PanelButtonStepModel _buttonModel)
{
Buttons.Add(_buttonModel);
}
public void SetButtons(List<PanelButtonStepModel> _buttonsModelList)
{
Buttons = _buttonsModelList;
}
*/
public void SetActionAfterDialogueEnds(UnityEvent _endOfDialogueStepAction)
{
EndOfDialogueStepAction = _endOfDialogueStepAction;
}
public void SetActionAfterDialogueEnds(Action _finishDialogueAction)
{
EndOfDialogueStepAction.AddListener( new UnityAction( _finishDialogueAction));
}
public void Show(DialogueModel panelModel)
{
Panel panelDis = panelModel.Panel("Kabix", panelModel);
panelDis.PanelInstance = panelDis.BuildPanel();
panelDis.SetContinueButtonAction(ShowNextPanel, this);
CurrentPanel = panelDis.PanelInstance;
}
private void ShowNextPanel(DialogueController parentDialController)
{
if (listOfDialogue.Count == 0)
{
MonoBehaviour.Destroy(parentDialController.CurrentPanel);
FinishDialogue();
}
else
{
MonoBehaviour.Destroy(parentDialController.CurrentPanel);
DialogueModel nextPanel = parentDialController.listOfDialogue.Dequeue();
Show(nextPanel);
}
}
// if palyer click last dialogue panel's "continue" button then ShowNextPanel
// function invoke this method whioch contain external action :D - MAGIC
public void FinishDialogue()
{
// set uoe everything whats is needed to change after finish dialogue
// eg.
// - add task to list
// - get reward
// - mark quest as completed :D
EndOfDialogueStepAction.Invoke();
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class DialogueModel //<TPanel> where TPanel : AbstractPanel
{
public Func<string, DialogueModel, Panel> Panel = PanelFactory.BasePanel;
[SerializeField]
public string Sentence; // { get; set; } // make set private but this will block inspector
[SerializeField]
public List<PanelButtonStepModel> Buttons = new List<PanelButtonStepModel>();
public DialogueModel() { }
public DialogueModel(string _sentence)
{
Sentence = _sentence;
}
public DialogueModel(string _sentence, List<PanelButtonStepModel> _buttonsModelsList)
{
Sentence = _sentence;
Buttons = _buttonsModelsList;
}
}

View File

@ -0,0 +1,55 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
// change to "mission step" model in future
[Serializable]
public class DialogueStepModel
{
[SerializeField] // this flag tell whatewer dialoge ware already display to user
public bool WasDisplayed = false;
[SerializeField] // list to map to queue in DialogueController
public List<DialogueModel> ListOfSentences = new List<DialogueModel>();
[SerializeField]
public List<GameObject> Rewards;
[SerializeField]
public UnityEvent EndOfDialogueStepAction = new UnityEvent();
// for displaying set of sentences in one display
public DialogueController DialogueController { get; protected set; }
public DialogueStepModel() { }
public DialogueStepModel(DialogueController _dialogueController)
{
DialogueController = _dialogueController;
}
/// <summary>
/// Just convert list to queue structure :D
/// </summary>
public virtual void Build()
{
// 1. Clear previous setups
// 2. Map first structur into second
DialogueController = new DialogueController();
foreach (DialogueModel DialogueModel in ListOfSentences)
{
// Pass data to builded panel (name, sentence, buttons)
DialogueController.AddSentence(DialogueModel);
}
// 3. Bind finishing action
DialogueController.SetActionAfterDialogueEnds(EndOfDialogueStepAction);
}
}

View File

@ -0,0 +1,28 @@
using UnityEngine;
public abstract class AbstractPanel : IPanel
{
// Panel data
public Vector3 Position { get; set; }
public Vector2 Size { get; set; }
public Vector3 Scale { get; set; }
public AbstractPanel() { }
public AbstractPanel(Vector3 _position, Vector2 _size, Vector3 _scale)
{
Position = _position;
Size = _size;
Scale = _scale;
}
/// <summary>
/// Must be overwritten in childern class
/// </summary>
/// <returns></returns>
public virtual GameObject BuildPanel()
{
throw new System.NotImplementedException();
}
}

View File

@ -0,0 +1,10 @@
// if you want to add new button and new button prefab you must:
// - add button mark to this enum
// - add new compose function to PanelComponentFactory class
public enum PanelButtonEnum
{
Continue = 0,
Base = 1, // no type button
Accept = 2,
Reject = 3
}

View File

@ -0,0 +1,96 @@
using UnityEngine;
using UnityEngine.UI;
public static class PanelComponentFactory
{
/// <summary>
///
/// </summary>
/// <param name="position"></param>
/// <param name="size"></param>
/// <param name="scale"></param>
/// <returns></returns>
public static GameObject BuildCustomPanel(Vector3 position, Vector2 size, Vector3 scale)
{
var panel = DialoguePanelsPrefabsList.GetPanel();
panel.GetComponent<RectTransform>().position = position;
panel.GetComponent<RectTransform>().localScale = scale;
panel.GetComponent<RectTransform>().sizeDelta = size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent<RectTransform>().localPosition, panel.transform.rotation) as GameObject;
prefab.name = "DialoguePanel";
prefab.transform.SetParent(GameObject.FindGameObjectWithTag("GUI").transform, false);
GameObject continueButton = BuildContinueButton(new Vector3(-100, 150, 0), new Vector2(115, 90), new Vector3(1.2f, 1.2f, 1));
continueButton.transform.SetParent(prefab.transform, false);
return prefab;
}
public static GameObject BuildCustomButton(ButtonPanelModel answerModel)
{
var panel = DialoguePanelsPrefabsList.GetBaseButton();
panel.GetComponent<RectTransform>().position = answerModel.Position;
panel.GetComponent<RectTransform>().localScale = answerModel.Scale;
panel.GetComponent<RectTransform>().sizeDelta = answerModel.Size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent<RectTransform>().localPosition, panel.transform.rotation) as GameObject;
prefab.name = answerModel.Response;
// Assign content
prefab.transform.Find("Text").GetComponent<Text>().text = answerModel.Response;
// Assign actions
prefab.GetComponent<Button>().onClick.AddListener(() => answerModel.ButtonActions.Invoke());
return prefab;
}
public static GameObject BuildAcceptButton(Vector3 position, Vector2 size, Vector3 scale)
{
var panel = DialoguePanelsPrefabsList.GetAcceptButton();
panel.GetComponent<RectTransform>().position = position;
panel.GetComponent<RectTransform>().localScale = scale;
panel.GetComponent<RectTransform>().sizeDelta = size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent<RectTransform>().localPosition, panel.transform.rotation) as GameObject;
prefab.name = "AcceptButton";
return prefab;
}
public static GameObject BuildRejectButton(Vector3 position, Vector2 size, Vector3 scale)
{
var panel = DialoguePanelsPrefabsList.GetRejectButton();
panel.GetComponent<RectTransform>().position = position;
panel.GetComponent<RectTransform>().localScale = scale;
panel.GetComponent<RectTransform>().sizeDelta = size;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent<RectTransform>().localPosition, panel.transform.rotation) as GameObject;
prefab.name = "RejectButton";
return prefab;
}
public static GameObject BuildContinueButton(Vector3 position, Vector2 size, Vector3 scale)
{
var panel = DialoguePanelsPrefabsList.GetContinueButton();
panel.GetComponent<RectTransform>().position = position;
panel.GetComponent<RectTransform>().sizeDelta = size;
panel.GetComponent<RectTransform>().localScale = scale;
GameObject prefab = MonoBehaviour.Instantiate(panel, panel.GetComponent<RectTransform>().localPosition, panel.transform.rotation) as GameObject;
prefab.name = "ContinueButton";
return prefab;
}
}

View File

@ -0,0 +1,128 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public static class PanelFactory
{
// panel basics config
private static Vector3 DialoguePanelPosition = new Vector3(0, 75, 0);
private static Vector2 DialoguePanelSize = new Vector2(800, 665);
private static Vector3 DialoguePanelScale = new Vector3(0.95f, 0.2f, 1);
// buttons config
private static Vector3 BaseButtonPosition = new Vector3(110, 0, 0);
private static Vector2 BaseButtonSize = new Vector2(150, 80);
private static Vector3 BaseButtonScale = new Vector3(1, 1, 1);
private static Vector3 AcceptButtonPosition = new Vector3(90, 270, 0);
private static Vector2 AcceptButtonSize = new Vector2(100, 80);
private static Vector3 AcceptButtonScale = new Vector3(1, 1, 1);
private static Vector3 RejectButtonPosition = new Vector3(105, 155, 0);
private static Vector2 RejectButtonSize = new Vector2(130, 80);
private static Vector3 RejectButtonScale = new Vector3(1, 1, 1);
const int BOTTOM_MARGIN = 15;
public static Panel BasePanel(string _header, DialogueModel _dialogueModel)
{
Panel panel;
// decide whic panel use later in the code
if (_dialogueModel.Buttons.ToArray().Length == 0)
panel = PanelFactory.TextPanel(_header, _dialogueModel.Sentence);
else
{
panel = new QuestionPanel();
panel.Header = _header;
panel.Content = _dialogueModel.Sentence;
panel.Scale = DialoguePanelScale;
panel.Size = new Vector2(DialoguePanelSize.x, 480 + ((BaseButtonSize.y + 30) * _dialogueModel.Buttons.ToArray().Length));
// y position: panel.Height/10 + margin (15)
panel.Position = new Vector2(DialoguePanelPosition.x, panel.Size.y / 10 + BOTTOM_MARGIN);
_dialogueModel.Buttons.Reverse();
foreach (var buttonModelWithIndex in _dialogueModel.Buttons.Select((value, index) => new { value, index }))
{
((QuestionPanel)panel).Answers.Add(
ButtonPanel(
new Vector2(BaseButtonPosition.x, BOTTOM_MARGIN + 40 + (30 + BaseButtonSize.y) * (buttonModelWithIndex.index + 1)),
BaseButtonSize,
BaseButtonScale,
buttonModelWithIndex.value
)
);
}
}
return panel;
}
public static Panel TextPanel(string _header, string _content) // panel wit "continue" button
{
Panel panel = new Panel();
panel.Header = _header;
panel.Content = _content;
panel.Scale = DialoguePanelScale;
panel.Size = DialoguePanelSize;
panel.Position = new Vector2(DialoguePanelPosition.x, panel.Size.y / 10 + BOTTOM_MARGIN);
return panel;
}
public static Panel QuestionPanel(string _header, string _content)
{
QuestionPanel panel = new QuestionPanel();
// set buttons
panel.Answers.Add(new ButtonPanelModel(PanelButtonEnum.Accept, AcceptButtonPosition, AcceptButtonSize, AcceptButtonScale));
panel.Answers.Add(new ButtonPanelModel(PanelButtonEnum.Reject, RejectButtonPosition, RejectButtonSize, RejectButtonScale));
panel.Header = _header;
panel.Content = _content;
panel.Position = DialoguePanelPosition;
panel.Size = DialoguePanelSize;
panel.Scale = DialoguePanelScale;
return panel;
}
// TODO some panel with more than two answres
public static Panel QuestionPanel(string _header, DialogueModel _dialogueModel )
{
QuestionPanel panel = new QuestionPanel();
// TODO to C-H-A-N-G-E ! ! !
panel.Answers.Add(new ButtonPanelModel(PanelButtonEnum.Accept, AcceptButtonPosition, AcceptButtonSize, AcceptButtonScale));
panel.Answers.Add(new ButtonPanelModel(PanelButtonEnum.Reject, RejectButtonPosition, RejectButtonSize, RejectButtonScale));
panel.Header = _header;
panel.Content = _dialogueModel.Sentence;
panel.Position = DialoguePanelPosition;
panel.Size = DialoguePanelSize;
panel.Scale = DialoguePanelScale;
return panel;
}
public static ButtonPanelModel ButtonPanel(Vector3 _position, Vector2 _size, Vector3 _scale, PanelButtonStepModel _buttonData)
{
return new ButtonPanelModel(_position, _size, _scale, _buttonData);
}
}

View File

@ -0,0 +1,6 @@
using UnityEngine;
public interface IPanel
{
public GameObject BuildPanel();
}

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class DialoguePanelsPrefabsList
{
private static string SourcePath = "Dialogue/";
public static GameObject GetPanel()
{
return Resources.Load<GameObject>(SourcePath + "DialoguePanel");
}
public static GameObject GetBaseButton()
{
return Resources.Load<GameObject>(SourcePath + "BaseButton");
}
public static GameObject GetAcceptButton()
{
return Resources.Load<GameObject>(SourcePath + "AcceptButton");
}
public static GameObject GetRejectButton()
{
return Resources.Load<GameObject>(SourcePath + "RejectButton");
}
public static GameObject GetContinueButton()
{
return Resources.Load<GameObject>(SourcePath + "ContinueButton");
}
}

View File

@ -0,0 +1,34 @@
using UnityEngine;
using UnityEngine.Events;
public class ButtonPanelModel : AbstractPanel
{
public PanelButtonEnum Type { get; set; }
public string Response { get; set; }
public UnityEvent ButtonActions;
public ButtonPanelModel(PanelButtonEnum _type)
{
Type = _type;
}
public ButtonPanelModel(Vector3 _position, Vector2 _size, Vector3 _scale) : base (_position, _size, _scale){ }
public ButtonPanelModel(PanelButtonEnum _type, Vector3 _position, Vector2 _size, Vector3 _scale) : base(_position, _size, _scale)
{
Type = _type;
}
public ButtonPanelModel(Vector3 _position, Vector2 _size, Vector3 _scale, PanelButtonStepModel _buttonData) : base (_position, _size, _scale)
{
Type = _buttonData.Type;
Response = _buttonData.ButtonName;
ButtonActions = _buttonData.ButtonActions;
}
// TODO build
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
[Serializable]
public class PanelButtonStepModel
{
[SerializeField]
public string ButtonName; // anme of button added in panel
[SerializeField]
public PanelButtonEnum Type;
[SerializeField]
public UnityEvent ButtonActions;
public PanelButtonStepModel() { }
public PanelButtonStepModel(string _buttonName, UnityEvent _buttonActions)
{
ButtonName = _buttonName;
ButtonActions = _buttonActions;
}
}

View File

@ -0,0 +1,56 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Panel : AbstractPanel
{
public string Header { get; set; }
public string Content { get; set; }
public GameObject PanelInstance { get; set; }
public Panel() { }
public Panel(Vector3 _position, Vector2 _size, Vector3 _scale) : base (_position, _size, _scale){ }
public override GameObject BuildPanel()
{
GameObject panelPrefab = PanelComponentFactory.BuildCustomPanel(Position, Size, Scale);
panelPrefab.transform.Find("Header").gameObject.GetComponent<UnityEngine.UI.Text>().text = Header;
panelPrefab.transform.Find("Content").gameObject.GetComponent<UnityEngine.UI.Text>().text = Content;
return panelPrefab;
}
public void SetContinueButtonAction(Action<DialogueController> onClickFunction, DialogueController dialogControllerModel)
{
PanelInstance.transform.Find("ContinueButton").GetComponent<Button>().onClick.AddListener(() => onClickFunction(dialogControllerModel));
}
// support method
protected Transform FindButtonByName(string _buttonName)
{
var panelButtonInstance = PanelInstance.transform.Find(_buttonName);
if (!panelButtonInstance)
throw new Exception($"Button {_buttonName} not found in composed panel");
return panelButtonInstance;
}
}
// continue button
// remove current game object instance from scene\
// do declared action
// - in dialogue - set current panel as "readed" + open next / close
// accept button
// - the same what "continue"
//
// - add task to user /

View File

@ -0,0 +1,92 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class QuestionPanel : Panel
{
public List<ButtonPanelModel> Answers = new List<ButtonPanelModel>();
public QuestionPanel() { }
public QuestionPanel(Vector3 _position, Vector2 _size, Vector3 _scale) : base(_position, _size, _scale) { }
public override GameObject BuildPanel()
{
var questionPanel = base.BuildPanel();
foreach (ButtonPanelModel answerModel in Answers)
{
// Render button from list
GameObject answerPrefab = SelectButton(answerModel);
answerPrefab.transform.SetParent(questionPanel.transform, false);
}
return questionPanel;
}
/* public void AddButton(PanelButtonStepModel _button)
{
Answers.Add(_button);
}*/
// set button actions
public void SetAnswerButtonAction(string _buttonName, Action onClickFunction)
{
var panelButtonInstance = FindButtonByName(_buttonName);
panelButtonInstance.GetComponent<Button>().onClick.AddListener(() => onClickFunction());
}
public void SetAnswerButtonActions(string _buttonName, UnityAction _buttonAction)
{
var panelButtonInstance = FindButtonByName(_buttonName);
panelButtonInstance.GetComponent<Button>().onClick.AddListener(_buttonAction);
}
public void SetAnswerButtonActions(string _buttonName, UnityEvent _buttonActionsEvent)
{
var panelButtonInstance = FindButtonByName(_buttonName);
_buttonActionsEvent.Invoke();
panelButtonInstance.GetComponent<Button>().onClick.AddListener(() => _buttonActionsEvent.Invoke());
}
/// <summary>
/// Function to decide which button instance create && map button model to its instance
/// </summary>
/// <param name="buttonModel"></param>
private GameObject SelectButton(ButtonPanelModel buttonModel)
{
switch (buttonModel.Type)
{
case PanelButtonEnum.Base:
{
return PanelComponentFactory.BuildCustomButton(buttonModel);
}
case PanelButtonEnum.Continue:
{
return PanelComponentFactory.BuildContinueButton(buttonModel.Position, buttonModel.Size, buttonModel.Scale);
}
case PanelButtonEnum.Accept:
{
return PanelComponentFactory.BuildAcceptButton(buttonModel.Position, buttonModel.Size, buttonModel.Scale);
}
case PanelButtonEnum.Reject:
{
return PanelComponentFactory.BuildRejectButton(buttonModel.Position, buttonModel.Size, buttonModel.Scale);
}
default:
{
throw new System.Exception("Invalid button!!! Button enum type exists but system dont know how to build it");
}
}
}
}

View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*public class NPCDialogue : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
*/

View File

@ -0,0 +1,60 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class NpcDialogueManager : MonoBehaviour
{
[SerializeField]
public List<DialogueStepModel> DialogueStepsList;
public void Start()
{
/* CODE DIALOGUE DECLARATION EXAMPLE
DialogueController DialogueStep = new DialogueController();
DialogueStep.AddSentence(new DialogueModel("lorem ipsum"));
*//* di.AddSentence(new QuestionDialogueModel("tolore dolore?",
new List<Tuple<string, Action>> {
new Tuple<string, Action>("AcceptButton", CustomPanel),
new Tuple<string, Action>("RejectButton", QuestionPanel)
}));*//*
DialogueStep.SetActionAfterDialogueEnds(() => { });
DialogueStepModel dialogueStepModel = new DialogueStepModel(DialogueStep);
DialogueStepsList = new List<DialogueStepModel> { dialogueStepModel };
*/
BuildDialogue();
}
/// <summary>
/// Function to begin dialogue - will be invoked after user reaction from other script :)
/// </summary>
public void ShowStep()
{
// 1. Find first yet undisplayed for player anbd show
foreach(var DialogueStep in DialogueStepsList)
{
if(!DialogueStep.WasDisplayed)
{
DialogueStep.DialogueController.Show(DialogueStep.DialogueController.listOfDialogue.Dequeue());
break;
}
}
}
/// <summary>
/// Build each step of dialogue
/// </summary>
private void BuildDialogue()
{
foreach(var dialogueStep in DialogueStepsList)
{
dialogueStep.Build();
}
}
}

View File

@ -0,0 +1,61 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class PanelTest : MonoBehaviour
{
[SerializeField] bool Custom = true;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void CustomPanel()
{
Debug.Log("Accept press");
}
private void QuestionPanel()
{
Debug.Log("Reject press");
}
private void EndDialogue()
{
Debug.Log("End dialogue :D");
}
}
public class NPCDialogue2 : MonoBehaviour
{
/* List<DialogueStepModel> DialogueStepsList;
public void Start()
{
DialogueController DialogueStep = new DialogueController();
DialogueStep.AddSentence(new DialogueModel("lorem ipsum"));
*//* DialogueStep.AddSentence(new QuestionDialogueModel("tolore dolore?",
new List<Tuple<string, Action>> {
new Tuple<string, Action>("AcceptButton", CustomPanel),
new Tuple<string, Action>("RejectButton", QuestionPanel)
}));*//*
DialogueStep.SetActionAfterDialogueEnds(() => { });
DialogueStepModel dialogueStepModel = new DialogueStepModel(DialogueStep);
DialogueStepsList = new List<DialogueStepModel> { dialogueStepModel };
}
public void ShowStep()
{
DialogueStepsList[0].DialogueController.Show(DialogueStepsList[0].DialogueController.listOfDialogue.Dequeue());
}*/
}

View File

@ -14,6 +14,7 @@ TagManager:
- PickaxeHitbox
- EnemyCollection
- NPCCollection
- UIPanel
layers:
- Default
- TransparentFX