// wrong public override Widget FromWidgetData(WidgetData data) { ButtonData _data = data as ButtonData; Type = _data.Type; return(this); }
// 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); }
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); }
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); }
// wrong public override Widget FromWidgetData(WidgetData data) { ButtonData _data = data as ButtonData; Type = _data.Type; return this; }
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; }
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; }
// 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; }