public Graphic() { InitializeComponent(); Figure.InitialiseConteneur(this); _spirographe = new Spirographe(); }
void Start() { SelectedLine = Spirographe.GetActiveSpiroFormule(); lineRenderer = SelectedLine.GetComponent <LineRenderer>(); HeaderFileName = string.Format("{0}/SVG/", Application.dataPath) + HeaderFileName; FooterFileName = string.Format("{0}/SVG/", Application.dataPath) + FooterFileName; }
public void AddLine() { int i; SelectedLine = Spirographe.GetActiveSpiroFormule(); SelectedLine.profondeur++; i = SelectedLine.profondeur - 1; //avant dernière ligne avant le crayon TextNumeroDisque.GetComponent <Text>().text = (i + 1).ToString(); int NbLignesCrees = PanelLignes.transform.childCount; if (NbLignesCrees < SelectedLine.profondeur) { IFR.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i; IFR.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent(); IFF.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i; IFF.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent(); IFRO.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i; IFRO.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent(); ToggleActiveDisque.GetComponent <ToggleRotAxe>().index = i; ToggleActiveDisque.GetComponent <ToggleRotAxe>().RefreshContent(); GameObject NewLine = Instantiate(LigneSpiro); NewLine.name = "Ligne" + (i).ToString(); NewLine.SetActive(true); NewLine.transform.SetParent(PanelLignes.transform, false); } else { PanelLignes.transform.GetChild(i).gameObject.SetActive(true); } RefreshPanel(); //PanelOptionTousDisques.GetComponent<PanelOptionTousDisques>().BuildPanel(); //refresh panel tous disques too Spirographe.ValueChange(); //Call ValueChange Event }
public void Refresh() { int NbCoul; SelectedAspect = Spirographe.GetActiveAspect(); if (SelectedAspect != null) { NbCoul = SelectedAspect.NombreCouleur; } else { NbCoul = 0; } { Debug.Log("Nombre Coul = " + NbCoul.ToString()); if (index > NbCoul - 1) { gameObject.GetComponent <Button>().enabled = false; gameObject.GetComponent <Image>().enabled = false; } else { //Debug.Log("Activation"); gameObject.GetComponent <Button>().enabled = true; gameObject.GetComponent <Image>().enabled = true; GetComponent <Image>().color = SelectedAspect.couleur[index]; } } }
public static void Loaded() { if (onLoaded != null) { onLoaded(); } Spirographe.Selection(); }
public void ToggleValueChanged() { GetActiveLine(); bool Check = GetComponent <Toggle>().isOn; SelectedLine.GetType().GetField(InputID).SetValue(SelectedLine, Check); Spirographe.ValueChange(); //Call ValueChange Event }
public void BeginColorPicking() { //Debug.Log("BeginColorPicking"); Spirographe.DestroyColorChangeEvent(); ShowPanel(); ColorPickerPanel.GetComponent <ColorPicker>().CurrentColor = Spirographe.SelectedAspect.couleur[index]; Spirographe.onColorChange += ColorPicking; }
public void AjusteWithEnter() { GetActiveLine(); ValeurOut = float.Parse(GetComponent <InputField>().text); EcritureValeur(ValeurOut); Spirographe.RefreshInputFieldPanelDisques(); // on rafraichi les autres champs IFR Spirographe.ValueChange(); //Call ValueChange Event }
public void ToggleValueChanged() { GetActiveLine(); bool Check = GetComponent <Toggle>().isOn; SelectedLine.RotAxe[index] = Check; Spirographe.RefreshInputFieldPanelDisques(); Spirographe.ValueChange(); //Call ValueChange Event }
public void DuplicateCurrentSpiro() { GetActiveLine(); NewLine = Instantiate(ActiveObjectInScene); NewLine.tag = "Untagged"; GetActiveTextLine(); CreateTextLine("Spiro"); Spirographe.RefreshInputField(); }
public void HidePanel() { bool activation; activation = PanelOption.active; //Spirographe.RefreshInputField(); PanelOption.SetActive(!activation); Spirographe.RefreshInputField(); //transform.parent.GetComponent<RectTransform>().ForceUpdateRectTransforms(); //force refresh //transform.Translate(Vector3.up); //force refresh }
// Update is called once per frame void Update() { if (Spirographe.GetActiveSpiroFormule() != null) { isRotating = Spirographe.GetActiveSpiroFormule().AnimRotation; if (isRotating) { GetComponent <InputFieldInterface>().RefreshContent(); } } }
public void Encadre(List <int> positionPoints) { _graphique.EncadreNettoie(); Spirographe points = new Spirographe(); foreach (int position in positionPoints) { points.Add(_spirographe[position]); } _graphique.Encadre(points.InverseY()); }
public void AjusteWithDrag() { //Debug.Log("IF drag"); CurrentMousePos = Input.mousePosition; DeltaMousePos = CurrentMousePos - MousePosInitiale; ValeurSortieIF = ValeurInitialeIF + DeltaMousePos.x / FacteurDiv; if (Clamp) { ValeurSortieIF = (float)Math.Floor((ValeurSortieIF / Precision)) * Precision; } GetComponent <InputField>().text = ValeurSortieIF.ToString(); EcritureValeur(ValeurSortieIF); Spirographe.ValueChange(); //Call ValueChange Event }
public void AjusteWithDrag() { CurrentMousePos = Input.mousePosition; DeltaMousePos = CurrentMousePos - MousePosInitiale; ValeurOut = ValeurIn + DeltaMousePos.x / FacteurDiv; if (Clamp) { ValeurOut = (float)Math.Floor((ValeurOut / Precision)) * Precision; } GetComponent <InputField>().text = ValeurOut.ToString(); EcritureValeur(ValeurOut); Spirographe.RefreshInputFieldPanelDisques(); // on rafraichi les autres champs IFR //Debug.Log("ok"); Spirographe.ValueChange(); //Call ValueChange Event }
void Start() { dataPath = Application.dataPath + "/Spiro/"; SpiroBasePath = Application.dataPath + "/Prefabs/SpiroFormule.prefab"; BoutonSelectionPremiereLigne.SelectLine(); //on sélectionne la seule spiro de la scene Spirographe.Selection(); //Send Initialisation event (to build panels) GetActiveTextLine(); LineCount = 2; //on comence avec une/deux ligne(s) BaseSpiro = SpiroFormuleToInstantiate; BaseMultiSpiro = MultiSpiroToInstantiate; SpiroRoot = SpiroParametrableRoot; MultiSpiroRoot = MultiSpiroParametrableRoot; TextBase = TextBaseToInstantiate; unselected = SelectButton.unselected; }
public void DeleteLine() { GameObject LastLine; SelectedLine = Spirographe.GetActiveSpiroFormule(); if (SelectedLine.profondeur > 3) { SelectedLine.profondeur--; LastLine = PanelLignes.transform.GetChild(SelectedLine.profondeur).gameObject; //RemoveEventsFromLine(LastLine); //Destroy(LastLine); LastLine.SetActive(false); } RefreshPanel(); //PanelOptionTousDisques.GetComponent<PanelOptionTousDisques>().BuildPanel(); //refresh panel tous disques too Spirographe.ValueChange(); //Call ValueChange Event }
public void NewLineRenderer() { //bool Visibility; //GameObject BoutonDelete; GetActiveLine(); NewLine = Instantiate(ActiveObjectInScene); NewLine.tag = "Untagged"; GetActiveTextLine(); NewLineName = Instantiate(PreviousTextLine); LineCount++; NameLine = NewLineName.transform.Find("TextName").GetComponent <Text>(); NewLineName.transform.SetParent(PreviousTextLine.transform.parent, false); NameLine.text = ("SpiroFormule" + LineCount.ToString()); NewLine.name = NameLine.text; NewLineName.transform.Find("DeleteButton").gameObject.SetActive(true); NewLineName.transform.Find("SelectButton").gameObject.GetComponent <SelectButton>().SelectLine(); Spirographe.RefreshInputField(); }
public void SelectLine() { GetActiveLine(); GetActiveTextLine(); TextNameLine = transform.parent.gameObject; if (PreviousTextLine == null) { PreviousTextLine = TextNameLine; } NameLine = TextNameLine.transform.Find("TextName").GetComponent <Text>(); ActiveObjectInScene.tag = "Untagged"; PreviousTextLine.transform.Find("TextName").GetComponent <Text>().color = unselected; TextNameLine.transform.Find("TextName").GetComponent <Text>().color = selected; ActiveObjectInScene = GameObject.Find(NameLine.text); ActiveObjectInScene.tag = "Selected"; PreviousTextLine = TextNameLine; Spirographe.Selection(); //call Selection Event Spirographe.RefreshInputField(); EventSystem.current.SetSelectedGameObject(null); //deselect button }
public void RefreshPanel() { SelectedLine = Spirographe.GetActiveSpiroFormule(); InputFieldPanelDisques[] ZOB; ToggleRotAxe[] BIT; ZOB = PanelLignes.GetComponentsInChildren <InputFieldPanelDisques>(); //Get all InputFieldPanelDisques in PanelLignes foreach (InputFieldPanelDisques IF in ZOB) { IF.gameObject.GetComponent <InputFieldPanelDisques>().RefreshContent(); //RefreshContent of all InputFieldPanelDisques in PanelLignes } BIT = PanelLignes.GetComponentsInChildren <ToggleRotAxe>(); //Get all ToggleRotAxe in PanelLignes foreach (ToggleRotAxe TRA in BIT) { TRA.gameObject.GetComponent <ToggleRotAxe>().RefreshContent(); //RefreshContent of all ToggleRotAxe in PanelLignes } int profondeur = SelectedLine.profondeur; int NbLignesCrees = PanelLignes.transform.childCount; GameObject LineCurr = PanelLignes.transform.GetChild(0).gameObject; for (int i = 0; i < NbLignesCrees; i++) // on n'affiche que les lignes d'indice inférieur à profondeur { LineCurr = PanelLignes.transform.GetChild(i).gameObject; if (i < profondeur) { LineCurr.SetActive(true); } else { LineCurr.SetActive(false); } } RefreshCochesActivation(); RefreshFacteurTransmission(); PanelOptionTousDisques.GetComponent <PanelOptionTousDisques>().BuildPanel(); //refresh panel tous disques too }
public void BuildPanel() { int profondeur; SpiroParametrableActive = Spirographe.GetActiveObject(); SelectedLine = Spirographe.GetActiveSpiroFormule(); if (SelectedLine == null) { profondeur = 0; } else { profondeur = SelectedLine.profondeur; } int NbLignesCrees = PanelLignes.transform.childCount; for (int i = 0; i < profondeur; i++) { if (i < NbLignesCrees) { LineCurr = PanelLignes.transform.GetChild(i).gameObject; LineCurr.SetActive(true); } else { TextNumeroDisque.GetComponent <Text>().text = (i + 1).ToString(); InitField(ref IFR, i); InitField(ref IFRO, i); InitField(ref IFA, i); InitField(ref IFV, i); InitField(ref IFP, i); InitField(ref IFF, i); ToggleAnimation.GetComponent <ToggleAnimRayon>().index = i; ToggleAnimation.GetComponent <ToggleAnimRayon>().RefreshContent(); ToggleActiveDisque.GetComponent <ToggleRotAxe>().index = i; ToggleActiveDisque.GetComponent <ToggleRotAxe>().RefreshContent(); GameObject NewLine = Instantiate(LigneSpiro); NewLine.name = "Ligne" + (i).ToString(); NewLine.SetActive(true); NewLine.transform.SetParent(PanelLignes.transform, false); } } //Reste à cacher les lignes restantes éventuelles : if (profondeur <= NbLignesCrees) { for (int i = profondeur; i < NbLignesCrees; i++) { PanelLignes.transform.GetChild(i).gameObject.SetActive(false); } } //Gestion affichage des coches RotAxe for (int i = 1; i < profondeur - 1; i++) { GetBackgroundActivation(i).SetActive(true); //on l'affiche } GetBackgroundActivation(0).SetActive(false); //on le cache GetBackgroundActivation(profondeur - 1).SetActive(false); //on le cache RefreshFacteurTransmission(); }
public void GetActiveLine() { ActiveObjectInScene = Spirographe.GetActiveObject(); SelectedLine = Spirographe.GetActiveSpiroFormule(); }
public void BuildPanel() { int profondeur; GameObject LineCurr; // //SpiroParametrableActive=Spirographe.GetActiveObject(); SelectedLine = Spirographe.GetActiveSpiroFormule(); if (SelectedLine == null) { profondeur = 0; } else { profondeur = SelectedLine.profondeur; } int NbLignesCrees = PanelLignes.transform.childCount; for (int i = 0; i < profondeur; i++) { if (i < NbLignesCrees) { LineCurr = PanelLignes.transform.GetChild(i).gameObject; LineCurr.SetActive(true); } else { TextNumeroDisque.GetComponent <Text>().text = (i + 1).ToString(); IFR.GetComponent <InputFieldPanelDisques>().index = i; IFR.GetComponent <InputFieldPanelDisques>().RefreshContent(); IFR.GetComponent <InputFieldPanelDisques>().Start(); IFF.GetComponent <InputFieldPanelDisques>().index = i; IFF.GetComponent <InputFieldPanelDisques>().RefreshContent(); IFF.GetComponent <InputFieldPanelDisques>().Start(); IFRO.GetComponent <InputFieldPanelDisques>().index = i; IFRO.GetComponent <InputFieldPanelDisques>().RefreshContent(); IFRO.GetComponent <InputFieldPanelDisques>().Start(); ToggleActiveDisque.GetComponent <ToggleRotAxe>().index = i; ToggleActiveDisque.GetComponent <ToggleRotAxe>().RefreshContent(); GameObject NewLine = Instantiate(LigneSpiro); NewLine.name = "Ligne" + (i).ToString(); NewLine.SetActive(true); NewLine.transform.SetParent(PanelLignes.transform, false); } } GetComponent <RectTransform>().ForceUpdateRectTransforms(); //Debug.Log("Building Panel big"); //Reste à cacher les lignes restantes éventuelles : if (profondeur <= NbLignesCrees) { for (int i = profondeur; i < NbLignesCrees; i++) { PanelLignes.transform.GetChild(i).gameObject.SetActive(false); } } //Gestion affichage des coches RotAxe /*if (profondeur>0) * { * RefreshCochesActivation(); * RefreshFacteurTransmission(); * }*/ RefreshPanel(); }
void CallColorChangeEvent() { Spirographe.ColorChange(); }
public void AjusteWithEnter() { ValeurSortieIF = float.Parse(GetComponent <InputField>().text); EcritureValeur(ValeurSortieIF); Spirographe.ValueChange(); //Call ValueChange Event }
public void GetActiveLine() { ActiveObjectInScene = Spirographe.GetActiveObject(); SelectedMultiSpiro = Spirographe.GetActiveMultiSpiro(); }