void EraseEntry(int idx) { print("EraseEntry: " + idx); SaveEntryView v = GetEntryViewAtIndex(idx); if (v == null) { return; } bool success = SaveManager.Instance.DeleteGame(CursorIndex); if (success) { PlayDeleteSound(); Destroy(v.gameObject); InstantiateSaveEntryView(CursorIndex); SetEntryViewsSelectedState(CursorIndex, true); } else { PlayErrorSound(); } }
void SetEntryViewsSelectedState(int idx, bool value) { SaveEntryView v = GetEntryViewAtIndex(idx); if (v == null) { return; } v.UpdateSelectedState(value); }
void InstantiateSaveEntryView(int idx) { GameObject g = Instantiate(saveEntryViewPrefab) as GameObject; SaveEntryView v = g.GetComponent <SaveEntryView>(); Transform t = v.transform; t.SetParent(saveEntryViewsContainer); t.localPosition = new Vector3(0, -idx * entryHeight, -0.1f); t.localRotation = Quaternion.identity; v.InitWithEntryData(SaveManager.Instance.LoadEntryData(idx)); _entryViews[idx] = v; }
void LoadEntry(int idx) { print("LoadEntry: " + idx); SaveEntryView v = GetEntryViewAtIndex(idx); if (v == null) { return; } CommonObjects.PlayerController_C.SetHaltUpdateMovement(false); Player p = CommonObjects.Player_C; p.RegisteredName = v.PlayerName; p.DeathCount = v.PlayerDeathCount; SaveManager.Instance.LoadGame(idx); }