Пример #1
0
        private void SetOrderContent(OrderContent order)
        {
            Assert.IsNotNull(order);

            var orderWrapper = GetOrderWrapperFromOrder(order);

            Assert.IsNotNull(orderWrapper);

            orderWrapper.gameObject.SetActive(true);
            orderWrapper.SetContent(order);
        }
Пример #2
0
        private void CreateConstructionButton(OrderContent orderContent, int index)
        {
            // instanciate button
            var instanciatedButton = UnityEngine.Object.Instantiate(_prefabConstructionButton);

            instanciatedButton.transform.SetParent(_parentConstructionButton, false);

            // set building type on construction button
            OrderButton orderWrapper = instanciatedButton.GetComponent <OrderButton>();

            orderWrapper.SetContent(orderContent);

            Assert.IsNotNull(orderWrapper, "Prefab construction prefab misses a UI_ConstructionButton component.");

            _orderButtons[index] = orderWrapper;
        }
Пример #3
0
        private void CreateConstructionButtons()
        {
            if (_orderButtons != null)
            {
                Debug.LogWarningFormat("Panel Construction : Recreate building buttons.");
            }

            // destroy older buttons
            _parentConstructionButton.transform.DestroyChildren();

            // create a button for each entries in game manager 'buildings in panel construction'
            var constructionOrders = GameManager.Instance.ManagerData.GetConstructionOrders();

            _orderButtons = new OrderButton[constructionOrders.Length];

            for (int i = 0; i < constructionOrders.Length; i++)
            {
                OrderContent order = constructionOrders[i];
                CreateConstructionButton(order, i);
            }

            Canvas.ForceUpdateCanvases();
        }
Пример #4
0
        private OrderButton GetOrderWrapperFromOrder(OrderContent order)
        {
            var orderWrappers = GetLineOrders(order.LinePosition);

            return(GetFirstInactiveOrderWrapper(orderWrappers));
        }