Ejemplo n.º 1
0
    public MainWindow()
    {
        InitializeComponent();

        boxPanelRoot = new BoxPanel();
        LayoutRoot.Children.Add(boxPanelRoot);

        this.Loaded += (_, __) => PopulateBoxPanel();
    }
Ejemplo n.º 2
0
    public void instantiatePool(int numsOfBoxes)
    {
        for (int i = 0; i < numsOfBoxes; i++)
        {
            //Instatiate Boxpanel
            GameObject boxPanelGameObject   = Instantiate(boxPanelPrefab, boxPanels);
            GameObject currentBoxGameObject = Instantiate(boxPrefab);
            ProductBox productBox           = currentBoxGameObject.GetComponent <ProductBox>();
            BoxPanel   boxPanel             = boxPanelGameObject.GetComponent <BoxPanel>();
            productBox.boxPanel = boxPanel;
            boxesPool.Add(productBox);
            int randomIndex = Random.Range(0, processTypeSequences.Count);
            while (processTypeSequences[randomIndex].Length > maxProcessesPerBox)
            {
                randomIndex = Random.Range(0, processTypeSequences.Count);
            }

            productBox.processes.Add(GameConstants.StationType.CInspection);
            //Instantiate(productionIconsPrefab, boxPanelGameObject.GetComponent<BoxPanel>().productionIconsTransform.transform);

            for (int seqIndex = 0; seqIndex < processTypeSequences[randomIndex].Length; seqIndex++)
            {
                switch (processTypeSequences[randomIndex][seqIndex])
                {
                case 'L':
                    productBox.processes.Add(lightProcessToBeRandomize[Random.Range(0, lightProcessToBeRandomize.Count)]);
                    break;

                case 'H':
                    productBox.processes.Add(heavyProcessToBeRandomize[Random.Range(0, heavyProcessToBeRandomize.Count)]);
                    break;

                default:
                    break;
                }

                //                Instantiate(prefabIcon, transform) with parent as boxpanel;
                GameObject productionIcon = Instantiate(productionIconsPrefab, boxPanel.productionIconsTransform.transform);
                boxPanel.productionIcons.Add(productionIcon.GetComponent <Image>());
            }
            productBox.processes.Add(GameConstants.StationType.CPolishing);
            GameObject polishingProductionIcon = Instantiate(productionIconsPrefab, boxPanelGameObject.GetComponent <BoxPanel>().productionIconsTransform.transform);
            boxPanel.productionIcons.Add(polishingProductionIcon.GetComponent <Image>());
        }
    }
 public void AddChildPanel(BoxPanel child)
 {
     bottomPanel.Children.Add(child);
     AdjustBottomPanel();
 }