Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ColdShot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
15박보승
ColdShot
Commits
6e883fc2
Commit
6e883fc2
authored
Jan 18, 2020
by
15박보승
Committed by
18류지석
Jan 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dialogue Scene Tool WIP
parent
71e26126
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
208 additions
and
2 deletions
+208
-2
Dialogue.cs
Assets/Dialogue.cs
+9
-1
DialogueSceneMakerWindow.cs
Assets/DialogueSceneMakerWindow.cs
+135
-0
DialogueSceneMakerWindow.cs.meta
Assets/DialogueSceneMakerWindow.cs.meta
+11
-0
DialogueSystem.cs
Assets/DialogueSystem.cs
+29
-1
DialogueTrigger2D.cs
Assets/DialogueTrigger2D.cs
+13
-0
DialogueTrigger2D.cs.meta
Assets/DialogueTrigger2D.cs.meta
+11
-0
No files found.
Assets/Dialogue.cs
View file @
6e883fc2
...
...
@@ -7,7 +7,7 @@ using BS;
public
class
DialogueScene
:
ScriptableObject
{
[
SerializeField
]
private
List
<
Dialogue
>
dialogues
;
private
List
<
Dialogue
>
dialogues
=
new
List
<
Dialogue
>()
;
private
int
dialogueIndex
=
0
;
public
bool
IsEnd
{
get
{
return
dialogueIndex
>=
dialogues
.
Count
;
}
}
...
...
@@ -27,7 +27,15 @@ public class DialogueScene : ScriptableObject
[
System
.
Serializable
]
public
struct
Dialogue
{
public
Dialogue
(
string
characterName
,
int
imageIndex
,
string
dialogue
)
{
this
.
characterName
=
characterName
;
this
.
imageIndex
=
imageIndex
;
this
.
dialogue
=
dialogue
;
}
public
string
characterName
;
[
TextArea
]
public
string
dialogue
;
public
int
imageIndex
;
}
\ No newline at end of file
Assets/DialogueSceneMakerWindow.cs
0 → 100644
View file @
6e883fc2
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEditor
;
public
class
DialogueSceneMakerWindow
:
EditorWindow
{
[
SerializeField
]
public
List
<
Dialogue
>
dialogues
=
new
List
<
Dialogue
>();
private
string
characterName
;
private
string
dialogueText
;
private
int
imageIndex
;
Vector2
scroll
;
private
int
loadFromDialoguesIndex
=
0
;
Rect
dialogueAdderWindowRect
=
new
Rect
(
0
,
0
,
400
,
400
);
Rect
dialogueSceneMakerWindowRect
=
new
Rect
(
400
,
0
,
400
,
400
);
[
MenuItem
(
"Tools/DialogueSceneMaker"
)]
static
void
Init
()
{
DialogueSceneMakerWindow
window
=
(
DialogueSceneMakerWindow
)
EditorWindow
.
GetWindow
(
typeof
(
DialogueSceneMakerWindow
));
window
.
minSize
=
new
Vector2
(
800
,
400
);
window
.
Show
();
}
private
void
OnGUI
()
{
/*
EditorGUILayout.BeginHorizontal();
EditorGUILayout.BeginVertical();
GUILayout.Label("Dialogue Scene Maker", EditorStyles.boldLabel);
EditorGUILayout.Space();
characterName = EditorGUILayout.TextField("Character Name", characterName, GUILayout.MaxWidth(position.width / 2));
imageIndex = EditorGUILayout.IntField("Character Image Index", imageIndex, GUILayout.MaxWidth(position.width / 2));
GUILayout.Label("Dialogue");
dialogueText = EditorGUILayout.TextArea(dialogueText,GUILayout.Height(200), GUILayout.MaxWidth(position.width / 2));
if (GUILayout.Button("Add new Dialogue", GUILayout.MaxWidth(position.width / 2)))
{
dialogues.Add(new Dialogue(characterName,imageIndex, dialogueText));
characterName = "";
imageIndex = 0;
dialogueText = "";
}
EditorGUILayout.BeginHorizontal();
loadFromDialoguesIndex = EditorGUILayout.IntField(loadFromDialoguesIndex, GUILayout.MaxWidth(position.width / 4));
if (GUILayout.Button("Load from current Dialogues", GUILayout.MaxWidth(position.width / 4)))
{
Dialogue dialogue = dialogues[loadFromDialoguesIndex];
characterName = dialogue.characterName;
imageIndex = dialogue.imageIndex;
dialogueText = dialogue.dialogue;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical();
scroll = GUILayout.BeginScrollView(scroll);
var serializedObject = new SerializedObject(this);
var list = serializedObject.FindProperty("dialogues");
EditorGUILayout.PropertyField(serializedObject.FindProperty("dialogues"), true, GUILayout.MaxWidth(position.width / 2));
GUILayout.EndScrollView();
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
*/
BeginWindows
();
dialogueAdderWindowRect
=
GUILayout
.
Window
(
1
,
dialogueAdderWindowRect
,
DialogueAdderWindow
,
"Dialogue Adder"
);
dialogueSceneMakerWindowRect
=
GUILayout
.
Window
(
2
,
dialogueSceneMakerWindowRect
,
DialogueSceneWindow
,
"Dialogue Scene Maker"
);
EndWindows
();
}
void
DialogueAdderWindow
(
int
id
)
{
characterName
=
EditorGUILayout
.
TextField
(
"Character Name"
,
characterName
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
imageIndex
=
EditorGUILayout
.
IntField
(
"Character Image Index"
,
imageIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
GUILayout
.
Label
(
"Dialogue"
);
dialogueText
=
EditorGUILayout
.
TextArea
(
dialogueText
,
GUILayout
.
Height
(
200
),
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
if
(
GUILayout
.
Button
(
"Add new Dialogue"
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
)))
{
dialogues
.
Add
(
new
Dialogue
(
characterName
,
imageIndex
,
dialogueText
));
characterName
=
""
;
imageIndex
=
0
;
dialogueText
=
""
;
}
EditorGUILayout
.
BeginHorizontal
();
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
if
(
GUILayout
.
Button
(
"Load from current Dialogues"
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
)))
{
Dialogue
dialogue
=
dialogues
[
loadFromDialoguesIndex
];
characterName
=
dialogue
.
characterName
;
imageIndex
=
dialogue
.
imageIndex
;
dialogueText
=
dialogue
.
dialogue
;
}
EditorGUILayout
.
EndHorizontal
();
GUI
.
DragWindow
();
}
void
DialogueSceneWindow
(
int
id
)
{
GUILayout
.
Label
(
"Current dialogue list"
,
EditorStyles
.
boldLabel
);
scroll
=
GUILayout
.
BeginScrollView
(
scroll
);
var
serializedObject
=
new
SerializedObject
(
this
);
var
list
=
serializedObject
.
FindProperty
(
"dialogues"
);
for
(
int
i
=
0
;
i
<
dialogues
.
Count
;
i
++)
{
EditorGUILayout
.
PropertyField
(
list
.
GetArrayElementAtIndex
(
i
));
}
//EditorGUILayout.PropertyField(serializedObject.FindProperty("dialogues"), true, GUILayout.MaxWidth(position.width / 2));
GUILayout
.
EndScrollView
();
GUI
.
DragWindow
();
}
private
void
DialogueToEditorLayout
(
Dialogue
dialogue
)
{
}
}
Assets/DialogueSceneMakerWindow.cs.meta
0 → 100644
View file @
6e883fc2
fileFormatVersion: 2
guid: 5bcc2111d5977a646b51ee6caf4d3862
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/DialogueSystem.cs
View file @
6e883fc2
...
...
@@ -23,21 +23,49 @@ public class DialogueSystem : MonoBehaviour
public
List
<
Image
>
characterImages
=
new
List
<
Image
>();
private
DialogueScene
dialogueScene
;
public
string
nextButton
,
prevButton
;
public
void
LoadDialogueScene
(
DialogueScene
dialogueScene
)
private
void
Update
()
{
if
(
Input
.
GetButtonDown
(
nextButton
))
{
NextDialogue
();
}
if
(
Input
.
GetButtonDown
(
prevButton
))
{
PrevDialogue
();
}
}
public
void
StartDialogueScene
(
DialogueScene
dialogueScene
)
{
this
.
dialogueScene
=
dialogueScene
;
}
public
void
NextDialogue
()
{
if
(
dialogueScene
.
IsEnd
)
{
}
Dialogue
dialogue
=
dialogueScene
.
GetNextDialogue
();
nameText
.
text
=
dialogue
.
characterName
;
StartCoroutine
(
TypingDialogue
(
dialogue
.
dialogue
));
}
public
void
PrevDialogue
()
{
if
(
dialogueScene
.
IsStart
)
{
return
;
}
Dialogue
dialogue
=
dialogueScene
.
GetPrevDialogue
();
nameText
.
text
=
dialogue
.
characterName
;
StartCoroutine
(
TypingDialogue
(
dialogue
.
dialogue
));
...
...
Assets/DialogueTrigger2D.cs
0 → 100644
View file @
6e883fc2
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
DialogueTrigger2D
:
MonoBehaviour
{
public
DialogueScene
dialogueScene
;
private
void
OnTriggerEnter2D
(
Collider2D
collision
)
{
}
}
Assets/DialogueTrigger2D.cs.meta
0 → 100644
View file @
6e883fc2
fileFormatVersion: 2
guid: b1581c99b89a8f642a2d683138a86ab6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment