Exemplo n.º 1
0
        /// <summary>
        /// show some layers by default if needed
        /// </summary>
        private void ShowLayerEntries()
        {
            // execute next frame
            Updater.Instance.ExecuteNextFrame(delegate
            {
                Events.Instance.GameplayStatus = DefaultGameplayStatus;
                UIManager.Instance.Switch(DefaultEnvironment, 0);

                if (LayerEntries.Count == 0)
                {
                    return;
                }

                int count = LayerEntries.Count;
                for (var i = 0; i < count; i++)
                {
                    LayerEntry layerEntry = LayerEntries[i];

                    if (layerEntry.LayerConfig == null || layerEntry.Action == UIAction.None)
                    {
                        continue;
                    }

                    UIManager.Instance.Switch(layerEntry.LayerConfig, layerEntry.Action);
                }
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// initialize List with all UI Layers
        /// </summary>
        private void SetupLayer()
        {
            // get UI
            Transform ui = GetTransformWithName(UIName);

            // save all Layer and hide it
            foreach (Transform item in ui)
            {
                if (item.name == "OLD")
                {
                    Debug.Log(item);
                }
                try
                {
                    var        child  = item.transform.Find("Container");
                    var        script = item.transform.GetComponent <LayerConfig>();
                    LayerEntry layer  = new LayerEntry(item.name, child, script);
                    LayerManager.Instance.AddLayerEntry(layer);
                    Hide(layer.Layer);
                }
                catch (Exception e)
                {
                    Debug.LogWarning(e);
                }
            }
        }
        public void HideMe()
        {
            string layerName = this.name;
            Layer  layer     = LayerEntry.StringToLayer(layerName);

            UIManager.Instance.Switch(layer, UIAction.Hide);
        }
Exemplo n.º 4
0
        private void DoUIStuff()
        {
            int count = ActionList.Count;

            for (var i = 0; i < count; i++)
            {
                LayerEntry layerEntry = ActionList[i];

                if (layerEntry.LayerConfig == null)
                {
                    Debug.LogWarning("LayerConfig is NULL!");
                    continue;
                }

                if (layerEntry.Action == UIAction.None)
                {
                    continue;
                }

                UIManager.Instance.Switch(layerEntry.LayerConfig, layerEntry.Action, Delay);
            }

            // Play Animations
            foreach (var anim in Animations)
            {
                if (anim.Object != null)
                {
                    anim.Object.Play(anim.State);
                }
            }

            // Environment
            if (Environment != global::GameEnvironment.None)
            {
                UIManager.Instance.Switch(Environment, Delay);
            }

            // Blend
            if (UseBlend)
            {
                UIManager.Instance.DoBlende();
            }

            // GameplayStatus
            if (GameplayStatus != GameplayStatus.None)
            {
                if (Events.Instance.GameplayStatus == GameplayStatus)
                {
                    if (OrToggleWithStatus != GameplayStatus.None)
                    {
                        Events.Instance.GameplayStatus = OrToggleWithStatus;
                    }
                }
                else
                {
                    Events.Instance.GameplayStatus = GameplayStatus;
                }
            }
        }
Exemplo n.º 5
0
        // Hide UI Elements

        private void Hide(Layer layer)
        {
            LayerEntry layerEntry = LayerManager.Instance.GetLayerEntry(layer);

            if (layerEntry == null)
            {
                Debug.LogWarning("Layer named " + layer + " not found");
                return;
            }
            //if (GameConfig.Instance.Debug)
            //    Debug.LogWarning("Hide(" + layerEntry.Layer + ")");
            this.Hide(layerEntry.GameObject);
        }
Exemplo n.º 6
0
        // Show UI Elements

        private void Show(Layer layer)
        {
            LayerEntry layerEntry = LayerManager.Instance.GetLayerEntry(layer);

            if (layerEntry == null)
            {
                Debug.LogWarning("Layer named " + layer + " not found");
                return;
            }
            if (InitManager.Instance.UIDebug)
            {
                Debug.LogWarning("Show(" + layerEntry.Layer + ")");
            }
            this.Show(layerEntry.GameObject);
        }
Exemplo n.º 7
0
        private void OnLayerChange(Layer layer, UIAction action)
        {
            // get LayerEntry by layer
            LayerEntry layerEntry = LayerManager.Instance.GetLayerEntry(layer);

            if (layerEntry.View == null)
            {
                if (InitManager.Instance.Debug)
                {
                    Debug.LogWarning("View" + layer.ToString() + " not found :'(");
                }
                return;
            }

            if (action == UIAction.Show)
            {
                layerEntry.View.onShow();
            }
            else
            {
                layerEntry.View.onHide();
            }
        }
Exemplo n.º 8
0
        // Animation

        private void DoAnimation(Layer layer, float delay)
        {
            UIAction action = LayerManager.Instance.GetToggledStatus(layer);

            if (layer == Layer.None)
            {
                return;
            }

            // Fade In Animation
            if (action == UIAction.Show)
            {
                // enable triggers OpenAnimations via Animator
                this.Show(layer);

                // sound
                LayerEntry layerEntry = LayerManager.Instance.GetLayerEntry(layer);
                if (layerEntry == null)
                {
                    Debug.LogWarning("Layer named " + layer + " not found");
                    return;
                }
                LayerConfig UIConfig = layerEntry.LayerConfig;
                if (UIConfig != null)
                {
                    // play each animation
                    foreach (var anim in UIConfig.OpenAnimations)
                    {
                        anim.Object.Play(anim.State);
                    }

                    if (UIConfig.OpenSound != "")
                    {
                        SoundManager.Instance.Play(UIConfig.OpenSound, SoundManager.SoundType.Soundeffect, false, 0.5f);
                    }
                }

                LayerManager.Instance.SetAction(layer, action);
            }
            // Fade Out animation
            else
            {
                //bool isAnimation = false;
                // check if UIConfig Component exists
                LayerEntry layerEntry = LayerManager.Instance.GetLayerEntry(layer);
                if (layerEntry == null)
                {
                    Debug.LogWarning("Layer named " + layer + " not found");
                    return;
                }
                LayerConfig UIConfig = layerEntry.LayerConfig;
                if (UIConfig != null)
                {
                    // play each animation
                    foreach (var anim in UIConfig.CloseAnimations)
                    {
                        //isAnimation = true;
                        anim.Object.Play(anim.State);
                    }

                    // sound
                    if (UIConfig.CloseSound != "")
                    {
                        SoundManager.Instance.Play(UIConfig.CloseSound, SoundManager.SoundType.Soundeffect, false, 0.5f);
                    }
                }

                // save for delayed animation
                //if (isAnimation == false)
                if (delay == 0)
                {
                    this.Hide(layer);
                    LayerManager.Instance.SetAction(layer, action);
                }
                else
                {
                    AddHideLayerList(layer);
                }
            }
        }
Exemplo n.º 9
0
 public void AddLayerEntry(LayerEntry layer)
 {
     _layerList.Add(layer);
 }