public void Activate(bool m_bool) { if (m_bool) { Name.SetActive(true); effect.SetActive(true); transform.GetChild(0).gameObject.SetActive(true); if (TooltipObject.GetComponent <MelodyBehaviour>() != null) { Melodies.Melody melody = TooltipObject.GetComponent <MelodyBehaviour>().melody; inspiration.SetActive(true); trance.SetActive(true); target.SetActive(true); type.SetActive(true); Name.GetComponent <Text>().text = Utils.SplitPascalCase(melody.name); effect.GetComponent <Text>().text = melody.effect; inspiration.GetComponent <Text>().text = stringInspiration(melody); trance.GetComponent <Text>().text = stringTrance(melody); type.GetComponent <Text>().text = "Tier " + melody.tier; //add trance melody possibility target.GetComponent <Text>().text = melodyTargetToString(melody.targetMode); } if (TooltipObject.GetComponent <InstrumentBehaviour>() != null) { Bard.Instrument instrument = TooltipObject.GetComponent <InstrumentBehaviour>().instrument; type.SetActive(true); Name.GetComponent <Text>().text = Utils.SplitPascalCase(instrument.name); effect.GetComponent <Text>().text = instrument.passif; type.GetComponent <Text>().text = instrument.type; } if (TooltipObject.GetComponent <SkillBehaviour>() != null) { Skills.Skill skill = TooltipObject.GetComponent <SkillBehaviour>().skill; target.SetActive(true); Name.GetComponent <Text>().text = Utils.SplitPascalCase(skill.name); effect.GetComponent <Text>().text = skill.description; target.GetComponent <Text>().text = skillTargetToString(skill.actions); } } else { Name.SetActive(false); effect.SetActive(false); target.SetActive(false); inspiration.SetActive(false); trance.SetActive(false); type.SetActive(false); transform.GetChild(0).gameObject.SetActive(false); } }
private void displayMelody(GameObject[] slotList, Melodies.Melody melody) { slot = slotList[findSlot(slotList)]; GameObject slottedSkill = slot.transform.GetChild(0).gameObject; slottedSkill.GetComponent <MelodyBehaviour>().melody = melody; slottedSkill.GetComponent <MelodyBehaviour>().IsClickable = false; slottedSkill.GetComponent <Image>().sprite = melody.sprite; slottedSkill.GetComponent <Image>().enabled = true; slot.GetComponent <SlotBehaviour>().Slotted = true; }
public void OnPointerClick(PointerEventData pointerEventData) { if (!IsClickable) { return; } if (transform.parent.GetComponent <SlotBehaviour>() != null) { this.melody = null; this.IsClickable = false; this.enabled = false; gameObject.GetComponent <Image>().sprite = null; gameObject.GetComponent <Image>().enabled = false; transform.parent.GetComponent <SlotBehaviour>().Slotted = false; transform.parent.GetComponentInParent <TheodoreMenuManager>().SelectedSkill -= 1; } else { if (findSlot(slottedSkills) == -1) { return; } slot = slottedSkills[findSlot(slottedSkills)]; GameObject slottedSkill = slot.transform.GetChild(0).gameObject; slottedSkill.GetComponent <MelodyBehaviour>().melody = melody; slottedSkill.GetComponent <MelodyBehaviour>().IsClickable = true; slottedSkill.GetComponent <MelodyBehaviour>().enabled = true; slottedSkill.GetComponent <Image>().color = GetComponent <Image>().color; slottedSkill.GetComponent <Image>().sprite = GetComponent <Image>().sprite; slottedSkill.GetComponent <Image>().enabled = true; slot.GetComponent <SlotBehaviour>().Slotted = true; currentSelected++; if (currentSelected == maxSelected) { IsClickable = false; } slottedSkill.GetComponent <Button>().onClick.AddListener(() => { IsClickable = true; currentSelected -= 1; }); slottedSkill.GetComponent <Button>().interactable = true; warning.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => { IsClickable = true; currentSelected = 0; }); transform.parent.GetComponentInParent <TheodoreMenuManager>().SelectedSkill += 1; } }
string stringTrance(Melodies.Melody melody) { int trance = melody.tranceValue; string s_trance; if (trance > 0) { s_trance = baseGeneration + trance + " de transe"; } else { s_trance = baseCosts + -trance + " de transe"; } return(s_trance); }
string stringInspiration(Melodies.Melody melody) { int inspi = melody.inspirationValue; string s_inspi; if (inspi > 0) { s_inspi = baseGeneration + inspi + " d'inspiration"; } else { s_inspi = baseCosts + -inspi + " d'inspiration"; } return(s_inspi); }
private NoteInfo CreateNote(string noteData, int index, Melody melody, float twoNotesDist) { int length = 1; NoteInfo note = null; if (noteData[index] != '-' && noteData[index] != '_') { // the last note is necessarily simple if (index == noteData.Length) { note = new NoteInfo { IsLongNote = false, Note = noteData[index], Melody = melody }; } else { // long if (noteData[index + 1] == '_') { while (noteData[index + length] == '_') { length++; } note = new NoteInfo { IsLongNote = true, Note = noteData[index], Melody = melody, Width = twoNotesDist * (length - 1) + 65 // there are n-1 spaces between n notes }; } // simple else { note = new NoteInfo { IsLongNote = false, Note = noteData[index], Melody = melody }; } } } //else if (noteData[index] == '-') score.Value += 1; return(note); }
public void selectSkills() { Melodies.Melody[] innateMelodies = new Melodies.Melody[4]; List <Bard.Instrument> instruments = new List <Bard.Instrument>(); int nMelody = 0; for (int i = 0; i < slots.Length; i++) { if (slots[i].InnateSkillSlot) { innateMelodies[nMelody] = slots[i].transform.GetComponentInChildren <MelodyBehaviour>().melody; nMelody++; } if (slots[i].InstrumentSlot) { instruments.Add(slots[i].transform.GetComponentInChildren <InstrumentBehaviour>().instrument); } } transform.GetComponentInParent <GuildeManagerBehaviour>().SetTheodore(innateMelodies, instruments); }
void Start() { if (GameObject.FindWithTag("Tooltip") != null) { instrumentTooltip = GameObject.FindWithTag("Tooltip").GetComponent <Tooltip>(); tooltipRectTransform = GameObject.FindWithTag("Tooltip").GetComponent <RectTransform>() as RectTransform; canvasRectTransform = tooltipRectTransform.parent.GetComponent <RectTransform>() as RectTransform; } if (instrument != null && IsClickable) { for (int i = 0; i < melodiesInstrument.Length; i++) { Melodies.Melody melody = instrument.melodies[i]; melodiesInstrument[i].GetComponent <MelodyBehaviour>().melody = melody; melodiesInstrument[i].GetComponent <Image>().sprite = melody.sprite; melodiesInstrument[i].GetComponent <Image>().color = new Color(1, 1, 1); melodiesInstrument[i].GetComponent <Image>().enabled = true; } } }