Beispiel #1
0
    private void OnClickBtnRewardDetail(GameObject sender)
    {
        MonthSignInChildItem item = sender.get_transform().get_parent().GetComponent <MonthSignInChildItem>();

        if (item.state == MonthSignInChildItem.MonthSignInChildItemState.CanSign)
        {
            SignInManager.Instance.SendSignReq(0, item.monthSignCache);
        }
        else if (item.state == MonthSignInChildItem.MonthSignInChildItemState.CanResign)
        {
            string chineseContent = GameDataUtils.GetChineseContent(502212, false);
            string text           = GameDataUtils.GetChineseContent(502213, false);
            text = text.Replace("xx", (item.monthSignCache.resignCost + DataReader <Resign> .Get(SignInManager.Instance.monthSignInfo.repairUsedNum + 1).cost).ToString());
            DialogBoxUIViewModel.Instance.ShowAsOKCancel(chineseContent, text, delegate
            {
            }, delegate
            {
                SignInManager.Instance.SendSignReq(1, item.monthSignCache);
            }, GameDataUtils.GetChineseContent(505113, false), GameDataUtils.GetChineseContent(505114, false), "button_orange_1", "button_yellow_1", null, true, true);
        }
        else if (item.state == MonthSignInChildItem.MonthSignInChildItemState.HaveSign)
        {
            ItemTipUIViewModel.ShowItem(item.monthSignCache.itemId, null);
        }
        else if (item.state == MonthSignInChildItem.MonthSignInChildItemState.None)
        {
            ItemTipUIViewModel.ShowItem(item.monthSignCache.itemId, null);
        }
    }
Beispiel #2
0
    private Cell CellForRow_MonthSign(ListView listView, int row)
    {
        string text = "cell";
        Cell   cell = listView.CellForReuseIndentify(text);

        if (cell == null)
        {
            cell          = new Cell(listView);
            cell.identify = text;
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("ItemMonthSignIn");
            cell.content = instantiate2Prefab;
            instantiate2Prefab.set_name("ItemMonthSignIn" + row);
            instantiate2Prefab.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
        }
        if (SignInManager.Instance.monthSignInfo == null)
        {
            return(cell);
        }
        ItemMonthSignIn component = cell.content.GetComponent <ItemMonthSignIn>();

        for (int i = 0; i < 5; i++)
        {
            int num = row * 5 + i;
            MonthSignInChildItem monthSignInChildItem = component.childItems.get_Item(i);
            if (row * 5 + i >= this.listMonthSign.get_Count())
            {
                monthSignInChildItem.get_gameObject().SetActive(false);
            }
            else
            {
                bool canSign   = false;
                bool canResign = false;
                bool haveSign  = false;
                if (num + 1 - SignInManager.Instance.monthSignInfo.signDays <= 0)
                {
                    haveSign = true;
                }
                else if (num - SignInManager.Instance.monthSignInfo.signDays == 0 && !SignInManager.Instance.monthSignInfo.isSign)
                {
                    canSign = true;
                }
                else if (num - SignInManager.Instance.monthSignInfo.signDays == 0 && SignInManager.Instance.monthSignInfo.repairNum > 0)
                {
                    canResign = true;
                }
                monthSignInChildItem.get_gameObject().SetActive(true);
                MonthSign monthSign = this.listMonthSign.get_Item(row * 5 + i);
                monthSignInChildItem.SetUI(monthSign, haveSign, canSign, canResign, num);
                monthSignInChildItem.BtnRewardDetail.onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickBtnRewardDetail);
                monthSignInChildItem.BtnReSignIn.onClickCustom     = new ButtonCustom.VoidDelegateObj(this.OnClickBtnReSignIn);
            }
        }
        return(cell);
    }