コード例 #1
0
ファイル: ChatDelegate.cs プロジェクト: arvindixonos/Zain360
        /// <summary>
        /// This method is called when the new cell has been jumpped to.
        /// It will reset the spacer's cell size to the remainder of the scroller's size minus the
        /// total cell size calculated in ResizeScroller. Finally, it will reload the
        /// scroller to set the new cell sizes.
        /// </summary>
        private void ResetSpacer()
        {
            // reset the spacer's cell size to the scroller's size minus the rest of the cell sizes
            // (or zero if the spacer is no longer needed)
            _data[0].cellSize = Mathf.Max(scroller.ScrollRectSize - _totalCellSize, 0);

            // reload the data to set the new cell size
            scroller.ReloadData(1.0f);
        }
コード例 #2
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadLargeData()
        {
            // set up some simple data
            _data = new SmallList<Data>();
            for (var i = 0; i < 1000; i++)
                _data.Add(new Data() { someText = "Cell Data Index " + i.ToString() });

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #3
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 50; i++)
            {
                if (i % 2 == 0)
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Multiple Expand",
                        descriptionText   = "Expanding this cell will not collapse other cells. This allows you to have multiple cells expanded at once.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 20f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.immediate,
                        tweenTimeExpand   = 0,
                        tweenTimeCollapse = 0
                    });
                }
                else if (i % 3 == 0)
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Tween Expand",
                        descriptionText   = "This cell will animate its size when clicked.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 20f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
                else
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Single Expand",
                        descriptionText   = "Expanding this cell will collapse other cells.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 30f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.immediate,
                        tweenTimeExpand   = 0,
                        tweenTimeCollapse = 0
                    });
                }
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #4
0
        protected override void ShowResponsesNow(Subtitle subtitle, Response[] responses, float timeout)
        {
            cellDataList.RemoveAll(x => x.prefab == cellViewPrefab.iconPanelPrefab.gameObject);
            var cellData = new CellData();

            cellData.prefab    = cellViewPrefab.menuPanelPrefab.gameObject;
            cellData.subtitle  = subtitle;
            cellData.responses = responses;
            cellData.timeout   = timeout;
            cellDataList.Add(cellData);
            enhancedScroller.ReloadData();
            ScrollToBottom();
        }
コード例 #5
0
    IEnumerator _ReloadData()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        UpdateData();
        masterScroller.ReloadData();
    }
コード例 #6
0
ファイル: SimpleDemo.cs プロジェクト: arvindixonos/Zain360
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadLargeData()
        {
            // set up some simple data
            _data = new SmallList <DataParticipant>();
            for (var i = 0; i < 1000; i++)
            {
                _data.Add(new DataParticipant()
                {
                    someText = "Arvind"
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #7
0
ファイル: Controller.cs プロジェクト: arvindixonos/Zain360
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData(int pageStartIndex)
        {
            // grab the last index of the data to jump to when we are finished
            var previousLastIndex = _data.Count;

            // calculate the last index of the new list
            var lastIndex = _data.Count + pageCount;

            // add data to the list
            for (var i = pageStartIndex; i < lastIndex; i++)
            {
                _data.Add(new Data()
                {
                    someText = "Cell Data Index " + i.ToString()
                });
            }

            // cache the scroller's position so that we can set it back after the reload
            var scrollPosition = scroller.ScrollPosition;

            // tell the scroller to reload now that we have the data.
            scroller.ReloadData();

            // set the scroller's position back to the cached position
            scroller.ScrollPosition = scrollPosition;

            // toggle off loading new so that we can load again at the bottom of the scroller
            _loadingNew = false;
        }
コード例 #8
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // if the data existed previously, loop through
            // and remove the selection change handlers before
            // clearing out the data.
            if (_data != null)
            {
                for (var i = 0; i < _data.Count; i++)
                {
                    _data[i].selectedChanged = null;
                }
            }

            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 1000; i++)
            {
                _data.Add(new Data()
                {
                    someText = i.ToString()
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #9
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // set up some simple data. This will be a two-dimensional array,
            // specifically a list within a list.

            _data = new List <MasterData>();
            for (var i = 0; i < 1000; i++)
            {
                var masterData = new MasterData()
                {
                    normalizedScrollPosition = 0,
                    childData = new List <DetailData>()
                };

                _data.Add(masterData);

                for (var j = 0; j < 20; j++)
                {
                    masterData.childData.Add(new DetailData()
                    {
                        someText = i.ToString() + "," + j.ToString()
                    });
                }
            }

            // tell the scroller to reload now that we have the data
            masterScroller.ReloadData();
        }
コード例 #10
0
    public void Reload()
    {
        jsonMonsterFile = Resources.Load("monsters") as TextAsset;
        jsonMonsters    = JsonMapper.ToObject(jsonMonsterFile.text);

        if (_data != null)
        {
            for (var i = 0; i < _data.Count; i++)
            {
                _data[i].selectedChanged = null;
            }
        }

        _data = new SmallList <InventoryData>();

        for (int i = 0; i < jsonMonsters["monsters"].Count; i++)
        {
            _data.Add(new InventoryData()
            {
                monsterName = jsonMonsters["monsters"][i]["image"].ToString()
            });
        }

        vScroller.ReloadData();
        if (listMonsterSelected.Count != 0)
        {
            ReloadMonsterSelected();
        }
    }
コード例 #11
0
        void Start()
        {
            // set the scroller's cell view visbility changed delegate to a method in this controller
            scroller.cellViewVisibilityChanged = CellViewVisibilityChanged;
            scroller.cellViewWillRecycle       = CellViewWillRecycle;

            // preload the cells by looking ahead (both behind and after)
            if (preloadCells)
            {
                scroller.lookAheadBefore = 1000f;
                scroller.lookAheadAfter  = 1000f;
            }

            // set up some simple data
            _data = new SmallList <Data>();

            // set up a list of images with their dimensions
            for (var i = 0; i < imageURLList.Length; i++)
            {
                // add the image based on the image list text file
                _data.Add(new Data()
                {
                    imageUrl        = imageURLList[i],
                    imageDimensions = new Vector2(200f, 200f)
                });
            }

            // set the scroller's delegate to this controller
            scroller.Delegate = this;

            // tell the scroller to reload
            scroller.ReloadData();
        }
コード例 #12
0
ファイル: Controller.cs プロジェクト: GengQiangQ/PETimer
        void Start()
        {
            // set the scroller's cell view visbility changed delegate to a method in this controller
            scroller.cellViewVisibilityChanged = CellViewVisibilityChanged;

            // set up some simple data
            _data = new SmallList <Data>();

            // set up a list of images with their dimensions
            for (var i = 0; i < imageURLList.Length; i++)
            {
                // add the image based on the image list text file
                _data.Add(new Data()
                {
                    imageUrl        = imageURLList[i],
                    imageDimensions = new Vector2(200f, 200f)
                });
            }

            // set the scroller's delegate to this controller
            scroller.Delegate = this;

            // tell the scroller to reload
            scroller.ReloadData();
        }
コード例 #13
0
    private void Reload()
    {
        jsonTeamFile = Resources.Load("teams") as TextAsset;
        jsonTeam     = JsonMapper.ToObject(jsonTeamFile.text);

        if (_data != null)
        {
            for (var i = 0; i < _data.Count; i++)
            {
                _data[i].selectedChanged = null;
            }
        }

        _data = new SmallList <TeamData>();

        for (int i = 0; i < jsonTeam["teams"].Count; i++)
        {
            _data.Add(new TeamData()
            {
                Selected     = System.Convert.ToBoolean(jsonTeam["teams"][i]["selected"].ToString()),
                Created      = System.Convert.ToBoolean(jsonTeam["teams"][i]["created"].ToString()),
                monsterName1 = jsonTeam["teams"][i]["monsters"][0]["name"].ToString(),
                monsterName2 = jsonTeam["teams"][i]["monsters"][1]["name"].ToString(),
                monsterName3 = jsonTeam["teams"][i]["monsters"][2]["name"].ToString(),
                monsterName4 = jsonTeam["teams"][i]["monsters"][3]["name"].ToString()
            });
        }

        vScroller.ReloadData();
    }
コード例 #14
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData(int pageStartIndex)
        {
            // grab the last index of the data to jump to when we are finished
            var previousLastIndex = _data.Count;

            // calculate the last index of the new list
            var lastIndex = _data.Count + pageCount;

            // add data to the list
            for (var i = pageStartIndex; i < lastIndex; i++)
            {
                _data.Add(new Data()
                {
                    someText = "Cell Data Index " + i.ToString()
                });
            }

            // tell the scroller to reload now that we have the data.
            scroller.ReloadData();

            // jump to the previous last index to make it look like the scroller did not move
            scroller.JumpToDataIndex(previousLastIndex, 1, 1);

            // toggle off loading new so that we can load again at the bottom of the scroller
            _loadingNew = false;
        }
コード例 #15
0
 private void LoadData()
 {
     _data             = mapConfig.stageList;
     scroller.Delegate = this;
     scroller.ReloadData();
     scroller.JumpToDataIndex(CampaignStageData.GetStageIndex(playerCampaign.GetLastStagePass()) - 1);
 }
コード例 #16
0
        /// <summary>
        /// This function sets up our inventory data and tells the scrollers to reload
        /// </summary>
        private void Reload()
        {
            // if the data existed previously, loop through
            // and remove the selection change handlers before
            // clearing out the data.
            if (_data != null)
            {
                for (var i = 0; i < _data.Count; i++)
                {
                    _data[i].selectedChanged = null;
                }
            }

            // set up a new inventory list
            _data = new SmallList <InventoryData>();

            // add inventory items to the list
            _data.Add(new InventoryData()
            {
                itemName = "Sword", itemCost = 123, itemDamage = 50, itemDefense = 0, itemWeight = 10, spritePath = resourcePath + "/sword", itemDescription = "Broadsword with a double-edged blade"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Shield", itemCost = 80, itemDamage = 0, itemDefense = 60, itemWeight = 50, spritePath = resourcePath + "/shield", itemDescription = "Steel shield to deflect your enemy's blows"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Amulet", itemCost = 260, itemDamage = 0, itemDefense = 0, itemWeight = 1, spritePath = resourcePath + "/amulet", itemDescription = "Magic amulet restores your health points gradually over time"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Helmet", itemCost = 50, itemDamage = 0, itemDefense = 20, itemWeight = 20, spritePath = resourcePath + "/helmet", itemDescription = "Standard helm will decrease your vulnerability"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Boots", itemCost = 40, itemDamage = 0, itemDefense = 10, itemWeight = 5, spritePath = resourcePath + "/boots", itemDescription = "Boots of speed will double your movement points"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Bracers", itemCost = 30, itemDamage = 0, itemDefense = 20, itemWeight = 10, spritePath = resourcePath + "/bracers", itemDescription = "Bracers will upgrade your overall armor"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Crossbow", itemCost = 100, itemDamage = 40, itemDefense = 0, itemWeight = 30, spritePath = resourcePath + "/crossbow", itemDescription = "Crossbow can attack from long range"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Fire Ring", itemCost = 300, itemDamage = 100, itemDefense = 0, itemWeight = 1, spritePath = resourcePath + "/fireRing", itemDescription = "Fire ring gives you the magical ability to cast fireball spells"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Knapsack", itemCost = 22, itemDamage = 0, itemDefense = 0, itemWeight = 0, spritePath = resourcePath + "/knapsack", itemDescription = "Knapsack will increase your carrying capacity by twofold"
            });

            // tell the scrollers to reload
            vScroller.ReloadData();
            hScroller.ReloadData();
        }
コード例 #17
0
    void Start()
    {
        _data = new List <ScrollerData>();

        _data.Add(new ScrollerData()
        {
            animalName = "Lion"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Bear"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Eagle"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Dolphin"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Ant"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Cat"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Sparrow"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Dog"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Spider"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Elephant"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Falcon"
        });
        _data.Add(new ScrollerData()
        {
            animalName = "Mouse"
        });

        myScroller.Delegate = this;
        myScroller.ReloadData();
    }
コード例 #18
0
        /// <summary>
        /// This function will exand the scroller to accommodate the cells, reload the data to calculate the cell sizes,
        /// reset the scroller's size back, then reload the data once more to display the cells.
        /// </summary>
        private void ResizeScroller()
        {
            // capture the scroller dimensions so that we can reset them when we are done
            var rectTransform = scroller.GetComponent <RectTransform>();
            var size          = rectTransform.sizeDelta;

            // set the dimensions to the largest size possible to acommodate all the cells
            rectTransform.sizeDelta = new Vector2(size.x, float.MaxValue);

            // First Pass: reload the scroller so that it can populate the text UI elements in the cell view.
            // The content size fitter will determine how big the cells need to be on subsequent passes
            scroller.ReloadData();

            // reset the scroller size back to what it was originally
            rectTransform.sizeDelta = size;

            // Second Pass: reload the data once more with the newly set cell view sizes and scroller content size
            scroller.ReloadData();
        }
コード例 #19
0
    /// <summary>
    /// Scroller的启动方法  注意:调用之前先setDataList
    /// </summary>
    public virtual ScrollerCtrlBase ReloadData(float scrollPositionFactor = 0)
    {
        if (isInit == false)
        {
            InitCtrl();
        }

        scroller.ReloadData(scrollPositionFactor);
        return(this);
    }
コード例 #20
0
        /// <summary>
        /// Check to see if the scroller needs to be reloaded
        /// </summary>
        void Update()
        {
            if (reloadDataNextFrame)
            {
                // scroller needs reloaded, so we unflag and reload the detail data

                reloadDataNextFrame = false;
                detailScroller.ReloadData(_data.normalizedScrollPosition);
            }
        }
コード例 #21
0
    public void SetData(List <Texture2D> datas)
    {
        _data = datas;

        scroller.Delegate         = this;
        scroller.scrollerScrolled = ScrollerScrolled;

        // tell the scroller to reload now that we have the data
        scroller.ReloadData();
    }
コード例 #22
0
 public void ShowType(MenuItemType type)
 {
     _data            = DiplomCore.Instance.MainBD.GetAllInfoAbout(type);
     _currentViewType = type;
     //_itemsContloller.InitDataToList<BaseDataForSelectWindow>(_data);
     if (_data.Count == 0)
     {
         Debug.LogError("Никого нет");
     }
     scroller.ReloadData();
     this.ShowWindow(null);
 }
コード例 #23
0
    /// <summary>
    /// обновить информацию в UI
    ///
    /// выставляем фотки, контакты и тому подобное
    /// </summary>
    public override void RefreshView()
    {
        DiplomCore.Instance.LoadSprite(CurrentData.Foto, OnLoadPhoto);

        _fio.text      = CurrentData.Name;
        _fullInfo.text = CurrentData.FullInfo;
        _contacts.text = CurrentData.Contatcts;
        _vk.UpdateDataView(CurrentData.Vk);
        _controller.UpdateDataView(CurrentData.Porfolio);
        scroller.ReloadData();
        ShowWindow(null);
    }
コード例 #24
0
        private void LoadData()
        {
            _data = new SmallList <DataPista>();

            foreach (Pista pista in enigma.Pistas)
            {
                if (pista.image != null)
                {
                    _data.Add(new DataPista()
                    {
                        headerText        = pista.PistaName,
                        descriptionText   = pista.TextRich,
                        imageOptional     = pista.image,
                        isExpanded        = false,
                        expandedSize      = pista.sizeText,
                        collapsedSize     = 60f,
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
                else
                {
                    _data.Add(new DataPista()
                    {
                        headerText        = pista.PistaName,
                        descriptionText   = pista.TextRich,
                        isExpanded        = false,
                        expandedSize      = pista.sizeText,
                        collapsedSize     = 60f,
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
            }

            scroller.ReloadData();
        }
コード例 #25
0
    public void LoadLevels()
    {
        _data = new List <LevelData>();

        _data.Clear();

        for (int i = 0; i < Levels.Length; i++)
        {
            _data.Add(new LevelData {
                LevelImage = Levels[i], LevelNumber = i + 1, time = timeEstimate[i], colorTime = colorEstimate[i], leanTween = leanTweenActivated[i]
            });
        }
        myScroller.Delegate = this;
        myScroller.ReloadData();
    }
コード例 #26
0
ファイル: HomeScrollerView.cs プロジェクト: ishidafuu/dmui
        public void Init(CellViewInstantiated cellViewInstantiated,
                         ScrollerScrollingChangedDelegate scrollerScrollingChanged,
                         OnBeginDragDelegate scrollerBeginDrag,
                         OnEndDragDelegate scrollerEndDrag)
        {
            m_Scroller.Delegate                 = this;
            m_Scroller.cellViewInstantiated     = cellViewInstantiated;
            m_Scroller.scrollerScrollingChanged = scrollerScrollingChanged;
            m_Scroller.scrollerBeginDrag        = scrollerBeginDrag;
            m_Scroller.scrollerEndDrag          = scrollerEndDrag;

            CellSize = UIController.Instance.m_CanvasScaler.referenceResolution.x;
            LoadData();
            m_Scroller.ReloadData();
        }
コード例 #27
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 31; i++)
            {
                _data.Add(new Data()
                {
                    someText   = i.ToString(),
                    isSelected = i == _selectedIndex
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #28
0
        void Start()
        {
            LoadLevelList();

            _comList          = new UndoRedoList();
            _comList.OnClean += OnListClean;
            _comList.OnDirty += OnListDirty;



            myScroller.Delegate      = this;
            _levelList.onDataChange += () => {
                myScroller.ReloadData();
                _scrollRect.onValueChanged.Invoke(_scrollRect.normalizedPosition);
            };
        }
コード例 #29
0
        public void SetData(string condition, string stackTrace, LogType type)
        {
            if (logInfos.Count > 300)
            {
                logInfos.Clear();
            }

            logInfos.Add(new LogInfo
            {
                condition  = condition,
                stackTrace = stackTrace,
                type       = type,
                height     = -1
            });
            scroller.ReloadData(1);
        }
コード例 #30
0
        /// <summary>
        /// Populates the data with a small set of records
        /// </summary>
        public void ParticipantsListReceived(List <string> participantsList)
        {
            _data = new SmallList <DataParticipant>();

            foreach (string participantName in participantsList)
            {
                _data.Add(new DataParticipant()
                {
                    someText = participantName
                });
            }

            scroller.ClearAll();

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }