Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public var letter : String;
- public var font : Sprite[];
- function Awake(){
- font = Resources.LoadAll("Font/SpriteFont", Sprite) as Sprite[];
- if (font != null){
- var Text = new SpriteText();
- Text.Letters = letter;
- Text.write("A",0,0);
- }else { Debug.LogWarning("Loaded no SpriteSheet for Font.");}
- }
- public class SpriteText{
- public var font : Sprite[];
- public var box : Sprite[];
- public var letter : char;
- public var letters : String;
- public function get Letters() : String
- { return letters; }
- public function set Letters(value : String)
- { letters = value;}
- public function write(text : String,x : float,y : float){
- Debug.Log("write");
- var line : int;
- for (var i = 0; i < text.Length; i++){
- Debug.Log("Get " + text[i]);
- letter = text[i];
- for ( var j = 0; j < letters.Length+1; j++){
- if (j == letters.Length+1){
- Debug.LogError("Letter not in the available Set");
- }
- if (letter == letters[j]){
- var frame;
- Debug.Log("Should Instantiate Letter " + letter);
- //font = Resources.LoadAll("Font") as Sprite[];
- //Sprite.Create(font);
- var Char = new GameObject();
- Char.AddComponent(SpriteRenderer);
- Char.GetComponent(SpriteRenderer).sprite = font[0];
- Char.transform.position.Set(x + i*6f,y + line * 7f, 0.0);
- j = letters.Length+1;
- }
- }
- }
- }
- public function delete(){
- }
- }
- public class TextBox {
- function TextBox(content : String) {
- if (content == null){
- content = "no content!";
- }
- var Text = new SpriteText();
- Text.write(content,0,0);
- }
- }
- public class TextBubble {
- function TextBubble(){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement