Beispiel #1
0
        // ----------------------------------------------------------------
        //  Update
        // ----------------------------------------------------------------
        private void Update()
        {
            // YouAreHere icon!
            float alpha = MathUtils.SinRange(0.3f, 1.2f, Time.time * 6f);

            GameUtils.SetUIGraphicAlpha(i_youAreHereIcon, alpha);
            // Update selection.
            if (isCurrWorld)
            {
                GameObject currSelGO = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
                // Nothing selected? Auto-select our last clustTile, yo.
                if (currSelGO == null)
                {
                    UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(selectedClustTile.gameObject);
                }
                if (currSelGO != null && selectedClustTile.gameObject != currSelGO) // Selection changed!
                {
                    ClustTile clustTile = currSelGO.GetComponent <ClustTile>();
                    if (clustTile != null)
                    {
                        SetSelectedClustTile(clustTile);
                    }
                }
            }
        }
Beispiel #2
0
        public void OnSetSelectedClustTile(ClustTile clustTile)
        {
            // Set scroll-layer pos!
            float currScrollPosY = rt_worldViews.anchoredPosition.y;
            float scrollPosY     = -clustTile.AnchoredPos.y;

            scrollPosY = Mathf.Clamp(currScrollPosY, scrollPosY - 400, scrollPosY);
            rt_worldViews.anchoredPosition = new Vector2(rt_worldViews.anchoredPosition.x, scrollPosY);
        }
Beispiel #3
0
        private RoomView GetRoomView(RoomData roomData)
        {
            if (roomData == null || roomData.MyCluster == null)
            {
                return(null);
            }                                                                  // Safety check.
            ClustTile clustTile = GetClustTile(roomData.MyCluster.ClustIndex);

            if (clustTile == null)
            {
                return(null);
            }                                       // Safety check.
            return(clustTile.GetRoomView(roomData));
        }
Beispiel #4
0
        private void MakeClustTiles()
        {
            WorldData myWorldData = GameManagers.Instance.DataManager.GetWorldData(WorldIndex);
            int       NumClusts   = myWorldData.clusters.Count;

            float       tempY = 0;
            const float gapY  = 6;

            clustTiles = new ClustTile[NumClusts];
            for (int i = 0; i < NumClusts; i++)
            {
                RoomClusterData clustData = myWorldData.clusters[i];
                ClustTile       newObj    = Instantiate(ResourcesHandler.Instance.ClustSelMapClustTile).GetComponent <ClustTile>();
                Vector2         tilePos   = new Vector2(0, tempY);
                newObj.Initialize(clustSelController, this, clustData, tilePos);
                clustTiles[i] = newObj;
                tempY        -= newObj.Size.y + gapY;
            }
            // Size meee
            myRectTransform.sizeDelta = new Vector2(myRectTransform.rect.size.x, Mathf.Abs(tempY) + 0);
        }
Beispiel #5
0
 private void SetSelectedClustTile(ClustTile clustTile)
 {
     selectedClustTile = clustTile;
     clustSelController.OnSetSelectedClustTile(clustTile);
 }