示例#1
0
        // wrong
        public override Widget FromWidgetData(WidgetData data)
        {
            ButtonData _data = data as ButtonData;

            Type = _data.Type;
            return(this);
        }
示例#2
0
        // this should return a new instnace.. but for now
        public virtual Widget FromWidgetData(WidgetData data)
        {
            this.ID   = data.ID;
            this.Name = data.Name;
            // enable

            if (data.ParentID != -1)
            {
                Parent = Singleton <GUI> .INSTANCE.widgets.Find((e) => e.ID == data.ParentID);
            }

            this.SetBounds(data.Location.X, data.Location.Y, data.Size.X, data.Size.Y);

            appearence.Clear();
            foreach (var appData in data.appearenceData)
            {
                appearence.AddAppearence(appData.Name, appData.ToAppearence());
            }

            //translations.Clear();
            //translations.AddRange(data.translations);

            WidgetCommands.handlers.TryGetValue(Name, out handler);

            return(this);
        }
示例#3
0
        public virtual WidgetData ToWidgetData()
        {
            WidgetData data = new WidgetData();

            data.Name     = this.Name;
            data.ID       = this.ID;
            data.Enable   = this.Enable;
            data.Location = new Vector2(Scale.hUnPosScale(Absolute_X), Scale.vUnPosScale(Absolute_Y));
            data.Size     = new Vector2(Scale.hUnSizeScale(size.X), Scale.vUnSizeScale(size.Y));
            appearence.Foreach((e) => { data.appearenceData.Add(e.ToData()); });
            return(data);
        }
示例#4
0
        public override Widget FromWidgetData(WidgetData data)
        {
            this.data = data;
            TextBoxData _data = data as TextBoxData;

            //TextBox textbox = new TextBox(data.ID, _data.Text, _data.Color, _data.CharDisplaySize);
            //return textbox;

            Color           = _data.Color;
            Text            = _data.Text;
            charDisplaySize = _data.CharDisplaySize;

            BaseSize(charDisplaySize);

            return(this);
        }
示例#5
0
 // wrong
 public override Widget FromWidgetData(WidgetData data)
 {
     ButtonData _data = data as ButtonData;
     Type = _data.Type;
     return this;
 }
示例#6
0
        public override Widget FromWidgetData(WidgetData data)
        {
            this.data = data;
            TextBoxData _data = data as TextBoxData;
            //TextBox textbox = new TextBox(data.ID, _data.Text, _data.Color, _data.CharDisplaySize);
            //return textbox;

            Color = _data.Color;
            Text = _data.Text;
            charDisplaySize = _data.CharDisplaySize;

            BaseSize(charDisplaySize);

            return this;
        }
示例#7
0
 public virtual WidgetData ToWidgetData()
 {
     WidgetData data = new WidgetData();
     data.Name = this.Name;
     data.ID = this.ID;
     data.Enable = this.Enable;
     data.Location = new Vector2(Scale.hUnPosScale(Absolute_X), Scale.vUnPosScale(Absolute_Y));
     data.Size = new Vector2(Scale.hUnSizeScale(size.X), Scale.vUnSizeScale(size.Y));
     appearence.Foreach((e) => { data.appearenceData.Add(e.ToData()); });
     return data;
 }
示例#8
0
        // this should return a new instnace.. but for now
        public virtual Widget FromWidgetData(WidgetData data)
        {
            this.ID = data.ID;
            this.Name = data.Name;
            // enable

            if (data.ParentID != -1)
            {
                Parent = Singleton<GUI>.INSTANCE.widgets.Find((e) => e.ID == data.ParentID);
            }

            this.SetBounds(data.Location.X, data.Location.Y, data.Size.X, data.Size.Y);

            appearence.Clear();
            foreach (var appData in data.appearenceData)
            {
                appearence.AddAppearence(appData.Name, appData.ToAppearence());
            }

            //translations.Clear();
            //translations.AddRange(data.translations);

            WidgetCommands.handlers.TryGetValue(Name, out handler);

            return this;
        }