Ejemplo n.º 1
0
 // 玩家站起
 public void UpdateAfterPlayerStandUp(RoomPlayerStandupAck roomPlayerStandupAck)
 {
     if (roomPlayerStandupAck.PlayerId == selfInfo.Id)
     {
         if (roomPlayerStandupAck.Force)
         {
             PopUtil.ShowMessageBoxWithConfirm("", "由于您多次没操作,是不是太累了,先站起旁观吧!!!");
         }
         // 更新站起玩家的数据
         UpdateStandupPlayer(roomPlayerStandupAck);
         // 重置UI
         ResetUIAfterStandOrSit();
         // 初始化玩家信息
         InitPlayerInfo(tableInfo.Players);
         // 初始化玩家手牌
         InitPlayerHandCard(tableInfo.Players);
         // 初始化玩家已下筹码
         InitPlayerChips(tableInfo.Players);
         if (tableInfo.N >= 2)
         {
             // 光标转到当前玩家
             TrunCurrentPalyer(tableInfo.Players, tableInfo.Bet);
         }
         else
         {
             waitting.SetActive(false);
         }
     }
     else
     {
         UpdateAfterPlayerGone(roomPlayerStandupAck.PlayerPos);
     }
 }
Ejemplo n.º 2
0
    /**
     * 微信登录返回结果
     */
    public void weixinLoginCallBack(string msg)
    {
        Dictionary <string, string> dicMsg = UnityIOSAndroid.parseMsg(msg);

        Dictionary <string, object> dic = new Dictionary <string, object>();

        dic.Add("type", 3);
        dic.Add("key", dicMsg["openID"]);
        dic.Add("from", "jjjj");
        dic.Add("unique_id", "UniqueId");
        dic.Add("channel", "jjjj");
        dic.Add("binding_param", "");

        PopUtil.ShowLoadingView("登录中...");

        HttpUtil.Http.Post(URLManager.thirdLoginUrl).Form(dic).OnSuccess(result =>
        {
            handleGetUserInfo(result);
        }).OnFail(result =>
        {
            if (_action != null)
            {
                _action(new Error(500, null), null);
            }
        }).GoSync();
    }
Ejemplo n.º 3
0
    /**
     * 检查凭证是否有效
     */
    public static void checkReceiptIsValid(string productID, string receipt, string uuid, GameObject gameObject)
    {
        Dictionary <string, object> receiptDict = new Dictionary <string, object>();

        receiptDict.Add("apple_data", receipt);
        receiptDict.Add("user_id", UserManager.Instance().authModel.user_id);
        receiptDict.Add("charge_goods_id", productID);
        receiptDict.Add("price", MainData.Instance().getGoodsPrice(productID));
        receiptDict.Add("uuid", uuid);

        // 发送之前先des加密
        string RSAString = DESBase64.DesEncryptWithKey(JsonMapper.ToJson(receiptDict), DESBase64.purchaseKey);
        Dictionary <string, object> RSADic = new Dictionary <string, object>();

        RSADic.Add("data", RSAString);

        HttpUtil.Http.Post(URLManager.appStoreCheckPurchaseCertUrl).Form(RSADic).OnSuccess(result =>
        {
            Debug.Log("OnSuccess: result------------------" + result);
            Dictionary <string, object> resultDict = JsonMapper.ToObject <Dictionary <string, object> >(result);
            string code = resultDict["code"].ToString();
            int codeInt = int.Parse(code);
            if (codeInt == 1)   // 凭证验证成功
            {
                removeReceipt(uuid);
                // 刷新主界面的信息
                UserInfoRefreshManager.refreshUserInfo(null);
                PopUtil.ShowMessageBoxWithConfirm("提示", "购买成功!");
            }
            else if (codeInt == -1)    //  服务器凭证验证成功但是数据操作异常,需要重新发送一次
            {
                PopUtil.ShowMessageBoxWithConfirmAndCancle("提示", "购买失败!点击确定重试!", () =>
                {          // 点击重新发送服务器验证
                    checkReceiptIsValid(productID, receipt, uuid, gameObject);
                }, () => { // 取消存储在本地,下次启动时候发送
                    saveReceipt(receiptDict, uuid);
                });
            }
            else if (codeInt == 0)    // 凭证无效
            {
                removeReceipt(uuid);
                PopUtil.ShowMessageBoxWithConfirm("提示", "购买失败!");
            }
        }).OnFail(result =>
        {
            Debug.Log("OnFail: result------------------" + result);
            // 网络问题
            PopUtil.ShowMessageBoxWithConfirmAndCancle("提示", "购买失败!点击确定重试!", () =>
            {             // 点击重新发送服务器验证
                checkReceiptIsValid(productID, receipt, uuid, gameObject);
            }, () =>
            {              // 取消存储在本地,下次启动时候发送
                saveReceipt(receiptDict, uuid);
            });
        }).GoSync();
    }
Ejemplo n.º 4
0
    /**
     * 购买信息回调
     */
    public void purchaseProductCallBack(string msg)
    {
        // 获取iOS传过来的消息
        Dictionary <string, string> dicMsg = UnityIOSAndroid.parseMsg(msg);
        string purchaseStatus = dicMsg["purchaseStatus"];
        string UUID           = dicMsg["UUID"];
        string productID      = dicMsg["productID"];

        PurchaseProductStatus status = (PurchaseProductStatus)Enum.Parse(typeof(PurchaseProductStatus), purchaseStatus);

        switch (status)
        {
        case PurchaseProductStatus.PKPurchaseProductStatusPurchased:
            string receipt = dicMsg["receipt"];
            checkReceiptIsValid(productID, receipt, UUID, gameObject);
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusRestored:
            PopUtil.ShowMessageBoxWithConfirm("提示", "恢复购买成功!");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusPurchasing:
            //CommonUI.showLoadingView(gameObject, "正在获取支付信息");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusFailed:
            PopUtil.ShowMessageBoxWithConfirm("提示", "购买失败!");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusCancelled:
            PopUtil.ShowMessageBoxWithConfirm("提示", "用户取消购买!");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusNotAllowed:
            PopUtil.ShowMessageBoxWithConfirm("提示", "该设备不支持内购");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusPermissionDenied:
            PopUtil.ShowMessageBoxWithConfirm("提示", "用户不支持内购");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusRequestingPurchase:
            PopUtil.ShowLoadingView("Loading....");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusRequestPurchaseSuccess:
            //CommonUI.showLoadingView(gameObject, " 商品信息获取成功!");
            break;

        case PurchaseProductStatus.PKPurchaseProductStatusRequestPurchaseFailed:
            PopUtil.ShowMessageBoxWithConfirm("提示", "拉取商品信息失败,请重试!");
            break;
        }
    }
Ejemplo n.º 5
0
 /**
  * 获取签到列表
  */
 void requestSignInList()
 {
     SignInHandle.requestSignInList((error, result) => {
         if (error == null)
         {
             if (result.list.Length < 9)
             {
                 PopUtil.ShowMessageBoxWithConfirm("提示", "后台数据错误!");
                 return;
             }
             signInResult = result;
             loadSignInView();
         }
     });
 }
Ejemplo n.º 6
0
    /**
     * 领取签到奖励请求
     */
    void receiveSignInReward(int isMore)
    {
        SignInHandle.receiveSignInReward(isMore, (error, result) =>
        {
            if (error == null)
            {
                if (result.ret == 1)
                {
                    if (isMore == 1)
                    {
                        receiveSevenMask.SetActive(true);
                        signInResult.is_more = 1;

                        SignIn signIn = signInResult.list[8];
                        PopUtil.ShowSignInSuccessView(signIn.image_describe);
                    }
                    else
                    {
                        int currenItem = result.checkin_days > 7 ? 8 : result.checkin_days;

                        GameObject signInedImage = GameObject.Find("SignInView/ContentView/GridView/SingDayItem" + currenItem + "/SignInedImage");
                        GameObject mask          = GameObject.Find("SignInView/ContentView/GridView/SingDayItem" + currenItem + "/Mask");
                        signInedImage.SetActive(true);
                        mask.SetActive(true);
                        receiveMask.SetActive(true);
                        UserManager.Instance().userInfo.is_checkin = 1;

                        // 更新额外奖励的
                        GameObject signSevenReward = GameObject.Find("SignInView/ContentView/SignSevenReward");
                        Text topTitle = signSevenReward.Find <Text>("SignInView/ContentView/SignSevenReward/TopTitle");
                        signInResult.already_checkin = signInResult.already_checkin + 1;
                        topTitle.text = "已连续签到" + signInResult.already_checkin + "天";

                        SignIn signIn = signInResult.list[currenItem - 1];
                        PopUtil.ShowSignInSuccessView(signIn.image_describe);
                    }
                }
                else
                {
                    PopUtil.ShowMessageBoxWithConfirm("提示", "签到失败");
                }
            }
            else
            {
                PopUtil.ShowMessageBoxWithConfirm("提示", "签到失败");
            }
        });
    }
Ejemplo n.º 7
0
    void loadGoldView()
    {
        GameObject commonUIPrefab = Resources.Load("Prefabs/GoldsItem") as GameObject;

        goldsObjectList = new List <GameObject>();
        for (int i = 0; i < MainData.Instance().chargeGoods.Length; i++)
        {
            ChargeGoodsInfo chargeGoods = MainData.Instance().chargeGoods[i];
            GameObject      golds       = Instantiate(commonUIPrefab) as GameObject;
            float           width       = golds.GetComponent <RectTransform>().sizeDelta.x;
            golds.transform.parent        = GameObject.Find("GoldContent/Viewport/Content").transform;
            golds.name                    = "GoldsItem" + i;
            golds.transform.localPosition = new Vector3(300 + i % 3 * (width + 150), -300 - (i / 3 * 400), 0);
            golds.transform.localScale    = new Vector3(1, 1, 0);

            //Image GoldTypeImage = golds.Find<Image>("GoldContent/Viewport/Content/"+golds.name +"/TopImage/GoldTypeImage");
            Text MondyText      = golds.Find <Text>("GoldContent/Viewport/Content/" + golds.name + "/TopImage/MondyText");
            Text ConversionText = golds.Find <Text>("GoldContent/Viewport/Content/" + golds.name + "/TopImage/ConversionText");
            Text DiamondText    = golds.Find <Text>("GoldContent/Viewport/Content/" + golds.name + "/DiamondImage/DiamondText");

            //GoldTypeImage.SetWebImage(chargeGoods.image, "");
            MondyText.text      = chargeGoods.price + "万";
            ConversionText.text = chargeGoods.goods_describe;
            DiamondText.text    = chargeGoods.price.ToString();

            golds.GetComponent <Button>().onClick.AddListener(() => {
                if (UserManager.Instance().userInfo.diamond_balance < chargeGoods.price)
                {
                    PopUtil.ShowMessageBoxWithConfirm("提示", "钻石不够啦,赶紧去买!");
                    return;
                }
                ShoppingHandle.exchargeDiamond(chargeGoods.id.ToString(), (error) =>
                {
                    if (error == null)
                    {
                        PopUtil.ShowMessageBoxWithConfirm("提示", "兑换成功!");
                        UserInfoRefreshManager.refreshUserInfo(null);
                    }
                    else
                    {
                        PopUtil.ShowMessageBoxWithConfirm("提示", "兑换失败");
                    }
                });
            });

            goldsObjectList.Add(golds);
        }
    }
    // 编辑昵称
    public void editBtnClick()
    {
        Image      editImg       = userCenter.Find <Image>(userCenter.name + "/UserInfo/Name/Edit");
        Text       nameText      = userCenter.Find <Text>(userCenter.name + "/UserInfo/Name/UserName");
        InputField nameFieldText = userCenter.Find <InputField>(userCenter.name + "/UserInfo/Name/NameField");

        if (isEdit)
        {
            if (nameFieldText.text == null || nameFieldText.text == "")
            {
                PopUtil.ShowTotoast("昵称不能为空");
                return;
            }
            else
            {
                isEdit = false;
                editImg.SetLocalImage("Textures/main/main_edit");
                mainHandle.nickname(nameFieldText.text, (error, result) =>
                {
                    if (error == null)
                    {
                        //UserManager.Instance().userInfo.nick_name = result;
                        //UserManager.saveUserInfoToUserDefault(UserManager.Instance().userInfo);
                        Text nicknameText = userCenter.Find <Text>(userCenter.name + "/UserInfo/Name/UserName");
                        nicknameText.text = result;
                        UserInfoRefreshManager.refreshUserInfo(null);
                    }
                    else
                    {
                        PopUtil.ShowTotoast("昵称修改失败");
                        return;
                    }
                });
                GameObject.Find(userCenter.name + "/UserInfo/Name/UserName").SetActive(true);
                GameObject.Find(userCenter.name + "/UserInfo/Name/NameField").SetActive(false);
            }
        }
        else
        {
            isEdit = true;
            editImg.SetLocalImage("Textures/main/main_checkin");
            nameFieldText.Select();
            GameObject.Find(userCenter.name + "/UserInfo/Name/NameField").SetActive(true);
            nameFieldText.text = nameText.text;
            GameObject.Find(userCenter.name + "/UserInfo/Name/UserName").SetActive(false);
        }
    }
Ejemplo n.º 9
0
    public void registBtnClick()
    {
        var count    = countField.text;
        var password = passwordField.text;

        if (count == null || count == "")
        {
            PopUtil.ShowTotoast("帐号不能为空");
            return;
        }

        if (password == null || password == "")
        {
            PopUtil.ShowTotoast("密码不能为空");
            return;
        }

        PopUtil.ShowLoadingView("注册中...");
        registHandle.registAction(count, password, (error, result) => {
            if (error == null)
            {
                PopUtil.ShowLoadingView("登录中...");
                NetCore.Instance.RegisterAction(NetProto.Api.ENetMsgId.user_login_ack, (loginAction) =>
                {
                    UserLoginAck userLoginAck = (UserLoginAck)loginAction;
                    if (userLoginAck.BaseAck.Ret == 1)
                    {
                        Application.LoadLevel("main");
                    }
                });
                loginHandle.loginReq();
            }
            else
            {
                if (error.code == 500)
                {
                    PopUtil.ShowTotoast("网络有问题,或者联系: JX");
                }
                else
                {
                    PopUtil.ShowTotoast(error.msg);
                }
            }
        });
    }
Ejemplo n.º 10
0
    /**
     * 是否是正在加载的界面
     */
    public void isLoadingView(bool flag)
    {
        string loadingText = "登录中...";

        if (UserManager.getUserAuthFromUserDefault() == null)
        {
            loadingText = "加载中...";
        }
        if (flag)
        {
            PopUtil.ShowLoadingView(loadingText);
        }
        else
        {
            PopUtil.DismissLoadingView();
        }
        login.SetActive(!flag);
    }
Ejemplo n.º 11
0
    public void onLoginBtnClick()
    {
        string count    = countField.text;
        string password = passwordField.text;

        if (count == null || count == "")
        {
            PopUtil.ShowTotoast("帐号不能为空");
            return;
        }

        if (password == null || password == "")
        {
            PopUtil.ShowTotoast("密码不能为空");
            return;
        }

        PopUtil.ShowLoadingView("登录中...");
        loginHandle.login(count, password, (error, result) =>
        {
            handleLoginResult(error, result);
        });
    }
Ejemplo n.º 12
0
 /**
  * 任务领取奖励
  */
 public void taskReceiveClick(UserTaskModel userTaskModel)
 {
     TaskHandle.taskReceive(userTaskModel.task_id.ToString(), (error, receiveResult) => {
         if (error == null)
         {
             if (receiveResult.ret == 1)
             {
                 // 成功之后刷新界面
                 refreshNewTask(userTaskModel, receiveResult.data);
                 // 更新用户信息
                 UserInfoRefreshManager.refreshUserInfo(null);
                 PopUtil.ShowSignInSuccessView(userTaskModel.image_describe);
             }
             else
             {
                 PopUtil.ShowMessageBoxWithConfirm("提示", "领取失败!");
             }
         }
         else
         {
             PopUtil.ShowMessageBoxWithConfirm("提示", "领取失败!");
         }
     });
 }
Ejemplo n.º 13
0
 // 登录结果回调
 public void handleLoginResult(Error error, UserInfo userInfo)
 {
     if (error == null)
     {
         NetCore.Instance.RegisterAction(NetProto.Api.ENetMsgId.user_login_ack, (loginAction) =>
         {
             UserLoginAck userLoginAck = (UserLoginAck)loginAction;
             Debug.Log("loginAction-----" + userLoginAck.BaseAck.Ret);
             if (userLoginAck.BaseAck.Ret == 1)
             {
                 Application.LoadLevel("main_yg");
             }
             else
             {
                 isLoadingView(false);
             }
         });
         loginHandle.loginReq();
     }
     else
     {
         isLoadingView(false);
         if (error.code == (int)Error.ErrorCode.Error)
         {
             PopUtil.ShowTotoast("网络有问题,或者联系: jX");
         }
         else if (error.code == (int)Error.ErrorCode.Cancel)
         {
             PopUtil.ShowTotoast("已取消登录");
         }
         else
         {
             PopUtil.ShowTotoast(error.msg);
         }
     }
 }
Ejemplo n.º 14
0
 public void Toast(string content)
 {
     print("+++++++++++++++++++++++++++Toast=" + content);
     PopUtil.ShowMessageBoxWithConfirm("Title", content);
 }