// Creates slots as buttons, representing available save files void PopulateGrid() { // Create template panel (button) GameObject newPanel; GameObject prefabPanel = Resources.Load <GameObject>(@"MenuPrefabs\prefabFileSlotPanel"); // PlayerPrefs keeps track of the *maximum* number of slots that has ever // been created by the player. This is different from the number of files available. int maxPotentialSlots = PlayerPrefs.HasKey(PlayerPrefsKeys.HighestSlotNum.ToString()) ? PlayerPrefs.GetInt(PlayerPrefsKeys.HighestSlotNum.ToString()) : 0; // PlayerPrefs has an entry for each save file created. The Key is "Slot#SaveName", and // the value is string saying either "No Save Data" or listing of the hero's names, // the party gold, and the date of the save. // Create a button for each key for (int i = 0; i < maxPotentialSlots; i++) { if (PlayerPrefs.HasKey(KeyName(i))) { // Create from template newPanel = GameObject.Instantiate(prefabPanel, gridContents.transform); // Access FilePanel component PanelSelection filePanel = newPanel.GetComponent <PanelSelection>(); // Set up the panel with the string to display filePanel.SetupPanel(i, PlayerPrefs.GetString(KeyName(i))); } } // Disable buttons until a slot is clicked EnableButtons(false); }
public static void AddInvoker_PanelSelect(PanelSelection panelScript) { invokers_PanelSelect.Add(panelScript); //if (listener_Battle_InvSelect != null) foreach (UnityAction <int?> listener in listeners_PanelSelect) { panelScript.AddListener_PanelSelect(listener); } }
/// <summary> /// Set active the passed in panel while deactivating all others. /// </summary> /// <param name="_panel">The panel to become active</param> private void DisplayPanel(PanelSelection _panel) { switch (_panel) { case PanelSelection.MainMenu: m_MainMenuPanel.SetActive(true); m_ConnectionMenuPanel.SetActive(false); m_HostMenuPanel.SetActive(false); m_RoomViewPanel.SetActive(false); m_LobbyScreen.SetActive(false); m_BackButton.gameObject.SetActive(false); break; case PanelSelection.ConnectionMenu: m_MainMenuPanel.SetActive(false); m_ConnectionMenuPanel.SetActive(true); m_HostMenuPanel.SetActive(false); m_RoomViewPanel.SetActive(false); m_LobbyScreen.SetActive(false); m_BackButton.gameObject.SetActive(false); m_HostErrorText.gameObject.SetActive(false); break; case PanelSelection.HostMenu: m_MainMenuPanel.SetActive(false); m_ConnectionMenuPanel.SetActive(false); m_HostMenuPanel.SetActive(true); m_RoomViewPanel.SetActive(false); m_LobbyScreen.SetActive(false); m_BackButton.gameObject.SetActive(true); break; case PanelSelection.RoomView: m_MainMenuPanel.SetActive(false); m_ConnectionMenuPanel.SetActive(false); m_HostMenuPanel.SetActive(false); m_RoomViewPanel.SetActive(true); m_LobbyScreen.SetActive(false); m_BackButton.gameObject.SetActive(true); break; case PanelSelection.LobbyScreen: m_MainMenuPanel.SetActive(false); m_ConnectionMenuPanel.SetActive(false); m_HostMenuPanel.SetActive(false); m_RoomViewPanel.SetActive(false); m_LobbyScreen.SetActive(true); m_BackButton.gameObject.SetActive(true); break; default: break; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { splitContainer1.Panel2.Controls.Clear(); splitContainer2.Panel2.Controls.Clear(); int i = comboBox1.SelectedIndex; TypeQuestion type = (TypeQuestion)i; switch (type) { case TypeQuestion.ChroniceSequence: PanelChronice p9 = new PanelChronice(); p9.Dock = DockStyle.Fill; p9.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p9); _questionPanel = p9; break; case TypeQuestion.Compare: PanelCompare p1 = new PanelCompare(); p1.Dock = DockStyle.Fill; p1.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p1); _questionPanel = p1; break; case TypeQuestion.FullAnswer: PanelFullAnswer p2 = new PanelFullAnswer(); p2.Dock = DockStyle.Fill; p2.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p2); _questionPanel = p2; break; case TypeQuestion.Graphic: PanelGraphic p3 = new PanelGraphic(); p3.Dock = DockStyle.Fill; p3.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p3); _questionPanel = p3; break; case TypeQuestion.InsertWords: PanelInsertWord p4 = new PanelInsertWord(); p4.Dock = DockStyle.Fill; p4.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p4); _questionPanel = p4; break; case TypeQuestion.LogicRelation: PanelLogicRelation p5 = new PanelLogicRelation(); p5.Dock = DockStyle.Fill; p5.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p5); _questionPanel = p5; break; case TypeQuestion.Matching: PanelMatching p6 = new PanelMatching(); p6.Dock = DockStyle.Fill; p6.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p6); _questionPanel = p6; break; case TypeQuestion.MoreOneVariant: PanelOneVariant p7 = new PanelOneVariant(); p7.Dock = DockStyle.Fill; p7.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p7); _questionPanel = p7; break; case TypeQuestion.OneVariant: PanelOneVariant p = new PanelOneVariant(); p.OnChangedProperty += OnChangedProperty; p.Dock = DockStyle.Fill; splitContainer2.Panel2.Controls.Add(p); _questionPanel = p; break; case TypeQuestion.Selection: PanelSelection p8 = new PanelSelection(); p8.Dock = DockStyle.Fill; p8.OnChangedProperty += OnChangedProperty; splitContainer2.Panel2.Controls.Add(p8); _questionPanel = p8; break; } _uc = lo[type]; splitContainer1.Panel2.Controls.Add(_uc); splitContainer1.Panel2.Invalidate(); splitContainer2.Panel2.Invalidate(); }