public override void Awake() { sharePanel = GetComponent <SharePanel>(); requestCode = RequestCode.Share; actionCode = ActionCode.UpdateShare; base.Awake(); }
public ShareItem Set(SharePanel sharePanel, Sprite image, string content, string name) { this.sharePanel = sharePanel; this.image.sprite = image; this._content.text = content; this.name.text = name; return(this); }
/// <summary> /// Removes a control panel /// </summary> /// <param name="panel">Panel to delete</param> public void RemovePanel(SharePanel panel) { if (!this.panels.Contains(panel)) { throw new Exception("Control don't constain this panel"); } //Panel is deleted int index = this.panels.IndexOf(panel); this.panels.Remove(panel); this.Controls.Remove(panel); //Depending of the panels that are... switch (this.panels.Count) { case 0: //If there is no panel left, the control will Self-hide this.Visible = false; this.panelSelected = -1; break; case 1: //If a panel remains, the Panel2 is hidden and the selector switches 2 1 and 3 1 are updated this.panel2.Visible = false; this.panelSelector2_1.Text = panels[0].Tittle; this.panelSelector3_1.Text = panels[0].ShortTittle; //Selects the single pane that there is this.SelectPanel(0); break; case 2: //If two panels remain, the panel3 is hidden, the Panel2 is displayed and the selectors 2 1, 3 1, 2 2 and 3 2 are updated this.panel2.Visible = true; this.panel3.Visible = false; this.panelSelector2_1.Text = panels[0].Tittle; this.panelSelector3_1.Text = panels[0].ShortTittle; this.panelSelector2_2.Text = panels[1].Tittle; this.panelSelector3_2.Text = panels[1].ShortTittle; //The new panel is selected based on the previously selected and the deleted panel if (this.panelSelected == 2) { this.SelectPanel(1); } else if ((this.panelSelected == 1) && (index == 1)) { this.SelectPanel(1); } else { this.SelectPanel(0); } break; } }
/// <summary> /// Add a new panel to the control /// </summary> /// <param name="panel">Panel to include</param> public void AddPanel(SharePanel panel) { if (this.panels.Count >= MAX_PANELS) { throw new Exception("This control can only have 3 panels"); } //The control is initialized and added to the Panel list panel.Location = new Point(6, 30); panel.Size = new Size(BOX_WIDTH - 12, this.Height - 60); panel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; this.Controls.Add(panel); this.panels.Add(panel); //Depending on the number of panels that have been incializa the control in different ways switch (this.panels.Count) { case 1: //If the first panel displays the control and initializes the 2 1 and 3 1 panel selectors base.Visible = true; this.panelSelector2_1.Text = panel.Tittle; this.panelSelector3_1.Text = panel.ShortTittle; this.panelSelector3_1.ToolTip = panel.Tittle; break; case 2: //If there are already two panels, the 2 2 and 2 3 panel selectors are Inciailizan and the Panel2 is displayed. this.panelSelector2_1.Selected = false; this.panelSelector2_2.Selected = true; this.panel2.Visible = true; this.panelSelector2_2.Text = panel.Tittle; this.panelSelector3_2.Text = panel.ShortTittle; this.panelSelector3_2.ToolTip = panel.Tittle; break; case 3: //If there are three panels, the 3 3 selector is initialized, the Panel2 is hidden and the panel3 is displayed this.panelSelector3_1.Selected = false; this.panelSelector3_2.Selected = false; this.panelSelector3_3.Selected = true; this.panel2.Visible = false; this.panel3.Visible = true; this.panelSelector3_3.Text = panel.ShortTittle; this.panelSelector3_3.ToolTip = panel.Tittle; break; } //Selects the last panel included this.SelectPanel(this.panels.Count - 1); }
/// <summary> /// Builder /// </summary> /// <param name="panel">Shared Box Panel</param> public SharePanelEventArgs(SharePanel panel) { this.panel = panel; }