예제 #1
0
        private void FocusLayer(LayerSettingsItem layerItem)
        {
            Vector3 tmpPos = layersPivot.localPosition;

            tmpPos.y = -layerItem.transform.localPosition.y;
            layersPivot.localPosition = tmpPos;
        }
예제 #2
0
        private void CreateUILayerSettings()
        {
            if (layerSettingsItems != null)
            {
                return;
            }

            layerSettingsItems = new Dictionary <byte, LayerSettingsItem>();

            currentLayer = defaultLayer = layersSettings.GetFirstLayer();
            if (savedLayer != null)
            {
                currentLayer = savedLayer;
            }

            foreach (TerrainTypeLayerSettings layerSettings in layersSettings)
            {
                GameObject        tmpItem           = Instantiate <GameObject>(layerSettingsItemGO);
                LayerSettingsItem layerSettingsItem = tmpItem.GetComponent <LayerSettingsItem>();
                tmpItem.transform.SetParent(layersPivot, false);
                layerSettingsItem.Init(layerSettings, layersToggleGroup, ShowMoreLayerInfo, HideMoreLayerInfo);
                layerSettingsItem.onActive += OnLayerChanged;

                layerSettingsItems.Add(layerSettingsItem.index, layerSettingsItem);
            }

            if (!layerSettingsItems.ContainsKey(currentLayer.index))
            {
                Debug.LogError("Can`t find default layer");
                currentLayer.index = 1;
                savedLayer         = null;
            }

            layerSettingsItems[currentLayer.index].SetActive(true);
        }
예제 #3
0
        /// <summary>
        /// Select layer in visual list
        /// </summary>
        /// <param name="layerItem"></param>
        /// <param name="focus">Scroll list to this layer</param>
        private void SelectLayer(LayerSettingsItem layerItem, bool focus = false)
        {
            layerItem.SetActive(true);

            if (focus)
            {
                FocusLayer(layerItem);
            }
        }