protected override void Awake() { base.Awake(); slidingPanel = this.transform.GetComponentInParent <SlidingPanel>(); rectTransform = this.GetComponent <RectTransform>(); timeSlot = this.GetComponent <TimeSlot>(); }
private void Start() { SlidingPanel slidingPanel = this.m_slidingPanel; slidingPanel.m_closedAction = (Action)Delegate.Combine(slidingPanel.m_closedAction, new Action(this.HidePanel)); this.m_characterName.text = Singleton <CharacterData> .instance.CharacterName.ToUpper(); }
void Start() { _panel = GetComponent <SlidingPanel>(); _id = GetComponentInParent <RootIdHolder>().id; _panel.onOpen += CreateLine; _panel.onClose += ClearLine; bpmSlider.onValueChange = v => Roots.Root[_id].pulse.Bpm = Mathf.Round(v); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
private void Start() { SlidingPanel slidingPanel = this.m_slidingPanel; slidingPanel.m_closedAction = (Action)Delegate.Combine(slidingPanel.m_closedAction, new Action(this.HidePanel)); this.m_characterName.text = Singleton <CharacterData> .instance.CharacterName; this.m_viewCharacterObj.SetActive(!Singleton <Login> .instance.GetBnPortal().Equals("cn", StringComparison.OrdinalIgnoreCase)); if (this.m_viewCharacterText != null) { this.m_viewCharacterText.text = StaticDB.GetString("SETTINGS_VIEW_CHARACTER", "[PH]VIEW CHARACTER").Replace("&s", Singleton <CharacterData> .instance.CharacterName); } }
public IEnumerator MoveThis(Vector2 originalMousePos) { int originalStartTime = timeSlot.data.startTime; float originalBoxPos = rectTransform.position.y; RectTransform currentPanel = GetCurrentPanel(); while (InputManager.IsHeld()) { Vector3 newPosition = rectTransform.position; newPosition.y = originalBoxPos + InputManager.GetPosition().y - originalMousePos.y; newPosition.y = Mathf.Clamp(newPosition.y, currentPanel.position.y - currentPanel.sizeDelta.y + rectTransform.sizeDelta.y, currentPanel.position.y); newPosition.x = currentPanel.position.x; rectTransform.position = newPosition; rectTransform.localPosition = new Vector3(rectTransform.localPosition.x, Mathf.Round(rectTransform.localPosition.y / 5) * 5); this.transform.SetParent(currentPanel, true); currentPanel = GetCurrentPanel(); timeSlot.SetFromRect(); yield return(null); } bool deleted = false; if (currentPanel == PanelManager.S.panelA) { Avian.S.OnEventDeleted(timeSlot.data.id); deleted = true; DestroyImmediate(this.gameObject); } else { this.transform.SetParent(PanelManager.S.panelB, true); slidingPanel = this.transform.GetComponentInParent <SlidingPanel>(); } TimeManager.S.SaveDay(); if (deleted) { yield break; } if (firstPlace) { Avian.S.OnEventCreated(timeSlot.data.id); firstPlace = false; } else { Avian.S.OnEventMoved(timeSlot.data.id, timeSlot.data.startTime - originalStartTime); } }
private void SlidingPanel_Tick(object sender, EventArgs e) { //Deplasarea panourilor if (UpComingPanel.Left <= 10) { UpGoingPanel.Dispose(); UpComingPanel.Dock = DockStyle.Fill; SlidingPanel.Stop(); } else { UpComingPanel.Left -= speed; UpGoingPanel.Left -= speed + 10; speed = UpComingPanel.Left / 6; if (speed <= 1) { speed = 1; } } }
void Start() { _panel = GetComponent <SlidingPanel>(); _direction = GetComponentInParent <DirectionIdHolder>().id; _panel.onOpen += DrawLines; _panel.onClose += ClearLines; GameManager.OnNextFrame += () => { _id = GetComponentInParent <RootIdHolder>().id; var rootBlock = Roots.Root[_id].block; var soundsPlayer = rootBlock.soundsPlayer; var config = soundsPlayer.Configs[_direction]; rate.InitValue(config.Rate); volume.InitValue(config.Volume * 100); rate.onValueChange += v => config.Rate = Mathf.RoundToInt(v); volume.onValueChange += v => config.Volume = v / 100; rate.onClick += () => soundsPlayer.Play(_direction); volume.onClick += () => soundsPlayer.Play(_direction); }; }
private void RandomMelodie() { //-----------------< Extrage o melodie si completeaza un panou cu informatii despre melodia respectiva >----------------- if (melodii.Count == 0) { CurrentId = -1; } else { //UpgoingPanel este panoul care va iesi din limitele ecranului atunci cand //se va trece la urmatoarea melodie if (UpGoingPanel == null) { Panel empty = new Panel(); empty.Width = panelSondaj.Width; panelSondaj.Controls.Add(empty); } else { UpGoingPanel.Dispose(); } UpGoingPanel = panelSondaj.Controls[0] as Panel; UpGoingPanel.Dock = DockStyle.None; //Melodiile for fi extrase una cate una, in mod aleator Random rnd = new Random(); int randomIndex = rnd.Next(0, melodii.Count); Melodie random = melodii[randomIndex]; CurrentId = randomIndex; //Panoul pentru afisarea informatiilor despre melodie Panel info = new Panel(); info.AutoScroll = true; info.Width = panelSondaj.Width; info.Height = panelSondaj.Height; //Label pentru afisarea Denumirii Label Denumire = new Label(); Denumire.Dock = DockStyle.Top; Denumire.Text = random.Denumire; Denumire.Font = new Font("Leelawadee", 20); Denumire.AutoSize = true; Denumire.MaximumSize = new Size(panelSondaj.Width, 0); //Label pentru afisarea Interpretului Label Interpret = new Label(); Interpret.Dock = DockStyle.Top; Interpret.Text = String.Format("\t" + random.Interpret); Interpret.Font = new Font("Leelawadee", 15); Interpret.ForeColor = Color.LightGray; Interpret.AutoSize = true; Interpret.MaximumSize = new Size(panelSondaj.Width, 0); //Label care va servi drept bara de subliniere Label bar = new Label(); bar.Height = 1; bar.Dock = DockStyle.Top; bar.Width = Denumire.Width; bar.BackColor = Color.WhiteSmoke; //Label pentru afisarea Genului Muzical Label Gen = new Label(); Gen.Dock = DockStyle.Top; Gen.Text = String.Format($"Genul muzical: {random.GenMuzical}"); Gen.Font = new Font("Leelawadee", 13); Gen.ForeColor = Color.LightGray; Gen.MaximumSize = new Size(info.Width, 0); Gen.Padding = new Padding(20); Gen.AutoSize = true; Gen.MaximumSize = new Size(panelSondaj.Width, 0); //Panoul care va contine 2 elemente, 1: Textul "Pozitia in Top", 2: Un comboBox //pentru alegerea pozitiei Panel comboPanel = new Panel(); comboPanel.Dock = DockStyle.Top; comboPanel.Padding = new Padding(20); //Label pentru afisarea mesajului Label Text = new Label(); Text.Dock = DockStyle.Left; Text.Text = "Pozitia in TOP: "; Text.Font = new Font("Leelawadee", 15); Text.ForeColor = Color.LightGray; Text.AutoSize = true; //ComboBox-ul pentru selectarea pozitiei ComboBox cmbPozitieTop = new ComboBox(); cmbPozitieTop.Dock = DockStyle.Top; cmbPozitieTop.MaximumSize = new Size(50, 50); for (int i = 1; i <= nrMelodiiInitial; i++) { cmbPozitieTop.Items.Add(i); } cmbPozitieTop.BackColor = Color.FromArgb(10, 7, 36); cmbPozitieTop.Font = new Font("Leelawadee", 15); cmbPozitieTop.ForeColor = Color.WhiteSmoke; cmbPozitieTop.DropDownStyle = ComboBoxStyle.DropDownList; cmbPozitieTop.Width = 50; cmbPozitieTop.Dock = DockStyle.Left; cmbPozitieTop.SelectedValueChanged += cmb_ValueChanged; comboPanel.Controls.Add(cmbPozitieTop); comboPanel.Controls.Add(Text); info.Controls.Add(comboPanel); //Label pentru afisarea informatiilor suplimentare if (random.Informatii != "") { Label Informatii = new Label(); Informatii.Dock = DockStyle.Top; Informatii.Text = String.Format($"Informatii: {random.Informatii}"); Informatii.Font = new Font("Leelawadee", 13); Informatii.ForeColor = Color.LightGray; Informatii.Padding = new Padding(20); Informatii.AutoSize = true; Informatii.MaximumSize = new Size(panelSondaj.Width, 0); info.Controls.Add(Informatii); } //Inserarea elementelor mai sus declarate in panoul parinte info.Controls.Add(Gen); info.Controls.Add(bar); info.Controls.Add(Interpret); info.Controls.Add(Denumire); panelSondaj.Controls.Add(info); speed = Width / 15; //UpComingPanel va fi panoul ce se va deplasa din dreapta catre mijlocul ecranului. UpComingPanel = info; UpComingPanel.Left = Width; //Declansarea animatiei de schimbare a melodiei afisate SlidingPanel.Start(); } }
private void Start() { slidingPanel = SlidingPanel.instance; }