public SaveDataComponent(string path, float hue = 0f) { Path = path; SaveDataIO = new SaveDataIO(); if (asd.Engine.File.Exists(path)) { SaveDataIO = SaveDataIO.Load <SaveDataIO>(path); } Texture = TextureManager.LoadTexture("Static/save_data.png"); Color = new HsvColor(hue, 0.6f, 1).ToRgb(); DataName = new asd.TextObject2D() { Text = path.Split('/').Last(), Font = asd.Engine.Graphics.CreateDynamicFont(Base.MainFont, 60, new asd.Color(255, 255, 255), 0, new asd.Color()), }; DataName.Position = new asd.Vector2DF(-Texture.Size.X / 4, 0) - DataName.Font.CalcTextureSize(DataName.Text, asd.WritingDirection.Horizontal).To2DF() / 2; MapName = new asd.TextObject2D() { Text = SaveDataIO.MapName != null ? SaveDataIO.MapName : "", Font = asd.Engine.Graphics.CreateDynamicFont(Base.MainFont, 40, new asd.Color(255, 255, 255), 0, new asd.Color()), }; MapName.Position = new asd.Vector2DF(Texture.Size.X / 4, -Texture.Size.Y / 4) - MapName.Font.CalcTextureSize(MapName.Text, asd.WritingDirection.Horizontal).To2DF() / 2; PlayerNames = new asd.TextObject2D() { Font = asd.Engine.Graphics.CreateDynamicFont(Base.MainFont, 40, new asd.Color(255, 255, 255), 0, new asd.Color()), }; foreach (var item in SaveDataIO.PlayingChacacter) { PlayerNames.Text += item + " "; } PlayerNames.Position = new asd.Vector2DF(Texture.Size.X / 4, 0) - PlayerNames.Font.CalcTextureSize(PlayerNames.Text, asd.WritingDirection.Horizontal).To2DF() / 2; PlayTime = new asd.TextObject2D() { Text = new TimeSpan(0, 0, SaveDataIO.Time).ToString(), Font = asd.Engine.Graphics.CreateDynamicFont(Base.MainFont, 40, new asd.Color(255, 255, 255), 0, new asd.Color()), }; PlayTime.Position = new asd.Vector2DF(Texture.Size.X / 4, Texture.Size.Y / 4) - PlayTime.Font.CalcTextureSize(PlayTime.Text, asd.WritingDirection.Horizontal).To2DF() / 2; NextScenePath = ""; OnPushed = (obj) => { }; }
public void Save() { SaveDataIO.Save(); }
//セーブデータを消去する // void DeleteSaveData() { SaveDataIO.Delete(); }