private void OnCreateAvatarCb(UEventBase obj)
    {
        var res = obj as EventCreateAvatar;

        UICommonTips.AddTip($"Create avatar {res.eResult}");
        if (res.eResult == PktCreateAvatarResult.EResult.Success)
        {
            OnUnloadThis();
            AClientApis.OnGetSdata();
        }
    }
Пример #2
0
    private void OnEnterGameCb(UEventBase obj)
    {
        AHotBase.UnloadAllClasses();
        var eb = obj as EventEnterGame;

        if (eb.info == null)
        {
            AHotBase.LoadUI <UIMinerCreateAvatar>();
        }
        else
        {
            AClientApis.OnGetSdata();
        }
    }
    protected override void InitComponents()
    {
        btnDailyCheck = FindWidget <Button>("btnDailyCheck");
        btnDailyCheck.onClick.AddListener(() =>
        {
            AClientApis.OnDailyCheck();
        });

        var textUsername = FindWidget <Text>("textUsername");

        textUsername.text = CakeClient.GetCake("pinfo", CakeAvatar.myID).GetStringValue(ParamNameDefs.AvatarName);
        textGold          = FindWidget <Text>("textGold");
        textGold.text     = "0";
        textDiamond       = FindWidget <Text>("textDiamond");
        textDiamond.text  = "0";

        var btnLogout = FindWidget <Button>("btnLogout");

        btnLogout.onClick.AddListener(() =>
        {
            AClientApp.OnDisconnect();
            OnUnloadThis();
            LoadAnotherUI <UIMinerLogin>();
        });

        var btnPay = FindWidget <Button>("btnPay");

        btnPay.onClick.AddListener(() =>
        {
            //AClientApis.OnPay(1);
            AClientApis.OnCreateOrder(1);
        });
        var btnExchange = FindWidget <Button>("btnExchange");

        btnExchange.onClick.AddListener(() =>
        {
            AClientApis.OnExchange(1);
        });

        OnParamUpdateCb(null);
        RegisterEvent(UEvents.ParamUpdate, OnParamUpdateCb);
        RegisterEvent(UEvents.EventCreateOrder, OnCreateOrderCb);

        //var map01 = LoadClass<UMinerMap>("UI/MinerMap/Map01");
        AClientApis.OnGetSdata("");

        OnRegistAction(str =>
        {
            UICommonWait.Hide();
            var astrs = str.Split(' ');
            switch (astrs[0])
            {
            case "ProvideContent":
                UIAlert.Show("ProvideContent " + str);
                break;

            case "FailedTransactions":
                UIAlert.Show("FailedTransactions " + str);
                break;

            case "UpdateTransactions":
                UIAlert.Show("UpdateTransactionss " + str);
                break;
            }
        });
    }