public void PlayHit(AbstractGoTween t) { if (hasTypes.Contains(RLTypes.MONSTER)) { Camera.main.audio.PlayOneShot(AllTogether.instance().playerHurtAudio); } }
public void CompleteChoice() { if (Choices is null || !ChoicesVisible) { return; } string sc = Choices.ElementAtOrDefault(SelectedChoice); if (sc is null) { return; } if (start > end) { end = selection.Text.Length; } string newText = selection.Text.Substring(0, start); string curText = selection.Text.Substring(start, end - start); newText += sc; newText += selection.Text.Substring(end); selection.SelectionStart = start + sc.Length; selection.SelectionLength = 0; selection.Text = newText; SetBuffers2(newText); ChoicesVisible = false; AllTogether.Remove(choices); AllTogether.Remove(choicesBG); AllTogether.Remove(choicesSel); }
private void metroButton11_Click(object sender, EventArgs e) { try { string fileName = "dataList.bin"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog1.FileName; } else { return; } AllTogether at = new AllTogether() { listPart = this.list, devicesList = this.listDevices, schoolList = this.listSchool, wkList = this.listWK }; using (Stream stream = File.Open(fileName, FileMode.Create)) { BinaryFormatter bin = new BinaryFormatter(); bin.Serialize(stream, at); } } catch (IOException) { } }
public void HideChoices() { ShowingChoices = false; ChoicesVisible = false; AllTogether.Remove(choices); AllTogether.Remove(choicesBG); AllTogether.Remove(choicesSel); }
public void FinalKill(AbstractGoTween t = null) { if (!hasTypes.Contains(RLTypes.MONSTER) && !hasTypes.Contains(RLTypes.GOLD_PICKUP) && !hasTypes.Contains(RLTypes.HEALTH_PICKUP) && !hasTypes.Contains(RLTypes.ACTION_PICKUP) ) { Camera.main.audio.PlayOneShot(AllTogether.instance().playerDeathAudio); } Destroy(gameObject); }
public void SetSelectionSprite(StringDrawable sel) { selection = sel; sel.Layer = -1; AllTogether.Add(sel); }
public void UpdateChoices(float camx, float camy) { if (ShowingChoices) { if (!AllTogether.Contains(choices)) { AllTogether.Add(choices); AllTogether.Add(choicesBG); AllTogether.Add(choicesSel); } if (SelectedChoice >= Choices.Count) { SelectedChoice = Choices.Count - 1; } else if (SelectedChoice == -1) { SelectedChoice = 0; choiceScroll = 0; } if (SelectedChoice >= choiceScroll + 7) { choiceScroll = SelectedChoice - 6; } else if (SelectedChoice < choiceScroll) { choiceScroll = SelectedChoice; } if (selection.SelectionStart < start || selection.SelectionStart > end) { Choices = new List <string>(); } choicesBG.X = selection.SelectionX + 16 + (start - selection.SelectionStart) * 8; choicesBG.Y = selection.SelectionY + 16; StringBuilder sb = new StringBuilder(); for (int i = choiceScroll; i < choiceScroll + 7; i++) { if (Choices.Count() > i) { sb.Append(Choices.ElementAtOrDefault(i)); sb.Append('\n'); } } if (sb.Length > 1) { sb.Remove(sb.Length - 1, 1); } choices.Text = sb.ToString(); choicesBG.SetSize(Math.Max(choices.Width + 2, 64), choices.Height + 2); if (choicesBG.Right > Game.RESOLUTION_WIDTH + camx) { choicesBG.Right = Game.RESOLUTION_WIDTH + camx; } if (choicesBG.Bottom > Game.RESOLUTION_HEIGHT + camy) { choicesBG.Bottom = selection.SelectionY; } choices.X = choicesBG.X + 1; choices.Y = choicesBG.Y + 1; choicesSel.SetSize(choicesBG.Width - 2, 8 * choices.Size); bool iv = Choices.Count() > 0; choicesBG.Visible = choicesSel.Visible = choices.Visible = iv; choicesSel.X = choicesBG.X + 1; choicesSel.Y = choicesBG.Y + 1 + (8 * choices.Size * (SelectedChoice - choiceScroll)); ChoicesVisible = iv; } }