Merge branch 'main' into DO-46-게임-씬-보조-기능-추가
This commit is contained in:
commit
90f853e9d6
@ -19668,6 +19668,7 @@ MonoBehaviour:
|
||||
userBProfileImages:
|
||||
- {fileID: 2288075173090734880}
|
||||
- {fileID: 7536757830621973007}
|
||||
replayFinishButton: {fileID: 609484620077371465}
|
||||
--- !u!1 &8676936482266105011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -7,4 +7,6 @@
|
||||
public const int WIN_COUNT = 5;
|
||||
//무승부 확인을 위한 최소 착수 수
|
||||
public const int MinCountForDrawCheck = 150;
|
||||
|
||||
public string[] AI_NAMIES = { "이세돌", "신사동호랭이","진짜인간임","종로3가짱돌","마스터김춘배","62세황순자","고준일 강사님"};
|
||||
}
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public abstract class BasePlayerState
|
||||
{
|
||||
@ -19,9 +20,11 @@ public abstract class BasePlayerState
|
||||
|
||||
if (gameLogic.CheckGameWin(playerType, row, col))
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: {playerType} Win",() =>{});
|
||||
var gameResult = playerType == Enums.PlayerType.PlayerA? Enums.GameResult.Win:Enums.GameResult.Lose;
|
||||
gameLogic.EndGame(gameResult);
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: {playerType} Win", () =>
|
||||
{
|
||||
var gameResult = playerType == Enums.PlayerType.PlayerA? Enums.GameResult.Win:Enums.GameResult.Lose;
|
||||
gameLogic.EndGame(gameResult);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -29,8 +32,10 @@ public abstract class BasePlayerState
|
||||
{
|
||||
if (gameLogic.CheckGameDraw())
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw",() =>{});
|
||||
gameLogic.EndGame(Enums.GameResult.Draw);
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: Draw", () =>
|
||||
{
|
||||
gameLogic.EndGame(Enums.GameResult.Draw);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -354,6 +359,7 @@ public class GameLogic : MonoBehaviour
|
||||
SetState(null);
|
||||
ReplayManager.Instance.SaveReplayDataResult(result);
|
||||
//TODO: 게임 종료 후 행동 구현
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
|
||||
//승리 확인 함수
|
||||
|
@ -28,8 +28,14 @@ public class GameManager : Singleton<GameManager>
|
||||
|
||||
private void InitPanels()
|
||||
{
|
||||
panelManager = Instantiate(panelManagerPrefab).GetComponent<PanelManager>();
|
||||
audioManager = Instantiate(audioManagerPrefab).GetComponent<AudioManager>();
|
||||
if (panelManager == null)
|
||||
{
|
||||
panelManager = Instantiate(panelManagerPrefab).GetComponent<PanelManager>();
|
||||
}
|
||||
if (audioManager == null)
|
||||
{
|
||||
audioManager = Instantiate(audioManagerPrefab).GetComponent<AudioManager>();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickConfirmButton()
|
||||
|
@ -42,7 +42,7 @@ public class MainPanelManager : MonoBehaviour
|
||||
|
||||
UpdateMainPanelUI(GameManager.Instance.panelManager.OpenMainPanel);
|
||||
// ScoreData.SetScore(userInfo.score);
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel(userInfo.nickname + "님" + "\n" + "자동 로그인 되었습니다", () => { });
|
||||
// GameManager.Instance.panelManager.OpenConfirmPanel(userInfo.nickname + "님" + "\n" + "자동 로그인 되었습니다", () => { });
|
||||
|
||||
loadingPanelController.StopLoading();
|
||||
}, () =>
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ReplayController : MonoBehaviour
|
||||
@ -11,6 +12,7 @@ public class ReplayController : MonoBehaviour
|
||||
[SerializeField] private TMP_Text playerBNicknameText;
|
||||
[SerializeField] private GameObject[] userAProfileImages;
|
||||
[SerializeField] private GameObject[] userBProfileImages;
|
||||
[SerializeField] private Button replayFinishButton;
|
||||
void Start()
|
||||
{
|
||||
InitReplayUI();
|
||||
@ -18,16 +20,26 @@ public class ReplayController : MonoBehaviour
|
||||
|
||||
public void OnclickExitButton()
|
||||
{
|
||||
ReplayManager.Instance.StopReplayFinish(() => { });;
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
|
||||
public void OnclickFirstButton()
|
||||
{
|
||||
ReplayManager.Instance.StopReplayFinish(() =>
|
||||
{
|
||||
replayFinishButton.interactable = true;
|
||||
});;
|
||||
ReplayManager.Instance.ReplayFirst();
|
||||
}
|
||||
|
||||
public void OnclickUndoButton()
|
||||
{
|
||||
ReplayManager.Instance.StopReplayFinish(() =>
|
||||
{
|
||||
replayFinishButton.interactable = true;
|
||||
});;
|
||||
|
||||
Move targetMove = ReplayManager.Instance.PopPlacedMove();
|
||||
if (targetMove != null)
|
||||
{
|
||||
@ -37,6 +49,10 @@ public class ReplayController : MonoBehaviour
|
||||
|
||||
public void OnclickNextButton()
|
||||
{
|
||||
ReplayManager.Instance.StopReplayFinish(() =>
|
||||
{
|
||||
replayFinishButton.interactable = true;
|
||||
});;
|
||||
Move nextMove = ReplayManager.Instance.GetNextMove();
|
||||
if (nextMove != null)
|
||||
{
|
||||
@ -44,9 +60,17 @@ public class ReplayController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 끝 버튼 눌렸을 때 중복 클릭 방지
|
||||
/// </summary>
|
||||
public void OnClickFinishButton()
|
||||
{
|
||||
ReplayManager.Instance.ReplayFinish();
|
||||
replayFinishButton.interactable = false;
|
||||
//실행이 끝난 후 끝버튼 다시 활성화
|
||||
ReplayManager.Instance.ReplayFinish(() =>
|
||||
{
|
||||
replayFinishButton.interactable = true;
|
||||
});
|
||||
}
|
||||
|
||||
public void InitReplayUI()
|
||||
|
@ -34,6 +34,7 @@ public class Move
|
||||
public class ReplayManager : Singleton<ReplayManager>
|
||||
{
|
||||
private ReplayRecord _recordingReplayData;
|
||||
private Coroutine finishCoroutine;
|
||||
|
||||
#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)
|
||||
{
|
||||
ReplayNext(GetNextMove());
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
onFinishEnd?.Invoke();
|
||||
}
|
||||
|
||||
public string GetPlayerANickname()
|
||||
{
|
||||
return _selectedReplayRecord.playerA;
|
||||
|
@ -27,7 +27,6 @@ public class ReplayPanelItemsController : ScrollPanelController
|
||||
records = ReplayManager.Instance.LoadReplayDatas();
|
||||
foreach (var replayRecord in records)
|
||||
{
|
||||
Debug.Log($"{replayRecord.gameDate}의 결과는 {replayRecord.gameResult}");
|
||||
var replayCellButtonObject = Instantiate(scrollItemPrefab, content.transform);
|
||||
ReplayCell replayCell = replayCellButtonObject.GetComponent<ReplayCell>();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user