Exemple #1
0
 private static void OnCreateAvatarCb(PktCreateAvatarResult res)
 {
     if (res.info != null)
     {
         CakeClient.AddCake(new CakeAvatar(res.info.avatarID, res.info));
         CakeAvatar.myID = res.info.avatarID;
     }
     AClientApp.clientComm.rcvCreateAvatarCb(res.eResult, res.info);
 }
Exemple #2
0
 private static void OnEnterGameCb(PktEnterGameResult res)
 {
     if (res.info != null)
     {
         CakeClient.AddCake(new CakeAvatar(res.info.avatarID, res.info));
         CakeAvatar.myID = res.info.avatarID;
     }
     AClientApp.clientComm.rcvEnterGameCb(res.info);
 }
Exemple #3
0
        private static void rcvParamUpdate(PktParamUpdate obj)
        {
            var cake = CakeClient.GetCake(obj.cakeType, obj.id, obj.iid);

            if (cake == null)
            {
                cake = new CakeClient(obj.cakeType, obj.id, obj.iid);
                CakeClient.AddCake(cake);
            }
            cake.UpdateFromPkt(obj);
            clientComm.rcvParamUpdate();
        }
Exemple #4
0
    protected override void InitComponents()
    {
        LoadUI <UIMinerMain>();

        foreach (var wx in InitValueDefs.wuxing.Keys)
        {
            var swx = wx;
            var btn = FindWidget <Button>(swx);
            var str = $"{InitValueDefs.wuxing[swx]} {CakeClient.GetCake("pinfo", CakeAvatar.myID).GetIntValue(swx)}级";
            FindWidget <Text>(btn.transform, "Text").text = str;
            btn.onClick.AddListener(() =>
            {
                OnEnterYuansuConta(swx);
            });
        }
        AClientApis.OnEnterScene();
    }
 private void OnParamUpdateCb(UEventBase eb)
 {
     textGold.text    = CakeClient.GetCake("items", CakeAvatar.myID, LibCommon.InitValueDefs.gold.ToString()).GetIntValue(ParamNameDefs.Count).ToString();
     textDiamond.text = CakeClient.GetCake("items", CakeAvatar.myID, LibCommon.InitValueDefs.money.ToString()).GetIntValue(ParamNameDefs.Count).ToString();
     btnDailyCheck.gameObject.SetActive(!ApiDateTime.IsSameDay(CakeClient.GetCake("pinfo", CakeAvatar.myID).GetIntValue(ParamNameDefs.LastDailyCheckTime)));
 }
    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;
            }
        });
    }