Пример #1
0
        // ----------------------------------------------------------------
        //  Initialize
        // ----------------------------------------------------------------
        public void Initialize(ClustSelController clustSelController, Transform tf_parent, int worldIndex, Vector2 myPos)
        {
            this.clustSelController = clustSelController;
            this.WorldIndex         = worldIndex;

            // Parent jazz!
            GameUtils.ParentAndReset(this.gameObject, tf_parent);
            this.gameObject.name             = "World " + worldIndex;
            myRectTransform.anchoredPosition = myPos;

            // Look right!
            t_worldName.text = worldIndex.ToString();

            MakeClustTiles();
            UpdateYouAreHereIconPos();

            // Set lastPlayedClustTile from save!
            SetSelectedClustTile(clustTiles[GameManagers.Instance.DataManager.LastPlayedClustIndex(worldIndex)]);
        }
Пример #2
0
        // ----------------------------------------------------------------
        //  Initialize
        // ----------------------------------------------------------------
        public void Initialize(ClustSelController clustSelController, WorldView myWorldView, RoomClusterData myClustData, Vector2 pos)
        {
            this.clustSelController = clustSelController;
            this.myClustData        = myClustData;
            worldHue = ((150 + myClustData.WorldIndex * 40) / 360f) % 1;

            // Parent jazz!
            GameUtils.ParentAndReset(this.gameObject, myWorldView.transform);
            //transform.SetAsFirstSibling(); // put behind other stuff.
            this.gameObject.name             = "ClustTile " + myClustData.ClustIndex;
            myRectTransform.anchoredPosition = pos;

            t_clustName.text = (myClustData.ClustIndex + 1).ToString();

            // Make RoomViews!
            AddRoomViews();

            // Add i_snacks!
            if (myClustData.IsUnlocked)
            {
                int        numEaten        = myClustData.SnackCount.Eaten_All;
                int        numTotal        = myClustData.SnackCount.Total_All;
                GameObject prefabGO        = ResourcesHandler.Instance.ClustSelListClustRowSnack;
                float      spacingX        = 18;
                float      snackIconsWidth = numTotal * spacingX;
                for (int i = 0; i < numTotal; i++)
                {
                    float posX = -2 - snackIconsWidth + (i * spacingX);
                    Image img  = Instantiate(prefabGO).GetComponent <Image>();
                    img.name = "Snack " + i;
                    GameUtils.ParentAndReset(img.gameObject, this.transform);
                    img.rectTransform.anchoredPosition = new Vector2(posX, 0);
                    // Not eaten? Darker img!
                    if (i >= numEaten)
                    {
                        img.color = new Color(0, 0, 0, 0.8f);
                    }
                }
            }

            RefreshVisuals();
        }