Commit baab9909 authored by Chae Ho Shin's avatar Chae Ho Shin

fix #108

parent c0f5b0ed
......@@ -68,8 +68,8 @@ namespace ISEKAI_Model
private void _InitEvents() // should add EVERY events when new event plan comes.
{
//allEventsList.Add(new Prolog_1(this));
// allEventsList.Add(new Prolog_2(this));
allEventsList.Add(new Prolog_1(this));
allEventsList.Add(new Prolog_2(this));
allEventsList.Add(new ReturnWarning(this));
......
......@@ -119,6 +119,7 @@ public class EventManager : MonoBehaviour
public void SetUpEventManager() // when playing new event, this instance should be made.
{
eventCore = GameManager.instance.currentEvent;
characterBrightNum = SpriteLocation.None;
scriptEnumerator = GameManager.instance.currentEvent.script.GetEnumerator();
}
......@@ -154,16 +155,7 @@ public class EventManager : MonoBehaviour
else
{
Command c = scriptEnumerator.Current;
if (c.commandNumber == 2)
_setBright(characterBrightNum);
else
_setBright(SpriteLocation.None);
_ExecuteCommand(c);
if (c.commandNumber != 1)
{
characterBrightNum = SpriteLocation.None;
_setBright(characterBrightNum);
}
}
}
......@@ -171,6 +163,7 @@ public class EventManager : MonoBehaviour
{
isNextButtonActive = true;
int choiceDependencyNum;
choiceDependencyNum = c.choiceDependency.Item1;
......@@ -297,22 +290,13 @@ public class EventManager : MonoBehaviour
}
}
IEnumerator WaitUntilCharacterLoaded()
IEnumerator WaitUntilCharacterLoadedExplanation(Explanation explanation)
{
if (_loadingCharacterCount != 0)
{
Debug.Log("Wait Until Character Loaded");
}
yield return new WaitUntil(() => _loadingCharacterCount == 0);
}
private void _Explanation(Explanation explanation)
{
Debug.Log("explanation");
UIScript.SetActive(true);
StartCoroutine(WaitUntilCharacterLoaded());
containerChoice.SetActive(false);
containerConversation.SetActive(false);
containerFullScript.SetActive(true);
......@@ -328,6 +312,50 @@ public class EventManager : MonoBehaviour
fullScriptText.GetComponent<RubyText>().isCalled = false;
}
IEnumerator WaitUntilCharacterLoadedConversation(Conversation conversation)
{
if (_loadingCharacterCount != 0)
{
Debug.Log("Wait Until Character Loaded");
}
yield return new WaitUntil(() => _loadingCharacterCount == 0);
containerChoice.SetActive(false);
containerConversation.SetActive(true);
containerFullScript.SetActive(false);
textCharacterInfo.text = conversation.characterName;
textScript.text = conversation.contents;
if (conversation.brightCharacter != SpriteLocation.None)
{
_setBright(conversation.brightCharacter);
}
else
{
_setBright(SpriteLocation.None);
}
foreach (Transform child in scriptText.transform)
{
GameObject.Destroy(child.gameObject);
Debug.Log("웨않되2");
}
scriptText.GetComponent<RubyText>().isCalled = false;
}
private void _Explanation(Explanation explanation)
{
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
Debug.Log("explanation");
UIScript.SetActive(true);
StartCoroutine(WaitUntilCharacterLoadedExplanation(explanation));
}
private String _fullScriptHandler(String s)
{
if (_scriptLength > 0)
......@@ -355,35 +383,15 @@ public class EventManager : MonoBehaviour
Debug.Log("conversation");
UIScript.SetActive(true);
StartCoroutine(WaitUntilCharacterLoaded());
containerChoice.SetActive(false);
containerConversation.SetActive(true);
containerFullScript.SetActive(false);
textCharacterInfo.text = conversation.characterName;
textScript.text = conversation.contents;
if (conversation.brightCharacter != SpriteLocation.None)
{
_setBright(conversation.brightCharacter);
characterBrightNum = conversation.brightCharacter;
}
else
_setBright(SpriteLocation.None);
foreach (Transform child in scriptText.transform)
{
GameObject.Destroy(child.gameObject);
Debug.Log("웨않되2");
}
scriptText.GetComponent<RubyText>().isCalled = false;
StartCoroutine(WaitUntilCharacterLoadedConversation(conversation));
}
private void _LoadCharacter(LoadCharacter loadCharacter)
{
containerChoice.SetActive(false);
containerConversation.SetActive(false);
containerFullScript.SetActive(false);
......@@ -394,7 +402,7 @@ public class EventManager : MonoBehaviour
{
isNextButtonActive = false;
StartCoroutine(fadeCharacter(loadCharacter));
//ExecuteOneScript();
}
......@@ -435,6 +443,9 @@ public class EventManager : MonoBehaviour
Color color1 = spriteRenderer1.color;
Color color2 = spriteRenderer2.color;
color1.a = 1.0f;
color2.a = 0.0f;
//페이드 인 아웃 동시에
while (color2.a < 1.0f)
{
......@@ -463,13 +474,21 @@ public class EventManager : MonoBehaviour
spritePeople[(int)loadCharacter.location] = charGameObject2;
spritePeopleTmp[(int)loadCharacter.location] = charGameObject1;
// ExecuteOneScript();
if (characterBrightNum != loadCharacter.location)
{
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
}
//ExecuteOneScript();
_loadingCharacterCount--;
isNextButtonActive = true;
}
private void _UnloadCharacter(UnloadCharacter unloadCharacter)
{
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
Debug.Log("UnloadCharacter");
if (unloadCharacter.location != SpriteLocation.None)
......@@ -484,7 +503,8 @@ public class EventManager : MonoBehaviour
private void _LoadBackground(LoadBackground loadBackground)
{
Debug.Log("LoadBackground");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
Sprite background = Resources.Load<Sprite>(loadBackground.filePath);
if (background == null)
......@@ -499,8 +519,7 @@ public class EventManager : MonoBehaviour
var tmpBackgroundRenderer = spriteBackgroundTemp.GetComponent<SpriteRenderer>();
if (tmpBackgroundRenderer == null) return;
if (mainBackgroundRenderer.sprite == null || mainBackgroundRenderer.sprite.Equals(background))
if(mainBackgroundRenderer.sprite == null || mainBackgroundRenderer.sprite.Equals(background))
{
// 그냥 페이드 인
spriteBackgroundTemp.SetActive(false);
......@@ -519,6 +538,7 @@ public class EventManager : MonoBehaviour
var worldScreenWidth = worldScreenHeight / Screen.height * Screen.width;
spriteBackground.transform.localScale = new Vector3((float)worldScreenWidth / width, (float)worldScreenHeight / height, 1);
//spriteBackgroundTemp.transform.localScale = new Vector3((float)worldScreenWidth / width, (float)worldScreenHeight / height, 1);
spriteBackground.SetActive(true);
spriteBackgroundTemp.SetActive(true);
......@@ -526,6 +546,7 @@ public class EventManager : MonoBehaviour
isNextButtonActive = false;
StartCoroutine(DissolveBackground(loadBackground, background, mainBackgroundRenderer, tmpBackgroundRenderer));
}
}
......@@ -558,6 +579,7 @@ public class EventManager : MonoBehaviour
}
isNextButtonActive = true;
ExecuteOneScript();
}
......@@ -605,6 +627,7 @@ public class EventManager : MonoBehaviour
mainBackgroundRenderer.color = mainBackgroundColor;
isNextButtonActive = true;
ExecuteOneScript();
}
......@@ -612,7 +635,8 @@ public class EventManager : MonoBehaviour
private void _PlayMusic(PlayMusic playMusic)
{
Debug.Log("PlayMusic");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
AudioClip bgm;
bgm = Resources.Load<AudioClip>(playMusic.filePath);
audioBGM.clip = bgm;
......@@ -625,7 +649,8 @@ public class EventManager : MonoBehaviour
private void _StopMusic(StopMusic stopMusic)
{
Debug.Log("StopMusic");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
audioBGM.Stop();
ExecuteOneScript();
......@@ -634,7 +659,8 @@ public class EventManager : MonoBehaviour
private void _LoadCG(LoadCG loadCG)
{
Debug.Log("LoadCG");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
Sprite cg;
cg = Resources.Load<Sprite>(loadCG.filePath);
spriteCG.GetComponent<SpriteRenderer>().sprite = cg;
......@@ -679,9 +705,10 @@ public class EventManager : MonoBehaviour
private void _UnloadCG(UnloadCG unloadCG)
{
Debug.Log("UnloadCG");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
SpriteRenderer cgRenderer = spriteCG.GetComponent<SpriteRenderer>();
spriteCG.SetActive(false);
ExecuteOneScript();
StartCoroutine(dissolveCG(cgRenderer));
......@@ -707,7 +734,8 @@ public class EventManager : MonoBehaviour
private void _VFXCamerashake(VFXCameraShake vfxCameraShake)
{
Debug.Log("VFXCamerashake");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
isNextButtonActive = false;
StartCoroutine(cameraShake());
}
......@@ -746,7 +774,8 @@ public class EventManager : MonoBehaviour
private void _VFXLoadSprite(VFXLoadSprite vfxLoadSprite)
{
Debug.Log("VFXLoadSprite");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
Sprite vfxSprite;
vfxSprite = Resources.Load<Sprite>(vfxLoadSprite.filePath);
......@@ -790,6 +819,7 @@ public class EventManager : MonoBehaviour
//UIButton.SetActive(true);
UIScript.SetActive(true);
isNextButtonActive = true;
ExecuteOneScript();
}
......@@ -807,14 +837,18 @@ public class EventManager : MonoBehaviour
}
UIScript.SetActive(true);
isNextButtonActive = true;
ExecuteOneScript();
}
private void _VFXUnloadSprite(VFXUnloadSprite vfxUnloadSprite)
{
Debug.Log("VFXUnloadSprite");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
SpriteRenderer spriteRenderer = spriteVFX.GetComponent<SpriteRenderer>();
StartCoroutine(dissolveSprite(spriteRenderer));
ExecuteOneScript();
}
......@@ -841,11 +875,13 @@ public class EventManager : MonoBehaviour
AudioClip vfx;
vfx = Resources.Load<AudioClip>(vfxSound.filePath);
audioVFX.clip = vfx;
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
float soundLength;
soundLength = (float)audioVFX.clip.length;
audioVFX.Play();
ExecuteOneScript();
//StartCoroutine(soundVFXPlay(vfxSound));
}
......@@ -869,6 +905,8 @@ public class EventManager : MonoBehaviour
private void _LoadMinigame(LoadMinigame loadMinigame)
{
Debug.Log("LoadMinigame");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
SetActiveEventSceneThings(false);
SceneManager.LoadScene(loadMinigame.minigameName, LoadSceneMode.Additive);
//ExecuteOneScript();
......@@ -877,7 +915,8 @@ public class EventManager : MonoBehaviour
private void _LoadVideo(LoadVideo loadVideo)
{
Debug.Log("LoadVideo");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
VideoClip videoClip;
videoClip = Resources.Load<VideoClip>(loadVideo.filePath);
......@@ -911,7 +950,8 @@ public class EventManager : MonoBehaviour
private void _Choice(Choice choice)
{
Debug.Log("Choice");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
//버튼 죽이기
isNextButtonActive = false;
......@@ -1024,19 +1064,21 @@ public class EventManager : MonoBehaviour
Debug.Log((GameManager.instance.game.choiceHistories[currentEventName])[0]);
ExecuteOneScript();
//ExecuteOneScript();
UI.transform.Find("ContainerSetting").gameObject.SetActive(true);
UI.transform.Find("ButtonNext").gameObject.SetActive(true);
//버튼 살리기
isNextButtonActive = true;
ExecuteOneScript();
}
private void _VFXTransition(VFXTransition vfxTransition)
{
Debug.Log("VFXTransition");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
StartCoroutine(transtionVFXPlay());
}
......@@ -1052,6 +1094,7 @@ public class EventManager : MonoBehaviour
yield return new WaitForSeconds(0.25f);
isNextButtonActive = true;
ExecuteOneScript();
yield return new WaitForSeconds(0.25f);
......@@ -1095,7 +1138,8 @@ public class EventManager : MonoBehaviour
private void _VFXPause(VFXPause vfxPause)
{
Debug.Log("VFXPause");
characterBrightNum = SpriteLocation.None;
_setBright(SpriteLocation.None);
isNextButtonActive = false;
StartCoroutine(pauseVFXPlay(vfxPause.second / 1000)); //millisecond to second
}
......
......@@ -35,7 +35,7 @@ Load Character "Character\Rancher\a\frown" -right
Load Character "Character\Smith\a\embarassed" -left
Load Character "Character\Rancher\a\embarassed" -right
## "???" "「으으음...」" -left
Load Character "Character\Father\a\comtemplating" - center
Load Character "Character\Father\a\comtemplating" -center
## "작업반장 동지(선녀의 아버지)" "「━━━━ 동무들, 이런 늦은 시각에 성난 『{산:멧}{도:돼}{티:지}』에 덤벼들어 생전 처음 본 새기를 구해준거 보면 나쁜 쓰나이인것 같지는 않소다。」" -center
## "작업반장 동지(선녀의 아버지)" "「내래 집에 방 하나를 마련해 줄 수 있으니 며칠 재워주고 봅시다。」" -center
## "???" "「뭐 작업반장 동지가 그렇다면야━━」" -right
......
......@@ -1068,7 +1068,7 @@ SpriteRenderer:
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 8.32, y: 4.69}
m_Size: {x: 6, y: 3.84}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
......@@ -1867,7 +1867,7 @@ SpriteRenderer:
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 8.32, y: 4.69}
m_Size: {x: 6, y: 3.84}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment