public CuiElementContainer ToStaticContainer(PanelTypes type) { CuiElementContainer container = new CuiElementContainer(); container.Add(new CuiElement { Name = UniqueElementName(ContainerTypes.Static, ContainerParent, type.ToString()), Parent = ContainerParent, Components = { new CuiImageComponent { Color = backgroundColor }, transform.ToRectComponent() } }); container.Add(new CuiElement { Name = UniqueElementName(ContainerTypes.Static, ContainerParent, type.ToString() + "Icon"), Parent = UniqueElementName(ContainerTypes.Static, ContainerParent, type.ToString()), Components = { icon.ToImageComponent(type.ToString()), icon.ToRectComponent() } }); return(container); }
public void OnSubPanelSaved(string strPanelType) { switch (strPanelType) { case "Columns": this.LastPanelTypeOnSaved = PanelTypes.Columns; break; case "ForeignKeys": this.LastPanelTypeOnSaved = PanelTypes.ForeignKeys; break; case "PrimaryKey": this.LastPanelTypeOnSaved = PanelTypes.PrimaryKey; break; case "Indexes": this.LastPanelTypeOnSaved = PanelTypes.Indexes; break; case "AppProperties": this.LastPanelTypeOnSaved = PanelTypes.AppProperties; break; default: this.LastPanelTypeOnSaved = PanelTypes.NotSet; break; } this.Open(); }
private void CreateContent(PanelTypes type, string elementName, string caption, string id, Control container) { Control ctrl = null; switch (type) { case PanelTypes.TextBoxPanel: if (elementName != "TextItem") { throw new XmlException("Element " + elementName + " not expected"); } ctrl = new Label(); ctrl.Text = caption; container.Controls.Add(ctrl); ctrl = new TextBox(); ctrl.Name = id; ctrl.Dock = DockStyle.Fill; container.Controls.Add(ctrl); break; case PanelTypes.GroupSelectionPanel: if (elementName != "SelectionItem") { throw new XmlException("Element " + elementName + " not expected"); } ctrl = new RadioButton(); ctrl.Name = id; ctrl.Text = caption; ctrl.Margin = new Padding(3, 0, 3, 0); container.Controls.Add(ctrl); break; case PanelTypes.CheckBoxListPanel: if (elementName != "SelectionItem") { throw new XmlException("Element " + elementName + " not expected"); } ((CheckedListBox)container).Items.Add( new CheckBoxListItem(caption, id)); break; case PanelTypes.LargeTextBoxPanel: if (elementName != "TextItem") { throw new XmlException("Element " + elementName + " not expected"); } ctrl = new TextBox(); ctrl.Dock = DockStyle.Fill; ((TextBox)ctrl).WordWrap = true; ((TextBox)ctrl).AcceptsReturn = true; ((TextBox)ctrl).Multiline = true; ctrl.Height *= 3; container.Controls.Add(ctrl); break; } }
public Panel(string tableName, int panelId, PanelTypes type, List<Panel> children, List<IField> fields, List<Control> controls, List<string> PKColNames, DataRow PK = null, Panel parent = null) { this.tableName = tableName; this.panelId = panelId; this.children = children; this.fields = fields; this.controls = controls; this.PKColNames = PKColNames; this.PK = PK; this.parent = parent; this.type = type; if (this.controls == null) this.controls = new List<Control>(); if (this.fields == null) this.fields = new List<IField>(); if (this.PKColNames == null) this.PKColNames = new List<string>(); if (this.children == null) this.children = new List<Panel>(); foreach (Panel child in this.children) { child.parent = this; } foreach (IField f in this.fields) { f.Panel = this; } foreach (Control c in this.controls) { c.panel = this; } }
// ================================================================ // Start / Destroy // ================================================================ void Start() { // Open the last panel that was open! PanelTypes lastPanelOpenType = (PanelTypes)SaveStorage.GetInt(SaveKeys.LastPanelOpen); string lastSetName = SaveStorage.GetString(SaveKeys.LastStudySetOpenName); StudySet lastSet = dm.library.GetSetByName(lastSetName); if (lastSet != null && lastPanelOpenType == PanelTypes.EditSet) { OpenPanel_EditSet(lastSet); } else if (lastSet != null && lastPanelOpenType == PanelTypes.StudyFlashcards) { OpenPanel_StudyFlashcards(lastSet); } else { OpenPanel_ChooseSet(); } // Add event listeners. GameManagers.Instance.EventManager.OpenPanelEditSetEvent += OpenPanel_EditSet; GameManagers.Instance.EventManager.OpenPanelChooseSetEvent += OpenPanel_ChooseSet; GameManagers.Instance.EventManager.OpenPanelStudyFlashcardsEvent += OpenPanel_StudyFlashcards; }
public PanelBase GetPanel(PanelTypes panelType) { if (panelInstancesDic.ContainsKey(panelType) && panelInstancesDic[panelType] != null) { return(panelInstancesDic[panelType]); } return(null); }
public ChildrenPanel(DataPanel dataPanel, DataChildrenPanel dataChildrenPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { AddButtonListener(); } catch (System.NullReferenceException) { } }
public GamePanel(DataPanel dataPanel, DataGamePanel menuPanel, PanelTypes panelTypes) : base(dataPanel, panelTypes) { try { AddButtonListener(); ShowPanel(); } catch (System.NullReferenceException) { } }
public SectionsPanel(DataPanel dataPanel, DataSectionsPanel dataSectionsPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { AddButtonListener(); this.dataSectionsPanel = dataSectionsPanel; } catch (System.NullReferenceException) { } }
public EndGamePanel(DataPanel dataPanel, DataEndGamePanel dataEndGamePanel, PanelTypes panelType) : base(dataPanel, panelType) { try { dataPanel.DataPanelBtns[0].BtnPanel.onClick.AddListener(BackToMenu); } catch (System.NullReferenceException) { } }
public LevelsPanel(DataPanel dataPanel, DataSetLevelsPanel levelsPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { this.levelsPanel = levelsPanel; SetInfoPanel(); AddButtonListener(); } catch (System.NullReferenceException) { } }
public ExitPanel(DataPanel dataPanel, DataExitPanel dataExitPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { AddButtonListener(); this.dataExitPanel = dataExitPanel; dataExitPanel.ExitBtn.onClick.AddListener(ExitApp); } catch (System.NullReferenceException) { } }
/// <summary>Constructor call for the PanelData struct.</summary> /// <param name="backgroundRect">The data for the CuiRectTransformComponent for the background of the panel.</param> /// <param name="backgroundImage">The data for the CuiImageComponent for the background of the panel.</param> /// <param name="iconRect">The data for the CuiRectTransformComponent for the icon of the panel.</param> /// <param name="iconImage">The data for the CuiImageComponent for the icon of the panel.</param> /// <param name="textRect">The data for the CuiRectTransformComponent for the text of the panel.</param> /// <param name="textText">The data for the CuiTextComponent for the text of the panel.</param> public PanelData(PanelTypes panelType, Dictionary <string, object> backgroundRect, Dictionary <string, object> backgroundImage, Dictionary <string, object> iconRect, Dictionary <string, object> iconImage, Dictionary <string, object> textRect, Dictionary <string, object> textText) { this.panelType = panelType; this.backgroundRect = backgroundRect; this.backgroundImage = backgroundImage; this.iconRect = iconRect; this.iconImage = iconImage; this.textRect = textRect; this.textText = textText; }
public InfoPanel(DataPanel dataPanel, DataInfoPanel dataInfoPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { this.DataInfoPanel = dataInfoPanel; SetTextInfo(); dataPanel.DataPanelBtns[0].BtnPanel.onClick.AddListener(HidePanel); dataPanel.DataPanelBtns[1].BtnPanel.onClick.AddListener(ShowPanel); } catch (System.NullReferenceException) { } }
public void SwitchPanel(PanelTypes panelType) { //Debug.Log(panelStack.Count); if (panelInstancesDic.ContainsKey(panelType) && panelInstancesDic[panelType] != null) { PopPanel(); } else { PushPanel(panelType); } }
public void LoadForm() { // Dispose the child controls. foreach (Control ctrl in targetContainer.Controls) { ctrl.Dispose(); } try { // Load the form into memory. XmlDocument doc = new XmlDocument(); doc.Load(fileName); // Iterate over panel nodes. foreach (XmlNode nodePanel in doc.DocumentElement.ChildNodes) { // Convert the element name into the appropriate enum value. PanelTypes type = (PanelTypes)Enum.Parse(typeof(PanelTypes), nodePanel.LocalName); // Check for caption node. string caption = CheckForAttribute(nodePanel, "caption"); // Create the container for this survey element. // It's placed into the next available cell. Control container = CreateContainer(type, caption); container.SuspendLayout(); // Iterate over the nested nodes. foreach (XmlNode nodeItem in nodePanel.ChildNodes) { // Get the node information. string id = CheckForAttribute(nodeItem, "id"); caption = CheckForAttribute(nodeItem, "caption"); if (caption == "") { caption = id; } // Create the content inside the survey element. CreateContent(type, nodeItem.LocalName, caption, id, container); } container.ResumeLayout(); } } catch (Exception err) { MessageBox.Show("Failure parsing file.\n" + err.Message); } }
private void SetSelectDevice(Device device) { if (this.InvokeRequired) { this.Invoke((Delegate) new Config.SetSelectDeviceDele(this.SetSelectDevice), (object)device); } else { switch (device.lastPanelType) { case "Log Out": this.treeView1.SelectedNode = this.treeView1.Nodes[0]; break; } if (this.myPanel1.SelectDevice == device) { return; } this.canNotChange = true; this.treeView1.Nodes[3].Nodes.Clear(); Controller.GetChannels(device); if (device.ChannelList.Count == 0) { Program.ShowMessage("No Serial!", true); this.Close(); } else { for (int index = 0; index < device.ChannelList.Count; ++index) { this.treeView1.Nodes[3].Nodes.Add("Channel" + device.ChannelList[index].getChannelName()); this.treeView1.Nodes[3].Nodes[index].Nodes.Add("Hostlist" + device.ChannelList[index].getChannelName()); this.treeView1.Nodes[3].Nodes[index].Nodes.Add("Serial Setting" + device.ChannelList[index].getChannelName()); this.treeView1.Nodes[3].Nodes[index].Nodes.Add("Connection" + device.ChannelList[index].getChannelName()); if (index == 0) { this.channelID = device.ChannelList[index].GetChannelNum(); } } this.setNodeVisable("Pins Configurations", device.CanPins); this.setNodeVisable("Email", device.CanEmail); this.setNodeVisable("GPRS Setting", device.CanGPRS); this.setNodeVisable("PPP Setting", device.CanPPP); this.setNodeVisable("PPPOE Setting", device.CanPPPOE); this.treeView1.SelectedNode = this.GetSelectNode(device.lastPanelType, this.treeView1.Nodes); this.panelType = this.GetPanelType(this.treeView1.SelectedNode.Text, ref this.channelID); this.canNotChange = false; this.myPanel1.SetSelectDevice(device, this.panelType, this.channelID); } } }
public XmlComponent(Panel panel, Dictionary <String, IXmlComponent> idList, String Namespace) { _panel = panel; if (_panel is FlowLayoutPanel) { _panelType = PanelTypes.Flow; } else { _panelType = PanelTypes.Panel; } _namespace = Namespace; _idList = idList; }
public AddChildPanel(DataPanel dataPanel, DataAddChildPanel dataAddChildPanel, PanelTypes panelType) : base(dataPanel, panelType) { try { this.dataAddChildPanel = dataAddChildPanel; AddButtonListener(); dataAddChildPanel.BtnCancel.onClick.AddListener(() => AddChild(false)); dataAddChildPanel.BtnAddChild.onClick.AddListener(() => AddChild(true)); } catch (System.NullReferenceException) { } }
/// <summary> /// Builds the CSS. /// </summary> /// <returns></returns> private string BuildCss() { StringBuilder classes = new StringBuilder("panel"); PanelTypes panelType = GetPanelType(); if (panelType != PanelTypes.Default) { classes.Append(" panel-"); classes.Append(StringHelper.ToLower(panelType)); } StringHelper.AppendWithSpaceIfNotEmpty(classes, this.CssClass); return(classes.ToString()); }
public void PushPanel(PanelTypes panelType) { while (panelStack.Count > 0 && panelStack.Peek() == null) { panelStack.Pop(); } if (panelStack.Count > 0) { panelStack.Peek().OnPause(); } var panel = getPanel(panelType); panel.OnEnter(); panelStack.Push(panel); }
/// <summary> /// Disable all panels not marked as alwaysVisible and enable the first panel of the specified type. /// If no panel of the type is found, the panels will be left unchanged. /// </summary> /// <param name="_type"></param> public void EnablePanelByType(PanelTypes _type) { foreach (PanelDetails _panel in panels) { if (_panel.type == _type) { DisablePanels(); _panel.panelObject.SetActive(true); ExtraEnableFunctionality(_panel); return; //if more than one of this type, only enable first one } } }
private CuiElementContainer GetStaticContainer(PanelTypes type) { switch (type) { default: return(new CuiElementContainer()); case PanelTypes.Active: return(panelsConfig.active.ToStaticContainer(type)); case PanelTypes.Sleeping: return(panelsConfig.sleeping.ToStaticContainer(type)); case PanelTypes.Clock: return(panelsConfig.clock.ToStaticContainer(type)); } }
public void LoadInstalledPanel(PanelTypes panelType, PanelDatabase sourceDatabase) { var variation = variationList.Where(m => m.Item1 == panelType && m.Item2 == sourceDatabase.Provider).FirstOrDefault(); if (variation != null) { PanelType = variation.Item1; CurrentPanel = variation.Item4; PanelData = variation.Item3; PanelData.LoadConnectionString(sourceDatabase.ConnectionString()); } else { throw new Exception(String.Format("Panel not supported: {0} - {1}", panelType, sourceDatabase.Provider)); } }
public CuiElementContainer ToDynamicContainer(PanelTypes type, params StringPlus.ReplacementData[] replacements) { CuiElementContainer container = new CuiElementContainer(); string textData = StringPlus.Replace(text.text, replacements); container.Add(new CuiElement { Name = UniqueElementName(ContainerTypes.Dynamic, ContainerParent, type.ToString()), Parent = ContainerParent, Components = { text.ToTextComponent(textData), text.ToRectComponent() } }); return(container); }
// Update Visuals public void UpdateTabHighlighted(PanelTypes panelType) { // Unhighlight all first. b_appSettings.ShowHighlight(false); b_chooseSet.ShowHighlight(false); b_editSet.ShowHighlight(false); b_search.ShowHighlight(false); b_studyFlashcards.ShowHighlight(false); // Only highlight the relevant one! switch (panelType) { case PanelTypes.AppSettings: b_appSettings.ShowHighlight(true); break; case PanelTypes.ChooseSet: b_chooseSet.ShowHighlight(true); break; case PanelTypes.EditSet: b_editSet.ShowHighlight(true); break; case PanelTypes.SearchTerms: b_search.ShowHighlight(true); break; case PanelTypes.StudyFlashcards: b_studyFlashcards.ShowHighlight(true); break; default: Debug.LogWarning("Whoa! No tab in BottomTabBar for this panel: " + panelType); break; } // Now, importantly, update interactability of set-dependent buttons. bool isASet = GameManagers.Instance.DataManager.CurrSet != null; b_editSet.interactable = isASet; b_studyFlashcards.interactable = isASet; }
private PanelBase getPanel(PanelTypes paneltype) { if (panelInstancesDic.ContainsKey(paneltype) && panelInstancesDic[paneltype] != null) { return(panelInstancesDic[paneltype]); } var panel = ResManager.Get().Load <GameObject>("Prefabs/UI/Panels/" + panelPrefabsPathDic[paneltype]); var panelbase = panel.GetComponent <PanelBase>(); if (panelInstancesDic.ContainsKey(paneltype)) { panelInstancesDic[paneltype] = panelbase; } else { panelInstancesDic.Add(paneltype, panelbase); } panelbase.transform.SetParent(Layer(panelbase.Layer), false); return(panelbase); }
/// <summary>Reinitializes the static Ui.</summary> /// <param name="key">The key of the icon (equal to the panel it belongs to).</param> /// <param name="value">The value of the icon.</param> private void IconLoaded(string key, string value) { PanelTypes type = EnumPlus.ToEnum <PanelTypes>(key); for (int i = 0; i < BasePlayer.activePlayerList.Count; i++) { CuiHelper.DestroyUi(BasePlayer.activePlayerList[i], UniqueElementName(ContainerTypes.Static, ContainerParent, type.ToString())); } staticContainers[(int)type] = GetStaticContainer(type); for (int j = 0; j < BasePlayer.activePlayerList.Count; j++) { if (!BasePlayer.activePlayerList[j].IsDead()) { CuiHelper.AddUi(BasePlayer.activePlayerList[j], staticContainers[(int)type]); UpdateField(BasePlayer.activePlayerList[j], type); } } }
/// <summary>Start a function that repeats updating a panel for each active player.</summary> /// <param name="panelType">The panel that should be updated.</param> /// <param name="updateInterval">The time in between updating the panel in milliseconds.</param> private void StartRepeatingFieldUpdate(PanelTypes panelType, float updateInterval) { // Updates the time if the repeating panel is the clock. if (panelType == PanelTypes.Clock) { TIME = TIME_RAW; } for (int i = 0; i < BasePlayer.activePlayerList.Count; i++) { if (!BasePlayer.activePlayerList[i].IsSleeping()) { UpdateField(BasePlayer.activePlayerList[i], panelType); } } timer.Once(updateInterval / 1000f, () => { StartRepeatingFieldUpdate(panelType, updateInterval); }); }
public Panel(string tableName, int panelId, PanelTypes type, List <Panel> children, List <IField> fields, List <Control> controls, List <string> PKColNames, DataRow PK = null, Panel parent = null) { this.tableName = tableName; this.panelId = panelId; this.children = children; this.fields = fields; this.controls = controls; this.PKColNames = PKColNames; this.PK = PK; this.parent = parent; this.type = type; if (this.controls == null) { this.controls = new List <Control>(); } if (this.fields == null) { this.fields = new List <IField>(); } if (this.PKColNames == null) { this.PKColNames = new List <string>(); } if (this.children == null) { this.children = new List <Panel>(); } foreach (Panel child in this.children) { child.parent = this; } foreach (IField f in this.fields) { f.Panel = this; } foreach (Control c in this.controls) { c.panel = this; } }
/// <summary>Updates the player's panel.</summary> /// <param name="player">The player for who the panel should be updated.</param> /// <param name="panel">The panel type that should be updated.</param> private void UpdateField(BasePlayer player, PanelTypes panel) { List <StringUtilities.ReplacementData> replacements = new List <StringUtilities.ReplacementData>(); switch (panel) { case PanelTypes.Active: replacements.Add(new StringUtilities.ReplacementData(replacementPrefix + FieldTypes.PlayersActive.ToString().ToUpper() + replacementSufix, BasePlayer.activePlayerList.Count.ToString())); replacements.Add(new StringUtilities.ReplacementData(replacementPrefix + FieldTypes.PlayerMax.ToString().ToUpper() + replacementSufix, ConVar.Server.maxplayers.ToString())); break; case PanelTypes.Sleeping: replacements.Add(new StringUtilities.ReplacementData(replacementPrefix + FieldTypes.PlayersSleeping.ToString().ToUpper() + replacementSufix, BasePlayer.sleepingPlayerList.Count.ToString())); break; case PanelTypes.Clock: replacements.Add(new StringUtilities.ReplacementData(replacementPrefix + FieldTypes.Time.ToString().ToUpper() + replacementSufix, TIME)); break; } UpdateField(player, panelsData[(int)panel], replacements.ToArray()); }
private Control CreateContainer(PanelTypes type, string caption) { // Represents the top-level container // (a TableLayoutPanel or FlowLayoutPanel, // depending on the survey element). TableLayoutPanel pnlTable = null; FlowLayoutPanel pnlFlow = null; // Represents the control object that contains // the rest of the survey content. // Often, this is the same as the top-level // container, but not so with the CheckBoxList. // For this survey element, a FlowLayoutPanel // hosts the caption and CheckBoxList, but // the CheckBoxList is container for survey elements, // not the FlowLayoutPanel. Control container = null; // Represents a caption that can be inserted at // the top of the panel. Label lblCaption; switch (type) { case PanelTypes.TextBoxPanel: pnlTable = new TableLayoutPanel(); pnlTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset; pnlTable.ColumnCount = 2; // When created programmatically, a TableLayoutPanel // has no ColumnStyle objects. // In this case, they're added to ensure the // label column sizes to fits its content and // the text box column fills all the remaining space //pnlTable.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); //pnlTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); // Make sure the full width of the form is used // for the text box. pnlTable.Anchor = AnchorStyles.Left | AnchorStyles.Right; container = pnlTable; break; case PanelTypes.GroupSelectionPanel: pnlFlow = new FlowLayoutPanel(); // Each radio button should take // a full line. pnlFlow.FlowDirection = FlowDirection.TopDown; // Add a caption. lblCaption = new Label(); lblCaption.Text = caption; lblCaption.AutoSize = true; pnlFlow.Controls.Add(lblCaption); container = pnlFlow; break; case PanelTypes.CheckBoxListPanel: pnlTable = new TableLayoutPanel(); // Size the table to fill the content. //pnlTable.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); //pnlTable.RowStyles.Add(new RowStyle(SizeType.AutoSize, 0)); pnlTable.ColumnCount = 1; // Add a caption. lblCaption = new Label(); lblCaption.Text = caption; lblCaption.AutoSize = true; pnlTable.Controls.Add(lblCaption); // Add the checkbox list. CheckedListBox checks = new CheckedListBox(); checks.AutoSize = true; pnlTable.Controls.Add(checks); container = checks; break; case PanelTypes.LargeTextBoxPanel: pnlTable = new TableLayoutPanel(); // Size the table to fill the available area. //pnlTable.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 100)); //pnlTable.RowStyles.Add(new RowStyle(SizeType.AutoSize, 100)); pnlTable.ColumnCount = 1; //pnlTable.Width = pnlForm.Width; pnlTable.Anchor = AnchorStyles.Left | AnchorStyles.Right; // Add a caption. lblCaption = new Label(); lblCaption.Text = caption; lblCaption.AutoSize = true; pnlTable.Controls.Add(lblCaption); container = pnlTable; break; } // Add the top-level container (the // FlowLayoutPanel or TableLayoutPanel) // to the table. Panel pnl = null; if (pnlTable != null) { pnl = pnlTable; } else { pnl = pnlFlow; } pnl.AutoSize = true; pnl.Margin = new Padding(7); targetContainer.Controls.Add(pnl); // Return the container control, so more content can // be inserted inside it. return container; }
private void CreateContent(PanelTypes type, string elementName, string caption, string id, Control container) { Control ctrl = null; switch (type) { case PanelTypes.TextBoxPanel: if (elementName != "TextItem") throw new XmlException("Element " + elementName + " not expected"); ctrl = new Label(); ctrl.Text = caption; container.Controls.Add(ctrl); ctrl = new TextBox(); ctrl.Name = id; ctrl.Dock = DockStyle.Fill; container.Controls.Add(ctrl); break; case PanelTypes.GroupSelectionPanel: if (elementName != "SelectionItem") throw new XmlException("Element " + elementName + " not expected"); ctrl = new RadioButton(); ctrl.Name = id; ctrl.Text = caption; ctrl.Margin = new Padding(3, 0, 3, 0); container.Controls.Add(ctrl); break; case PanelTypes.CheckBoxListPanel: if (elementName != "SelectionItem") throw new XmlException("Element " + elementName + " not expected"); ((CheckedListBox)container).Items.Add( new CheckBoxListItem(caption, id)); break; case PanelTypes.LargeTextBoxPanel: if (elementName != "TextItem") throw new XmlException("Element " + elementName + " not expected"); ctrl = new TextBox(); ctrl.Dock = DockStyle.Fill; ((TextBox)ctrl).WordWrap = true; ((TextBox)ctrl).AcceptsReturn = true; ((TextBox)ctrl).Multiline = true; ctrl.Height *= 3; container.Controls.Add(ctrl); break; } }