public void Event(string text, STMTextInfo info) { split = text.Split(','); //if exactly two strings and first is the rt tag... if (split.Length == 2 && split[0] == "rt") { //create a new STM, and assign the remaining text to it tempStm = new GameObject().AddComponent <SuperTextMesh>(); tempStm.t.SetParent(this.transform); //parent it to this tempStm.t.name = split[1]; //center above letter tmpPos.x = info.Middle.x; tmpPos.y = info.pos.y + info.size + verticalOffset; tempStm.t.localPosition = tmpPos; tempStm.size = rubyTextSize; tempStm.font = stm.font; tempStm.color = stm.color; tempStm.anchor = TextAnchor.LowerCenter; tempStm.alignment = SuperTextMesh.Alignment.Center; //center above letter tempStm.autoWrap = info.RelativeWidth; //max width is letter width tempStm.bestFit = SuperTextMesh.BestFitMode.OverLimit; //shrink to fit if it goes over tempStm.text = split[1]; rubyText.Add(tempStm); //add to list } }
public STMTextInfo(SuperTextMesh stm) //for setting "defaults" { this.ch.style = stm.style; //this.colorData = ScriptableObject.CreateInstance<STMColorData>(); // this.colorData.color = stm.color; this.indent = 0; this.size = stm.size; this.alignment = stm.alignment; this.stopPreviousSound = stm.stopPreviousSound; this.pitchMode = stm.pitchMode; this.overridePitch = stm.overridePitch; this.minPitch = stm.minPitch; this.maxPitch = stm.maxPitch; this.speedReadPitch = stm.speedReadPitch; this.readDelay = stm.readDelay; this.drawAnimData = Resources.Load <STMDrawAnimData>("STMDrawAnims/" + stm.drawAnimName); if (this.drawAnimData == null) { STMDrawAnimData[] tmpDrawAnims = Resources.LoadAll <STMDrawAnimData>("STMDrawAnims"); if (tmpDrawAnims.Length > 0) { this.drawAnimData = tmpDrawAnims[0]; //get first one } } this.drawOrder = stm.drawOrder; }
public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty gradient = serializedData.FindProperty("gradient"); SerializedProperty gradientSpread = serializedData.FindProperty("gradientSpread"); SerializedProperty scrollSpeed = serializedData.FindProperty("scrollSpeed"); SerializedProperty direction = serializedData.FindProperty("direction"); SerializedProperty smoothGradient = serializedData.FindProperty("smoothGradient"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(gradient); EditorGUILayout.PropertyField(gradientSpread); EditorGUILayout.PropertyField(scrollSpeed); EditorGUILayout.PropertyField(direction); EditorGUILayout.PropertyField(smoothGradient); EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Jitter Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty amount = serializedData.FindProperty("amount"); SerializedProperty perlin = serializedData.FindProperty("perlin"); SerializedProperty perlinTimeMulti = serializedData.FindProperty("perlinTimeMulti"); //SerializedProperty distance = serializedData.FindProperty("distance"); //SerializedProperty distanceOverTime = serializedData.FindProperty("distanceOverTime"); SerializedProperty distanceOverTimeMulti = serializedData.FindProperty("distanceOverTimeMulti"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(amount); EditorGUILayout.PropertyField(perlin); if (perlin.boolValue) { EditorGUILayout.PropertyField(perlinTimeMulti); } //EditorGUILayout.PropertyField(distance); //EditorGUILayout.PropertyField(distanceOverTime); distance = EditorGUILayout.CurveField("Distance", distance); distanceOverTime = EditorGUILayout.CurveField("Distance Over Time", distanceOverTime); EditorGUILayout.PropertyField(distanceOverTimeMulti); EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public static void DrawTitleBar(Object myObject, SuperTextMesh stm) { if (myObject != null) { EditorGUILayout.BeginHorizontal(); //ping button: if (GUILayout.Button("Ping")) { //EditorUtility.FocusProjectWindow(); this doesn't work for some reason EditorGUIUtility.PingObject(myObject); //select this object } //name: EditorGUI.BeginChangeCheck(); myObject.name = EditorGUILayout.TextField(myObject.name); if (EditorGUI.EndChangeCheck()) { AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(myObject), myObject.name); //Undo.RecordObject (myObject, "Change Asset Name"); AssetDatabase.Refresh(); stm.data = null; } //delete button: if (GUILayout.Button("X")) { //AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(myObject)); AssetDatabase.MoveAssetToTrash(AssetDatabase.GetAssetPath(myObject)); //Undo.DestroyObjectImmediate(myObject); AssetDatabase.Refresh(); stm.data = null; //make this refresh, too } EditorGUILayout.EndHorizontal(); } }
public FilterMode filterMode = FilterMode.Bilinear; //default #if UNITY_EDITOR public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty font = serializedData.FindProperty("font"); SerializedProperty quality = serializedData.FindProperty("quality"); SerializedProperty filterMode = serializedData.FindProperty("filterMode"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(font); if (this.font != null) { if (!this.font.dynamic) { EditorGUI.BeginDisabledGroup(!this.font.dynamic); this.quality = EditorGUILayout.IntSlider("Quality", this.font.fontSize, 1, 512); EditorGUI.EndDisabledGroup(); } else { EditorGUILayout.PropertyField(quality); } EditorGUILayout.PropertyField(filterMode); } EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
//public float speed = 0.5f; //scroll speed //public float spread = 0.1f; //how far it stretches, in local #if UNITY_EDITOR public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty texture = serializedData.FindProperty("texture"); SerializedProperty filterMode = serializedData.FindProperty("filterMode"); SerializedProperty relativeToLetter = serializedData.FindProperty("relativeToLetter"); SerializedProperty scaleWithText = serializedData.FindProperty("scaleWithText"); SerializedProperty tiling = serializedData.FindProperty("tiling"); SerializedProperty offset = serializedData.FindProperty("offset"); SerializedProperty scrollSpeed = serializedData.FindProperty("scrollSpeed"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(texture); EditorGUILayout.PropertyField(filterMode); EditorGUILayout.PropertyField(relativeToLetter); EditorGUILayout.PropertyField(scaleWithText); EditorGUILayout.PropertyField(tiling); EditorGUILayout.PropertyField(offset); EditorGUILayout.PropertyField(scrollSpeed); EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty animateFromTimeDrawn = serializedData.FindProperty("animateFromTimeDrawn"); SerializedProperty main = serializedData.FindProperty("main"); SerializedProperty individualVertexControl = serializedData.FindProperty("individualVertexControl"); SerializedProperty topLeft = serializedData.FindProperty("topLeft"); SerializedProperty topRight = serializedData.FindProperty("topRight"); SerializedProperty bottomLeft = serializedData.FindProperty("bottomLeft"); SerializedProperty bottomRight = serializedData.FindProperty("bottomRight"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(animateFromTimeDrawn); EditorGUILayout.PropertyField(main, true); EditorGUILayout.PropertyField(individualVertexControl); if (individualVertexControl.boolValue) { EditorGUILayout.PropertyField(topLeft, true); EditorGUILayout.PropertyField(topRight, true); EditorGUILayout.PropertyField(bottomLeft, true); EditorGUILayout.PropertyField(bottomRight, true); } EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public UITextField(SuperTextMesh superTextMesh) { this.uiText = null; #if TMP_PRESENT this.textMeshProUGUI = null; #endif this.superTextMesh = superTextMesh; }
public void OnEnable() { //get stm component stm = GetComponent <SuperTextMesh>(); //set up events stm.OnCustomEvent += Event; stm.OnPreParse += Parse; stm.OnRebuildEvent += ClearRubyText; }
public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Wave Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty animateFromTimeDrawn = serializedData.FindProperty("animateFromTimeDrawn"); //SerializedProperty position = serializedData.FindProperty("position"); //SerializedProperty rotation = serializedData.FindProperty("rotation"); //SerializedProperty scale = serializedData.FindProperty("scale"); SerializedProperty individualVertexControl = serializedData.FindProperty("individualVertexControl"); SerializedProperty positionControl = serializedData.FindProperty("positionControl"); SerializedProperty rotationControl = serializedData.FindProperty("rotationControl"); SerializedProperty scaleControl = serializedData.FindProperty("scaleControl"); //SerializedProperty topLeft = serializedData.FindProperty("topLeft"); //SerializedProperty topRight = serializedData.FindProperty("topRight"); //SerializedProperty bottomLeft = serializedData.FindProperty("bottomLeft"); //SerializedProperty bottomRight = serializedData.FindProperty("bottomRight"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(animateFromTimeDrawn); EditorGUILayout.PropertyField(positionControl); if (positionControl.boolValue) { position.DrawInspector("Position"); } EditorGUILayout.PropertyField(rotationControl); if (rotationControl.boolValue) { rotation.DrawInspector("Rotation"); } EditorGUILayout.PropertyField(scaleControl); if (scaleControl.boolValue) { scale.DrawInspector("Scale"); } EditorGUILayout.PropertyField(individualVertexControl); if (individualVertexControl.boolValue) { //EditorGUILayout.PropertyField(topLeft,true); //EditorGUILayout.PropertyField(topRight,true); //EditorGUILayout.PropertyField(bottomLeft,true); //EditorGUILayout.PropertyField(bottomRight,true); topLeft.DrawInspector("Top Left"); topRight.DrawInspector("Top Right"); bottomLeft.DrawInspector("Bottom Left"); bottomRight.DrawInspector("Bottom Right"); } EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty texture = serializedData.FindProperty("texture"); SerializedProperty filterMode = serializedData.FindProperty("filterMode"); SerializedProperty columns = serializedData.FindProperty("columns"); SerializedProperty rows = serializedData.FindProperty("rows"); SerializedProperty iconIndex = serializedData.FindProperty("iconIndex"); SerializedProperty size = serializedData.FindProperty("size"); SerializedProperty offset = serializedData.FindProperty("offset"); SerializedProperty advance = serializedData.FindProperty("advance"); SerializedProperty animDelay = serializedData.FindProperty("animDelay"); SerializedProperty frames = serializedData.FindProperty("frames"); SerializedProperty silhouette = serializedData.FindProperty("silhouette"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(texture); if (this.texture != null) { EditorGUILayout.PropertyField(silhouette); EditorGUILayout.PropertyField(filterMode); EditorGUILayout.Space(); //////////////////SPACE EditorGUILayout.PropertyField(columns); EditorGUILayout.PropertyField(rows); EditorGUILayout.Space(); //////////////////SPACE if (this.animDelay <= 0f) { EditorGUILayout.PropertyField(iconIndex); //use single icon index } if (this.columns > 1) { EditorGUILayout.PropertyField(animDelay); if (this.animDelay > 0f) { EditorGUILayout.PropertyField(frames, true); //iterate thru multiple } } EditorGUILayout.Space(); //////////////////SPACE } EditorGUILayout.PropertyField(size); EditorGUILayout.PropertyField(offset); EditorGUILayout.PropertyField(advance); EditorGUILayout.Space(); //////////////////SPACE //FixColumnCount(); if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty clips = serializedData.FindProperty("clips"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(clips, true); if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Quad Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(serializedData.FindProperty("texture")); if (this.texture != null) { EditorGUILayout.PropertyField(serializedData.FindProperty("silhouette")); EditorGUILayout.PropertyField(serializedData.FindProperty("overrideFilterMode")); EditorGUI.BeginDisabledGroup(!this.overrideFilterMode); EditorGUILayout.PropertyField(serializedData.FindProperty("filterMode")); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); //////////////////SPACE EditorGUILayout.PropertyField(serializedData.FindProperty("columns")); EditorGUILayout.PropertyField(serializedData.FindProperty("rows")); EditorGUILayout.Space(); //////////////////SPACE if (this.animDelay <= 0f) { EditorGUILayout.PropertyField(serializedData.FindProperty("iconIndex")); //use single icon index } if (this.columns > 1) { EditorGUILayout.PropertyField(serializedData.FindProperty("animDelay")); if (this.animDelay > 0f) { EditorGUILayout.PropertyField(serializedData.FindProperty("frames"), true); //iterate thru multiple } } EditorGUILayout.Space(); //////////////////SPACE } EditorGUILayout.PropertyField(serializedData.FindProperty("size")); EditorGUILayout.PropertyField(serializedData.FindProperty("offset")); EditorGUILayout.PropertyField(serializedData.FindProperty("advance")); EditorGUILayout.Space(); //////////////////SPACE //FixColumnCount(); if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Color Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty color = serializedData.FindProperty("color"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(color); EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public Color32 startColor = Color.clear; //for fill/fade. //add curves for this stuff! #if UNITY_EDITOR public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Draw Animation Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //gather parts for this data: SerializedProperty animTime = serializedData.FindProperty("animTime"); //SerializedProperty animCurve = serializedData.FindProperty("animCurve"); SerializedProperty startScale = serializedData.FindProperty("startScale"); SerializedProperty startOffset = serializedData.FindProperty("startOffset"); SerializedProperty fadeTime = serializedData.FindProperty("fadeTime"); //SerializedProperty fadeCurve = serializedData.FindProperty("fadeCurve"); SerializedProperty startColor = serializedData.FindProperty("startColor"); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(animTime); if (animTime.floatValue > 0f) { //EditorGUILayout.PropertyField(animCurve); animCurve = EditorGUILayout.CurveField("Anim Curve", animCurve); EditorGUILayout.PropertyField(startScale); EditorGUILayout.PropertyField(startOffset); } EditorGUILayout.PropertyField(fadeTime); if (fadeTime.floatValue > 0f) { //EditorGUILayout.PropertyField(fadeCurve); fadeCurve = EditorGUILayout.CurveField("Fade Curve", fadeCurve); } EditorGUILayout.PropertyField(startColor); EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
public void DrawCustomInspector(SuperTextMesh stm) { Undo.RecordObject(this, "Edited STM Font Data"); var serializedData = new SerializedObject(this); serializedData.Update(); //Title bar: STMCustomInspectorTools.DrawTitleBar(this, stm); //the rest: EditorGUILayout.PropertyField(serializedData.FindProperty("font")); if (this.font != null) { if (!this.font.dynamic) { EditorGUI.BeginDisabledGroup(!this.font.dynamic); EditorGUILayout.PropertyField(serializedData.FindProperty("overrideQuality")); //for show this.quality = EditorGUILayout.IntSlider("Quality", this.font.fontSize, 1, 512); //set to default EditorGUI.EndDisabledGroup(); } else { EditorGUILayout.PropertyField(serializedData.FindProperty("overrideQuality")); EditorGUI.BeginDisabledGroup(!this.overrideQuality); EditorGUILayout.PropertyField(serializedData.FindProperty("quality")); EditorGUI.EndDisabledGroup(); } EditorGUILayout.PropertyField(serializedData.FindProperty("overrideFilterMode")); EditorGUI.BeginDisabledGroup(!this.overrideFilterMode); EditorGUILayout.PropertyField(serializedData.FindProperty("filterMode")); EditorGUI.EndDisabledGroup(); } EditorGUILayout.Space(); //////////////////SPACE if (this != null) { serializedData.ApplyModifiedProperties(); //since break; cant be called } }
private void OnEnable() { SuperTextMesh.RebuildAll(); }
public void Reset() { //get stm component stm = GetComponent <SuperTextMesh>(); }
public static void DrawCreateNewButton(string buttonText, string folderName, string typeName, SuperTextMesh stm) { if (GUILayout.Button(buttonText)) { ScriptableObject newData = NewData(typeName); if (newData != null) { AssetDatabase.CreateAsset(newData, AssetDatabase.GenerateUniqueAssetPath("Assets/Clavian/SuperTextMesh/Resources/" + folderName)); //save to file //Undo.undoRedoPerformed += OnUndoRedo; //subscribe to event //Undo.RegisterCreatedObjectUndo(newData, buttonText); AssetDatabase.Refresh(); stm.data = null; } } }
public void Init(List <string> messages) { textMesh = GetComponentInChildren <SuperTextMesh>(); this.messages = messages; textMesh.text = messages[0]; }
public static void DrawCreateFolderButton(string buttonText, string parentFolder, string newFolder, SuperTextMesh stm) { if (GUILayout.Button(buttonText)) { AssetDatabase.CreateFolder("Assets/Clavian/SuperTextMesh/Resources/" + parentFolder, newFolder); AssetDatabase.Refresh(); stm.data = null; } }
private void Awake() { textMesh = DialogueBox.GetComponentInChildren <SuperTextMesh>(); DialogueBox.SetActive(false); }
public void Reset() { originalText = GetComponent <SuperTextMesh>(); }
public static void SetUppercaseText(this SuperTextMesh superTextMesh, string newText) { superTextMesh.text = newText.ToUpper(); }
public static void SetTextWithStringAtStart(this SuperTextMesh stm, string extra) { stm.text = extra + stm.text; }
// Start is called before the first frame update void Start() { scoreText = GetComponent <SuperTextMesh>(); }
//is this implementation better? causes errors when the object isn't defined... public void OverflowLeftovers(SuperTextMesh stm) { overflowText.text = stm.leftoverText.TrimStart(); }
private void Awake() { _superText = GetComponent <SuperTextMesh>(); }
public void Reset() { superTextMesh = GetComponent <SuperTextMesh>(); }