예제 #1
0
        private void RegenerateWorldDungeonButton()
        {
            _worldTreeDungeonButtonDictionary.Clear();
            worldTreeDungeonButtonPrefab.gameObject.SetActive(false);
            List <WorldTreeDungeonInfo> allWorldDungeonInfoList        = WorldTreeProxy.instance.GetAllWorldTreeDungeonInfoList();
            int                  allWorldDungeonInfoCount              = allWorldDungeonInfoList.Count;
            List <Vector2>       worldTreeDungeonButtonPosTemplateList = GlobalData.GetGlobalData().worldTreeDungeonPosList;
            WorldTreeDungeonInfo worldTreeDungeonInfo = null;
            Vector2              worldTreeDungeonButtonPos;

            for (int i = 0; i < allWorldDungeonInfoCount; i++)
            {
                worldTreeDungeonInfo = allWorldDungeonInfoList[i];
                WorldTreeDungeonButton worldTreeDungeonButton = GameObject.Instantiate <WorldTreeDungeonButton>(worldTreeDungeonButtonPrefab);
                worldTreeDungeonButton.SetWorldTreeDungeonInfo(worldTreeDungeonInfo);
                worldTreeDungeonButton.transform.SetParent(worldTreeDungeonButtonsRoot, false);

                worldTreeDungeonButtonPos  = worldTreeDungeonButtonPosTemplateList[i % worldTreeDungeonButtonPosTemplateList.Count];
                worldTreeDungeonButtonPos += new Vector2(-120 + (i % 2) * 250, (i / worldTreeDungeonButtonPosTemplateList.Count) * 640);
                worldTreeDungeonButton.GetComponent <RectTransform>().anchoredPosition = worldTreeDungeonButtonPos;
                worldTreeDungeonButton.gameObject.SetActive(true);
                _worldTreeDungeonButtonDictionary.Add(worldTreeDungeonInfo.dungeonID, worldTreeDungeonButton);
            }
            float contentIdealPosY = -_worldTreeDungeonButtonDictionary[WorldTreeProxy.instance.UnlockedWorldTreeDungeonInfo.dungeonID].GetComponent <RectTransform>().anchoredPosition.y + worldTreeDungeonsScrollRect.viewport.rect.size.y * 0.5f;

            contentIdealPosY = Mathf.Clamp(contentIdealPosY, -(worldTreeDungeonsScrollRect.content.rect.size.y - worldTreeDungeonsScrollRect.viewport.rect.y), 0);
            worldTreeDungeonsScrollRect.content.anchoredPosition = new Vector2(0, contentIdealPosY);
        }
예제 #2
0
 public void ClickWorldTreeDungeonButtonHandler(WorldTreeDungeonButton worldTreeDungeonButton)
 {
     ResetSelectedWorldTreeDungeonInfo(worldTreeDungeonButton.WorldTreeDungeonInfo);
 }