-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Studio-23-xyz/dialogue-expressions-script…
…able Dialogue expressions scriptable
- Loading branch information
Showing
28 changed files
with
491 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Qodana | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: # Specify your branches here | ||
- main # The 'main' branch | ||
|
||
jobs: | ||
qodana: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
checks: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit | ||
fetch-depth: 0 # a full history is required for pull request analysis | ||
- name: 'Qodana Scan' | ||
uses: JetBrains/qodana-action@v2023.3 | ||
env: | ||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,70 @@ | ||
name: docfx-unitypackage | ||
name: docfx for GitHub Pages | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- 'main' | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest. | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Find and copy specific files | ||
run: | | ||
# Look for LICENSE.md, README.md, and CHANGELOG.md in subdirectories | ||
find . -name LICENSE.md -exec cp {} . \; | ||
find . -name README.md -exec cp {} . \; | ||
find . -name CHANGELOG.md -exec cp {} . \; | ||
uses: actions/checkout@v4 | ||
|
||
|
||
- name: Remove csproj files | ||
run: find . -name "*.csproj" -type f -delete | ||
shell: bash | ||
|
||
- name: Build | ||
uses: CaseyHofland/docfx-unitypackage@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
|
||
- name: Deploy with DocFX | ||
uses: sator-imaging/docfx-pages@v1 | ||
id: deployment | ||
with: | ||
app_name: 'Dialoguesystem' | ||
site_title: 'Dialoguesystem' | ||
site_footer: '<big>× Is HTML accepted?</big>' | ||
class_members: 'separatePages' | ||
google_analytics: '' | ||
define_symbols: '' | ||
site_logo: '<logo>.svg' | ||
site_favicon: '<favicon>.svg' | ||
main_js: | | ||
export default { | ||
defaultTheme: 'light', | ||
showLightbox: (img) => true, | ||
iconLinks: [ | ||
{ | ||
icon: 'github', | ||
href: 'https://github.com/sator-imaging', | ||
title: 'GitHub' | ||
}, | ||
], | ||
} | ||
main_css: | | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_branch: gh-pages | ||
publish_dir: _site | ||
|
36 changes: 36 additions & 0 deletions
36
Assets/Packages/com.studio23.ss2.dialoguesystem/Editor/Data/CharacterDataEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Studio23.SS2.DialogueSystem.Data; | ||
using UnityEditor; | ||
using UnityEditor.Localization.Plugins.XLIFF.V12; | ||
using UnityEngine; | ||
|
||
namespace Editor.Data | ||
{ | ||
[CustomEditor(typeof(CharacterData))] | ||
public class CharacterDataEditor:UnityEditor.Editor | ||
{ | ||
private string newExpressionName = "QUESTIONABLE EMOJI FACE"; | ||
public override void OnInspectorGUI() | ||
{ | ||
base.OnInspectorGUI(); | ||
var charData = target as CharacterData; | ||
newExpressionName = EditorGUILayout.TextField(newExpressionName); | ||
if (!string.IsNullOrEmpty(newExpressionName) && GUILayout.Button("Add new Expression")) | ||
{ | ||
AddExpression(charData, newExpressionName); | ||
} | ||
} | ||
|
||
public static void AddExpression(CharacterData character, string expressionName) | ||
{ | ||
var expression = ScriptableObject.CreateInstance<CharacterExpressionData>(); | ||
expression.Character = character; | ||
expression.ExpressionName = expressionName; | ||
expression.name = expression.GetAssetName(); | ||
character.Expressions.Add(expression); | ||
|
||
AssetDatabase.AddObjectToAsset(expression, character); | ||
AssetDatabase.SaveAssets(); | ||
EditorUtility.SetDirty(character); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Assets/Packages/com.studio23.ss2.dialoguesystem/Editor/Data/CharacterDataEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
Assets/Packages/com.studio23.ss2.dialoguesystem/Editor/Data/CharacterExpressionDataEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Studio23.SS2.DialogueSystem.Data; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Editor.Data | ||
{ | ||
[CustomEditor(typeof(CharacterExpressionData))] | ||
public class CharacterExpressionDataEditor:UnityEditor.Editor | ||
{ | ||
public override void OnInspectorGUI() | ||
{ | ||
base.OnInspectorGUI(); | ||
var expressionData = target as CharacterExpressionData; | ||
if (GUILayout.Button("RENAME")) | ||
{ | ||
Rename(expressionData); | ||
} | ||
|
||
if (GUILayout.Button("REMOVE")) | ||
{ | ||
RemoveExpression(expressionData); | ||
} | ||
} | ||
|
||
public void RemoveExpression(CharacterExpressionData data) | ||
{ | ||
data.Character.Expressions.Remove(data); | ||
Undo.DestroyObjectImmediate(data); | ||
AssetDatabase.SaveAssets(); | ||
} | ||
|
||
public void Rename(CharacterExpressionData data) | ||
{ | ||
data.name = data.GetAssetName(); | ||
AssetDatabase.SaveAssets(); | ||
EditorUtility.SetDirty(data); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ackages/com.studio23.ss2.dialoguesystem/Editor/Data/CharacterExpressionDataEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
Assets/Packages/com.studio23.ss2.dialoguesystem/Editor/Data/LineSpeakerDataPropertyDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System.Linq; | ||
using Studio23.SS2.DialogueSystem.Data; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Editor.Data | ||
{ | ||
[CustomPropertyDrawer(typeof(LineSpeakerData))] | ||
public class LineSpeakerDataPropertyDrawer:PropertyDrawer | ||
{ | ||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) | ||
{ | ||
return base.GetPropertyHeight(property, label) * 3; | ||
} | ||
|
||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
EditorGUI.BeginProperty(position, label, property); | ||
// Don't make child fields be indented | ||
var indent = EditorGUI.indentLevel; | ||
EditorGUI.indentLevel = 0; | ||
// // Calculate rects | ||
// var charRect = new Rect(position.x, position.y, 30, position.height); | ||
// var unitRect = new Rect(position.x + 35, position.y, 50, position.height); | ||
// var nameRect = new Rect(position.x + 90, position.y, position.width - 90, position.height); | ||
// | ||
// // Draw fields - pass GUIContent.none to each so they are drawn without labels | ||
// EditorGUI.PropertyField(unitRect, property.FindPropertyRelative("unit"), GUIContent.none); | ||
// EditorGUI.PropertyField(nameRect, property.FindPropertyRelative("name"), GUIContent.none); | ||
// position.y += 30; | ||
var lineSpeakerData = property.boxedValue as LineSpeakerData; | ||
// EditorGUI.LabelField(position, lineSpeakerData is LineSpeakerData?"asdas":"zz"); | ||
var charFieldRect = position; | ||
charFieldRect.height = EditorGUIUtility.singleLineHeight; | ||
EditorGUI.PropertyField(charFieldRect, property.FindPropertyRelative("Character"), new GUIContent("Character")); | ||
if (lineSpeakerData.Character != null) | ||
{ | ||
position.y += EditorGUIUtility.singleLineHeight; | ||
var expressions = lineSpeakerData.Character.Expressions.Select(ced => ced.ExpressionName).ToArray(); | ||
// EditorGUI.LabelField(position," :" + lineSpeakerData); | ||
if (expressions.Length == 0) | ||
{ | ||
EditorGUI.HelpBox(position, "NO EXPRESSIONS", MessageType.Error); | ||
} | ||
else | ||
{ | ||
var expressionProp = property.FindPropertyRelative("Expression"); | ||
|
||
var prevIndex = lineSpeakerData.Character.GetExpressionIndexByName(lineSpeakerData.Expression); | ||
var expressionPopupRect = position; | ||
expressionPopupRect.height = EditorGUIUtility.singleLineHeight; | ||
var expressionIndex = EditorGUI.Popup(expressionPopupRect, prevIndex, expressions); | ||
if (expressionIndex != prevIndex) | ||
{ | ||
if (expressionIndex >= 0 && expressionIndex < expressions.Length) | ||
{ | ||
expressionProp.objectReferenceValue = lineSpeakerData.Character.Expressions[expressionIndex]; | ||
expressionProp.serializedObject.ApplyModifiedProperties(); | ||
|
||
} | ||
} | ||
position.y += EditorGUIUtility.singleLineHeight; | ||
var expressionFieldRect = position; | ||
expressionFieldRect.height = EditorGUIUtility.singleLineHeight; | ||
EditorGUI.BeginDisabledGroup(true); | ||
EditorGUI.ObjectField(expressionFieldRect, expressionProp, GUIContent.none); | ||
EditorGUI.EndDisabledGroup(); | ||
} | ||
} | ||
|
||
// Set indent back to what it was | ||
EditorGUI.indentLevel = indent; | ||
|
||
EditorGUI.EndProperty(); | ||
} | ||
} | ||
} |
Oops, something went wrong.