public static SaveSlot Create(int slot) { var s = new SaveSlot(); s.Init("Save " + slot); return(s); }
protected override void OnInit() { _savingEnabled = CurrentGameState.CurrentLocation != GameResources.MainMenuSceneName; _headerText = UiLabels.FullWidthHeaderLabel("Game", Color.White); _changeModeButton = UiButtons.MenuSmallBlue("Load", new Vector2(840, 960), () => SetMode(_mode == SaveMode.Save ? SaveMode.Load : SaveMode.Save)); if (_savingEnabled) { Add(_changeModeButton); } SetMode(_savingEnabled ? SaveMode.Save : SaveMode.Load); Add(UiButtons.BackBlue(() => Scene.NavigateTo(CurrentGameState.CurrentLocation))); var positions = new[] { new Vector2(320, 200), new Vector2(1120, 200), new Vector2(320, 600), new Vector2(1120, 600), }; for (var i = 0; i < 4; i++) { var s = new SaveSlotView(positions[i], SaveSlot.Create(i), () => _mode); s.Init(); AddUi(s); } }
public SaveSlotView(Vector2 position, SaveSlot slot, Func <SaveMode> getMode) { _position = position; _slot = slot; _getMode = getMode; }