Пример #1
0
    private void InitComponent(out Canvas canvas)
    {
        _rect  = GetComponent <RectTransform>();
        canvas = null;

        foreach (Canvas c in _rect.GetComponentsInParent <Canvas>())
        {
            if (c.isRootCanvas)
            {
                canvas = c;
                break;
            }
        }

        _clippingMask    = _rect.Find("ClippingMask").GetComponent <RectTransform>();
        _rightPage       = _rect.Find("RightPage").gameObject.AddComponent <Page>();
        _leftPage        = _rect.Find("LeftPage").gameObject.AddComponent <Page>();
        _leftSideOfPage  = _rect.Find("LeftSide").gameObject.AddComponent <TheDraggingPage>();
        _rightSideOfPage = _rect.Find("RightSide").gameObject.AddComponent <TheDraggingPage>();

        _rect.Find("RightDragButton").gameObject
        .AddComponent <DragButton>()
        .Init(OnMouseDragRightPage, OnUpdateDage, OnEndDragRightPage);

        _rect.Find("LeftDragButton").gameObject
        .AddComponent <DragButton>()
        .Init(OnMouseDragLeftPage, OnUpdateDage, OnEndDragLeftPage);

        _rightPage.Init(GetSprite);
        _leftPage.Init(GetSprite);
        _leftSideOfPage.Init(GetSprite);
        _rightSideOfPage.Init(GetSprite);
    }
Пример #2
0
 public DragRightPage(UIBook book,
                      BookModel model,
                      TheDraggingPage frontPage,
                      TheDraggingPage backPage,
                      Vector3 startPos)
     : base(book, model, frontPage, backPage, startPos)
 {
 }
Пример #3
0
 public DragPageBase(UIBook book, BookModel model, TheDraggingPage frontPage, TheDraggingPage backPage, Vector3 startPos)
 {
     _book         = book;
     _bookModel    = model;
     _frontPage    = frontPage;
     _backPage     = backPage;
     _startPos     = startPos;
     _clippingMask = book.GetClippingMask();
 }