Beispiel #1
0
    public void RemoveLayerGame()
    {
#if USE_XLUA
        InvokeXLua("RemoveLayerGame");
#else
        foreach (var item in layerCaches)
        {
            var layerTemps = item.Value;
            if (layerTemps.Count > 0)
            {
                for (int i = layerTemps.Count - 1; i >= 0; i--)
                {
                    UILayer layer = layerTemps[i];
                    if (layer.isGameLayer)
                    {
                        layerTemps.Remove(layer);

                        layer.DisableLayer();
                        layer.BeforeHideLayer();
                        layer.HideLayer();
                        layer.DestroyLayer();

                        Destroy(layer.gameObject);
                    }
                }
            }
        }

        UnloadAllAssets();
#endif
    }
Beispiel #2
0
    private UILayer ShowLayer(UILayer layer)
    {
#if USE_XLUA
        return(InvokeXLua("ShowLayer", new object[] { layer })[0] as UILayer);
#else
        if (layer == null)
        {
            return(null);
        }

        UILayer lastLayer = null;

        List <UILayer> uiLayerTemps = layers[layer.position];

        int layerCount = uiLayerTemps.Count;

        // disable layer
        if (layerCount > 0)
        {
            lastLayer = uiLayerTemps[layerCount - 1];
            lastLayer.DisableLayer();
        }

        if (layer.position == UILayer.Position.Middle)
        {
            layerMiniMask.SetActive(true);
        }

        layer.SetLayerIndex(layerCount);
        uiLayerTemps.Add(layer);
        layer.EnableLayer();

        // animation
        switch (layer.layerAnimType)
        {
        case UILayer.AnimType.Popup:
            layer.PlayAnimation(UILayer.AnimKey.OpenPopup);
            break;

        case UILayer.AnimType.None:
            if (layer.hideBehindLayers)
            {
                if (lastLayer != null)
                {
                    lastLayer.gameObject.SetActive(false);
                }
            }
            break;
        }

        return(layer);
#endif
    }
Beispiel #3
0
    private void PrivateHideLayer(UILayer layer)
    {
#if USE_XLUA
        InvokeXLua("PrivateHideLayer", layer);
#else
        layer.DisableLayer();
        layer.BeforeHideLayer();
        layer.HideLayer();

        if (layer.allowDestroy)
        {
            layer.DestroyLayer();
            Destroy(layer.gameObject);
        }
        else
        {
            layer.ResetPosition();
            CacheLayer(layer);
        }
#endif
    }