Merge pull request #43 from Degulleo/DO-47-승패-무승부-기보씬에-적용
기보씬 '끝' 버튼 시간차 돌놓기
This commit is contained in:
commit
0c3c280882
@ -19668,6 +19668,7 @@ MonoBehaviour:
|
|||||||
userBProfileImages:
|
userBProfileImages:
|
||||||
- {fileID: 2288075173090734880}
|
- {fileID: 2288075173090734880}
|
||||||
- {fileID: 7536757830621973007}
|
- {fileID: 7536757830621973007}
|
||||||
|
replayFinishButton: {fileID: 609484620077371465}
|
||||||
--- !u!1 &8676936482266105011
|
--- !u!1 &8676936482266105011
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -7,4 +7,6 @@
|
|||||||
public const int WIN_COUNT = 5;
|
public const int WIN_COUNT = 5;
|
||||||
//무승부 확인을 위한 최소 착수 수
|
//무승부 확인을 위한 최소 착수 수
|
||||||
public const int MinCountForDrawCheck = 150;
|
public const int MinCountForDrawCheck = 150;
|
||||||
|
|
||||||
|
public string[] AI_NAMIES = { "이세돌", "신사동호랭이","진짜인간임","종로3가짱돌","마스터김춘배","62세황순자","고준일 강사님"};
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class ReplayController : MonoBehaviour
|
public class ReplayController : MonoBehaviour
|
||||||
@ -11,6 +12,7 @@ public class ReplayController : MonoBehaviour
|
|||||||
[SerializeField] private TMP_Text playerBNicknameText;
|
[SerializeField] private TMP_Text playerBNicknameText;
|
||||||
[SerializeField] private GameObject[] userAProfileImages;
|
[SerializeField] private GameObject[] userAProfileImages;
|
||||||
[SerializeField] private GameObject[] userBProfileImages;
|
[SerializeField] private GameObject[] userBProfileImages;
|
||||||
|
[SerializeField] private Button replayFinishButton;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
InitReplayUI();
|
InitReplayUI();
|
||||||
@ -18,16 +20,26 @@ public class ReplayController : MonoBehaviour
|
|||||||
|
|
||||||
public void OnclickExitButton()
|
public void OnclickExitButton()
|
||||||
{
|
{
|
||||||
|
ReplayManager.Instance.StopReplayFinish(() => { });;
|
||||||
SceneManager.LoadScene("Main");
|
SceneManager.LoadScene("Main");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnclickFirstButton()
|
public void OnclickFirstButton()
|
||||||
{
|
{
|
||||||
|
ReplayManager.Instance.StopReplayFinish(() =>
|
||||||
|
{
|
||||||
|
replayFinishButton.interactable = true;
|
||||||
|
});;
|
||||||
ReplayManager.Instance.ReplayFirst();
|
ReplayManager.Instance.ReplayFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnclickUndoButton()
|
public void OnclickUndoButton()
|
||||||
{
|
{
|
||||||
|
ReplayManager.Instance.StopReplayFinish(() =>
|
||||||
|
{
|
||||||
|
replayFinishButton.interactable = true;
|
||||||
|
});;
|
||||||
|
|
||||||
Move targetMove = ReplayManager.Instance.PopPlacedMove();
|
Move targetMove = ReplayManager.Instance.PopPlacedMove();
|
||||||
if (targetMove != null)
|
if (targetMove != null)
|
||||||
{
|
{
|
||||||
@ -37,6 +49,10 @@ public class ReplayController : MonoBehaviour
|
|||||||
|
|
||||||
public void OnclickNextButton()
|
public void OnclickNextButton()
|
||||||
{
|
{
|
||||||
|
ReplayManager.Instance.StopReplayFinish(() =>
|
||||||
|
{
|
||||||
|
replayFinishButton.interactable = true;
|
||||||
|
});;
|
||||||
Move nextMove = ReplayManager.Instance.GetNextMove();
|
Move nextMove = ReplayManager.Instance.GetNextMove();
|
||||||
if (nextMove != null)
|
if (nextMove != null)
|
||||||
{
|
{
|
||||||
@ -44,9 +60,17 @@ public class ReplayController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 끝 버튼 눌렸을 때 중복 클릭 방지
|
||||||
|
/// </summary>
|
||||||
public void OnClickFinishButton()
|
public void OnClickFinishButton()
|
||||||
{
|
{
|
||||||
ReplayManager.Instance.ReplayFinish();
|
replayFinishButton.interactable = false;
|
||||||
|
//실행이 끝난 후 끝버튼 다시 활성화
|
||||||
|
ReplayManager.Instance.ReplayFinish(() =>
|
||||||
|
{
|
||||||
|
replayFinishButton.interactable = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitReplayUI()
|
public void InitReplayUI()
|
||||||
|
@ -34,6 +34,7 @@ public class Move
|
|||||||
public class ReplayManager : Singleton<ReplayManager>
|
public class ReplayManager : Singleton<ReplayManager>
|
||||||
{
|
{
|
||||||
private ReplayRecord _recordingReplayData;
|
private ReplayRecord _recordingReplayData;
|
||||||
|
private Coroutine finishCoroutine;
|
||||||
|
|
||||||
#region 기보 시작 후 데이터를 컨트롤하기
|
#region 기보 시작 후 데이터를 컨트롤하기
|
||||||
|
|
||||||
@ -223,14 +224,34 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReplayFinish()
|
public void ReplayFinish(Action onFinishEnd)
|
||||||
|
{
|
||||||
|
finishCoroutine = StartCoroutine(IReplayFinish(onFinishEnd));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 끝 버튼을 중간에 멈춰야 할 때 사용
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="onFinishStop">마지막 장면까지 가는 도중에 멈출경우 해야할 일 전달</param>
|
||||||
|
public void StopReplayFinish(Action onFinishStop)
|
||||||
|
{
|
||||||
|
if (finishCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(finishCoroutine);
|
||||||
|
finishCoroutine = null;
|
||||||
|
}
|
||||||
|
onFinishStop?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator IReplayFinish(Action onFinishEnd)
|
||||||
{
|
{
|
||||||
while(_placedStoneStack.Count < _selectedReplayRecord.moves.Count)
|
while(_placedStoneStack.Count < _selectedReplayRecord.moves.Count)
|
||||||
{
|
{
|
||||||
ReplayNext(GetNextMove());
|
ReplayNext(GetNextMove());
|
||||||
|
yield return new WaitForSeconds(0.1f);
|
||||||
}
|
}
|
||||||
|
onFinishEnd?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetPlayerANickname()
|
public string GetPlayerANickname()
|
||||||
{
|
{
|
||||||
return _selectedReplayRecord.playerA;
|
return _selectedReplayRecord.playerA;
|
||||||
|
@ -27,7 +27,6 @@ public class ReplayPanelItemsController : ScrollPanelController
|
|||||||
records = ReplayManager.Instance.LoadReplayDatas();
|
records = ReplayManager.Instance.LoadReplayDatas();
|
||||||
foreach (var replayRecord in records)
|
foreach (var replayRecord in records)
|
||||||
{
|
{
|
||||||
Debug.Log($"{replayRecord.gameDate}의 결과는 {replayRecord.gameResult}");
|
|
||||||
var replayCellButtonObject = Instantiate(scrollItemPrefab, content.transform);
|
var replayCellButtonObject = Instantiate(scrollItemPrefab, content.transform);
|
||||||
ReplayCell replayCell = replayCellButtonObject.GetComponent<ReplayCell>();
|
ReplayCell replayCell = replayCellButtonObject.GetComponent<ReplayCell>();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user