-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7eed67
commit 3667898
Showing
27 changed files
with
1,807 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using TMPro; | ||
|
||
public class Canva : Object { | ||
|
||
public Canva(ObjectProperty obj, int escala) : base(obj, escala) {} | ||
|
||
public GameObject createObject() { | ||
GameObject gameObject = new GameObject(); | ||
gameObject.AddComponent<Canvas>(); | ||
|
||
Canvas canvas = gameObject.GetComponent<Canvas>(); | ||
canvas.renderMode = RenderMode.WorldSpace; | ||
gameObject.AddComponent<CanvasScaler>(); | ||
gameObject.AddComponent<GraphicRaycaster>(); | ||
RectTransform rectTransform = canvas.GetComponent<RectTransform>(); | ||
setSize(rectTransform); | ||
setPosition(rectTransform); | ||
|
||
GameObject painel = new Painel(obj, escala).createObject(); | ||
painel.name = obj.name; | ||
painel.transform.SetParent(gameObject.transform); | ||
return gameObject; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class Painel : Object { | ||
|
||
public Painel(ObjectProperty obj, int escala) : base(obj, escala) {} | ||
|
||
public GameObject createObject() { | ||
gameObject = new GameObject(); | ||
Image painel = gameObject.AddComponent<Image>(); | ||
RectTransform rectTransform = painel.GetComponent<RectTransform>(); | ||
setSize(rectTransform); | ||
setPosition(rectTransform); | ||
setColor(painel); | ||
setCornerRadius(); | ||
setBorder(); | ||
|
||
if(obj.children != null) { | ||
for(int i = 0; i < obj.children.Length; i++) { | ||
Builder objeto = new Builder(obj.children[i], gameObject, escala); | ||
objeto.createObject(); | ||
} | ||
} | ||
return gameObject; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,57 @@ | ||
using UnityEngine; | ||
// using UnityEngine.UI; | ||
using TMPro; | ||
|
||
public class Text : Object { | ||
|
||
public Text(ObjectProperty obj, float eixoZ) : base(obj, eixoZ, 0){} | ||
public Text(ObjectProperty obj, int escala) : base(obj, escala){} | ||
|
||
public GameObject createObject() { | ||
gameObject = new GameObject("3D Text"); | ||
TextMesh textMesh = gameObject.AddComponent<TextMesh>() as TextMesh; | ||
setCharacters(textMesh); | ||
setFontSize(textMesh); | ||
italicAndNegrito(textMesh); | ||
gameObject = new GameObject(); | ||
TextMeshProUGUI text = gameObject.AddComponent<TextMeshProUGUI>(); | ||
setCharacters(text); | ||
setFontSize(text); | ||
italicAndNegrito(text); | ||
RectTransform rectTransform = gameObject.GetComponent<RectTransform>(); | ||
setSizeFont(); | ||
setSizeRectFont(rectTransform); | ||
setPosition(rectTransform); | ||
setColorText(); | ||
gameObject.transform.Rotate(180.0f, 0f, 0f, Space.World); | ||
setPosition(); | ||
setColor(); | ||
return gameObject; | ||
} | ||
|
||
public void italicAndNegrito(TextMesh textMesh) { | ||
if(obj.style.italic == true && obj.style.fontWeight >= 700) | ||
public void setCharacters(TextMeshProUGUI text) { | ||
text.text = obj.characters; | ||
} | ||
|
||
public void setFontSize(TextMeshProUGUI text) { | ||
text.fontSize = obj.style.fontSize; | ||
} | ||
|
||
public void setSizeFont() { | ||
width = (float)1/escala; | ||
height = (float)1/escala; | ||
Vector3 size = new Vector3(width, height, 1); | ||
gameObject.transform.localScale = size; | ||
} | ||
|
||
public void setSizeRectFont(RectTransform rectTransform) { | ||
width = obj.absoluteBoundingBox.width; | ||
height = obj.absoluteBoundingBox.height; | ||
rectTransform.sizeDelta = new Vector2(width, height); | ||
width = width/escala; | ||
height = height/escala; | ||
} | ||
|
||
public void italicAndNegrito(TextMeshProUGUI text) { | ||
/*if(obj.style.italic == true && obj.style.fontWeight >= 700) | ||
textMesh.fontStyle = FontStyle.BoldAndItalic; | ||
else if(obj.style.fontWeight >= 700) | ||
textMesh.fontStyle = FontStyle.Bold; | ||
else if(obj.style.italic == true) | ||
textMesh.fontStyle = FontStyle.Italic; | ||
textMesh.fontStyle = FontStyle.Italic;*/ | ||
} | ||
|
||
public void setFontSize(TextMesh textMesh) { | ||
textMesh.fontSize = obj.style.fontSize; | ||
} | ||
|
||
public void setCharacters(TextMesh textMesh) { | ||
textMesh.text = obj.characters; | ||
} | ||
public void setColorText() {} | ||
} |
Oops, something went wrong.