public override void Reload(UICollection uic, UIElementLayout uiel)
        {
            base.Reload(uic, uiel);
            var temp = uiel as UIScreenSliderSaveLayout;

            sliderType = temp.UIST;
        }
        public override void Reload(UICollection uic, UIElementLayout uiel)
        {
            base.Reload(uic, uiel);
            var temp = uiel as UIButtonSaveLayout;

            if (temp.ButtonAnim_ClickState == null)
            {
                temp.ButtonAnim_ClickState = new ShapeAnimation();
            }
            if (temp.ButtonAnim_RestState == null)
            {
                temp.ButtonAnim_RestState = new ShapeAnimation();
            }
            if (temp.ButtonAnim_HoverState == null)
            {
                temp.ButtonAnim_HoverState = new ShapeAnimation();
            }

            temp.ButtonAnim_ClickState.ReloadTexture();
            temp.ButtonAnim_RestState.ReloadTexture();
            temp.ButtonAnim_HoverState.ReloadTexture();

            ButtonAnim_RestState  = temp.ButtonAnim_RestState;
            ButtonAnim_HoverState = temp.ButtonAnim_HoverState;
            ButtonAnim_ClickState = temp.ButtonAnim_ClickState;
        }
        public override void Reload(UICollection uic, UIElementLayout uiel)
        {
            base.Reload(uic, uiel);
            var temp = uiel as UINumericInputLayout;

            defaultInput = temp.defaultInput;
        }
        public virtual void Reload(UICollection uic, UIElementLayout uiel)
        {
            collectionParent = uic;
            name             = uiel.name;
            description      = uiel.description;
            id = uiel.ID;
            holdEventActivateTimer = uiel.holdEventActivateTimer;
            holdEventTick          = uiel.holdEventTick;
            activateType           = uiel.activateType;

            initialPosition = uiel.Position;
            initialSize     = uiel.Size;

            position = initialPosition;
            size     = initialSize;

            try
            {
                baseTexture = Game1.contentManager.Load <Texture2D>(uiel.baseTexLoc);
            }
            catch (Exception)
            {
                baseTexture     = Game1.hitboxHelp;
                uiel.baseTexLoc = baseTexture.Name.Replace(Game1.rootContent, "");
            }

            if (uiElementRender == null || uiElementRender.IsDisposed)
            {
                uiElementRender = new RenderTarget2D(Game1.graphics.GraphicsDevice, size.X, size.Y);
            }
        }
Ejemplo n.º 5
0
        public override void Reload(UICollection uic, UIElementLayout uiel)
        {
            base.Reload(uic, uiel);
            var temp = uiel as UITextElementLayout;

            try
            {
                sf = Game1.contentManager.Load <SpriteFont>(temp.fontLocation);
            }
            catch (Exception)
            {
                sf = Game1.defaultFont;
            }
            Text = temp.text;
        }
        internal UICollection Clone()
        {
            UICollection temp = new UICollection();

            temp = (UICollection)this.MemberwiseClone();
            temp.elementsInCollection = new List <BaseUIElement>();
            temp.uiCollectionRender   = new RenderTarget2D(temp.UICollectionRender.GraphicsDevice, temp.UICollectionRender.Width, temp.UICollectionRender.Height);
            temp.elementsInCollection.Clear();
            temp.startMainElement = this.startMainElement.Clone(null, null, temp) as UIScreen;
            temp.elementsInCollection.Add(temp.startMainElement);

            foreach (var item in this.elementsInCollection)
            {
                if (item.ElementID != temp.startMainElement.ElementID)
                {
                    temp.elementsInCollection.Add(item.Clone(null, temp.startMainElement, temp));
                }
            }

            return(temp);
        }
        public void Reload()
        {
            parent = new UICollection();
            parent.elementsInCollection = new List <BaseUIElement>();
            foreach (var item in listUIElementsSaves)
            {
                if (item.GetType() == typeof(UIScreenSaveLayout))
                {
                    UIScreen uis = new UIScreen();
                    uis.Reload(parent, item);
                    parent.elementsInCollection.Add(uis);
                }
                else if (item.GetType() == typeof(UIScreenSliderSaveLayout))
                {
                    UIScreenSlider uisl = new UIScreenSlider();
                    uisl.Reload(parent, item);
                    parent.elementsInCollection.Add(uisl);
                }
                else if (item.GetType() == typeof(UINumericInputLayout))
                {
                    UINumericInput uinum = new UINumericInput();
                    uinum.Reload(parent, item);
                    parent.elementsInCollection.Add(uinum);
                }
                else if (item.GetType() == typeof(UIButtonSaveLayout))
                {
                    GButton uib = new GButton();
                    uib.Reload(parent, item);
                    parent.elementsInCollection.Add(uib);
                }
                else if (item.GetType() == typeof(UITextElementLayout))
                {
                    UITextElement uite = new UITextElement();
                    uite.Reload(parent, item);
                    parent.elementsInCollection.Add(uite);
                }
            }

            parent.startMainElement = parent.elementsInCollection.FindAll(e => e.GetType() == typeof(UIScreen)).Cast <UIScreen>().ToList().Find(uis => uis.ElementID == startElementID);
        }
        internal override BaseUIElement Clone(BaseUIElement bue, BaseUIElement parent, UICollection parentCollection)
        {
            UIScreen temp = (UIScreen)this.MemberwiseClone();

            return(base.Clone(temp, parent, parentCollection));
        }
        internal override BaseUIElement Clone(BaseUIElement bue, BaseUIElement parent, UICollection parentCollection)
        {
            GButton temp = (GButton)this.MemberwiseClone();

            temp.ButtonAnim_ClickState = temp.ButtonAnim_ClickState.Clone();
            temp.ButtonAnim_HoverState = temp.ButtonAnim_HoverState.Clone();
            temp.ButtonAnim_ClickState = temp.ButtonAnim_ClickState.Clone();

            return(base.Clone(temp, parent, parentCollection));
        }
        internal virtual BaseUIElement Clone(BaseUIElement bue, BaseUIElement parent, UICollection parentCollection)
        {
            bue.uiElementRender  = new RenderTarget2D(bue.UIElementRender.GraphicsDevice, bue.UIElementRender.Width, bue.UIElementRender.Height);
            bue.parent           = parent;
            bue.collectionParent = parentCollection;

            return(bue);
        }