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
fa2de7bc
Commit
fa2de7bc
authored
Jan 19, 2020
by
15박보승
Committed by
18류지석
Jan 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add utility features to Dialogue Scene Maker
parent
6e883fc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
44 deletions
+98
-44
Dialogue.cs
Assets/Dialogue.cs
+7
-0
DialogueSceneMakerWindow.cs
Assets/DialogueSceneMakerWindow.cs
+91
-44
No files found.
Assets/Dialogue.cs
View file @
fa2de7bc
...
@@ -34,6 +34,13 @@ public struct Dialogue
...
@@ -34,6 +34,13 @@ public struct Dialogue
this
.
dialogue
=
dialogue
;
this
.
dialogue
=
dialogue
;
}
}
public
Dialogue
(
Dialogue
dialogue
)
{
this
.
characterName
=
dialogue
.
characterName
;
this
.
imageIndex
=
dialogue
.
imageIndex
;
this
.
dialogue
=
dialogue
.
dialogue
;
}
public
string
characterName
;
public
string
characterName
;
[
TextArea
]
[
TextArea
]
public
string
dialogue
;
public
string
dialogue
;
...
...
Assets/DialogueSceneMakerWindow.cs
View file @
fa2de7bc
...
@@ -12,11 +12,15 @@ public class DialogueSceneMakerWindow : EditorWindow
...
@@ -12,11 +12,15 @@ public class DialogueSceneMakerWindow : EditorWindow
private
string
dialogueText
;
private
string
dialogueText
;
private
int
imageIndex
;
private
int
imageIndex
;
Vector2
s
croll
;
Vector2
dialogueS
croll
;
private
int
loadFromDialoguesIndex
=
0
;
private
int
loadFromDialoguesIndex
=
0
;
Rect
dialogueAdderWindowRect
=
new
Rect
(
0
,
0
,
400
,
400
);
Rect
dialogueAdderWindowRect
=
new
Rect
(
0
,
0
,
400
,
400
);
Rect
dialogueSceneMakerWindowRect
=
new
Rect
(
400
,
0
,
400
,
400
);
Rect
dialogueSceneMakerWindowRect
=
new
Rect
(
400
,
0
,
400
,
600
);
DialogueScene
dialogueScene
=
null
;
string
newFileName
;
[
MenuItem
(
"Tools/DialogueSceneMaker"
)]
[
MenuItem
(
"Tools/DialogueSceneMaker"
)]
static
void
Init
()
static
void
Init
()
...
@@ -28,21 +32,23 @@ public class DialogueSceneMakerWindow : EditorWindow
...
@@ -28,21 +32,23 @@ public class DialogueSceneMakerWindow : EditorWindow
private
void
OnGUI
()
private
void
OnGUI
()
{
{
/*
BeginWindows
();
EditorGUILayout.BeginHorizontal();
dialogueAdderWindowRect
=
GUILayout
.
Window
(
1
,
dialogueAdderWindowRect
,
DialogueAdderWindow
,
"Dialogue Adder"
);
dialogueSceneMakerWindowRect
=
GUILayout
.
Window
(
2
,
dialogueSceneMakerWindowRect
,
DialogueSceneWindow
,
"Dialogue Scene Maker"
);
EndWindows
();
}
EditorGUILayout.BeginVertical();
void
DialogueAdderWindow
(
int
id
)
GUILayout.Label("Dialogue Scene Maker", EditorStyles.boldLabel);
{
EditorGUILayout.Space();
characterName
=
EditorGUILayout
.
TextField
(
"Character Name"
,
characterName
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
characterName
=
EditorGUILayout
.
TextField
(
"Character Name"
,
characterName
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
imageIndex
=
EditorGUILayout
.
IntField
(
"Character Image Index"
,
imageIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
imageIndex
=
EditorGUILayout
.
IntField
(
"Character Image Index"
,
imageIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
GUILayout
.
Label
(
"Dialogue"
);
GUILayout
.
Label
(
"Dialogue"
);
dialogueText = EditorGUILayout.TextArea(dialogueText,GUILayout.Height(200), GUILayout.MaxWidth(position.width / 2));
dialogueText
=
EditorGUILayout
.
TextArea
(
dialogueText
,
GUILayout
.
Height
(
200
),
GUILayout
.
MaxWidth
(
position
.
width
/
2
));
if
(
GUILayout
.
Button
(
"Add new Dialogue"
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
)))
if
(
GUILayout
.
Button
(
"Add new Dialogue"
,
GUILayout
.
MaxWidth
(
position
.
width
/
2
)))
{
{
dialogues.Add(new Dialogue(characterName,imageIndex, dialogueText));
dialogues
.
Add
(
new
Dialogue
(
characterName
,
imageIndex
,
dialogueText
));
characterName
=
""
;
characterName
=
""
;
imageIndex
=
0
;
imageIndex
=
0
;
dialogueText
=
""
;
dialogueText
=
""
;
...
@@ -50,49 +56,25 @@ public class DialogueSceneMakerWindow : EditorWindow
...
@@ -50,49 +56,25 @@ public class DialogueSceneMakerWindow : EditorWindow
EditorGUILayout
.
BeginHorizontal
();
EditorGUILayout
.
BeginHorizontal
();
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
if (GUILayout.Button("
Load from current Dialogues
", GUILayout.MaxWidth(position.width / 4)))
if
(
GUILayout
.
Button
(
"
Add new Dialogue at
"
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
)))
{
{
Dialogue dialogue = dialogues[loadFromDialoguesIndex]
;
dialogues
.
Add
(
new
Dialogue
(
characterName
,
imageIndex
,
dialogueText
))
;
characterName =
dialogue.characterName
;
characterName
=
""
;
imageIndex =
dialogue.imageIndex
;
imageIndex
=
0
;
dialogueText =
dialogue.dialogue
;
dialogueText
=
""
;
}
}
EditorGUILayout
.
EndHorizontal
();
EditorGUILayout
.
EndHorizontal
();
EditorGUILayout.EndVertical();
EditorGUILayout
.
BeginHorizontal
();
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
EditorGUILayout.BeginVertical();
if
(
GUILayout
.
Button
(
"Edit Dialogue at"
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
)))
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
));
dialogues
.
Add
(
new
Dialogue
(
characterName
,
imageIndex
,
dialogueText
));
characterName
=
""
;
characterName
=
""
;
imageIndex
=
0
;
imageIndex
=
0
;
dialogueText
=
""
;
dialogueText
=
""
;
}
}
EditorGUILayout
.
EndHorizontal
();
EditorGUILayout
.
BeginHorizontal
();
EditorGUILayout
.
BeginHorizontal
();
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
loadFromDialoguesIndex
=
EditorGUILayout
.
IntField
(
loadFromDialoguesIndex
,
GUILayout
.
MaxWidth
(
position
.
width
/
4
));
...
@@ -112,13 +94,78 @@ public class DialogueSceneMakerWindow : EditorWindow
...
@@ -112,13 +94,78 @@ public class DialogueSceneMakerWindow : EditorWindow
{
{
GUILayout
.
Label
(
"Current dialogue list"
,
EditorStyles
.
boldLabel
);
GUILayout
.
Label
(
"Current dialogue list"
,
EditorStyles
.
boldLabel
);
scroll
=
GUILayout
.
BeginScrollView
(
scroll
);
/*
GUILayout.BeginHorizontal();
dialogueScene = EditorGUILayout.ObjectField(dialogueScene, typeof(DialogueScene), false) as DialogueScene;
if (GUILayout.Button("Save", GUILayout.Width(100)))
{
}
if (GUILayout.Button("Load", GUILayout.Width(100)))
{
}
GUILayout.EndHorizontal();
/*
GUILayout.BeginHorizontal();
if (GUILayout.Button("Save", GUILayout.Width(100)))
{
}
if (GUILayout.Button("Load", GUILayout.Width(100)))
{
}
GUILayout.EndHorizontal();
*/
dialogueScroll
=
GUILayout
.
BeginScrollView
(
dialogueScroll
);
var
serializedObject
=
new
SerializedObject
(
this
);
var
serializedObject
=
new
SerializedObject
(
this
);
var
list
=
serializedObject
.
FindProperty
(
"dialogues"
);
var
list
=
serializedObject
.
FindProperty
(
"dialogues"
);
for
(
int
i
=
0
;
i
<
dialogues
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
dialogues
.
Count
;
i
++)
{
{
EditorGUILayout
.
PropertyField
(
list
.
GetArrayElementAtIndex
(
i
));
if
(
EditorGUILayout
.
PropertyField
(
list
.
GetArrayElementAtIndex
(
i
),
new
GUIContent
(
"Dialogue "
+
i
.
ToString
()),
true
))
{
Debug
.
Log
(
"ASDF"
);
var
element
=
list
.
GetArrayElementAtIndex
(
i
);
Dialogue
dialogue
=
new
Dialogue
(
element
.
FindPropertyRelative
(
"characterName"
).
stringValue
,
element
.
FindPropertyRelative
(
"imageIndex"
).
intValue
,
element
.
FindPropertyRelative
(
"dialogue"
).
stringValue
);
dialogues
[
i
]
=
dialogue
;
}
GUILayout
.
BeginHorizontal
();
GUILayout
.
FlexibleSpace
();
if
(
i
>
0
&&
GUILayout
.
Button
(
"↑"
,
GUILayout
.
Width
(
20
)))
{
Dialogue
tmp
=
dialogues
[
i
];
dialogues
[
i
]
=
dialogues
[
i
-
1
];
dialogues
[
i
-
1
]
=
tmp
;
break
;
}
if
(
i
<
dialogues
.
Count
-
1
&&
GUILayout
.
Button
(
"↓"
,
GUILayout
.
Width
(
20
)))
{
Dialogue
tmp
=
dialogues
[
i
];
dialogues
[
i
]
=
dialogues
[
i
+
1
];
dialogues
[
i
+
1
]
=
tmp
;
break
;
}
if
(
GUILayout
.
Button
(
"+"
,
GUILayout
.
Width
(
20
)))
{
Dialogue
tmp
=
new
Dialogue
(
dialogues
[
i
]);
dialogues
.
Insert
(
i
+
1
,
tmp
);
break
;
}
if
(
GUILayout
.
Button
(
"-"
,
GUILayout
.
Width
(
20
)))
{
dialogues
.
RemoveAt
(
i
);
break
;
}
GUILayout
.
EndHorizontal
();
}
}
...
...
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