Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit c1649dc

Browse files
committed
매인 화면은 끝남
1 parent 1e63c37 commit c1649dc

File tree

16 files changed

+407
-22
lines changed

16 files changed

+407
-22
lines changed

MaybeBossRaid/Jemmun/Assets/01_Script/Handler/GameStartHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ private void FixedUpdate()
1515
{
1616
if (bStarted)
1717
{
18+
bStarted = false;
1819
UnityEngine.SceneManagement.SceneManager.LoadScene("Battle");
1920
}
2021
}

MaybeBossRaid/Jemmun/Assets/01_Script/Manager/TurnManager.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ public class TurnManager : MonoBehaviour
1212
protected List<TurnTask> endTurnTasks = new List<TurnTask>(); // 턴이 끝날 때 마다 리스트 안에 있는 함수를 전부 실행시킴
1313
protected List<TurnTask> midTurnTasks = new List<TurnTask>(); // 턴이 끝날 때 마다 리스트 안에 있는 함수를 전부 실행시킴
1414

15+
protected List<CharactorBase> playerList = new List<CharactorBase>();
16+
1517
// Turn
1618
public int turn { get; private set; }
1719

1820
private void Awake()
1921
{
2022
// 사실 체크를 하나 해 줘야 하는데 귀찮았스빈다.
2123
instance = this;
24+
25+
SocketClient.Send(JsonUtility.ToJson(new DataVO("gamestart", "null")));
26+
27+
turn = 0;
28+
}
29+
30+
private void Start()
31+
{
32+
playerList = UserManager.GetAllPlayerBase();
2233
}
2334

2435

@@ -62,7 +73,7 @@ public void MidTurn()
6273
}
6374

6475

65-
#region EndTurn, MidTurn 에서 사용되는 함수들
76+
#region EndTurn, MidTurn Tasks
6677

6778
private void DoTurnEndTasks()
6879
{
@@ -82,4 +93,11 @@ private void DoMidTurnTasks()
8293
}
8394

8495
#endregion
96+
97+
98+
// 캐릭터들의 턴 상태를 설정함
99+
private void SetTurnStatus()
100+
{
101+
// 턴
102+
}
85103
}

MaybeBossRaid/Jemmun/Assets/01_Script/Manager/UserManager.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using UnityEngine;
44

55
// 접속한 유저들에 관한 것들을 해 주는 클레스
6-
public class UserManager : MonoBehaviour
6+
public partial class UserManager : MonoBehaviour
77
{
88
static private UserManager instance = null;
99

1010
// 접속한 유저들의 CharactorBase 를 가진 배열
11-
private CharactorBase[] players = new CharactorBase[4];
11+
private List<CharactorBase> players = new List<CharactorBase>();
1212

1313
// 실제로 이 컴퓨터의 유저가 플레이하고있는 플레이어
1414
// players 배열의 인덱스
@@ -32,7 +32,7 @@ private void InitData()
3232
GameObject[] tempPlayerArr = GameObject.FindGameObjectsWithTag("Player");
3333
for (int i = 0; i < tempPlayerArr.Length; ++i)
3434
{
35-
players[i] = tempPlayerArr[i].GetComponent<CharactorBase>();
35+
players.Add(tempPlayerArr[i].GetComponent<CharactorBase>());
3636

3737
// isRemote 가 false 라면 직접 플레이하고있는 캐릭터
3838
if (!players[i].isRemote)
@@ -43,22 +43,26 @@ private void InitData()
4343
}
4444

4545
// 직접 만든 클레스 변수 수정이라 돌아갑니다.
46+
/// <summary>
47+
/// 자신이 플레이하는 캐릭터의 변수를 초기화합니다.
48+
/// </summary>
49+
/// <param name="vo">PlayerDataVO</param>
4650
static public void InitPlayerData(PlayerDataVO vo)
4751
{
4852
instance.players[instance.playerIndex].hp = vo.hp;
4953
instance.players[instance.playerIndex].mp = vo.mp;
5054
instance.players[instance.playerIndex].id = vo.id;
5155
}
5256
#endregion
53-
57+
5458
/// <summary>
5559
/// id에 따라 플레이어를 찾아 옵니다.
5660
/// </summary>
5761
/// <param name="id">찾을 플레이어의 id</param>
5862
/// <returns>찾은 플레이어의 CharactorBase</returns>
5963
static public CharactorBase GetPlayerBase(int id)
6064
{
61-
for (int i = 0; i < instance.players.Length; ++i)
65+
for (int i = 0; i < instance.players.Count; ++i)
6266
{
6367
if (instance.players[i].id == id)
6468
{
@@ -70,8 +74,19 @@ static public CharactorBase GetPlayerBase(int id)
7074
return null;
7175
}
7276

77+
/// <summary>
78+
/// 같은 방에 있는 모든 플레이어들의 CharactorBase 를 반환합니다.
79+
/// </summary>
80+
/// <returns>List of CharactorBase</returns>
81+
static public List<CharactorBase> GetAllPlayerBase()
82+
{
83+
return instance.players;
84+
}
7385

86+
}
7487

88+
public partial class UserManager : MonoBehaviour
89+
{
7590
// CRITICAL_SECTION 과 비슷한 역할을 하는 변수에요.
7691
public object lockObj = new object();
7792

MaybeBossRaid/Jemmun/Assets/01_Script/UI/Main/MatchMakingManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void SetPlayerWaitingIcon()
8989

9090
private void SetStatusText()
9191
{
92-
txtMatchMakingStat.text = $"({playersWaiting} / 4) 명이 대기중입니다.";
92+
txtMatchMakingStat.text = $"({playersWaiting} / {playerStatus.Length}) 명이 대기중입니다.";
9393
}
9494

9595
#endregion
@@ -130,6 +130,8 @@ private void CancelMatchMaking()
130130
onMatchMaking = false;
131131

132132
SetUIVisiblity();
133+
134+
SocketClient.DisconnectToServer();
133135
}
134136

135137
// UI enable 상태 바꿔주는 함수

MaybeBossRaid/Jemmun/Assets/01_Script/_Base/Player/CharactorBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ abstract public partial class CharactorBase : MonoBehaviour
1616
public float atk = 1.0f;
1717
public float def = 1.0f;
1818

19-
// 사망 또는 행동 불가능 상태
20-
public bool isDead = false;
21-
19+
public bool isDead = false; // 사망 또는 행동 불가능 상태
2220
public bool isRemote = false; // 본인 캐릭터인지
21+
public bool isTurn = false; // 본인 턴인지
22+
2323

2424
// 마지막으로 맞은 스킬 저장용
2525
public SkillData LastHitSkill { get; private set; }

MaybeBossRaid/Jemmun/Assets/01_Script/_Socket/SocketClient.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ private void Awake()
2525
instance = this;
2626
}
2727

28-
//private void Start()
29-
//{
30-
// // 서버에 연결
31-
// // 나중에 바로 연결 안 할수도 있으니 함수로 •暳
32-
// ConnectSocket();
33-
//}
34-
3528
/// <summary>
3629
/// 서버에 연결하는 함수
3730
/// </summary>
@@ -72,6 +65,13 @@ static public void ConnectToServer(string ip, int port, OnConnected callback = n
7265
}
7366

7467

68+
static public void DisconnectToServer(OnConnected callback = null)
69+
{
70+
instance.ws.Close();
71+
72+
callback?.Invoke();
73+
}
74+
7575
private void ReceiveData(WebSocket sender, MessageEventArgs e)
7676
{
7777
// 들어온 메세지를 DataVO 에 넣어줘요.

MaybeBossRaid/Jemmun/Assets/02_Sprites/Charactor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

MaybeBossRaid/Jemmun/Assets/02_Sprites/Charactor/Charactor5.png.meta

Lines changed: 108 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)