Beispiel #1
0
 private void SetRectTransformData(UITemps uiTemp)
 {
     uiTemp.UIElement.pivot         = uiTemp.UIElementData.Pivot;
     uiTemp.UIElement.anchorMin     = uiTemp.UIElementData.AnchorMin;
     uiTemp.UIElement.anchorMax     = uiTemp.UIElementData.AnchorMax;
     uiTemp.UIElement.rotation      = uiTemp.UIElementData.Rotation;
     uiTemp.UIElement.localPosition = uiTemp.UIElementData.Position;
     uiTemp.UIElement.localScale    = uiTemp.UIElementData.Scale;
     uiTemp.UIElement.sizeDelta     = uiTemp.UIElementData.SizeDelta;
 }
Beispiel #2
0
        void SetUIElements(List <UIElement> elements)
        {
            screenElements = new List <ScreenElements>();


            for (int i = 0; i < elements.Count; i++)
            {
                for (int j = 0; j < elements[i].screenElements.Count; j++)
                {
                    //Search if there are any element in the screen elements matching the current Screen
                    int indexK = -1;
                    int indexM = -1;
                    for (int k = 0; k < screenElements.Count; k++)
                    {
                        if (screenElements[k].Screen.Equals(elements[i].screenElements[j].Screen))
                        {
                            indexK = k;
                            //found object and found screen
                            for (int m = 0; m < screenElements[k].Panels.Count; m++)
                            {
                                if (screenElements[k].Panels[m].Equals(elements[i].screenElements[j].Panel))
                                {
                                    indexM = m;
                                    //found the correct object and correct panel
                                }
                            }
                        }
                    }

                    if (indexK != -1)
                    {
                        if (indexM != -1)
                        {
                            UITemps temps = new UITemps();
                            temps.UIElement     = elements[i].GetComponent <RectTransform>();
                            temps.UIElementData = elements[i].screenElements[j].TransformData;
                            temps.ElementId     = elements[i].screenElements[j].ElementInPanel;
                            screenElements[indexK].Panels[indexM].UIElements.Add(temps);
                        }
                        else
                        {
                            PanelObj Panel = new PanelObj();
                            Panel.Panel = elements[i].screenElements[j].Panel;
                            UITemps temps = new UITemps();
                            temps.UIElement     = elements[i].GetComponent <RectTransform>();
                            temps.UIElementData = elements[i].screenElements[j].TransformData;
                            temps.ElementId     = elements[i].screenElements[j].ElementInPanel;
                            Panel.UIElements.Add(temps);
                            screenElements[indexK].Panels.Add(Panel);
                        }
                    }
                    else
                    {
                        ScreenElements element = new ScreenElements(elements[i].screenElements[j].Screen);
                        PanelObj       Panel   = new PanelObj();
                        Panel.Panel = elements[i].screenElements[j].Panel;
                        UITemps temps = new UITemps();
                        temps.UIElement     = elements[i].GetComponent <RectTransform>();
                        temps.UIElementData = elements[i].screenElements[j].TransformData;
                        temps.ElementId     = elements[i].screenElements[j].ElementInPanel;
                        Panel.UIElements.Add(temps);
                        element.Panels.Add(Panel);
                        screenElements.Add(element);
                    }
                }
            }
        }