/// <summary>
 /// This function will be called whenever the layout is rebuilt - if you have any setup code which needs to be executed after the layout is rebuilt, override this function and implement it here.
 /// ParseXmlResult.Changed   => The Xml was parsed and the layout changed as a result
 /// ParseXmlResult.Unchanged => The Xml was unchanged, so no the layout remained unchanged
 /// ParseXmlResult.Failed    => The Xml failed validation
 /// </summary>
 public virtual void LayoutRebuilt(ParseXmlResult parseResult)
 {
     if (this.OnLayoutRebuilt != null)
     {
         this.OnLayoutRebuilt(this);
     }
 }
Example #2
0
        public override void LayoutRebuilt(ParseXmlResult parseResult)
        {
            // ParseXmlResult.Changed   => The Xml was parsed and the layout changed as a result
            // ParseXmlResult.Unchanged => The Xml was unchanged, so no the layout remained unchanged
            // ParseXmlResult.Failed    => The Xml failed validation

            // Called whenever the XmlLayout finishes rebuilding the layout
            // Use this function to make any dynamic changes (e.g. create dynamic lists, menus, etc.) or dynamically load values/selections for elements such as DropDown
        }
 public override void LayoutRebuilt(ParseXmlResult parseResult)
 {
     if (toggleGroup != null)
     {
         // As the layout has just been rebuilt, the toggle group will no longer have anything selected
         // so we're just going to set it again here
         toggleGroup.element.SetSelectedValue(selectedLanguage, false);
     }
 }
        public override void LayoutRebuilt(ParseXmlResult parseResult)
        {
            if (parseResult != ParseXmlResult.Changed || Products == null || !Products.Any())
            {
                return;
            }

            var shopContent  = xmlLayout.GetElementById <TableLayout>("shopContent");
            var itemTemplate = xmlLayout.GetElementById("productTemplate");

            var columnCount  = 4;
            var column       = 0;
            var rows         = shopContent.Rows.ToList();
            var productCount = Products.Count;

            var rowHeight = rows.First().preferredHeight;

            TableRow row;

            if (rows.Any())
            {
                row = rows.Last();
            }
            else
            {
                row = shopContent.AddRow(0);
                row.preferredHeight = rowHeight;
            }

            for (var x = 0; x < productCount; x++)
            {
                var product = Products[x];

                var item = GameObject.Instantiate(itemTemplate);
                item.Initialise(xmlLayout, (RectTransform)item.transform, itemTemplate.tagHandler);

                item.gameObject.SetActive(true); // the template is inactive so as not to show up, so we need to activate our new object

                // Add a new cell to the row (containing our new product)
                row.AddCell(item.rectTransform);

                HandleProduct(product, item, x);

                // increment column count
                column++;

                // move to the next row, if necessary
                if (column == columnCount && (x + 1) < productCount)
                {
                    column = 0;
                    row    = shopContent.AddRow(0);
                    row.preferredHeight = rowHeight;
                }
            }
        }
 public override void LayoutRebuilt(ParseXmlResult parseResult)
 {
     _workerMoneyLabelReference   = _workerMoneyLabelReference ?? this.XmlElementReference <Text>("moneyLabel");
     _workerPanelReference        = _workerPanelReference ?? this.XmlElementReference <XmlElement>("workerPanel");
     _specsPanelReference         = _specsPanelReference ?? this.XmlElementReference <XmlElement>("specsPanel");
     _shopPanelReference          = _shopPanelReference ?? this.XmlElementReference <XmlElement>("shopPanel");
     _messageBoxReference         = _messageBoxReference ?? this.XmlElementReference <XmlElement>("messageBox");
     _workerUnlockPanelReference  = _workerUnlockPanelReference ?? this.XmlElementReference <XmlElement>("workerUnlockPanel");
     _moneyUpgradeButtonReference = _moneyUpgradeButtonReference ??
                                    this.XmlElementReference <XmlElement>("UpgradeMoneyPercentage");
 }
Example #6
0
        public override void LayoutRebuilt(ParseXmlResult parseResult)
        {
            // populate dataTable3 if necessary (this should only be once ever)
            if (dataTable3 == null)
            {
                dataTable3 = XmlElementReference <XmlLayoutDataTable>("dataTable3");
            }

            // Set the data of the dataTable directly
            dataTable3.element.SetData(myData3);
        }
        public override void LayoutRebuilt(ParseXmlResult parseResult)
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (parseResult == ParseXmlResult.Changed)
            {
                UpdateDisplay();
            }
        }
        /// <summary>
        /// LayoutRebuilt is called by XmlLayout whenever the layout is finished being built
        /// (regardless of whether the rebuild was triggered automatically or manually)
        /// </summary>
        public override void LayoutRebuilt(ParseXmlResult parseResult)
        {
            if (parseResult != ParseXmlResult.Changed)
            {
                return;
            }

            // get the menu button container
            menuButtonGroup = xmlLayout.GetElementById("menuButtons");

            // get the menu button template so that we can clone it
            var menuButtonTemplate = xmlLayout.GetElementById("menuButtonTemplate");

            foreach (var example in Examples)
            {
                var name = example.name;

                AddMenuButton(name, menuButtonGroup, menuButtonTemplate);
            }

            AddMenuButton("Drag & Drop", menuButtonGroup, menuButtonTemplate);
            AddMenuButton("Localization", menuButtonGroup, menuButtonTemplate);
            AddMenuButton("World Space", menuButtonGroup, menuButtonTemplate);
        }
 public override void LayoutRebuilt(ParseXmlResult parseResult)
 {
     UpdateDisplay();
 }
 public override void LayoutRebuilt(ParseXmlResult parseResult)
 {
     // start with the root XmlElement
     Localize(xmlLayout.XmlElement);
 }
Example #11
0
 public override void LayoutRebuilt(ParseXmlResult parseResult)
 {
     SetFormDefaults();
 }
Example #12
0
 /// <summary>
 /// This function will be called whenever the layout is rebuilt - if you have any setup code which needs to be executed after the layout is rebuilt, override this function and implement it here.
 /// ParseXmlResult.Changed   => The Xml was parsed and the layout changed as a result
 /// ParseXmlResult.Unchanged => The Xml was unchanged, so no the layout remained unchanged
 /// ParseXmlResult.Failed    => The Xml failed validation
 /// </summary>
 public virtual void LayoutRebuilt(ParseXmlResult parseResult)
 {
 }