예제 #1
0
    public static void SetShift(ScrollRectCustom src, object arg)
    {
        if (arg == null)
        {
            return;
        }
        if (src == null)
        {
            return;
        }
        Vector3 action    = (Vector3)arg;
        bool    bRightNow = action.z == 1f;

        switch ((int)action.x)
        {
        case 1:
            src.Move2Next();
            break;

        case 2:
            src.Move2Previous();
            break;

        case 3:
            src.Move2First(bRightNow);
            src.OnHasBuilt = delegate
            {
                src.OnHasBuilt = null;
                src.Move2First(bRightNow);
            };
            break;

        case 4:
            src.Move2Last(bRightNow);
            src.OnHasBuilt = delegate
            {
                src.OnHasBuilt = null;
                src.Move2Last(bRightNow);
            };
            break;

        case 5:
            src.Move2Page((int)action.y, bRightNow);
            src.OnHasBuilt = delegate
            {
                if (src.GetPageNum() > (int)action.y)
                {
                    src.OnHasBuilt = null;
                    src.Move2Page((int)action.y, bRightNow);
                }
            };
            break;

        case 6:
            src.Move2Index((int)action.y, bRightNow);
            src.OnHasBuilt = delegate
            {
                src.OnHasBuilt = null;
                src.Move2Index((int)action.y, bRightNow);
            };
            break;
        }
    }
예제 #2
0
    protected override void DataBinding()
    {
        base.DataBinding();
        ListBinder listBinder = base.FindTransform("Show1ItemList").get_gameObject().AddComponent <ListBinder>();

        listBinder.BindingProxy             = base.get_gameObject();
        listBinder.PrefabName               = "ShoppingPage";
        listBinder.SourceBinding.MemberName = "ItemList1";
        ScrollRectCustom itemSR1 = base.FindTransform("Show1ItemSR").GetComponent <ScrollRectCustom>();

        itemSR1.movePage      = true;
        itemSR1.Arrow2First   = base.FindTransform("ArrowL");
        itemSR1.Arrow2Last    = base.FindTransform("ArrowR");
        itemSR1.OnPageChanged = delegate(int pageIndex)
        {
            this.m_lblPageNum.set_text((pageIndex + 1).ToString());
            PageUIView.Instance.SetPage(itemSR1.GetPageNum(), pageIndex);
            ShoppingUIViewModel.Instance.CurrentPageIndex = pageIndex;
        };
        ListShiftBinder listShiftBinder = base.FindTransform("Show1ItemList").get_gameObject().AddComponent <ListShiftBinder>();

        listShiftBinder.BindingProxy            = base.get_gameObject();
        listShiftBinder.ShiftBinding.MemberName = "ShiftType";
        listBinder = base.FindTransform("Show2ItemList").get_gameObject().AddComponent <ListBinder>();
        listBinder.BindingProxy             = base.get_gameObject();
        listBinder.PrefabName               = "ShoppingPage2";
        listBinder.SourceBinding.MemberName = "ItemList2";
        ScrollRectCustom itemSR2 = base.FindTransform("Show2ItemSR").GetComponent <ScrollRectCustom>();

        itemSR2.movePage      = true;
        itemSR2.Arrow2First   = base.FindTransform("ArrowL");
        itemSR2.Arrow2Last    = base.FindTransform("ArrowR");
        itemSR2.OnPageChanged = delegate(int pageIndex)
        {
            this.m_lblPageNum.set_text((pageIndex + 1).ToString());
            PageUIView.Instance.SetPage(itemSR2.GetPageNum(), pageIndex);
            ShoppingUIViewModel.Instance.CurrentPageIndex = pageIndex;
        };
        listShiftBinder = base.FindTransform("Show2ItemList").get_gameObject().AddComponent <ListShiftBinder>();
        listShiftBinder.BindingProxy            = base.get_gameObject();
        listShiftBinder.ShiftBinding.MemberName = "ShiftType";
        VisibilityBinder visibilityBinder = base.get_gameObject().AddComponent <VisibilityBinder>();

        visibilityBinder.BindingProxy            = base.get_gameObject();
        visibilityBinder.Target                  = base.FindTransform("BtnRefresh").get_gameObject();
        visibilityBinder.ValueBinding.MemberName = "BtnRefreshVisibility";
        visibilityBinder = base.get_gameObject().AddComponent <VisibilityBinder>();
        visibilityBinder.BindingProxy            = base.get_gameObject();
        visibilityBinder.Target                  = base.FindTransform("CurrentCoin").get_gameObject();
        visibilityBinder.ValueBinding.MemberName = "CurrentCoinVisibility";
        visibilityBinder = base.get_gameObject().AddComponent <VisibilityBinder>();
        visibilityBinder.BindingProxy            = base.get_gameObject();
        visibilityBinder.Target                  = base.FindTransform("RemainRefreshTimesRegion").get_gameObject();
        visibilityBinder.ValueBinding.MemberName = "RemainRefreshTimesRegion";
        ImageBinder imageBinder = base.FindTransform("CurrentCoinIcon").get_gameObject().AddComponent <ImageBinder>();

        imageBinder.BindingProxy             = base.get_gameObject();
        imageBinder.SpriteBinding.MemberName = "CurrentCoinIcon";
        imageBinder = base.FindTransform("RefreshCoinIcon").get_gameObject().AddComponent <ImageBinder>();
        imageBinder.BindingProxy             = base.get_gameObject();
        imageBinder.SpriteBinding.MemberName = "RefreshCoinIcon";
        TextBinder textBinder = base.FindTransform("CurrentCoinNum").get_gameObject().AddComponent <TextBinder>();

        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "CurrentCoinNum";
        textBinder = base.FindTransform("MarketName").get_gameObject().AddComponent <TextBinder>();
        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "MarketName";
        textBinder = base.FindTransform("RefreshTime").get_gameObject().AddComponent <TextBinder>();
        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "RefreshTime";
        textBinder = base.FindTransform("RemainRefreshTimes").get_gameObject().AddComponent <TextBinder>();
        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "RemainRefreshTimes";
        textBinder = base.FindTransform("BtnRefreshName").get_gameObject().AddComponent <TextBinder>();
        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "BtnRefreshName";
        textBinder = base.FindTransform("RefreshCoinNum").get_gameObject().AddComponent <TextBinder>();
        textBinder.BindingProxy            = base.get_gameObject();
        textBinder.LabelBinding.MemberName = "RefreshCoinNum";
    }