コード例 #1
0
ファイル: EdicaoChar.cs プロジェクト: vitorric/comanda_app
    private void btnSalvarAlteracao()
    {
        Dictionary <string, object> data = new Dictionary <string, object>
        {
            { "corpo", PnlCharacter.Avatar.corpo },
            { "cabeca", PnlCharacter.Avatar.cabeca },
            { "nariz", PnlCharacter.Avatar.nariz },
            { "olhos", PnlCharacter.Avatar.olhos },
            { "boca", PnlCharacter.Avatar.boca },
            { "roupa", PnlCharacter.Avatar.roupa },
            { "cabeloTraseiro", PnlCharacter.Avatar.cabeloTraseiro },
            { "cabeloFrontal", PnlCharacter.Avatar.cabeloFrontal },
            { "barba", PnlCharacter.Avatar.barba },
            { "sombrancelhas", PnlCharacter.Avatar.sombrancelhas },
            { "orelha", PnlCharacter.Avatar.orelha },
            { "corPele", PnlCharacter.Avatar.corPele },
            { "corCabelo", PnlCharacter.Avatar.corCabelo },
            { "corBarba", PnlCharacter.Avatar.corBarba }
        };

        StartCoroutine(AvatarAPI.AlterarAvatar(data,
                                               (response, error) =>
        {
            if (error != null)
            {
                Debug.Log(JsonConvert.SerializeObject(response));
                Debug.Log("btnSalvarAlteracao" + error);
                AlertaManager.Instance.ChamarAlertaMensagem(error, false);
                return;
            }

            EasyAudioUtility.Instance.Play(EasyAudioUtility.Som.Success);

            AlertaManager.Instance.IniciarAlerta(response);

            Debug.Log(JsonConvert.SerializeObject(PnlCharacter.Avatar));

            PnlCharacter.Avatar.info.level           = Cliente.ClienteLogado.avatar.info.level;
            PnlCharacter.Avatar.info.exp             = Cliente.ClienteLogado.avatar.info.exp;
            PnlCharacter.Avatar.info.expProximoLevel = Cliente.ClienteLogado.avatar.info.expProximoLevel;

            Cliente.ClienteLogado.avatar = PnlCharacter.Avatar;

            fecharCena(true);
        }));
    }
コード例 #2
0
ファイル: MenuComanda.cs プロジェクト: vitorric/comanda_app
    private void obterAvatarMembroGrupo(Comanda.Grupo grupo, GrupoObj grupoComanda)
    {
        Dictionary <string, object> form = new Dictionary <string, object>
        {
            { "avatarId", grupo.cliente.avatar }
        };

        //é feito essa conferencia pra nao ficar batendo toda hora na rota do avatar
        if (grupoComanda.Integrante != null && grupo.avatarAlterado.Subtract(grupoComanda.Integrante.avatarAlterado).TotalSeconds <= 0)
        {
            grupoComanda.PreencherInfo(grupo, null, clienteLogadoEhLider, (clienteId, nomeCliente) =>
            {
                ConvidarGrupo.AbrirPnlTransferirLideranca(clienteId, nomeCliente);
            });

            StartCoroutine(calcularTotaisComanda());

            return;
        }

        StartCoroutine(AvatarAPI.ObterAvatar(form,
                                             (response, error) =>
        {
            if (error != null)
            {
                Debug.Log("ObterAvatar: " + error);
                AlertaManager.Instance.ChamarAlertaMensagem(error, false);
                return;
            }

            grupoComanda.PreencherInfo(grupo, response, clienteLogadoEhLider, (clienteId, nomeCliente) =>
            {
                ConvidarGrupo.AbrirPnlTransferirLideranca(clienteId, nomeCliente);
            });

            StartCoroutine(calcularTotaisComanda());
        }));
    }