-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://doublsb.tistory.com/81 - Emotion Class Serialize - 변경된 클래스에 맞도록 DialogManager 수정 - Enum Emotion 삭제
- Loading branch information
Showing
5 changed files
with
135 additions
and
50 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
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
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,45 +1,41 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using System; | ||
|
||
namespace Doublsb.Dialog | ||
{ | ||
[SerializeField] | ||
public class Emotion : MonoBehaviour | ||
[Serializable] | ||
public class Emotion | ||
{ | ||
//================================================ | ||
//Public Variable | ||
//================================================ | ||
public Dictionary<string, Sprite> Data; | ||
|
||
|
||
//================================================ | ||
//Private Variable | ||
//================================================ | ||
[SerializeField] | ||
private string[] _emotion; | ||
|
||
[SerializeField] | ||
private Sprite[] _sprite; | ||
private Dictionary<string, Sprite> _data; | ||
public Dictionary<string, Sprite> Data | ||
{ | ||
get | ||
{ | ||
if (_data == null) _init_emotionList(); | ||
return _data; | ||
} | ||
} | ||
|
||
public string[] _emotion; | ||
public Sprite[] _sprite; | ||
|
||
//================================================ | ||
//Private Method | ||
//================================================ | ||
private void Awake() | ||
{ | ||
_init_emotionList(); | ||
} | ||
|
||
private void _init_emotionList() | ||
{ | ||
Data = new Dictionary<string, Sprite>(); | ||
_data = new Dictionary<string, Sprite>(); | ||
|
||
if (_emotion.Length != _sprite.Length) | ||
Debug.LogError("Emotion and Sprite have different lengths"); | ||
|
||
for (int i = 0; i < _emotion.Length; i++) | ||
Data.Add(_emotion[i], _sprite[i]); | ||
_data.Add(_emotion[i], _sprite[i]); | ||
} | ||
} | ||
} |