using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RegFuncs : MonoBehaviour
{
    public ADokManager adok;
    public InputField inpCodeMoaref;
    public Text txtResult;

    // Use this for initialization
    void Start()
    {
        adok.OnCodeMoarefChange += Adok_OnCodeMoarefChange;
        adok.OnMoarefiCountChange += Adok_OnMoarefiCountChange;
        adok.OnMoarefiCountAllChange += Adok_OnMoarefiCountAllChange;
        adok.OnMoarefiSetRewardChange += Adok_OnMoarefiSetRewardChange;
        adok.OnLogOutChange += Adok_OnLogOutChange;
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void SetCodeMoaref()
    {
        adok.SetCodeMoaref(inpCodeMoaref.text);
    }

    public void GetMoarefiCount()
    {
        adok.GetMoarefiCount();
    }

    public void GetMoarefiCountAll()
    {
        adok.GetMoarefiCountAll();
    }

    public void SetMoarefiReward()
    {
        adok.GetMoarefiSetReward();
    }

    public void GetCodeMoaref()
    {
        txtResult.text = "CodeMoaref: " + adok.GetCodeMoaref();
    }

    public void LogOut()
    {
        adok.LogOut();
    }

    private void Adok_OnLogOutChange(ADokManager.LogOutResult LogOutResult)
    {
        txtResult.text = "LogOutResult: " + LogOutResult.ToString()+" --- "+ "playerId: " + adok.GetUserId() + " nickName:" + adok.GetNickName() + " userName:" + adok.GetUserName();
    }

    private void Adok_OnCodeMoarefChange(ADokManager.CodeMoarefResult cmResult)
    {
        txtResult.text = "CodeMoarefResult: " + cmResult.ToString();
    }

    public void getUserInfoRegister()
    {
        txtResult.text = "playerId: " + adok.GetUserId() + " nickName:" + adok.GetNickName() + " userName:" + adok.GetUserName();
    }

    private void Adok_OnMoarefiCountChange(ADokManager.MoarefiCountResult cmResult)
    {
        txtResult.text = "MoarefiCountResult: " + cmResult.ToString() + " count:" + adok.GetMoreafiCountVal() ;
    }

    private void Adok_OnMoarefiCountAllChange(ADokManager.MoarefiCountResult cmResult)
    {
        txtResult.text = "MoarefiCountAllResult: " + cmResult.ToString() + " count:" + adok.GetMoreafiCountValAll();
    }

    private void Adok_OnMoarefiSetRewardChange(ADokManager.MoarefiCountResult cmResult)
    {
        txtResult.text = "MoarefiSetRewardResult: " + cmResult.ToString() + " count:" + adok.GetMoreafiSetRewardCount();
    }
}
