GetViewSize() public method

Panel's size -- which is either the clipping rect, or the screen dimensions.
public GetViewSize ( ) : Vector2
return Vector2
Exemplo n.º 1
0
    void OnPlayRewardAnimationFinished()
    {
        #region  步精力和钱经验
        BattleSyncData syncdata = this.listdata[RewardAnimationIndex].sync;
        PlayerManager  pm       = Core.Data.playerManager;

        if (syncdata != null)
        {
            pm.SetCurUserLevel(syncdata.lv);
            pm.RTData.curCoin   = syncdata.coin;
            pm.RTData.curExp    = syncdata.ep;
            pm.RTData.curJingLi = syncdata.eny;

            DBUIController.mDBUIInstance.RefreshUserInfo();
        }
        #endregion


        RewardAnimationIndex++;
        Vector3 pos  = uiPanel.transform.localPosition;
        Vector2 size = uiPanel.GetViewSize();
        if (RewardAnimationIndex < List_Elements.Count)
        {
            float cha = (RewardAnimationIndex + 1) * uiGrid.cellWidth - size.y - pos.y;
            if (cha > 0)
            {
                pos.y += cha;
                SpringPanel.Begin(uiPanel.gameObject, pos, 16f).onFinished = () =>
                {
                    List_Elements[RewardAnimationIndex].Play();
                };
            }
            else
            {
                List_Elements[RewardAnimationIndex].Play();
            }
        }
        else
        {
            float cha = RewardAnimationIndex * uiGrid.cellWidth + 240f - size.y - pos.y;
            if (cha > 0)
            {
                pos.y += cha;
                SpringPanel.Begin(uiPanel.gameObject, pos, 16f).onFinished = () =>
                {
                    SaoDangOK.SetActive(true);
                    OnSaoDangOKFinshed();
                };
            }
            else
            {
                SaoDangOK.SetActive(true);
                OnSaoDangOKFinshed();
            }
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     item.gameObject.SetActive(false);
     listPanel_         = ListView_.gameObject.GetComponent <UIPanel>();
     listDragArea_      = ListView_.gameObject.GetComponent <BoxCollider>();
     listDragArea_.size = new Vector3(listPanel_.GetViewSize().x, listPanel_.GetViewSize().y, 0);
     addItem();
     MoreCardsRewardData.GetRewardData();
     UIManager.SetButtonEventHandler(closeBtn.gameObject, EnumButtonEvent.OnClick, OnClickClose, 0, 0);
 }
Exemplo n.º 3
0
    public void Init()
    {
        _matPropBlock = new MaterialPropertyBlock();
        _matVectorID  = Shader.PropertyToID("_Area");

        //return;
        mPanel = gameObject.GetComponentInParent <UIPanel>();
        mRoot  = GameObject.Find("MainHudUI").transform;

        if (mPanel == null || mPanel.clipping != UIDrawCall.Clipping.SoftClip)
        {
            //不是滚动的item不需要做特效剪裁
            return;
        }

        //获取UI的scale,容器的宽高的一半的值
        mRootScale  = mRoot.localScale.x;
        mHalfWidth  = mPanel.GetViewSize().x * 0.5f * mRootScale;
        mHalfHeight = mPanel.GetViewSize().y * 0.5f * mRootScale;

        //给shader的容器坐标变量_Area赋值
        Vector4 area = CalculateArea(GetPostion());

        //获取所有需要修改shader的material,并替换shader
        var particleSystems = GetComponentsInChildren <ParticleSystem>();
        var len             = particleSystems.Length;

        for (int i = 0; i < len; i++)
        {
            var render = particleSystems[i].GetComponent <Renderer>();
            var mat    = render.material;

            //Debug.LogErrorFormat("EffectClip Material Name = {0}", mat.name);
            if (mat == null)
            {
                continue;
            }

            if (mat.shader.name.Contains("Scroll2LayersSineAlphaAdd"))//特写流光uv特效,有更好方法后再替换
            {
                mat.shader = Shader.Find("Custom/Scaler/Particles/Scroll2LayersSineAlphaAdd1");
            }
            else
            {
                mat.shader = Shader.Find("EBG/Particle/Add 1");
            }

            //mat.SetVector("_Area", area);
            render.GetPropertyBlock(_matPropBlock);
            _matPropBlock.SetVector(_matVectorID, area);
            render.SetPropertyBlock(_matPropBlock);
            HasInitialized = true;
        }
    }
Exemplo n.º 4
0
    public void Set(int itemNum, bool initValue = true)
    {
        this.itemNum = itemNum;

        if (initValue)
        {
            scrollBar.value = 0;
        }

        scrollLength      = wrap.itemSize * Mathf.CeilToInt(itemNum / (float)row);
        scrollBar.barSize = panel_ScrollView.GetViewSize().y / scrollLength;
    }
Exemplo n.º 5
0
    public void AddAllCards()
    {
        HeroCard card     = AddCard();
        Vector2  cardSize = card.GetCardSize();

        int num = Mathf.CeilToInt(panel_ScrollView.GetViewSize().x / cardSize.x);

        card_num = num + 1;

        for (int i = 0; i < num; i++)
        {
            AddCard();
        }
    }
Exemplo n.º 6
0
 public void install()
 {
     uIScrollView = panel.gameObject.AddComponent <UIScrollView>();
     uIScrollView.can_be_draged = false;
     uIScrollView.movement      = UIScrollView.Movement.Vertical;
     uIScrollView.contentPivot  = UIWidget.Pivot.TopLeft;
     uIScrollView.dragEffect    = UIScrollView.DragEffect.Momentum;
     scrollBar.onDragged        = onScrollBarChange;
     scrollBar.value            = 0;
     scrollBar.barSize          = 0.3f;
     width  = panel.GetViewSize().x;
     height = panel.GetViewSize().y;
     clear();
     toTop();
 }
    void VisibleProcess()
    {
        if (defualtMinSize <= 0)
        {
            GetMiniSize();
        }
        float start     = (m_Orienatation == TableViewOrienatation.Vertical) ? -m_ScrollPanel.clipOffset.y : m_ScrollPanel.clipOffset.x;
        float panelSize = (m_Orienatation == TableViewOrienatation.Vertical) ? m_ScrollPanel.GetViewSize().y : m_ScrollPanel.GetViewSize().x;

        offset = (panelSize - size) / 2 - ((m_Orienatation == TableViewOrienatation.Vertical) ? m_ScrollPanel.clipSoftness.y : m_ScrollPanel.clipSoftness.x);
        transform.localPosition = ((m_Orienatation == TableViewOrienatation.Vertical) ? Vector3.up : Vector3.left) * offset;
        visibleItemCount        = (int)(panelSize / (size + cellSpace)) + 2;
        topItemIndex            = (int)(start / (size + cellSpace)) - 1;
        if (listData == null)
        {
            topItemIndex     = -1;
            visibleItemCount = 0;
        }
        else
        {
            if (topItemIndex + visibleItemCount >= listData.Count)
            {
                topItemIndex = listData.Count - visibleItemCount;
            }
            if (topItemIndex < 0)
            {
                topItemIndex = 0;
            }
        }
    }
Exemplo n.º 8
0
    void PanelAnchorsAdjust(UIPanel panel, UIWidget.Pivot pivot)
    {
        Vector2 panelSize = panel.GetViewSize();
        float   pHeight   = panelSize.y;
        float   pWidth    = panelSize.x;

        switch (pivot)
        {
        case UIWidget.Pivot.TopLeft:
        {
            panel.clipOffset = new Vector2(pWidth / 2, -pHeight / 2);
        }
        break;

        case UIWidget.Pivot.TopRight:
        {
            panel.clipOffset = new Vector2(-pWidth / 2, -pHeight / 2);
        }
        break;

        case UIWidget.Pivot.BottomLeft:
        {
            panel.clipOffset = new Vector2(pWidth / 2, pHeight / 2);
        }
        break;

        case UIWidget.Pivot.BottomRight:
        {
            panel.clipOffset = new Vector2(-pWidth / 2, pHeight / 2);
        }
        break;
        }
    }
Exemplo n.º 9
0
    void Start()
    {
        btns.Add(SystemBtn);
        btns.Add(WorldBtn);
        btns.Add(GuildBtn);
        btns.Add(ContingentBtn);
        btns.Add(allBtn);
        Item.SetActive(false);
        meItem.SetActive(false);
        sysItem.SetActive(false);
        gameObject.GetComponent <UIPanel> ().depth = 10;
        //dikuang.transform.localPosition = new Vector3 (749,226,0);
        UIManager.SetButtonEventHandler(SystemBtn.gameObject, EnumButtonEvent.OnClick, OnClickSystem, 0, 0);
        UIManager.SetButtonEventHandler(WorldBtn.gameObject, EnumButtonEvent.OnClick, OnClickWorld, 1, 0);
        UIManager.SetButtonEventHandler(GuildBtn.gameObject, EnumButtonEvent.OnClick, OnClickGuild, 2, 0);
        UIManager.SetButtonEventHandler(ContingentBtn.gameObject, EnumButtonEvent.OnClick, OnClickContingent, 3, 0);
        UIEventListener.Get(VoiceBtn.gameObject).onPress = OnPrassVoice;
        UIManager.SetButtonEventHandler(ExpressionBtn.gameObject, EnumButtonEvent.OnClick, OnClickExpression, 0, 0);
        UIManager.SetButtonEventHandler(SendBtn.gameObject, EnumButtonEvent.OnClick, OnClickSend, 0, 0);
        UIManager.SetButtonEventHandler(SetBtn.gameObject, EnumButtonEvent.OnClick, OnClickSet, 0, 0);
        UIManager.SetButtonEventHandler(AreBtn.gameObject, EnumButtonEvent.OnClick, OnClickAre, 0, 0);
        UIManager.SetButtonEventHandler(allBtn.gameObject, EnumButtonEvent.OnClick, OnClicall, 4, 0);
        //UIEventListener.Get (chatminPanel).onClick = ShowSelfWindow;
        //UIEventListener.Get (chatmaxPanel).onClick = ShowSelfWindow;
        chatType = ChatKind.CK_World;
        BtnChoose(1);
        //ChatokOk (ChatSystem.ChatInfos);
        AddEvent();
        chatminPanel.GetComponent <ChatMinPanel> ().AddEvent();
        //chatmaxPanel.GetComponent<ChatMaxPanel> ().AddEvent ();
        SV = NGUITools.FindInParents <UIPanel>(gameObject);
        Vector2 size = SV.GetViewSize();

        nums = size.y / grid.cellHeight;
    }
Exemplo n.º 10
0
    /// <summary>
    /// Cache the scroll view and return 'false' if the scroll view is not found.
    /// </summary>
    private bool CacheScrollView()
    {
        m_uiScrollView = NGUITools.FindInParents <UIScrollView>(gameObject);
        //Atheos 用unity自带的GetComponentInParent在编辑器模式下会出现获取不到组件的BUG
        //m_uiScrollView = transform.GetComponentInParent<UIScrollView>();
        if (m_uiScrollView == null)
        {
            return(false);
        }
        m_panel = m_uiScrollView.GetComponent <UIPanel>();
        if (m_uiScrollView.movement == UIScrollView.Movement.Horizontal)
        {
            m_canShowItem = Mathf.CeilToInt(m_panel.GetViewSize().x / m_itemSize);
            m_horizontal  = true;
        }
        else if (m_uiScrollView.movement == UIScrollView.Movement.Vertical)
        {
            m_canShowItem = Mathf.CeilToInt(m_panel.GetViewSize().y / m_itemSize);
            m_horizontal  = false;
        }
        else
        {
            return(false);
        }
        switch (m_uiScrollView.contentPivot)
        {
        //正常的排序方式
        case UIWidget.Pivot.TopLeft:
        case UIWidget.Pivot.Top:
        case UIWidget.Pivot.TopRight:
        case UIWidget.Pivot.Left:
        case UIWidget.Pivot.Center:
            m_direct = false;
            break;

        case UIWidget.Pivot.Right:
        case UIWidget.Pivot.BottomLeft:
        case UIWidget.Pivot.Bottom:
        case UIWidget.Pivot.BottomRight:
            m_direct = true;
            break;

        default:
            break;
        }
        return(true);
    }
Exemplo n.º 11
0
 private void RepositionChildrenToStartFromTop(UIPanel panel)
 {
     this.startPositionForFirstItem = (Mathf.RoundToInt(panel.GetViewSize().y) / 2) - Mathf.RoundToInt(itemSize) / 2 - 10;
     for (int i = 0; i < transform.childCount; i++)
     {
         transform.GetChild(i).localPosition = new Vector3(0, startPositionForFirstItem - i * Mathf.RoundToInt(itemSize), 0);
     }
 }
Exemplo n.º 12
0
 static void SetSize(UIPanel parent, LobbyRowPhom row)
 {
     Debug.Log(parent.GetViewSize().x);
     //row.spriteBackground.width = (int)parent.GetViewSize().x;
     //row.spriteBackground.SetAnchor(parent.transform);
     row.spriteBackground.leftAnchor.target  = parent.transform;
     row.spriteBackground.rightAnchor.target = parent.transform;
 }
Exemplo n.º 13
0
        public override void Start()
        {
            mPanel     = scrollView.GetComponent <UIPanel>();
            mPanelSize = mPanel.GetViewSize();
            mPanelOrigionClipOffset = mPanel.clipOffset;
            mLastScrollOffset       = mPanelOrigionClipOffset;

            Dirty = true;
        }
Exemplo n.º 14
0
    public void adjustWrapPos()
    {
        if (mScroll == null)
        {
            CacheScrollView();
        }
        Bounds  b   = NGUIMath.CalculateRelativeWidgetBounds(mScroll.transform, MChildren[0], true);
        Vector2 pos = transform.localPosition;

        if (mHorizontal)
        {
            pos.x = -(mPanel.GetViewSize().x / 2f - mPanel.baseClipRegion.x - b.extents.x - mPanel.clipSoftness.x);
        }
        else
        {
            pos.y = mPanel.GetViewSize().y / 2f + mPanel.baseClipRegion.y - b.extents.y - mPanel.clipSoftness.y;
        }
        transform.localPosition = pos;
    }
Exemplo n.º 15
0
    void install()
    {
        uIScrollView = panel.gameObject.AddComponent <UIScrollView>();
        uIScrollView.can_be_draged = false;
        uIScrollView.movement      = UIScrollView.Movement.Vertical;
        uIScrollView.contentPivot  = UIWidget.Pivot.TopLeft;
        uIScrollView.dragEffect    = UIScrollView.DragEffect.Momentum;
        scrollBar.value            = 0;
        scrollBar.barSize          = 0.1f;
        UIHelper.registEvent(uIScrollView, printSmall);
        UIHelper.registEvent(scrollBar, onScrollBarChange);
        float magicNumber = -(panel.GetViewSize().y) / 2 + heightOfEach;

        uIScrollView.transform.localPosition = new Vector3(
            uIScrollView.transform.localPosition.x,
            -magicNumber,
            uIScrollView.transform.localPosition.z
            );
        panel.clipOffset = new Vector2(0, magicNumber);
    }
Exemplo n.º 16
0
 static public int GetViewSize(IntPtr l)
 {
     try {
         UIPanel self = (UIPanel)checkSelf(l);
         var     ret  = self.GetViewSize();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 17
0
    private void CreateStageButtons()
    {
        foreach (Transform childTransform in this.StageSelectGrid.transform)
        {
            Destroy(childTransform.gameObject);
        }

        int totalLevels = this.levelMapping.Mapping.Count;

        int remainder;
        int numStages = Math.DivRem(totalLevels, this.LevelsPerStage, out remainder);

        if (remainder > 0)
        {
            numStages++;
        }

        UIPanel uiPanel     = this.StageSelectScrollViewer.GetComponent <UIPanel>();
        Vector2 viewSize    = uiPanel.GetViewSize();
        int     buttonWidth = (int)viewSize.x - this.StageSelectButtonTrimSize;

        for (int i = 1; i <= numStages; i++)
        {
            GameObject item = NGUITools.AddChild(this.StageSelectGrid.gameObject, this.StageSelectButton);

            StageSelectButton stageSelectButton = item.GetComponent <StageSelectButton>();

            if (stageSelectButton != null)
            {
                stageSelectButton.SetStage(this, i, this.StageSelectOverrideActivateTarget, this.StageSelectOverrideDeactivateTarget);
            }

            UIWidget uiWidget = item.GetComponent <UIWidget>();

            if (uiWidget != null)
            {
                uiWidget.SetDimensions(buttonWidth, uiWidget.height);
            }
        }

        this.StageSelectGrid.enabled       = true;
        this.StageSelectGrid.repositionNow = true;

        UIScrollView scrollView = this.StageSelectScrollViewer.GetComponent <UIScrollView>();

        scrollView.enabled = true;
        scrollView.ResetPosition();

        this.refreshGrid = true;
    }
Exemplo n.º 18
0
 static int GetViewSize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIPanel             obj = (UIPanel)ToLua.CheckObject <UIPanel>(L, 1);
         UnityEngine.Vector2 o   = obj.GetViewSize();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 19
0
    public void AddAllButton()
    {
        // add 1
        VipButton button     = AddButton();
        Vector2   buttonSize = button.GetSize();

        int num = Mathf.CeilToInt(panel_ScrollView.GetViewSize().y / buttonSize.y);

        // add 1
        num += 1;

        button_num = num + 1;

        for (int i = 0; i < num; i++)
        {
            AddButton();
        }
    }
    private void InitNeed()
    {
        if (IsSvNull())
        {
            return;
        }
        mPanel = mScrollView.panel;
        Vector3 center    = mScrollView.transform.position;
        Vector3 boundSize = mPanel.GetViewSize();

        mPanelBounds = new Bounds(center, boundSize);
        mMovement    = mScrollView.movement;
        RegisterEvent();

        cellParent      = NGUITools.AddChild(mScrollView.gameObject);
        cellParent.name = "EquidistanceRecycle";
        InitPanelColRow();
    }
Exemplo n.º 21
0
        private void Reposition()
        {
            Bounds  bs        = NGUIMath.CalculateRelativeWidgetBounds(previewTable.transform);
            Vector2 panelSize = mPanel.GetViewSize();

            float width  = bs.size.x;
            float height = Mathf.Max(bs.size.y, panelSize.y);

            placeholder.SetRect(0, 0, width, height);
            var pos = placeholder.transform.localPosition;

            pos.x = 0;
            pos.y = panelSize.y / 2 + mPanel.baseClipRegion.y;
            placeholder.transform.localPosition = pos;

            scrollView.SetDragAmount(1f, 0f, false);
            //scrollView.SetDragAmount(1f, 0f, true);
            scrollView.ResetPosition();
        }
Exemplo n.º 22
0
    private void CreateSpecialStageButtons()
    {
        UIPanel uiPanel     = this.StageSelectScrollViewer.GetComponent <UIPanel>();
        Vector2 viewSize    = uiPanel.GetViewSize();
        int     buttonWidth = (int)viewSize.x - this.StageSelectButtonTrimSize;

        foreach (VirtualGood virtualGood in ShopManager.VirtualGoods)
        {
            SpecialStage readSpecialStage = SpecialStageXmlIo.ReadSpecialStage(virtualGood.ItemId);

            GameObject item = NGUITools.AddChild(this.StageSelectGrid.gameObject, this.SpecialStageSelectButton);

            SpecialStageSelectButton stageSelectButton = item.GetComponent <SpecialStageSelectButton>();

            if (stageSelectButton != null)
            {
                stageSelectButton.SetStage(
                    this,
                    readSpecialStage,
                    this.StageSelectOverrideActivateTarget,
                    this.StageSelectOverrideDeactivateTarget,
                    this.PurchaseStagePopUp,
                    this.RewardOnlyStagePopUp);
            }

            UIWidget uiWidget = item.GetComponent <UIWidget>();

            if (uiWidget != null)
            {
                uiWidget.SetDimensions(buttonWidth, uiWidget.height);
            }
        }

        this.StageSelectGrid.enabled       = true;
        this.StageSelectGrid.repositionNow = true;

        UIScrollView scrollView = this.StageSelectScrollViewer.GetComponent <UIScrollView>();

        scrollView.enabled = true;
        scrollView.ResetPosition();

        this.refreshGrid = true;
    }
Exemplo n.º 23
0
        void OnEnable()
        {
            _nameLabel = GetComponent <UILabel>();
            if (_nameLabel == null)
            {
                YxDebug.Log("No Label! No Name!");
                return;
            }
            if (_panel == null)
            {
                _panel = GetComponent <UIPanel>() ?? GetComponentInParent <UIPanel>();
            }
            if (_panel == null)
            {
                return;
            }

            _nameLabel.UpdateNGUIText();
            int     labelWidth = _nameLabel.width;
            float   viewWidth  = _panel.GetViewSize().x;
            Vector3 pos        = transform.localPosition;

            _startPos = new Vector3(viewWidth / -2, pos.y, pos.z);

            if (labelWidth > viewWidth + _nameLabel.fontSize && !_isMoving)
            {
                _isMoving        = true;
                _nameLabel.pivot = UIWidget.Pivot.Left;
                StartCoroutine(LabelMove());
            }
            else
            {
                _isMoving = false;
                _nameLabel.overflowMethod          = UILabel.Overflow.ShrinkContent;
                _nameLabel.pivot                   = UIWidget.Pivot.Center;
                _nameLabel.width                   = 100;
                _nameLabel.transform.localPosition = Vector3.zero;
            }
        }
Exemplo n.º 24
0
    private void InitNeed()
    {
        if (IsSvNull())
        {
            return;
        }
        mPanel = mScrollView.panel;
        var sizey = mPanel.baseClipRegion.w;

        mPanel.baseClipRegion = new Vector4(0, 0, cellSize * pageColumnLimit, sizey);
        Vector3 center    = mScrollView.transform.position;
        Vector3 boundSize = mPanel.GetViewSize();

        mPanelBounds = new Bounds(center, boundSize);
        mMovement    = mScrollView.movement;
        mScrollView.DisableSpring();

        RegisterEvent();

        cellParent      = NGUITools.AddChild(mScrollView.gameObject);
        cellParent.name = "EquidistancePageRecycle";

        InitPanelColRow();
    }
Exemplo n.º 25
0
    // Use this for initialization
    private void Start()
    {
        switch (this.ItemPack)
        {
        case ItemPackType.Token75Pack:
            this.VirtualCurrencyPack = GnomeStoreAssets.TokenPack75;
            break;

        case ItemPackType.Token250Pack:
            this.VirtualCurrencyPack = GnomeStoreAssets.TokenPack250;
            break;

        case ItemPackType.Token500Pack:
            this.VirtualCurrencyPack = GnomeStoreAssets.TokenPack500;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        this.ItemId           = this.VirtualCurrencyPack.ItemId;
        this.Description.text = this.VirtualCurrencyPack.Description;

        this.Price.text = "$" + ((PurchaseWithMarket)this.VirtualCurrencyPack.PurchaseType).MarketItem.Price.ToString("F2");

        UIPanel uiPanel     = NGUITools.FindInParents <UIPanel>(this.gameObject);
        Vector2 viewSize    = uiPanel.GetViewSize();
        int     buttonWidth = (int)viewSize.x - this.TrimSize;

        UIWidget uiWidget = this.GetComponent <UIWidget>();

        if (uiWidget != null)
        {
            uiWidget.SetDimensions(buttonWidth, uiWidget.height);
        }
    }
Exemplo n.º 26
0
    public void Awake()
    {
        if (Node != null)
        {
            Node.SetActive(false);
        }
        if (scrollView == null)
        {
            scrollView = GetComponent <UIScrollView>();
        }


        if (panel == null)
        {
            panel = scrollView.GetComponent <UIPanel>();
        }
        if (grid == null)
        {
            grid = root.GetComponent <UIGrid>();
        }
        mTransform = transform;
        if (grid != null)
        {
            grid.enabled = false;
            cellWidth    = grid.cellWidth;
            cellHight    = grid.cellHeight;
            maxPerLine   = grid.maxPerLine;
        }
        if (autoSizeClip)
        {
            if (scrollView.movement == UIScrollView.Movement.Horizontal)
            {
                panel.SetRect(100, 100, ViewSize.x, panel.GetViewSize().y);
            }
            else
            {
                panel.SetRect(0, 0, panel.GetViewSize().x, ViewSize.y);
            }
        }

        panelWidth       = panel.GetViewSize().x;
        panelHight       = panel.GetViewSize().y;
        panel.clipOffset = Vector2.zero;

        mTransform.localPosition = Vector3.zero;
        if (scrollView.movement == UIScrollView.Movement.Horizontal)
        {
            showLineCount      = Mathf.CeilToInt((panelWidth - panel.clipSoftness.x * 2) / cellWidth);
            root.localPosition = Vector3.left * (panelWidth / 2 - panel.clipSoftness.x - cellWidth / 2);
        }
        else
        {
            showLineCount      = Mathf.CeilToInt((panelHight - panel.clipSoftness.y * 2) / cellHight);
            root.localPosition = Vector3.up * (panelHight / 2 - panel.clipSoftness.y - cellHight / 2);
        }

        if (cacheNodes.Count == 0)
        {
            int i = 0;
            while (i++ < (showLineCount + 2) * maxPerLine)
            {
                GameObject     go   = NGUITools.AddChild(root.gameObject, Node);
                ScrollViewNode node = go.GetComponent <ScrollViewNode>();
                cacheNodes.Add(node);
                node.viewHelper = this;
                go.SetActive(false);
            }

            scrollView.onMomentumMove = onMomentumMove;
            scrollView.onDragStarted  = onDragStart;
        }

        if (sNode == null)
        {
            GameObject go = new GameObject();
            go.name = "sNode";
            UIWidget widget = go.AddComponent <UIWidget>();
            widget.SetRect(0, 0, cellWidth, cellHight);
            sNode            = go.transform;
            sNode.parent     = root;
            sNode.localScale = Vector3.one;
        }
        if (eNode == null)
        {
            GameObject go = new GameObject();
            go.name = "eNode";
            UIWidget widget = go.AddComponent <UIWidget>();
            widget.SetRect(0, 0, cellWidth, cellHight);
            eNode            = go.transform;
            eNode.parent     = root;
            eNode.localScale = Vector3.one;
        }
    }
Exemplo n.º 27
0
 public void Send(bool is_touch, Transform button, string item_name, Transform parent_scroll)
 {
     //IL_0027: Unknown result type (might be due to invalid IL or missing references)
     //IL_002c: Expected O, but got Unknown
     //IL_002f: Unknown result type (might be due to invalid IL or missing references)
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_005a: Unknown result type (might be due to invalid IL or missing references)
     //IL_005f: Expected O, but got Unknown
     //IL_0063: Unknown result type (might be due to invalid IL or missing references)
     //IL_0068: Unknown result type (might be due to invalid IL or missing references)
     //IL_006b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0078: Unknown result type (might be due to invalid IL or missing references)
     //IL_007d: Unknown result type (might be due to invalid IL or missing references)
     //IL_009d: Unknown result type (might be due to invalid IL or missing references)
     //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
     //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
     //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
     //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
     //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
     //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
     //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
     //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
     //IL_0107: Unknown result type (might be due to invalid IL or missing references)
     //IL_010c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0111: Unknown result type (might be due to invalid IL or missing references)
     //IL_011b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0120: Unknown result type (might be due to invalid IL or missing references)
     //IL_0125: Unknown result type (might be due to invalid IL or missing references)
     //IL_0129: Unknown result type (might be due to invalid IL or missing references)
     //IL_0138: Unknown result type (might be due to invalid IL or missing references)
     //IL_013d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0142: Unknown result type (might be due to invalid IL or missing references)
     //IL_014d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0152: Unknown result type (might be due to invalid IL or missing references)
     //IL_016b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0170: Unknown result type (might be due to invalid IL or missing references)
     //IL_017c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0181: Unknown result type (might be due to invalid IL or missing references)
     //IL_0186: Unknown result type (might be due to invalid IL or missing references)
     //IL_0197: Unknown result type (might be due to invalid IL or missing references)
     //IL_019c: Unknown result type (might be due to invalid IL or missing references)
     //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
     //IL_01b5: Unknown result type (might be due to invalid IL or missing references)
     //IL_01ba: Unknown result type (might be due to invalid IL or missing references)
     //IL_01bf: Unknown result type (might be due to invalid IL or missing references)
     //IL_0206: Unknown result type (might be due to invalid IL or missing references)
     //IL_020b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0210: Unknown result type (might be due to invalid IL or missing references)
     //IL_0232: Unknown result type (might be due to invalid IL or missing references)
     //IL_0237: Unknown result type (might be due to invalid IL or missing references)
     //IL_023c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0259: Unknown result type (might be due to invalid IL or missing references)
     //IL_025e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0289: Unknown result type (might be due to invalid IL or missing references)
     //IL_028e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0299: Unknown result type (might be due to invalid IL or missing references)
     //IL_02a4: Unknown result type (might be due to invalid IL or missing references)
     //IL_02b0: Unknown result type (might be due to invalid IL or missing references)
     if (!(lbl == null))
     {
         SetEnableInfo(is_touch);
         if (is_touch)
         {
             SetText(item_name);
             Transform val = this.get_transform();
             val.set_parent(button.get_parent());
             val.set_localScale(Vector3.get_one());
             UIScrollView componentInParent = button.GetComponentInParent <UIScrollView>();
             BoxCollider  component         = button.GetComponent <BoxCollider>();
             UIWidget     uIWidget          = widget;
             Transform    val2               = this.get_transform();
             Vector3      position           = val2.get_position();
             UIRoot       componentInParent2 = this.get_gameObject().GetComponentInParent <UIRoot>();
             Vector3      size               = component.get_size();
             int          num        = (int)(size.y * 0.5f) + uIWidget.height / 2;
             float        num2       = (float)num;
             Vector3      localScale = componentInParent2.get_transform().get_localScale();
             float        num3       = num2 * localScale.y;
             Vector3      position2  = component.get_transform().get_position();
             float        num4       = num3 + position2.y;
             Vector3      position3  = val2.get_position();
             position._002Ector(position3.x, num4);
             if (componentInParent != null)
             {
                 UIPanel component2  = componentInParent.GetComponent <UIPanel>();
                 Vector3 val3        = position;
                 float   num5        = (float)(uIWidget.height / 2);
                 Vector3 localScale2 = componentInParent2.get_transform().get_localScale();
                 Vector3 worldPos    = val3 + new Vector3(0f, num5 * localScale2.y);
                 if (!component2.IsVisible(worldPos))
                 {
                     Vector3 position4   = componentInParent.get_transform().get_position();
                     float   y           = position4.y;
                     Vector2 viewSize    = component2.GetViewSize();
                     float   num6        = (viewSize.y - (float)uIWidget.height) / 2f;
                     Vector2 clipOffset  = component2.clipOffset;
                     float   num7        = num6 + clipOffset.y;
                     Vector3 localScale3 = componentInParent2.get_transform().get_localScale();
                     position.y = y + num7 * localScale3.y;
                 }
             }
             Vector3 position5   = component.get_transform().get_position();
             float   num8        = position5.x;
             float   num9        = num8;
             Vector3 localScale4 = componentInParent2.get_transform().get_localScale();
             float   num10       = num9 * (1f / localScale4.x);
             float   num11       = UIVirtualScreen.screenWidth * 0.5f;
             int     num12       = uIWidget.width / 2;
             float   num13       = num10 - (float)num12;
             float   num14       = num10 + (float)num12;
             if (0f - num11 > num13)
             {
                 float   num15       = 0f - num11 + (float)num12;
                 Vector3 localScale5 = componentInParent2.get_transform().get_localScale();
                 num8 = num15 * localScale5.x;
             }
             else if (num11 < num14)
             {
                 float   num16       = num11 - (float)num12;
                 Vector3 localScale6 = componentInParent2.get_transform().get_localScale();
                 num8 = num16 * localScale6.x;
             }
             position._002Ector(num8, position.y);
             val.get_transform().set_position(position);
             isEnableParentScroll = (componentInParent != null);
             if (componentInParent != null)
             {
                 val.set_parent(((object)parent_scroll) ?? ((object)componentInParent.get_transform().get_parent()));
                 val.set_localScale(Vector3.get_one());
             }
             val.get_gameObject().SetActive(false);
             val.get_gameObject().SetActive(true);
         }
     }
 }
Exemplo n.º 28
0
    private void adjustPosY(Transform button)
    {
        //IL_0000: Unknown result type (might be due to invalid IL or missing references)
        //IL_0005: Unknown result type (might be due to invalid IL or missing references)
        //IL_001c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0021: Expected O, but got Unknown
        //IL_0024: Unknown result type (might be due to invalid IL or missing references)
        //IL_0031: Unknown result type (might be due to invalid IL or missing references)
        //IL_0036: Unknown result type (might be due to invalid IL or missing references)
        //IL_0056: Unknown result type (might be due to invalid IL or missing references)
        //IL_005b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0060: Unknown result type (might be due to invalid IL or missing references)
        //IL_006b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0070: Unknown result type (might be due to invalid IL or missing references)
        //IL_0075: Unknown result type (might be due to invalid IL or missing references)
        //IL_0085: Unknown result type (might be due to invalid IL or missing references)
        //IL_008a: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
        //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e1: Unknown result type (might be due to invalid IL or missing references)
        //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
        //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
        //IL_00fa: Unknown result type (might be due to invalid IL or missing references)
        //IL_0105: Unknown result type (might be due to invalid IL or missing references)
        //IL_010a: Unknown result type (might be due to invalid IL or missing references)
        //IL_011b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0120: Unknown result type (might be due to invalid IL or missing references)
        //IL_012c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0131: Unknown result type (might be due to invalid IL or missing references)
        //IL_0136: Unknown result type (might be due to invalid IL or missing references)
        //IL_0148: Unknown result type (might be due to invalid IL or missing references)
        Vector3      zero = Vector3.get_zero();
        UIScrollView componentInParent = button.GetComponentInParent <UIScrollView>();
        BoxCollider  component         = button.GetComponent <BoxCollider>();
        UIWidget     component2        = this.GetComponent <UIWidget>();
        Transform    val = this.get_transform();
        UIRoot       componentInParent2 = this.get_gameObject().GetComponentInParent <UIRoot>();
        Vector3      size       = component.get_size();
        int          num        = (int)(size.y * 0.5f) + component2.height / 2;
        float        num2       = (float)num;
        Vector3      localScale = componentInParent2.get_transform().get_localScale();
        float        num3       = num2 * localScale.y;
        Vector3      position   = component.get_transform().get_position();
        float        num4       = num3 + position.y;
        Vector3      position2  = val.get_position();

        zero._002Ector(position2.x, num4);
        if (componentInParent != null)
        {
            UIPanel component3  = componentInParent.GetComponent <UIPanel>();
            Vector3 val2        = zero;
            float   num5        = (float)(component2.height / 2);
            Vector3 localScale2 = componentInParent2.get_transform().get_localScale();
            Vector3 worldPos    = val2 + new Vector3(0f, num5 * localScale2.y);
            if (!component3.IsVisible(worldPos))
            {
                Vector3 position3   = componentInParent.get_transform().get_position();
                float   y           = position3.y;
                Vector2 viewSize    = component3.GetViewSize();
                float   num6        = viewSize.y / 2f;
                Vector2 clipOffset  = component3.clipOffset;
                float   num7        = num6 + clipOffset.y;
                Vector3 localScale3 = componentInParent2.get_transform().get_localScale();
                zero.y = y + num7 * localScale3.y;
            }
        }
        val.set_position(zero);
    }
Exemplo n.º 29
0
    private void InitData()
    {
        SetInitMinMaxIndex();
        float x = mPanel.baseClipRegion.x - mPanel.baseClipRegion.z / 2;
        float y = mPanel.baseClipRegion.w / 2 + mPanel.baseClipRegion.y;

        mCorrectPos = new Vector3(x, y, 0);
        mIsLoadOver = false;

        if (LineCount <= 0 || CountPerLine <= 0 || CellWidth <= 0 || CellHeight <= 0)
        {
            SQDebug.LogError("初始化数据错误");
            return;
        }
        if (StartIndex < 0 || StartIndex >= mAllCount)
        {
            SQDebug.LogError("初始化数据错误");
            return;
        }

        //设置滚动方向
        if (mScrollView.movement == UIScrollView.Movement.Horizontal)
        {
            mIsHorizontal = true;
            mPanel.transform.localPosition = new Vector3(mInitPanelPos.x - mOffsetByStartIndex, mInitPanelPos.y, 0);
            mPanel.clipOffset = new Vector2(mInitPanelClip.x + mOffsetByStartIndex, mInitPanelClip.y);
            mNextUpPos        = mPanel.transform.localPosition.x - (Offeset.x + CellWidth * LineCount - mPanel.GetViewSize().x) + mOffsetByStartIndex;
            mNextDownPos      = mPanel.transform.localPosition.x + mOffsetByStartIndex;
        }
        else if (mScrollView.movement == UIScrollView.Movement.Vertical)
        {
            mIsHorizontal = false;
            mPanel.transform.localPosition = new Vector3(mInitPanelPos.x, mInitPanelPos.y + mOffsetByStartIndex, 0);
            mPanel.clipOffset = new Vector2(mInitPanelClip.x, mInitPanelClip.y - mOffsetByStartIndex);
            mNextUpPos        = mPanel.transform.localPosition.y + (Offeset.y + CellHeight * LineCount - mPanel.GetViewSize().y) - mOffsetByStartIndex;
            mNextDownPos      = mPanel.transform.localPosition.y - mOffsetByStartIndex;
        }
        else
        {
            SQDebug.LogError("不支持该方向类型");
            return;
        }
        //添加item
        int count = LineCount * CountPerLine;

        if (mAllCount < count)
        {
            count = mAllCount;
        }
        StartCoroutine(InitItems());
    }
Exemplo n.º 30
0
    void OnEnable()
    {
        try
        {
            RoleInfo role_info = LobbyClient.Instance.CurrentRole;
            for (int i = 0; i < buttons.Count; i++)
            {
                bool   open     = false;
                int    openLv   = 0;
                string btnName  = buttons[i].name;
                string unitName = "";
                string openTime = "";
                int    type     = -1;
                switch (btnName.TrimStart("1234567890".ToCharArray()))
                {
                case NAME_GOLD:
                    openLv   = LevelLockProvider.Instance.GetDataById(15).m_Level;  //RoleInfo.c_GoldOpenLv;
                    unitName = StrDictionaryProvider.Instance.GetDictString(882);
                    openTime = GetOpenTime((int)MatchSceneEnum.Gold);
                    type     = (int)GuideActionEnum.Gold;
                    break;

                case NAME_TREASURE:
                    openLv   = LevelLockProvider.Instance.GetDataById(13).m_Level;  //ExpeditionPlayerInfo.c_UnlockLevel;
                    unitName = StrDictionaryProvider.Instance.GetDictString(881);
                    openTime = "00:00-24:00";
                    type     = (int)GuideActionEnum.Expedition;
                    break;

                case NAME_TRIAL:
                    openLv   = LevelLockProvider.Instance.GetDataById(14).m_Level;  //RoleInfo.c_TrialOpenLv;
                    unitName = StrDictionaryProvider.Instance.GetDictString(874);
                    openTime = GetOpenTime((int)MatchSceneEnum.Attempt);
                    type     = (int)GuideActionEnum.Attempt;
                    break;
                }
                if (role_info != null && role_info.Level >= openLv)
                {
                    open = true;
                    if (!role_info.IsDoneAction(type))
                    {
                        PlayUnLock(buttons[i]);
                    }
                }

                TrialUnit unit = buttons[i].GetComponent <TrialUnit>();
                if (unit != null)
                {
                    unit.UpdateData(unitName, open, openTime, openLv);
                }
            }
            CheckHasTip();
            ////播放解锁特效
            //buttons.Sort(SortByLv);
            //if (role_info != null) {
            //  if (role_info.HasActivityTip) {
            //    role_info.HasActivityTip = false;
            //    CheckHasTip();
            //    PlayUnLock();
            //  }
            //}

            if (grid != null)
            {
                grid.repositionNow = true;
            }
            if (scrollView != null)
            {
                int num = buttons.Count;
                if (num <= 4 && num > 0)
                {
                    scrollView.enabled = false;
                    //强制居中
                    UIPanel panel = scrollView.gameObject.GetComponent <UIPanel>();
                    if (panel != null && buttons.Count > 0)
                    {
                        float interval               = grid.cellWidth - buttons[0].GetComponent <UISprite>().width;
                        float totalWidth             = grid.cellWidth * num - interval;
                        float scrollWidth            = panel.GetViewSize().x;
                        float tempX                  = scrollWidth / 2 - totalWidth / 2 - 25;
                        UnityEngine.Vector2 tempVec2 = panel.clipOffset;
                        panel.clipOffset = new UnityEngine.Vector2(-tempX, tempVec2.y);
                        UnityEngine.Vector3 tempLocal = scrollView.gameObject.transform.localPosition;
                        scrollView.gameObject.transform.localPosition = new UnityEngine.Vector3(tempX, tempLocal.y, tempLocal.z);
                    }
                }
                else
                {
                    scrollView.enabled = true;
                }
            }
            SetCoin();
        }
        catch (System.Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }