Beispiel #1
0
    // HQ가 파괴되었다는 패킷 수신 함수
    public void OnReceiveGameFinishPacket(PacketId id, byte[] data)
    {
        GameFinishPacket packet     = new GameFinishPacket(data);
        GameFinishData   winnerData = packet.GetPacket();

        HTTPManager httpManager = new HTTPManager();
        UserInfo    userInfo    = GameObject.Find("DataObject").GetComponent <UserInfo>();

        bool win = userInfo.userData.playerCamp == winnerData.winnerCamp;

        httpManager.UpdateUserWinReq(userInfo.userData.id, win);

        UIManager.instance.ActivateGameEnd(win);

        // 서버에 보낼 게임 정보 업데이트
        userInfo.userPlayData.achievescore = 0;
        userInfo.userPlayData.victory      = 0;
        userInfo.userPlayData.lose         = 0;
        userInfo.userPlayData.death        = 1;
        userInfo.userPlayData.imageid      = 0;

        userInfo.userPlayData.kill   = killCount;
        userInfo.userPlayData.damage = (int)damageCount;

        // Flask 서버에 업적 업데이트 및 점수 업데이트.
        httpManager.UpdateAchieveReq(userInfo.userData.id, userInfo.userPlayData);

        // n 초 뒤에 로비씬으로 이동.
        StartCoroutine(GoBackToLobby());
    }