Beispiel #1
0
    public Task DraftActors()
    {
        // ================= Steps to Draft =================
        // 1. Convert packet to POCO
        // 2. update hand array
        // 3. update party array
        // 4. update Mana
        // 7. update ui elements
        // 8. send updated info to server

        Player homePlayer = ServiceProvider.PlayerManager.GetHomePlayer();

        DraftEvent.Invoke();

        UpdateUiEvent.Invoke();

        DraftPOCO outputPoco = new DraftPOCO
        {
            Hand  = homePlayer.Hand,
            Party = homePlayer.Party,
            Mana  = homePlayer.Mana
        };

        Packet packet = new Packet
        {
            CommandId = (short)CommandId.draft,
            PlayerId  = homePlayer.PlayerId,
            POCOJson  = JsonUtility.ToJson(outputPoco)
        };

        ServiceProvider.NetworkManager.SendPacket(packet);

        return(Task.FromResult(0));
    }
Beispiel #2
0
    public Task AcknowlegdeDraft(Packet packet)
    {
        var poco = JsonUtility.FromJson <DraftPOCO>(packet.POCOJson);

        var player = ServiceProvider.PlayerManager.GetHomePlayer();

        player.Party = poco.Party;
        player.Hand  = poco.Hand;
        player.Mana  = poco.Mana;

        DraftEvent.Invoke();
        UpdateUiEvent.Invoke();

        return(Task.FromResult(0));
    }