fix conversation dialog
This commit is contained in:
@@ -148,7 +148,7 @@ RectTransform:
|
|||||||
m_GameObject: {fileID: 26194717}
|
m_GameObject: {fileID: 26194717}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 4.8501, y: 3.7125, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 353014638}
|
- {fileID: 353014638}
|
||||||
@@ -157,9 +157,9 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: -246, y: -225}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 492, y: 420}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!1 &94928690
|
--- !u!1 &94928690
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -284,10 +284,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1928618662}
|
m_Father: {fileID: 1928618662}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: -151, y: 234}
|
m_AnchoredPosition: {x: 0, y: -25}
|
||||||
m_SizeDelta: {x: 200, y: 50}
|
m_SizeDelta: {x: 0, y: 50}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &107380538
|
--- !u!114 &107380538
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -372,7 +372,7 @@ MonoBehaviour:
|
|||||||
m_VertexBufferAutoSizeReduction: 0
|
m_VertexBufferAutoSizeReduction: 0
|
||||||
m_useMaxVisibleDescender: 1
|
m_useMaxVisibleDescender: 1
|
||||||
m_pageToDisplay: 1
|
m_pageToDisplay: 1
|
||||||
m_margin: {x: 0, y: 0, z: -297.24536, w: 0}
|
m_margin: {x: 0, y: 0, z: -1.1646118, w: 0}
|
||||||
m_isUsingLegacyAnimationComponent: 0
|
m_isUsingLegacyAnimationComponent: 0
|
||||||
m_isVolumetricText: 0
|
m_isVolumetricText: 0
|
||||||
m_hasFontAssetChanged: 0
|
m_hasFontAssetChanged: 0
|
||||||
@@ -2959,7 +2959,7 @@ RectTransform:
|
|||||||
m_GameObject: {fileID: 353014637}
|
m_GameObject: {fileID: 353014637}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1496617599}
|
- {fileID: 1496617599}
|
||||||
@@ -2968,8 +2968,8 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 195}
|
||||||
m_SizeDelta: {x: 160, y: 30}
|
m_SizeDelta: {x: 492, y: 30}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &353014639
|
--- !u!114 &353014639
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -3014,7 +3014,19 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 353014640}
|
m_TargetGraphic: {fileID: 353014640}
|
||||||
m_OnClick:
|
m_OnClick:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 11500000, guid: 745fe52b243d8e947842f8f284e49aad, type: 3}
|
||||||
|
m_TargetAssemblyTypeName: ChoiceController, Assembly-CSharp
|
||||||
|
m_MethodName:
|
||||||
|
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!114 &353014640
|
--- !u!114 &353014640
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -3035,7 +3047,7 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
m_Sprite: {fileID: 0}
|
||||||
m_Type: 1
|
m_Type: 1
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@@ -3067,7 +3079,19 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
conversationChangeEvent:
|
conversationChangeEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 11500000, guid: 745fe52b243d8e947842f8f284e49aad, type: 3}
|
||||||
|
m_TargetAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_MethodName: set_name
|
||||||
|
m_Mode: 5
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument: Hide();
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
--- !u!1 &448269316
|
--- !u!1 &448269316
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -4455,7 +4479,7 @@ RectTransform:
|
|||||||
- {fileID: 1524120978}
|
- {fileID: 1524120978}
|
||||||
- {fileID: 1267368772}
|
- {fileID: 1267368772}
|
||||||
m_Father: {fileID: 2137624722}
|
m_Father: {fileID: 2137624722}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
@@ -5870,12 +5894,12 @@ MonoBehaviour:
|
|||||||
m_faceColor:
|
m_faceColor:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
rgba: 4294967295
|
rgba: 4294967295
|
||||||
m_fontSize: 24
|
m_fontSize: 18
|
||||||
m_fontSizeBase: 24
|
m_fontSizeBase: 8
|
||||||
m_fontWeight: 400
|
m_fontWeight: 400
|
||||||
m_enableAutoSizing: 0
|
m_enableAutoSizing: 1
|
||||||
m_fontSizeMin: 18
|
m_fontSizeMin: 15
|
||||||
m_fontSizeMax: 72
|
m_fontSizeMax: 18
|
||||||
m_fontStyle: 0
|
m_fontStyle: 0
|
||||||
m_HorizontalAlignment: 2
|
m_HorizontalAlignment: 2
|
||||||
m_VerticalAlignment: 512
|
m_VerticalAlignment: 512
|
||||||
@@ -6418,7 +6442,7 @@ RectTransform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2137624722}
|
m_Father: {fileID: 2137624722}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
@@ -6762,7 +6786,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1928618662}
|
- component: {fileID: 1928618662}
|
||||||
- component: {fileID: 1928618663}
|
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Conversation
|
m_Name: Conversation
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -6791,23 +6814,9 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: -26.218018, y: -20.2967}
|
m_AnchoredPosition: {x: -256, y: -265}
|
||||||
m_SizeDelta: {x: 512.4757, y: 528.4197}
|
m_SizeDelta: {x: 512, y: 530}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!114 &1928618663
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1928618661}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 745fe52b243d8e947842f8f284e49aad, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_title: {fileID: 107380538}
|
|
||||||
_choiceButton: {fileID: 353014639}
|
|
||||||
--- !u!1 &2045246561
|
--- !u!1 &2045246561
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -6840,7 +6849,7 @@ RectTransform:
|
|||||||
- {fileID: 1205079055}
|
- {fileID: 1205079055}
|
||||||
- {fileID: 530701384}
|
- {fileID: 530701384}
|
||||||
m_Father: {fileID: 2137624722}
|
m_Father: {fileID: 2137624722}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
@@ -7304,9 +7313,9 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 1682316606}
|
||||||
- {fileID: 1024192185}
|
- {fileID: 1024192185}
|
||||||
- {fileID: 2045246562}
|
- {fileID: 2045246562}
|
||||||
- {fileID: 1682316606}
|
|
||||||
- {fileID: 2068384141}
|
- {fileID: 2068384141}
|
||||||
m_Father: {fileID: 329780516}
|
m_Father: {fileID: 329780516}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ public class ChoiceController : MonoBehaviour
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
public static ChoiceController AddChoiceButton(Button choiceButtonTemplate, KeyValuePair<string, BaseAction> option, int index)
|
public static ChoiceController AddChoiceButton(Button choiceButtonTemplate, KeyValuePair<string, BaseAction> option, int index)
|
||||||
{
|
{
|
||||||
int buttonSpacing = -44;
|
int buttonSpacing = -50;
|
||||||
|
|
||||||
Button button = Instantiate(choiceButtonTemplate);
|
Button button = Instantiate(choiceButtonTemplate);
|
||||||
|
|
||||||
button.transform.SetParent(choiceButtonTemplate.transform.parent);
|
button.transform.SetParent(choiceButtonTemplate.transform.parent);
|
||||||
button.transform.localScale = Vector3.one;
|
button.transform.localScale = Vector3.one;
|
||||||
button.transform.localPosition = new Vector3(0, index * buttonSpacing, 0);
|
button.transform.localPosition = choiceButtonTemplate.transform.localPosition + new Vector3(0, index * buttonSpacing, 0);
|
||||||
button.name = option.Key;
|
button.name = option.Key;
|
||||||
button.gameObject.SetActive(true);
|
button.gameObject.SetActive(true);
|
||||||
|
|
||||||
ChoiceController choiceController = button.GetComponent<ChoiceController>();
|
ChoiceController choiceController = button.GetComponent<ChoiceController>();
|
||||||
choiceController._option = option;
|
choiceController._option = option;
|
||||||
return choiceController;
|
return choiceController;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public class ConversationController : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
public Button _choiceButton;
|
public Button _choiceButton;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private Button _closeBtn;
|
||||||
|
|
||||||
private List<ChoiceController> choiceControllers = new();
|
private List<ChoiceController> choiceControllers = new();
|
||||||
public static ConversationController Instance { get; private set; }
|
public static ConversationController Instance { get; private set; }
|
||||||
|
|
||||||
@@ -32,10 +35,17 @@ public class ConversationController : MonoBehaviour
|
|||||||
ChoiceController c = ChoiceController.AddChoiceButton(_choiceButton, options.ElementAt(count), count);
|
ChoiceController c = ChoiceController.AddChoiceButton(_choiceButton, options.ElementAt(count), count);
|
||||||
choiceControllers.Add(c);
|
choiceControllers.Add(c);
|
||||||
}
|
}
|
||||||
|
_closeBtn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
Time.timeScale = 0;
|
||||||
_choiceButton.gameObject.SetActive(false);
|
_choiceButton.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void RemoveChoices()
|
private void RemoveChoices()
|
||||||
{
|
{
|
||||||
foreach (ChoiceController c in choiceControllers)
|
foreach (ChoiceController c in choiceControllers)
|
||||||
@@ -47,5 +57,6 @@ public class ConversationController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
RemoveChoices();
|
RemoveChoices();
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
|
Time.timeScale = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user