コード例 #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);
     }
 }
コード例 #2
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();
    }
コード例 #3
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;
        }
    }
コード例 #4
0
 /**
  * 获取签到列表
  */
 void requestSignInList()
 {
     SignInHandle.requestSignInList((error, result) => {
         if (error == null)
         {
             if (result.list.Length < 9)
             {
                 PopUtil.ShowMessageBoxWithConfirm("提示", "后台数据错误!");
                 return;
             }
             signInResult = result;
             loadSignInView();
         }
     });
 }
コード例 #5
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("提示", "签到失败");
            }
        });
    }
コード例 #6
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);
        }
    }
コード例 #7
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("提示", "领取失败!");
         }
     });
 }
コード例 #8
0
 public void Toast(string content)
 {
     print("+++++++++++++++++++++++++++Toast=" + content);
     PopUtil.ShowMessageBoxWithConfirm("Title", content);
 }