Ejemplo n.º 1
0
    /// <summary>
    /// 礼包是否领取过,获得当前礼包需要充值钱数;
    /// </summary>
    void updateBoxInfo()
    {
        TotalChargeTableItem item = TotalChargeModule.GetItem(CurSelectObjId);

        if (item == null)
        {
            Debug.LogError("错了");
            return;
        }

        PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (pdm == null)
        {
            return;
        }

        if (!pdm.GetTotalChargeRewardGot(CurSelectObjId))
        {
            mBoxBtn.normalSprite = "rewardpic1";
        }
        else
        {
            mBoxBtn.normalSprite = "rewardpic2";
        }
        mBoxBtn.GetComponent <UISprite>().MakePixelPerfect();

        mBoxMoney.text = item.giftPrice.ToString();
    }
Ejemplo n.º 2
0
    void onBoxBtnClick()
    {
        PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (pdm == null)
        {
            return;
        }

        int curSelectId = getCurSelectId();

        // 领取失败,奖励已经领取过;
        if (pdm.GetTotalChargeRewardGot(curSelectId))
        {
            PopTipManager.Instance.AddNewTip(StringHelper.GetString("totalcharge_reward_got", FontColor.Red));
            return;
        }

        int maxCanGetResId = TotalChargeModule.GetMaxRewardIdx();

        // 领取失败,充值额度不够;
        if (curSelectId > maxCanGetResId)
        {
            PopTipManager.Instance.AddNewTip(StringHelper.GetString("totalcharge_reward_no", FontColor.Red));
            return;
        }

        // 请求领取奖励;
        TotalChargeRewardParam param = new TotalChargeRewardParam();

        param.opType = Message.TOTALCHARGE_OP_TYPE.TOTALCHARGE_GET_REWARD;
        param.ResId  = curSelectId;

        Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_TOTALCHARGE, param);
    }
Ejemplo n.º 3
0
    void CreateItems()
    {
        IDictionaryEnumerator itr = DataManager.TotalChargeTable.GetEnumerator();

        while (itr.MoveNext())
        {
            TotalChargeTableItem item = TotalChargeModule.GetItem((int)itr.Key);

            if (item == null)
            {
                continue;
            }

            CreateItem(item);
        }
//         foreach(int key in DataManager.TotalChargeTable.Keys)
//         {
//             TotalChargeTableItem item = TotalChargeModule.GetItem(key);
//
//             if (item == null)
//                 continue;
//
//             CreateItem(item);
//         }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 还要充多少钱领什么东西;
    /// </summary>
    void updateCharge()
    {
        int max = TotalChargeModule.GetMaxRewardIdx();

        // 达到最大奖励提示;
        if (TotalChargeModule.IsLastRewardIdx(max))
        {
            mChargeLb.text = StringHelper.GetString("totalcharge_all_got");
            return;
        }

        TotalChargeTableItem item = TotalChargeModule.GetItem(max + 1);

        if (item == null)
        {
            Debug.LogError("totalCharge 表错了!");
            return;
        }

        PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (pdm == null)
        {
            Debug.LogError("playerDataModule null 了");
            return;
        }

        int needNum = (int)(item.chargeNum - pdm.GetTotalChargeNum());

        mChargeLb.text = string.Format(StringHelper.GetString("totalcharge_detail"), needNum, item.giftPrice);
    }