Пример #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 = "World " + worldIndex;

            MakeClustRows();
            UpdateYouAreHereIconPos();

            // Start with last-played cluster selected.
            {
                int      clustIndex = GameManagers.Instance.DataManager.LastPlayedClustIndex(worldIndex);
                ClustRow clustRow   = GetClustRow(clustIndex);
                if (clustRow != null)
                {
                    UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(clustRow.gameObject);
                }
            }
        }
Пример #2
0
        private void UpdateYouAreHereIconPos()
        {
            int      clustIndex = GameManagers.Instance.DataManager.LastPlayedClustIndex(WorldIndex);
            ClustRow clustRow   = GetClustRow(clustIndex);

            if (clustRow != null)
            {
                i_youAreHereIcon.transform.position = clustRow.transform.position + new Vector3(-25, -29); // hacky hardcoded offset.
            }

            //RoomData roomData = GameManagers.Instance.DataManager.LastPlayedRoomData(WorldIndex);//GameManagers.Instance.DataManager.currRoomData;
            //bool doShowIcon = roomData!=null && roomData.MyCluster!=null && roomData.MyCluster.IsUnlocked;
            //i_youAreHereIcon.enabled = doShowIcon;
            //if (doShowIcon) {
            //    i_youAreHereIcon.transform.position = clustRows[roomData.MyCluster.ClustIndex].transform.position + new Vector3(-25,-29); // hacky hardcoded offset.
            //}
        }
Пример #3
0
        private void MakeClustRows()
        {
            WorldData myWorldData = GameManagers.Instance.DataManager.GetWorldData(WorldIndex);
            int       NumClusts   = myWorldData.clusters.Count;

            float       tempY = 0;
            const float gapY  = 6;

            clustRows = new ClustRow[NumClusts];
            for (int i = 0; i < NumClusts; i++)
            {
                RoomClusterData clustData = myWorldData.clusters[i];
                ClustRow        newObj    = Instantiate(ResourcesHandler.Instance.ClustSelListClustRow).GetComponent <ClustRow>();
                Vector2         objPos    = new Vector2(0, tempY);
                newObj.Initialize(clustSelController, this, clustData, objPos);
                clustRows[i] = newObj;
                tempY       -= newObj.Size.y + gapY;
            }
            // Size meee
            myRectTransform.sizeDelta = new Vector2(myRectTransform.rect.size.x, Mathf.Abs(tempY) + 0);
        }