Skip to content

Commit

Permalink
메일 수정중
Browse files Browse the repository at this point in the history
  • Loading branch information
KWONYHULHEE committed Aug 13, 2020
2 parents d973ab8 + d17af0a commit c78512e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Assets/Scenes/LobbyScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ MonoBehaviour:
LoadingProgress: {fileID: 264315257}
InfoText: {fileID: 1839908335}
GameMailInfo: {fileID: 9035306661128124591, guid: 4c37657774985b0498e7266112d2541d, type: 3}
LoadingText: {fileID: 2041948930}
--- !u!114 &842335929
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4036,7 +4037,7 @@ GameObject:
- component: {fileID: 2041948931}
- component: {fileID: 2041948930}
m_Layer: 5
m_Name: Text
m_Name: LoadingText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down
16 changes: 16 additions & 0 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class GameManager : MonoBehaviour

public static PacketFunc RecvLoginResult;
public static PacketFunc RecvLobbyEnter;
public static PacketFunc RecvLobbyChat;
public static PacketFunc RecvMatchingResult;
public static PacketFunc RecvRoomEnter;

public static NetworkManager ClientNetworkManager;

Expand Down Expand Up @@ -89,13 +91,27 @@ void DispatchPacket()

RecvLobbyEnter(packet.Result);
} break;
case PacketDef.ClientGatePacketID.NTFLobbyChat:
{
Debug.Log("Recv NTFLobbyChat");
var packet = MessagePackSerializer.Deserialize<GatewayServer.Packet.PKTNTFLobbyChat>(packetData.PacketBody);

RecvLobbyChat(packet.Chat);
} break;
case PacketDef.ClientGatePacketID.NTFMatchingResult:
{
Debug.Log("Recv NTFMatchingReuslt");
var packet = MessagePackSerializer.Deserialize<GatewayServer.Packet.PKTNTFMatchingResult>(packetData.PacketBody);

RecvMatchingResult(packet.Result);
} break;
case PacketDef.ClientGatePacketID.ResRoomEnter:
{
Debug.Log("Recv ResRoomEnter");
var packet = MessagePackSerializer.Deserialize<GatewayServer.Packet.PKTResRoomEnter>(packetData.PacketBody);

RecvRoomEnter(packet.Result);
} break;
}
}
}
Expand Down
48 changes: 41 additions & 7 deletions Assets/Scripts/Lobby/LobbySceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ public class LobbySceneManager : MonoBehaviour

public GameObject GameMailInfo;

public Text LoadingText;

// Start is called before the first frame update
void Start()
{
GameManager.RecvMatchingResult += RecvMatchingResult;

// GameInfoPanel = GameObject.Find("MailUnfoPanel").gameObject;
// GameInfoPanel.SetActive(false);
// GameManager.ClientNetworkManager.GetMail(3);
GameManager.RecvRoomEnter += RecvRoomEnter;
GameManager.RecvLobbyChat += RecvLobbyChat;

}

// Update is called once per frame
Expand Down Expand Up @@ -157,6 +159,12 @@ public void ClickInfoOk()
InfoPanel.SetActive(false);
}

void StartLoading()
{
LoadingText.text = "매칭중...";
LoadingPanel.SetActive(true);
}

void SendMatching()
{
var packetData = new PKTReqMatching();
Expand All @@ -166,9 +174,11 @@ void SendMatching()
var sendPacket = PacketDef.PKTHandleHelper.MakePacket((UInt16)PacketDef.ClientGatePacketID.ReqMatching, packet);

GameManager.ClientNetworkManager.Send(sendPacket);

StartLoading();
}

void SendEnterRoom()
void SendRoomEnter()
{
var packetData = new PKTReqRoomEnter();

Expand All @@ -178,17 +188,41 @@ void SendEnterRoom()
GameManager.ClientNetworkManager.Send(sendPacket);
}

void RecvLobbyChat(object data)
{
var chat = (string)data;

Debug.Log(chat);
}

void RecvMatchingResult(object data)
{
var result = (UInt16)data;

Debug.Log($"RecvMatchingResult : [{result}]");

if(result == 0)
if(result != 0)
{
SendEnterRoom();
LoadingPanel.SetActive(false);

LoadingPanel.SetActive(true);
return;
}

SendRoomEnter();
}

void RecvRoomEnter(object data)
{
var result = (UInt16)data;

Debug.Log($"RecvRoomEnterResult : [{ result }]");

if(result != 0)
{
NewInfo("매칭 실패");
return;
}

LoadingText.text = "다른 플레이어 기다리는 중...";
}
}

0 comments on commit c78512e

Please sign in to comment.