public void Initialize() { defaultFont = m_defaultFont; defaultMaterial = m_defaultMaterial; defaultColor = m_defaultColor; defaultResolution = m_defaultResolution; defaultSize = m_defaultSize; defaultDepth = m_defaultDepth; defaultLetterSpacing = m_defaultLetterSpacing; defaultLineSpacing = m_defaultLineSpacing; defaultJustification = m_defaultJustification; includeBackface = m_includeBackface; texturePerLetter = m_texturePerLetter; anchor = m_anchor; zAnchor = m_zAnchor; colliderType = m_colliderType; addRigidbodies = m_addRigidbodies; physicsMaterial = m_physicsMaterial; smoothingAngle = m_smoothingAngle; if (defaultMaterial == null) { var mat = Resources.Load("VertexColored") as Material; if (mat) { defaultMaterial = mat; } else { var shader = Shader.Find("Diffuse"); if (shader) { defaultMaterial = new Material(shader); } } } if (m_fontData.Count == 0) { _initialized = false; return; } _fontInfo = new TTFFontInfo[m_fontData.Count]; _fontNames = new string[m_fontData.Count]; for (int i = 0; i < m_fontData.Count; i++) { if (m_fontData[i].ttfFile != null) { _fontInfo[i] = new TTFFontInfo(m_fontData[i].ttfFile.bytes); var name = _fontInfo[i].name; name = name.Replace(" ", ""); name = name.ToLower(); _fontNames[i] = name; } } _colorDictionary = new Dictionary <string, Color>() { { "red", Color.red }, { "green", Color.green }, { "blue", Color.blue }, { "white", Color.white }, { "black", Color.black }, { "yellow", Color.yellow }, { "cyan", Color.cyan }, { "magenta", Color.magenta }, { "gray", Color.gray }, { "grey", Color.grey } }; DontDestroyOnLoad(this); _initialized = true; }
public void Initialize() { defaultFont = m_defaultFont; defaultMaterial = m_defaultMaterial; defaultColor = m_defaultColor; defaultResolution = m_defaultResolution; defaultSize = m_defaultSize; defaultDepth = m_defaultDepth; defaultLetterSpacing = m_defaultLetterSpacing; defaultLineSpacing = m_defaultLineSpacing; defaultJustification = m_defaultJustification; includeBackface = m_includeBackface; texturePerLetter = m_texturePerLetter; anchor = m_anchor; zAnchor = m_zAnchor; colliderType = m_colliderType; addRigidbodies = m_addRigidbodies; physicsMaterial = m_physicsMaterial; smoothingAngle = m_smoothingAngle; if (defaultMaterial == null) { var mat = Resources.Load ("VertexColored") as Material; if (mat) { defaultMaterial = mat; } else { var shader = Shader.Find ("Diffuse"); if (shader) { defaultMaterial = new Material(shader); } } } if (m_fontData.Count == 0) { _initialized = false; return; } _fontInfo = new TTFFontInfo[m_fontData.Count]; _fontNames = new string[m_fontData.Count]; for (int i = 0; i < m_fontData.Count; i++) { if (m_fontData[i].ttfFile != null) { _fontInfo[i] = new TTFFontInfo (m_fontData[i].ttfFile.bytes); var name = _fontInfo[i].name; name = name.Replace(" ", ""); name = name.ToLower(); _fontNames[i] = name; } } _colorDictionary = new Dictionary<string, Color>(){{"red", Color.red}, {"green", Color.green}, {"blue", Color.blue}, {"white", Color.white}, {"black", Color.black}, {"yellow", Color.yellow}, {"cyan", Color.cyan}, {"magenta", Color.magenta}, {"gray", Color.gray}, {"grey", Color.grey}}; DontDestroyOnLoad (this); _initialized = true; }