Пример #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();

        LoopScrollRect scroll = (LoopScrollRect)target;

        if (GUILayout.Button("Create PoolObject"))
        {
            var _tf = scroll.transform.Find(LoopScrollPrefabSource.__POOLSNAME);

            if (!_tf)
            {
                GameObject _gameObject = new GameObject(LoopScrollPrefabSource.__POOLSNAME);

                _gameObject.transform.SetParent(scroll.transform);
                _gameObject.transform.localScale    = Vector3.one;
                _gameObject.transform.localPosition = Vector3.zero;

                _tf = _gameObject.transform;
            }

            scroll.prefabSource.PoolGameObject = _tf;

            Debug.Log("Create Suc!");
        }

        GUI.enabled = Application.isPlaying;

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear"))
        {
            scroll.ClearCells();
        }
        if (GUILayout.Button("Refresh"))
        {
            scroll.RefreshCells();
        }
        if (GUILayout.Button("Refill"))
        {
            scroll.RefillCells();
        }
        if (GUILayout.Button("RefillFromEnd"))
        {
            scroll.RefillCellsFromEnd();
        }
        EditorGUILayout.EndHorizontal();

        EditorGUIUtility.labelWidth = 45;
        float w = (EditorGUIUtility.currentViewWidth - 100) / 2;

        EditorGUILayout.BeginHorizontal();
        index = EditorGUILayout.IntField("Index", index, GUILayout.Width(w));
        speed = EditorGUILayout.FloatField("Speed", speed, GUILayout.Width(w));
        if (GUILayout.Button("Scroll", GUILayout.Width(45)))
        {
            scroll.SrollToCell(index, speed);
        }
        EditorGUILayout.EndHorizontal();
    }
Пример #2
0
 void Start()
 {
     m_LoopScrollRect = GetComponent <LoopScrollRect>();
     m_LoopScrollRect.m_OnItemCreateEvent    += OnItemCreate;
     m_LoopScrollRect.m_OnItemRemoveEvent    += OnItemRemove;
     m_LoopScrollRect.m_OnItemViewFlushEvent += OnItemFlush;
 }
Пример #3
0
    private static Dictionary <string, List <string> > logBufferMap = new Dictionary <string, List <string> >(); //缓存特定系统的日志


    public static void Init(LoopScrollRect content = null)
    {
        ClearLocalFile();
        Application.logMessageReceived += LogCallback;

        //获取文件路径
        fs = File.Open(GetFilePath("QiPaiLogFile.txt"), FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
        sw = new StreamWriter(fs);

        //获取ui组件
        wrapContent = content;

        //是否要输出日志
#if LOG_OPEN
        IsOpenLog = true;
#else
        IsOpenLog = false;
#endif

        //指定要输出的目标
        SwitchTarget(OutputTarget.eConsole, true);
        SwitchTarget(OutputTarget.eUI, true);
        SwitchTarget(OutputTarget.eBuffer, false);
#if LOG_TO_FILE
        SwitchTarget(OutputTarget.eFile, true);
#else
        SwitchTarget(OutputTarget.eFile, false);
#endif

        //指定输出的级别
        SwitchLevel(OutputLevel.eLog, true);
        SwitchLevel(OutputLevel.eLogWaning, true);
        SwitchLevel(OutputLevel.eLogError, true);
    }
Пример #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();

            LoopScrollRect scroll = (LoopScrollRect)target;

            //scroll.m_PrefabGameObject = EditorGUILayout.ObjectField("Prefab", scroll.m_PrefabGameObject, typeof(GameObject), true, null) as GameObject;

            scroll.totalCount       = EditorGUILayout.IntField("Total Count", scroll.totalCount);
            scroll.threshold        = Mathf.Max(10, EditorGUILayout.FloatField("Threshold", scroll.threshold));
            scroll.reverseDirection = EditorGUILayout.Toggle("Reverse Direction", scroll.reverseDirection);
            scroll.rubberScale      = Mathf.Max(0, EditorGUILayout.FloatField("Rubber Scale", scroll.rubberScale));
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Clear"))
            {
                scroll.ClearCells();
            }
            if (GUILayout.Button("Refill"))
            {
                scroll.RefillCells();
            }
            if (GUILayout.Button("Refresh"))
            {
                scroll.RefreshCells();
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();

        LoopScrollRect scroll = (LoopScrollRect)target;

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear"))
        {
            scroll.ClearCells();
        }
        if (GUILayout.Button("Refresh"))
        {
            scroll.RefreshCells();
        }
        if (GUILayout.Button("Refill"))
        {
            scroll.RefillCells(50);
        }
        if (GUILayout.Button("RefillFromEnd"))
        {
            scroll.RefillCellsFromEnd();
        }
        EditorGUILayout.EndHorizontal();
    }
Пример #6
0
        public void ChangeScrollViewCount(GameObject go, int num)
        {
            LoopScrollRect component = go.GetComponent <LoopScrollRect>();

            if (component != null)
            {
                component.totalCount = Math.Max(0, component.totalCount + num);
            }
        }
Пример #7
0
 public void Reset(ObservableList <TVm> items, LoopScrollRect loopScrollRect)
 {
     itemsVm             = items;
     this.loopScrollRect = loopScrollRect;
     items.AddListener(OnListChanged);
     loopScrollRect.totalCount  = items.Count;
     loopScrollRect.OnItemShow += OnItemChanged;
     loopScrollRect.RefillCells();
 }
Пример #8
0
        private void Start()
        {
            scrollRect = GetComponent <LoopScrollRect>();

            onFavoritesUpdated += () => {
                if (displayMode == LibraryDisplayMode.Favorites)
                {
                    MakeGames();
                }
            };
        }
Пример #9
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     LoopScrollRect = GetComponentInParent <LoopScrollRect>();
     if (LoopScrollRect != null)
     {
         LoopScrollRect.OnBeginDrag(eventData);
     }
     if (!isHaveScrollHorizen)
     {
         LoopScrollRect = null;
     }
 }
Пример #10
0
        public void InitScrollView(GameObject go, int count, string cellName, int focusIndex = -1)
        {
            LoopScrollRect component = go.GetComponent <LoopScrollRect>();

            if (component != null)
            {
                component.prefabPool = this.EasyObjectPool;
                component.SetPrefabToPool(cellName);
                component.ClearCells();
                component.totalCount = count;
                component.focusIndex = focusIndex;
            }
        }
Пример #11
0
        void Start()
        {
            _scrollRect = GetComponent <LoopScrollRect>();
            var dataSource = new LoopScrollPrefabSource();

            dataSource.prefabName = ObjectResourceName;
            _scrollRect.Init(dataSource, LoopScrollSendIndexSource.Instance);
            for (int i = 0; i < totalCount; i++)
            {
                _scrollRect.AddItem((object)i, false);
            }

            _scrollRect.RefillCells();
        }
Пример #12
0
        /// <summary>
        /// 用在热更的BindView
        /// </summary>
        public void BindViewList(ObservableList <ViewModelAdapter.Adapter> list, LoopScrollRect root, Type view)
        {
            BindLoopViewList <ViewModelAdapter.Adapter, ViewAdapter.Adapter> bind;

            if (CacheBinds.Count > 0)
            {
                bind = (BindLoopViewList <ViewModelAdapter.Adapter, ViewAdapter.Adapter>)CacheBinds.Dequeue();
            }
            else
            {
                bind = new BindLoopViewList <ViewModelAdapter.Adapter, ViewAdapter.Adapter>();
            }
            bind.SetViewType(view);
            bind.Reset(list, root);
            AddClearable(bind);
        }
Пример #13
0
        public override void GetPaths()
        {
            base.GetPaths();

            this.ListView = this.GetComponent <LoopScrollRect>();
            if (this.ListView != null)
            {
                var rViewModelProps = new List <BindableMember <PropertyInfo> >(
                    DataBindingTypeResolve.GetListViewModelProperties(this.gameObject));
                this.ModelPaths = DataBindingTypeResolve.GetAllViewModelPaths(rViewModelProps).ToArray();

                if (string.IsNullOrEmpty(this.ViewModelPath))
                {
                    this.ViewModelPath = this.ModelPaths.Length > 0 ? this.ModelPaths[0] : "";
                }
            }
        }
Пример #14
0
        public void BindViewList <TItemVm, TItemView>
            (ObservableList <TItemVm> list, LoopScrollRect root) where TItemVm : ViewModel
            where TItemView : View, new()
        {
            BindLoopViewList <TItemVm, TItemView> bind;

            if (CacheBinds.Count > 0)
            {
                bind = (BindLoopViewList <TItemVm, TItemView>)CacheBinds.Dequeue();
            }
            else
            {
                bind = new BindLoopViewList <TItemVm, TItemView>();
            }
            bind.Reset(list, root);
            AddClearable(bind);
        }
Пример #15
0
    public void TryFindScrollRect(bool force = false)
    {
        if (scrollRect != null)
        {
            foundScrollRect = true;
            if (!force)
            {
                return;
            }
        }
        scrollRect = GetComponentInParent <LoopScrollRect>();

        if (scrollRect != null)
        {
            foundScrollRect = true;
        }
    }
Пример #16
0
    void InitializeComponent()
    {
        m_inventory_Panel = GameObject.Find("inst_Inventory_Panel").gameObject;
        m_ray_State_check = GameObject.Find("inst_Raycast_State_Check");


        //m_inst_Item_List = m_inventory_Panel.transform.GetChild(0).transform.GetChild(0).transform.GetChild(0).gameObject;

        int tEndChild = m_inventory_Panel.transform.childCount;

        m_backBtn = m_inventory_Panel.transform.GetChild(tEndChild - 2).GetComponent <Button>();

        for (int i = 0; i < InvenCategoryCount; i++)
        {
            m_categoryBtnColor.Add(m_inventory_Panel.transform.GetChild(1 + i).GetComponent <Image>());
        }

        m_LoopScrollRect = m_inventory_Panel.transform.GetChild(0).GetComponent <LoopScrollRect>();

        m_Item_Info_Panel = m_inventory_Panel.transform.GetChild(5).gameObject;
        m_Item_Info_Panel.SetActive(false); //아이템 정보 판넬 : ID: 5

        //웨폰 정보 UI모음
        m_weaponSprite    = m_Item_Info_Panel.transform.GetChild(0).GetChild(0).GetComponent <Image>();
        m_weaponName      = m_Item_Info_Panel.transform.GetChild(1).GetChild(0).GetComponent <Text>();
        m_weaponSkill     = m_Item_Info_Panel.transform.GetChild(2).GetChild(0).GetComponent <Text>();
        m_weaponSkillDesc = m_Item_Info_Panel.transform.GetChild(3).GetChild(0).GetComponent <Text>();
        m_weaponDesc      = m_Item_Info_Panel.transform.GetChild(4).GetChild(0).GetComponent <Text>();

        m_weaponStatus = new Text[m_Item_Info_Panel.transform.GetChild(5).childCount];
        for (int i = 0; i < m_weaponStatus.Length; i++)
        {
            m_weaponStatus[i] = m_Item_Info_Panel.transform.GetChild(5).GetChild(i).GetComponent <Text>();
        }

        //포션 정보 UI모음
        m_potion_info_Panel        = m_inventory_Panel.transform.GetChild(tEndChild - 1).gameObject;
        m_potion_info_BG           = m_inventory_Panel.transform.GetChild(tEndChild - 1).GetChild(0).gameObject;
        m_potionSprite             = m_potion_info_BG.transform.GetChild(0).GetChild(0).GetComponent <Image>(); //포션 이미지
        m_potionName               = m_potion_info_BG.transform.GetChild(1).GetChild(0).GetComponent <Text>();  //포션이름
        m_potionDesc               = m_potion_info_BG.transform.GetChild(2).GetChild(0).GetComponent <Text>();  // 포션 설명
        m_potionCount              = m_potion_info_BG.transform.GetChild(2).GetChild(1).GetComponent <Text>();  // 포션 수량
        m_potionInfo_Closed_Button = m_potion_info_BG.transform.GetChild(m_potion_info_BG.transform.childCount - 1).GetComponent <Button>();

        m_potion_info_Panel.SetActive(false);
    }
Пример #17
0
    /// <summary>
    /// 初始化组件
    /// </summary>
    void Initial()
    {
        _bgTra                        = transform.Find("bg");
        _topTra                       = _bgTra.Find("Top");
        _closeBtn                     = _topTra.Find("CloseButton").GetComponent <Button>();
        _topToggleGroup               = _topTra.GetComponent <ToggleGroup>();
        _topScrollRect                = _topTra.Find("Scroll View").GetComponent <ScrollRect>();
        _topTwoTra                    = _bgTra.Find("TopTwo");
        _topTwoToggleGroup            = _topTwoTra.GetComponent <ToggleGroup>();
        _topTwoScrollRect             = _topTwoTra.Find("Scroll View").GetComponent <ScrollRect>();
        _itemBoxTra                   = _bgTra.Find("Itembox").GetComponent <RectTransform>();
        _itemBoxContentRect           = _itemBoxTra.Find("Content").GetComponent <RectTransform>();
        _loopScrollRect               = _itemBoxTra.GetComponent <LoopScrollRect>();
        _chatSlideListStateInspection = _itemBoxTra.Find("Content").GetComponent <ChatSlideListStateInspection>();
        _bottomTra                    = _bgTra.Find("Bottom");
        _bottomInputField             = _bottomTra.Find("InputField").GetComponent <InputField>();
        _sendBtn                      = _bottomTra.Find("SendBtn").GetComponent <Button>();
        _sendBtnMaskImage             = _sendBtn.transform.Find("Mask").GetComponent <Image>();
        _sendBtnText                  = _sendBtn.transform.Find("Text").GetComponent <Text>();
        _barrageToggle                = _bottomTra.Find("BarrageToggle").GetComponent <Toggle>();
        _barrageToggleRect            = _barrageToggle.transform.GetComponent <RectTransform>();
        _barrageToggleTageTra         = _barrageToggleRect.Find("Tage").GetComponent <RectTransform>();
        _newMessageBtn                = _bottomTra.Find("NewMessageBtn").GetComponent <Button>();
        _newMessageBtnText            = _newMessageBtn.transform.Find("Text").GetComponent <Text>();
        _chatTopBtnItem               = _bgTra.Find("ChatTopBtnItem").GetComponent <ChatTopBtnItemController>();
        _privateChatIconItem          = _bgTra.Find("PrivateChatIconItem").GetComponent <PrivateChatIconItemController>();

        _barrageToggle.onValueChanged.RemoveAllListeners();
        _barrageToggle.onValueChanged.AddListener(ClickBarrageToggle);

        _closeBtn.onClick.RemoveAllListeners();
        _closeBtn.onClick.AddListener(ClickCloseBtn);

        _newMessageBtn.onClick.RemoveAllListeners();
        _newMessageBtn.onClick.AddListener(ClickNewMessageBtn);

        _bottomInputField.onValueChanged.RemoveAllListeners();
        _bottomInputField.onValueChanged.AddListener(OnInputFieldChange);
        _bottomInputField.onEndEdit.RemoveAllListeners();
        _bottomInputField.onEndEdit.AddListener(OnInputField);

        _sendBtn.onClick.RemoveAllListeners();
        _sendBtn.onClick.AddListener(OnSendBtn);
        SetPanelMultilingual();
        _isInitial = true;
    }
Пример #18
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();

            LoopScrollRect scroll = (LoopScrollRect)target;

            GUI.enabled = Application.isPlaying;

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Clear"))
            {
                scroll.ClearCells();
            }

            if (GUILayout.Button("Refresh"))
            {
                scroll.RefreshCells();
            }

            if (GUILayout.Button("Refill"))
            {
                scroll.RefillCells();
            }

            if (GUILayout.Button("RefillFromEnd"))
            {
                scroll.RefillCellsFromEnd();
            }

            EditorGUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = 45;
            float w = (EditorGUIUtility.currentViewWidth - 100) / 2;

            EditorGUILayout.BeginHorizontal();
            index = EditorGUILayout.IntField("Index", index, GUILayout.Width(w));
            speed = EditorGUILayout.FloatField("Speed", speed, GUILayout.Width(w));
            if (GUILayout.Button("Scroll", GUILayout.Width(45)))
            {
                scroll.SrollToCell(index, speed);
            }

            EditorGUILayout.EndHorizontal();
        }
Пример #19
0
        public void ScrollViewFocusOn(GameObject go, int index, LuaFunction func)
        {
            LoopScrollRect component = go.GetComponent <LoopScrollRect>();

            if (component != null)
            {
                component.FocusOnByIndex(index, delegate(RectTransform target)
                {
                    if (func != null)
                    {
                        func.Call(new object[]
                        {
                            target
                        });
                        func.Dispose();
                        func = null;
                    }
                });
            }
        }
    public override void OnInspectorGUI()
    {
        LoopScrollRect scroll = (LoopScrollRect)target;

        scroll.initInStart      = EditorGUILayout.Toggle("Init in Start", scroll.initInStart);
        scroll.prefabPool       = (MarchingBytes.EasyObjectPool)EditorGUILayout.ObjectField("Prefab Pool", scroll.prefabPool, typeof(MarchingBytes.EasyObjectPool), true);
        scroll.prefabPoolName   = EditorGUILayout.TextField("Prefab Pool Name", scroll.prefabPoolName);
        scroll.totalCount       = EditorGUILayout.IntField("Total Count", scroll.totalCount);
        scroll.cacheExtendCount = Mathf.Max(1, EditorGUILayout.IntField("Cache Extend Count", scroll.cacheExtendCount));
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear Cells"))
        {
            scroll.ClearCells();
        }
        if (GUILayout.Button("Refill Cells"))
        {
            scroll.RefillCells();
        }
        EditorGUILayout.EndHorizontal();
        base.OnInspectorGUI();
    }
Пример #21
0
 // Start is called before the first frame update
 protected override void Awake()
 {
     for (int i = 0; i < content.childCount; ++i)
     {
         LoopScrollRect lcr = content.GetChild(i).GetComponent <LoopScrollRect>();
         if (lcr != null)
         {
             lcr.del_td      += OnDrag_CB;
             lcr.del_tdbegin += OnBeginDrag_CB;
             lcr.del_tdend   += OnEndDrag_CB;
         }
         InTabNormalScrollRect nsr = content.GetChild(i).GetComponent <InTabNormalScrollRect>();
         if (nsr != null)
         {
             nsr.del_td      += OnDrag_CB;
             nsr.del_tdbegin += OnBeginDrag_CB;
             nsr.del_tdend   += OnEndDrag_CB;
         }
     }
     base.Awake();
 }
Пример #22
0
        private GameObject CreateScroll(ScrollNode node, GameObject gameObject)
        {
            int            scrollDirect = node.scrollDirect;
            LoopScrollRect rect         = null;

            if (scrollDirect == 0)
            {
                rect          = gameObject.AddComponent <LoopHorizontalScrollRect>();
                rect.vertical = false;
            }
            else
            {
                rect            = gameObject.AddComponent <LoopVerticalScrollRect>();
                rect.horizontal = false;
            }

            gameObject    = CreateStretchObject("Viewport", gameObject);
            rect.viewport = gameObject.GetComponent <RectTransform>();
            gameObject    = CreateStretchObject("Content", gameObject);
            rect.content  = gameObject.GetComponent <RectTransform>();

            rect.content.anchorMax = Vector2.one * 0.5f;
            rect.content.anchorMin = Vector2.one * 0.5f;

            rect.content.sizeDelta = rect.GetComponent <RectTransform>().sizeDelta;
            if (node.type.ToString().Contains(UINodeType.gscroll.ToString()))
            {
                SetLayout(rect.content.gameObject.AddComponent <GridLayoutGroup>(), node as GScrollNode);
            }
            else if (node.type.ToString().StartsWith("h"))
            {
                SetLayout(rect.content.gameObject.AddComponent <HorizontalLayoutGroup>(), node as ScrollNode);
            }
            else
            {
                SetLayout(rect.content.gameObject.AddComponent <VerticalLayoutGroup>(), node as ScrollNode);
            }

            return(gameObject);
        }
Пример #23
0
    /// <summary>
    /// 初始化组件
    /// </summary>
    void Initial()
    {
        _uiIntegralController = GetComponent <CanvasGroup>();
        // 邮箱计时器
        _mailBoxTimeController = transform.Find("Timer").GetComponent <MailBoxTimeController>();
        // 顶部栏
        _topRectTra = transform.Find("Top").GetComponent <RectTransform>();
        // 退出按钮
        _outBtn = _topRectTra.Find("OutBtn").GetComponent <Button>();
        // 标题
        _titleBgTra = _topRectTra.Find("TitleBg");
        // 标题Text
        _titleText = _titleBgTra.Find("Title").GetComponent <Text>();
        // 内容栏
        _contentRectTra = transform.Find("Content").GetComponent <RectTransform>();
        // 滑动组件
        _loopScrollRect = _contentRectTra.GetComponent <LoopScrollRect>();
        // 底部栏
        _bottomRectTra = transform.Find("Bottom").GetComponent <RectTransform>();
        // 一键删除按钮
        _akeyToDelete = _bottomRectTra.Find("AkeyToDelete").GetComponent <Button>();
        //一键领取按钮
        _akeyToGet = _bottomRectTra.Find("AkeyToGet").GetComponent <Button>();
        //彩条
        _colourBar = transform.Find("ColourBar");

        _outBtn.onClick.RemoveListener(OnCliclOut);
        _outBtn.onClick.AddListener(OnCliclOut);

        _akeyToDelete.onClick.RemoveListener(OnClickAKeyToDeleteBtn);
        _akeyToDelete.onClick.AddListener(OnClickAKeyToDeleteBtn);
        _akeyToGet.onClick.RemoveListener(OnClickAKeyToToGetBtn);
        _akeyToGet.onClick.AddListener(OnClickAKeyToToGetBtn);

        SetPanelMultilingual();
        _isInitial = true;
    }
Пример #24
0
    /// <summary>
    /// 初始控制器
    /// </summary>
    public void Initial()
    {
        _bgImage          = transform.Find("Box").GetComponent <Image>();
        _loopScrollRect   = transform.Find("Box/Itembox").GetComponent <LoopScrollRect>();
        _showCapacityText = transform.Find("Box/ShowCapacity/Number").GetComponent <Text>();
        _closeBtn         = transform.Find("Box/CloseBtn").GetComponent <Button>();
        _closeBtn.onClick.RemoveAllListeners();
        _closeBtn.onClick.AddListener(Close);

        _showPriceText  = transform.Find("Box/ShowPrice/Price").GetComponent <Text>();
        _oneKeySaleBtn  = transform.Find("Box/SaleButton").GetComponent <Button>();
        _lineRect       = transform.Find("Box/Line").GetComponent <RectTransform>();
        _treasureBoxTra = transform.Find("Box/TreasureBox");
        _lowClass       = _treasureBoxTra.Find("LowClass").GetComponent <WarehouseTreasureChest>();
        _lowClassNo     = _treasureBoxTra.Find("LowClassNo");
        _middleRank     = _treasureBoxTra.Find("MiddleRank").GetComponent <WarehouseTreasureChest>();
        _middleRankNo   = _treasureBoxTra.Find("MiddleRankNo");
        _highClass      = _treasureBoxTra.Find("HighClass").GetComponent <WarehouseTreasureChest>();
        _highClassNo    = _treasureBoxTra.Find("HighClassNo");
        _warehouseTreasureChestDic.Clear();
        _warehouseTreasureChestDic.Add(1, _lowClass);
        _warehouseTreasureChestDic.Add(2, _middleRank);
        _warehouseTreasureChestDic.Add(3, _highClass);
        _warehouseTreasureChestNoDic.Add(1, _lowClassNo);
        _warehouseTreasureChestNoDic.Add(2, _middleRankNo);
        _warehouseTreasureChestNoDic.Add(3, _highClassNo);
        _treasureChestMaskBtn = _treasureBoxTra.Find("Mask").GetComponent <Button>();
        _itemBoxRect          = transform.Find("Box/Itembox").GetComponent <RectTransform>();


        _oneKeySaleBtn.onClick.RemoveAllListeners();
        _oneKeySaleBtn.onClick.AddListener(OneKeySale);
        SetPanelMultilingual();
        WarehouseTool.GetUnlockTreasureChestID();
        _isInitial = true;
    }
Пример #25
0
 //LoopScrollPrefabRect 从池中取出时自动注册归属的菜单事件
 public virtual void RegisterEvent(LoopScrollRect lsr, Transform link)
 {
     linkedTransID = lsr.GetInstanceID(); linkedTrans = link; MsgManager.Instance.Register(InternalEvent.UI_SCROLL_ELEMENT, OnUpdateInfo);
 }
Пример #26
0
 // Use this for initialization
 void Awake()
 {
     loopScrollRect = GetComponent <LoopScrollRect>();
     loopScrollRect.AddListenerOnReturn(OnCellReturned);
     loopScrollRect.AddListenerOnData(OnCellData);
 }
Пример #27
0
 void Awake()
 {
     m_LoopScrollRect = GetTarget <LoopScrollRect> ();
 }
Пример #28
0
        static public void CreateLoopScrollRect(MenuCommand menuCommand)
        {
            GameObject    root   = new GameObject("Loop Scroll View", typeof(RectTransform), typeof(CanvasRenderer));
            RectTransform rootRT = root.GetComponent <RectTransform>();

            rootRT.anchorMin = Vector2.zero;
            rootRT.anchorMax = Vector2.one;
            rootRT.sizeDelta = Vector2.zero;
            rootRT.pivot     = new Vector2(.5f, .5f);
            root.SetActive(false);
            AddImage(root);
            LoopScrollRect loopScrollRect = root.AddComponent <LoopScrollRect>();

            //create ViewPort
            var viewport = new GameObject("ViewPort", typeof(RectTransform), typeof(CanvasRenderer));

            viewport.AddComponent <Image>();
            viewport.AddComponent <Mask>();
            viewport.transform.SetParent(root.transform, false);
            RectTransform viewportRT = viewport.GetComponent <RectTransform>();

            viewportRT.anchorMin = Vector2.zero;
            viewportRT.anchorMax = Vector2.one;
            viewportRT.sizeDelta = Vector2.zero;
            viewportRT.pivot     = Vector2.up;

            loopScrollRect.viewport = viewportRT;

            //create content
            var content = new GameObject("Content", typeof(RectTransform));

            content.transform.SetParent(viewport.transform, false);
            RectTransform contentRT = content.GetComponent <RectTransform>();

            contentRT.anchorMin    = Vector2.up;
            contentRT.anchorMax    = Vector2.one;
            contentRT.sizeDelta    = new Vector2(0, 300);
            contentRT.pivot        = Vector2.up;
            loopScrollRect.content = contentRT;

            //create ItemContainer
            var itemContainer = new GameObject("ItemContainer", typeof(RectTransform));

            itemContainer.transform.SetParent(root.transform, false);
            var itemContainerRT = itemContainer.GetComponent <RectTransform>();

            itemContainerRT.anchorMin = Vector2.zero;
            itemContainerRT.anchorMax = Vector2.one;
            itemContainerRT.sizeDelta = Vector2.zero;
            itemContainerRT.pivot     = Vector2.up;
            itemContainer.SetActive(false);

            //create ItemSource
            var itemSource = new GameObject("ItemSource", typeof(RectTransform));

            itemSource.transform.SetParent(itemContainer.transform, false);
            RectTransform rt2 = itemSource.GetComponent <RectTransform>();

            rt2.anchorMin = Vector2.up;
            rt2.anchorMax = Vector2.up;
            rt2.sizeDelta = new Vector2(100, 100);
            rt2.pivot     = Vector2.up;
            var bindableContainer = itemSource.AddComponent <BindableContainer>();

            loopScrollRect.itemSource = bindableContainer;

            GameObject parent = menuCommand.context as GameObject; // Selection.activeGameObject;

            root.SetActive(true);
            GameObjectUtility.SetParentAndAlign(root, parent);
        }
Пример #29
0
 void Start()
 {
     ls            = GetComponent <LoopScrollRect>();
     ls.totalCount = totalCount;
     ls.RefillCells();
 }
Пример #30
0
 public void Awake()
 {
     mScrollRect = GetComponentInParent <LoopScrollRect>();
 }