示例#1
0
        public void Close()
        {
            if (TradeType == TradeType.Buy)
            {
                InputEvent.Instance.Event_SwitchShop.RemoveListener(SwitchMenuToSell);
            }
            else
            {
                InputEvent.Instance.Event_SwitchShop.RemoveListener(SwitchMenuToBuy);
            }

            Left.Deactivate();
            Right.Deactivate();
            Products = null;

            UI_NavigatorManager.Instance.Remove(ref uinav_escapeToCloseShop);
            UI_NavigatorManager.Instance.Remove(ref uinav_tabSellOrBuy);
            InputEvent.Instance.Event_CloseShop.RemoveAllListener();

            UI_Chat_Main.Instance.Dialogue.UpdateDialogue(dialogueAfterShopClosed.ReturnToObject.Dialogue
                                                          , dialogueAfterShopClosed.ReturnToIndex);

            dialogueAfterShopClosed = null;

            OnClosed.Invoke();
        }
示例#2
0
        public void Open(IReadOnlyCollection <Item_Product> products, Chat_ReturnTo dialogueAfterShopClosed)
        {
            if (GameManager.IsScreenResolutionGreaterOrEqualThanFHD == false)
            {
                var canvasScaler = GetComponent <CanvasScaler>();
                canvasScaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                canvasScaler.referenceResolution = new Vector2(GameManager.FULLHD_WIDTH, GameManager.FULLHD_HEIGHT);
            }
            else
            {
                var screenSize = new Vector2(Screen.width, Screen.height);

                Left.RectTransform.sizeDelta     = new Vector2(screenSize.x * 0.5f, screenSize.y);
                Left.RectTransform.localPosition = new Vector3(screenSize.x * -0.25f, 0.0f);

                Right.RectTransform.sizeDelta     = Left.RectTransform.sizeDelta;
                Right.RectTransform.localPosition = new Vector3(screenSize.x * 0.25f, 0.0f);
            }

            TradeType = TradeType.Buy;

            Products = products;
            Left.Activate();
            Right.Activate();

            UI_NavigatorManager.Instance.Add(ref uinav_escapeToCloseShop, "Back", InputEvent.ACTION_CLOSE_SHOP_MENU);
            UI_NavigatorManager.Instance.Add(ref uinav_tabSellOrBuy, "Sell", InputEvent.ACTION_SWITCH_SHOP_MENU);
            this.dialogueAfterShopClosed = dialogueAfterShopClosed;
            InputEvent.Instance.Event_CloseShop.AddListener(Close);
            InputEvent.Instance.Event_SwitchShop.AddListener(SwitchMenuToSell);

            OnOpened.Invoke();
        }