├── .gitignore ├── Assets ├── EmojiTexture.meta └── EmojiTexture │ ├── EmojiTexture.cs │ ├── EmojiTexture.cs.meta │ ├── Example.meta │ ├── Example │ ├── EmojiExample.unity │ ├── EmojiExample.unity.meta │ ├── EmojiGithubMaterial.mat │ ├── EmojiGithubMaterial.mat.meta │ ├── EmojiMaterial.mat │ ├── EmojiMaterial.mat.meta │ ├── EmojiTextureExample.cs │ ├── EmojiTextureExample.cs.meta │ ├── GithubEmojiExample.cs │ ├── GithubEmojiExample.cs.meta │ ├── TextMeshProExample.cs │ ├── TextMeshProExample.cs.meta │ ├── TouchKeyboard.cs │ └── TouchKeyboard.cs.meta │ ├── Github.meta │ ├── Github │ ├── GithubExtentions.cs │ ├── GithubExtentions.cs.meta │ ├── GithubHelper.cs │ ├── GithubHelper.cs.meta │ ├── MiniJSON.cs │ └── MiniJSON.cs.meta │ ├── Plugins.meta │ ├── Plugins │ ├── Android.meta │ ├── Android │ │ ├── emojitexture-debug.aar │ │ ├── emojitexture-debug.aar.meta │ │ └── source~ │ │ │ └── EmojiTexture │ │ │ ├── .gitignore │ │ │ ├── .idea │ │ │ ├── gradle.xml │ │ │ ├── misc.xml │ │ │ ├── modules.xml │ │ │ └── runConfigurations.xml │ │ │ ├── build.gradle │ │ │ ├── emojitexture │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ ├── androidTest │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── ibicha │ │ │ │ │ └── emojitexture │ │ │ │ │ └── ExampleInstrumentedTest.java │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── cpp │ │ │ │ │ ├── TextureHelper.cpp │ │ │ │ │ └── Unity │ │ │ │ │ │ ├── IUnityGraphics.h │ │ │ │ │ │ ├── IUnityInterface.h │ │ │ │ │ │ └── IUnityRenderingExtensions.h │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── ibicha │ │ │ │ │ │ └── emojitexture │ │ │ │ │ │ └── EmojiTexture.java │ │ │ │ └── res │ │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ibicha │ │ │ │ └── emojitexture │ │ │ │ └── ExampleUnitTest.java │ │ │ ├── gradle.properties │ │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ │ ├── gradlew │ │ │ ├── gradlew.bat │ │ │ └── settings.gradle │ ├── WebGL.meta │ ├── WebGL │ │ ├── EmojiTexture.jslib │ │ └── EmojiTexture.jslib.meta │ ├── iOS.meta │ └── iOS │ │ ├── EmojiTexture.mm │ │ ├── EmojiTexture.mm.meta │ │ ├── IUnityGraphics.h │ │ ├── IUnityGraphics.h.meta │ │ ├── IUnityInterface.h │ │ ├── IUnityInterface.h.meta │ │ ├── IUnityRenderingExtensions.h │ │ └── IUnityRenderingExtensions.h.meta │ ├── TMPro.meta │ └── TMPro │ ├── TMP_EmojiSupport.cs │ ├── TMP_EmojiSupport.cs.meta │ ├── TMProEmojiAsset.cs │ └── TMProEmojiAsset.cs.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── README.md └── preview.gif /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | /iOS 36 | Assets/TextMesh Pro 37 | TextMesh Pro.meta 38 | -------------------------------------------------------------------------------- /Assets/EmojiTexture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d4c176cc99ca43b1a4f08d5111c6da5 3 | folderAsset: yes 4 | timeCreated: 1514747733 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/EmojiTexture.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_2017_2_OR_NEWER 2 | //#define ENABLE_CUSTOM_TEXTURE_UPDATE 3 | #endif 4 | 5 | using System; 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | using System.Runtime.InteropServices; 9 | using AOT; 10 | using UnityEngine; 11 | using UnityEngine.Rendering; 12 | 13 | namespace iBicha 14 | { 15 | public class EmojiTexture 16 | { 17 | private static List bufferRef = new List(); 18 | 19 | [UnmanagedFunctionPointer(CallingConvention.StdCall)] 20 | private delegate IntPtr GetBufferPointerByIndexDelegate(int index); 21 | 22 | [MonoPInvokeCallback(typeof(GetBufferPointerByIndexDelegate))] 23 | private static IntPtr GetBufferPointerByIndex(int index) 24 | { 25 | if (index < bufferRef.Count) 26 | return bufferRef[index]; 27 | return IntPtr.Zero; 28 | } 29 | 30 | public static bool CanCopyTextures 31 | { 32 | get { return SystemInfo.copyTextureSupport != UnityEngine.Rendering.CopyTextureSupport.None; } 33 | } 34 | 35 | #if UNITY_IOS && !UNITY_EDITOR 36 | [DllImport("__Internal")] 37 | private static extern int EmojiTexture_render(string text, IntPtr buffer, int width, int height, int sanitize); 38 | 39 | [DllImport("__Internal")] 40 | private static extern IntPtr EmojiTexture_GetTextureUpdateCallback(); 41 | 42 | [DllImport("__Internal")] 43 | private static extern void EmojiTexture_SetBufferRefByIndexFunction(GetBufferPointerByIndexDelegate fn); 44 | 45 | #elif UNITY_ANDROID && !UNITY_EDITOR 46 | private static AndroidJavaClass _EmojiTextureClass; 47 | private static AndroidJavaClass EmojiTextureClass { 48 | get { 49 | if(_EmojiTextureClass == null){ 50 | _EmojiTextureClass = new AndroidJavaClass("com.ibicha.emojitexture.EmojiTexture"); 51 | } 52 | return _EmojiTextureClass; 53 | } 54 | } 55 | 56 | [DllImport("emojiTextureHelper")] 57 | private static extern void EmojiTexture_SetBufferRefByIndexFunction(GetBufferPointerByIndexDelegate fn); 58 | 59 | #elif UNITY_WEBGL && !UNITY_EDITOR 60 | [DllImport("__Internal")] 61 | private static extern int EmojiTexture_render(string text, IntPtr buffer, int width, int height, int sanitize); 62 | #endif 63 | 64 | #if ENABLE_CUSTOM_TEXTURE_UPDATE 65 | private static IntPtr textureUpdateCallback = IntPtr.Zero; 66 | private static IntPtr TextureUpdateCallback 67 | { 68 | get 69 | { 70 | #if UNITY_ANDROID && !UNITY_EDITOR 71 | if (textureUpdateCallback == IntPtr.Zero) 72 | { 73 | textureUpdateCallback = new IntPtr(EmojiTextureClass.CallStatic("jGetTextureUpdateCallback")); 74 | EmojiTexture_SetBufferRefByIndexFunction(GetBufferPointerByIndex); 75 | } 76 | #elif UNITY_IOS && !UNITY_EDITOR 77 | if (textureUpdateCallback == IntPtr.Zero) 78 | { 79 | textureUpdateCallback = EmojiTexture_GetTextureUpdateCallback(); 80 | EmojiTexture_SetBufferRefByIndexFunction(GetBufferPointerByIndex); 81 | } 82 | #endif 83 | return textureUpdateCallback; 84 | } 85 | } 86 | #endif 87 | 88 | /// 89 | /// Get or set how the text if filtered. If set to true, the first emoji character found is extracted from the text to be rendered. 90 | /// If set to false, text is rendered as is. Defaults to true. 91 | /// 92 | public bool SanitizeText 93 | { 94 | get { return sanitizeText; } 95 | set 96 | { 97 | sanitizeText = value; 98 | this.Text = Text; 99 | } 100 | } 101 | 102 | /// 103 | /// Get or set the text of the emoji. Usually a one character string representing the emoji. 104 | /// 105 | /// Emoji string 106 | public string Text 107 | { 108 | get { return text; } 109 | set 110 | { 111 | text = value; 112 | if (SanitizeText) 113 | { 114 | int index = IndexOfFirstEmoji(text); 115 | if (index != -1) 116 | text = text.Substring(index, Mathf.Min(16, text.Length - index)); 117 | else 118 | text = ""; 119 | } 120 | 121 | Render(); 122 | } 123 | } 124 | 125 | /// 126 | /// Get or set the unicode character of the emoji 127 | /// 128 | public int Unicode 129 | { 130 | get 131 | { 132 | if (string.IsNullOrEmpty(text)) 133 | return 0; 134 | if (text.Length == 1) 135 | return text[0]; 136 | return char.ConvertToUtf32(text, 0); 137 | } 138 | set { Text = char.ConvertFromUtf32(value); } 139 | } 140 | 141 | /// 142 | /// Copies the pixels from the native buffer and returns a byte array in the RGBA32 format. 143 | /// 144 | /// The byte buffer. 145 | public byte[] ByteBuffer 146 | { 147 | get 148 | { 149 | if (isByteBufferDirty) 150 | { 151 | if (buffer != IntPtr.Zero && bufferSize > 0) 152 | { 153 | if (byteBuffer == null) 154 | byteBuffer = new byte[bufferSize]; 155 | Marshal.Copy(buffer, byteBuffer, 0, bufferSize); 156 | isByteBufferDirty = false; 157 | } 158 | } 159 | 160 | return byteBuffer; 161 | } 162 | } 163 | 164 | public bool didDownloadTexture { get; private set; } 165 | 166 | public IEnumerator Download(string url, string emojiName = "") 167 | { 168 | didDownloadTexture = false; 169 | using (WWW www = new WWW(url)) 170 | { 171 | yield return www; 172 | if (string.IsNullOrEmpty(www.error)) 173 | { 174 | www.LoadImageIntoTexture(texture); 175 | text = emojiName; 176 | didDownloadTexture = true; 177 | } 178 | 179 | yield return null; 180 | } 181 | } 182 | 183 | private void Render() 184 | { 185 | //Rendering 186 | #if UNITY_IOS && !UNITY_EDITOR 187 | int length = EmojiTexture_render(text, buffer, texture.width, texture.height, SanitizeText ? 1 : 0); 188 | if (!string.IsNullOrEmpty(text) && text.Length != length) 189 | text = text.Substring(0, length); 190 | #elif UNITY_ANDROID && !UNITY_EDITOR 191 | int length = 192 | EmojiTextureClass.CallStatic("render", text, jByteBuffer, texture.width, texture.height, SanitizeText); 193 | if (!string.IsNullOrEmpty(text) && text.Length != length) 194 | text = text.Substring(0, length); 195 | #elif UNITY_WEBGL && !UNITY_EDITOR 196 | int length = EmojiTexture_render(text, buffer, texture.width, texture.height, SanitizeText ? 1 : 0); 197 | if (!string.IsNullOrEmpty(text) && text.Length != length) 198 | text = text.Substring(0, length); 199 | #endif 200 | //Copy pixels to texture 201 | #if (UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL) && !UNITY_EDITOR 202 | isByteBufferDirty = true; 203 | 204 | #if ENABLE_CUSTOM_TEXTURE_UPDATE 205 | if (CanCopyTextures && TextureUpdateCallback != IntPtr.Zero) 206 | { 207 | commandBuffer.IssuePluginCustomTextureUpdate( 208 | TextureUpdateCallback, texture, (uint)(bufferRef.IndexOf(buffer)) 209 | ); 210 | Debug.Log("CustomTextureUpdate"); 211 | Graphics.ExecuteCommandBuffer(commandBuffer); 212 | commandBuffer.Clear(); 213 | } 214 | else 215 | #endif 216 | { 217 | texture.LoadRawTextureData(buffer, bufferSize); 218 | texture.Apply(); 219 | } 220 | #endif 221 | } 222 | 223 | private Texture2D texture; 224 | private string text; 225 | private bool sanitizeText; 226 | private IntPtr buffer; 227 | private AndroidJavaObject jByteBuffer; 228 | private int bufferSize; 229 | 230 | private byte[] byteBuffer; 231 | private bool isByteBufferDirty; 232 | 233 | private CommandBuffer commandBuffer; 234 | 235 | public EmojiTexture() : this(null) 236 | { 237 | } 238 | 239 | public EmojiTexture(string text) : this(text, 256, 256) 240 | { 241 | } 242 | 243 | public EmojiTexture(string text, int size) : this(text, size, size) 244 | { 245 | } 246 | 247 | public EmojiTexture(int size) : this(null, size, size) 248 | { 249 | } 250 | 251 | public EmojiTexture(int width, int height) : this(null, width, height) 252 | { 253 | } 254 | 255 | public EmojiTexture(string text, int width, int height) 256 | { 257 | width = Mathf.Clamp(width, 8, 256); 258 | height = Mathf.Clamp(height, 8, 256); 259 | texture = new Texture2D(width, height, TextureFormat.RGBA32, false); 260 | 261 | //Making the texture read only 262 | #if ENABLE_CUSTOM_TEXTURE_UPDATE 263 | if (CanCopyTextures && TextureUpdateCallback != IntPtr.Zero) 264 | { 265 | texture.Apply(false, true); 266 | commandBuffer = new CommandBuffer(); 267 | } 268 | #endif 269 | 270 | bufferSize = 0; 271 | buffer = IntPtr.Zero; 272 | byteBuffer = null; 273 | isByteBufferDirty = false; 274 | sanitizeText = true; 275 | 276 | #if (UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL) && !UNITY_EDITOR 277 | bufferSize = width * height * 4; 278 | buffer = Marshal.AllocHGlobal(bufferSize); 279 | bufferRef.Add(buffer); 280 | #endif 281 | #if UNITY_ANDROID && !UNITY_EDITOR 282 | jByteBuffer = new AndroidJavaObject("java.nio.DirectByteBuffer", buffer.ToInt64(), bufferSize); 283 | #endif 284 | 285 | Text = text; 286 | } 287 | 288 | ~EmojiTexture() 289 | { 290 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR 291 | if(buffer != IntPtr.Zero) 292 | { 293 | bufferRef.Remove(buffer); 294 | Marshal.FreeHGlobal(buffer); 295 | } 296 | #endif 297 | if (commandBuffer != null) 298 | { 299 | commandBuffer.Dispose(); 300 | } 301 | } 302 | 303 | public static implicit operator Texture2D(EmojiTexture emojiTexture) 304 | { 305 | return emojiTexture == null ? null : emojiTexture.texture; 306 | } 307 | 308 | /// 309 | /// Extracts the first emoji character from the text. returns String.Empty if no emojis are found. 310 | /// 311 | /// The input text 312 | /// A string representing an emoji. String.Empty if not emojis found in the input text. 313 | public static int IndexOfFirstEmoji(string text) 314 | { 315 | if (!string.IsNullOrEmpty(text)) 316 | { 317 | var match = System.Text.RegularExpressions.Regex.Match(text, 318 | @"(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])"); 319 | if (match.Success) 320 | return match.Index; 321 | } 322 | 323 | return -1; 324 | } 325 | 326 | public static string GetFirstEmoji(string text) 327 | { 328 | if (!string.IsNullOrEmpty(text)) 329 | { 330 | var match = System.Text.RegularExpressions.Regex.Match(text, 331 | @"(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])"); 332 | if (match.Success) 333 | return match.Value; 334 | } 335 | 336 | return null; 337 | } 338 | } 339 | } -------------------------------------------------------------------------------- /Assets/EmojiTexture/EmojiTexture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a92e00b83633475bb5867530bc21c7a 3 | timeCreated: 1514758148 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bb08cc5f80774361acc7b94e90441bf 3 | folderAsset: yes 4 | timeCreated: 1514758218 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6725bd42fe5684f489e2924a6bfa7f12 3 | timeCreated: 1514760259 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiGithubMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: EmojiGithubMaterial 10 | m_Shader: {fileID: 10751, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiGithubMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 535efbe8765464d71a39a2d92971f1ad 3 | timeCreated: 1519088045 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: EmojiMaterial 10 | m_Shader: {fileID: 10751, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _ALPHAPREMULTIPLY_ON 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 10 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _InvFade: 1 66 | - _Metallic: 0 67 | - _Mode: 3 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _Shininess: 0.7 71 | - _SmoothnessTextureChannel: 0 72 | - _SpecularHighlights: 1 73 | - _SrcBlend: 1 74 | - _UVSec: 0 75 | - _ZWrite: 0 76 | m_Colors: 77 | - _Color: {r: 1, g: 1, b: 1, a: 1} 78 | - _Emission: {r: 0, g: 0, b: 0, a: 0} 79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 80 | - _SpecColor: {r: 1, g: 1, b: 1, a: 0} 81 | - _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 82 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8414cfaacedd44a43a8540cacd6337f0 3 | timeCreated: 1514751854 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiTextureExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; using UnityEngine; using UnityEngine.EventSystems; namespace iBicha { public class EmojiTextureExample : MonoBehaviour, IPointerClickHandler { //Materials for the changing emoji texture public Material material; //EmojiTexture used for rendering private EmojiTexture emojiTexture; //Emoji list to shuffle from private string[] emojis = { "☺", "❤", "🍆", "🍑" }; void Start() { emojiTexture = new EmojiTexture(); material.mainTexture = emojiTexture; InvokeRepeating("ChangeEmoji", 0f, 1f); } //Change emoji every second void ChangeEmoji() { emojiTexture.Text = emojis[Mathf.RoundToInt(Time.time) % emojis.Length]; } //When the quad is tapped, we open the touch keyboard to input own emoji public void OnPointerClick(PointerEventData eventData) { //Cancel shuffling of the emojis CancelInvoke("ChangeEmoji"); //Read emoji from keyboard TouchKeyboard.get.EditText(emojiTexture.Text, (success, text) => { if (success) emojiTexture.Text = text; }); } } } -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/EmojiTextureExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51bededea65a54c73ab4e1ca2a7e6297 3 | timeCreated: 1514747750 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/GithubEmojiExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | using iBicha.Github; 4 | using UnityEngine.EventSystems; 5 | 6 | namespace iBicha 7 | { 8 | public class GithubEmojiExample : MonoBehaviour, IPointerClickHandler 9 | { 10 | //Materials for the changing emoji texture 11 | public Material material; 12 | 13 | //EmojiTexture used for rendering 14 | private EmojiTexture emojiTexture; 15 | 16 | //Emoji list to shuffle from 17 | private string[] githubEmojis = { ":blush:", ":heart:", ":eggplant:", ":peach:" }; 18 | 19 | void Start() 20 | { 21 | emojiTexture = new EmojiTexture(); 22 | material.mainTexture = emojiTexture; 23 | StartCoroutine(ChangeGithubEmoji()); 24 | } 25 | 26 | //Change emoji every second 27 | //We use a coroutine because downloading emojis from github is an async operation 28 | IEnumerator ChangeGithubEmoji() 29 | { 30 | while (true) 31 | { 32 | yield return SetEmoji(githubEmojis[Mathf.RoundToInt(Time.time) % githubEmojis.Length]); 33 | yield return new WaitForSeconds(1f); 34 | } 35 | } 36 | 37 | //When the quad is tapped, we open the touch keyboard to input own emoji 38 | public void OnPointerClick(PointerEventData eventData) 39 | { 40 | //Cancel shuffling of the emojis 41 | StopAllCoroutines(); 42 | //Read emoji from keyboard 43 | TouchKeyboard.get.EditText(emojiTexture.Text, (success, text) => 44 | { 45 | if (success) 46 | { 47 | StartCoroutine(SetEmoji(text)); 48 | } 49 | }); 50 | } 51 | 52 | IEnumerator SetEmoji(string text) 53 | { 54 | yield return emojiTexture.SetGithubEmoji(text); 55 | } 56 | 57 | } 58 | } -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/GithubEmojiExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8adfaa42265b44999742a773e684b56 3 | timeCreated: 1522100163 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/TextMeshProExample.cs: -------------------------------------------------------------------------------- 1 | #if TMPRO_EMOJIS 2 | using UnityEngine; 3 | using UnityEngine.EventSystems; 4 | using TMPro; 5 | 6 | namespace iBicha.TMPro 7 | { 8 | public class TextMeshProExample : MonoBehaviour, IPointerClickHandler 9 | { 10 | private TextMeshProUGUI label; 11 | 12 | private void Start() 13 | { 14 | label = GetComponent(); 15 | } 16 | 17 | public void OnPointerClick(PointerEventData eventData) 18 | { 19 | TouchKeyboard.get.EditText(label.text, (success, text) => 20 | { 21 | if (success) 22 | label.text = text; 23 | }); 24 | } 25 | } 26 | } 27 | #else 28 | using System.Collections; 29 | using UnityEngine; 30 | using UnityEngine.EventSystems; 31 | 32 | namespace iBicha.TMPro 33 | { 34 | public class TextMeshProExample : MonoBehaviour, IPointerClickHandler 35 | { 36 | 37 | private void Start() 38 | { 39 | Debug.LogWarning("EmojiTexture for TextMesh Pro is not active, please add 'TMPRO_EMOJIS' to the Scripting Define Symbols in the Player Settings."); 40 | } 41 | 42 | public void OnPointerClick(PointerEventData eventData) 43 | { 44 | } 45 | } 46 | } 47 | #endif -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/TextMeshProExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b3680bdadaf992408a56363f5b69f40 3 | timeCreated: 1518637675 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/TouchKeyboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | namespace iBicha 6 | { 7 | public class TouchKeyboard : MonoBehaviour 8 | { 9 | public static TouchKeyboard get; 10 | TouchScreenKeyboard keyboard; 11 | 12 | string input = ""; 13 | bool waitingForInput = false; 14 | bool wasCanceled = false; 15 | 16 | private void Start() 17 | { 18 | get = this; 19 | } 20 | 21 | public void EditText(string text, Action callback) 22 | { 23 | StartCoroutine(StartEditText(text, callback)); 24 | } 25 | 26 | IEnumerator StartEditText(string text, Action callback) 27 | { 28 | input = text; 29 | waitingForInput = true; 30 | wasCanceled = false; 31 | 32 | if (!TouchScreenKeyboard.isSupported) 33 | { 34 | OnGUIEditing = true; 35 | yield return new WaitUntil(() => { return !waitingForInput; }); 36 | } 37 | else 38 | { 39 | if (!TouchScreenKeyboard.isSupported) 40 | { 41 | waitingForInput = false; 42 | yield break; 43 | } 44 | keyboard = TouchScreenKeyboard.Open(input); 45 | yield return new WaitUntil(() => keyboard.status == TouchScreenKeyboard.Status.Canceled || 46 | keyboard.status == TouchScreenKeyboard.Status.Done || 47 | keyboard.status == TouchScreenKeyboard.Status.LostFocus); 48 | waitingForInput = true; 49 | wasCanceled = keyboard.status == TouchScreenKeyboard.Status.Canceled || 50 | keyboard.status == TouchScreenKeyboard.Status.LostFocus; 51 | input = keyboard.text; 52 | } 53 | 54 | callback(!wasCanceled, input); 55 | } 56 | 57 | public static bool OnGUIEditing = false; 58 | 59 | private void OnGUI() 60 | { 61 | if (!waitingForInput || !OnGUIEditing) 62 | return; 63 | 64 | GUILayout.BeginHorizontal(); 65 | input = GUILayout.TextField(input, GUILayout.MinWidth(200f)); 66 | if (GUILayout.Button("OK")) 67 | { 68 | wasCanceled = false; 69 | waitingForInput = OnGUIEditing = false; 70 | } 71 | if (GUILayout.Button("CANCEL")) 72 | { 73 | wasCanceled = true; 74 | waitingForInput = OnGUIEditing = false; 75 | } 76 | GUILayout.EndHorizontal(); 77 | 78 | if (GUI.Button(new Rect(0, 0, Screen.width, Screen.height), "", GUIStyle.none)) 79 | { 80 | wasCanceled = true; 81 | waitingForInput = OnGUIEditing = false; 82 | return; 83 | } 84 | } 85 | 86 | private void OnDisable() 87 | { 88 | if (waitingForInput) 89 | waitingForInput = OnGUIEditing = false; 90 | if (keyboard != null) 91 | keyboard.active = false; 92 | } 93 | 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Example/TouchKeyboard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3e2161447f454431a9e14cf7c6f16dc 3 | timeCreated: 1522099547 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 053876e6599bb4892acc4650ed43838d 3 | folderAsset: yes 4 | timeCreated: 1519016158 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/GithubExtentions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | namespace iBicha.Github 6 | { 7 | public static class GithubExtentions 8 | { 9 | public static IEnumerator SetGithubEmoji(this EmojiTexture emojiTexture, string text) 10 | { 11 | yield return GithubHelper.SetGithubEmoji(emojiTexture, text); 12 | } 13 | 14 | public static IEnumerator SetGithubEmoji(this EmojiTexture emojiTexture, int unicode) 15 | { 16 | yield return GithubHelper.SetGithubEmoji(emojiTexture, unicode); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/GithubExtentions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74c7cfd69797542cdbc1a0cf828a4d32 3 | timeCreated: 1519016587 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/GithubHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; using System.Collections; using System.IO; using UnityEngine; using System.Linq; using System; namespace iBicha.Github { public class GithubHelper { const string API_ENDPOINT = "https://api.github.com/emojis"; const string CACHE_FILENAME = "emojiDict.json"; const string CACHE_FOLDER = "github"; const int CACHE_EXPIRATION_HOURS = 30 * 24; //30 days //Map from keyword to url private static Dictionary mapKeyword = new Dictionary(); //Map from unicode to url private static Dictionary mapUnicode = new Dictionary(); public static bool IsInitialized { get; private set; } public static string Version { get; private set; } public static bool cacheEnabled = true; public static void ClearCache() { string folder = Path.Combine(Application.persistentDataPath, CACHE_FOLDER); if (Directory.Exists(folder)) { Directory.Delete(folder, true); } Version = null; IsInitialized = false; Debug.Log("Github cache cleared"); } public static IEnumerator Initialize(bool forceRefresh = false) { if (IsInitialized && !forceRefresh) yield break; string folder = Path.Combine(Application.persistentDataPath, CACHE_FOLDER); if (Directory.Exists(folder)) { var creationTime = Directory.GetCreationTime(folder); var difference = DateTime.Now.Subtract(creationTime); if (difference.TotalHours > CACHE_EXPIRATION_HOURS) { ClearCache(); } } if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string filename = Path.Combine(folder, CACHE_FILENAME); string jsonString = null; if (File.Exists(filename) && !forceRefresh && cacheEnabled) { jsonString = File.ReadAllText(filename); } else { using (var www = new WWW(API_ENDPOINT)) { yield return www;//api call if (!(www.isDone && string.IsNullOrEmpty(www.error))) { yield break; } jsonString = www.text; if (cacheEnabled) File.WriteAllText(filename, jsonString); } } mapKeyword = Json.Deserialize(jsonString) as Dictionary; var first = (string)mapKeyword.Values.First(); if (first.Contains("?")) Version = first.Substring(first.IndexOf("?", StringComparison.Ordinal) + 1); LoadUnicodeMap(); IsInitialized = true; } public static IEnumerator SetGithubEmoji(EmojiTexture emojiTexture, string text) { if (string.IsNullOrEmpty(text)) yield break; if (!IsInitialized) { yield return Initialize(); if (!IsInitialized) { yield break; } } int unicode; if (text.StartsWith(":", StringComparison.Ordinal) && text.EndsWith(":", StringComparison.Ordinal) && mapKeyword.ContainsKey(text.Trim(':'))) { text = Path.GetFileNameWithoutExtension((string)mapKeyword[text.Trim(':')]); } if (text.Length == 1) { unicode = text[0]; } else if (char.IsSurrogatePair(text, 0)) { unicode = char.ConvertToUtf32(text, 0); } else if (!int.TryParse(text, System.Globalization.NumberStyles.HexNumber, null, out unicode)) { yield break; } yield return SetGithubEmoji(emojiTexture, unicode); } public static IEnumerator SetGithubEmoji(EmojiTexture emojiTexture, int unicode) { if (!IsInitialized) { yield return Initialize(); if (!IsInitialized) { yield break; } } if (!mapUnicode.ContainsKey(unicode)) { yield break; } string text = char.ConvertFromUtf32(unicode); string url = mapUnicode[unicode]; string filename = ""; bool isLocalFile = false; if (cacheEnabled) { string folder = Path.Combine(Application.persistentDataPath, CACHE_FOLDER); filename = Path.GetFileNameWithoutExtension(url) + ".png"; filename = Path.Combine(folder, filename); if (File.Exists(filename)) { url = "file://" + filename; isLocalFile = true; } } yield return emojiTexture.Download(url, text); if (!isLocalFile && cacheEnabled && emojiTexture.didDownloadTexture) { Texture2D texture = emojiTexture; File.WriteAllBytes(filename, texture.EncodeToPNG()); } } public static bool IsValid(int unicode) { if (!IsInitialized) return false; return mapUnicode.ContainsKey(unicode); } public static bool IsValid(string text) { if (!IsInitialized) return false; int unicode; if (text.StartsWith(":", StringComparison.Ordinal) && text.EndsWith(":", StringComparison.Ordinal) && mapKeyword.ContainsKey(text.Trim(':'))) { text = Path.GetFileNameWithoutExtension((string)mapKeyword[text.Trim(':')]); } if (!int.TryParse(text, System.Globalization.NumberStyles.HexNumber, null, out unicode)) { return false; } if (!mapUnicode.ContainsKey(unicode)) { return false; } return true; } private static void LoadUnicodeMap() { foreach (var pair in mapKeyword) { var hex = Path.GetFileNameWithoutExtension((string)pair.Value); int unicode; if (int.TryParse(hex, System.Globalization.NumberStyles.HexNumber, null, out unicode)) { if (!mapUnicode.ContainsKey(unicode)) mapUnicode.Add(unicode, (string)pair.Value); } } } } } -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/GithubHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a189fa9f3ccd4cd4a151b6edff91f76 3 | timeCreated: 1519016355 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/MiniJSON.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Calvin Rien 3 | * 4 | * Based on the JSON parser by Patrick van Bergen 5 | * http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html 6 | * 7 | * Simplified it so that it doesn't throw exceptions 8 | * and can be used in Unity iPhone with maximum code stripping. 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining 11 | * a copy of this software and associated documentation files (the 12 | * "Software"), to deal in the Software without restriction, including 13 | * without limitation the rights to use, copy, modify, merge, publish, 14 | * distribute, sublicense, and/or sell copies of the Software, and to 15 | * permit persons to whom the Software is furnished to do so, subject to 16 | * the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be 19 | * included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | using System; 30 | using System.Collections; 31 | using System.Collections.Generic; 32 | using System.Reflection; 33 | using System.IO; 34 | using System.Linq; 35 | using System.Linq.Expressions; 36 | using System.Text; 37 | 38 | namespace iBicha.Github 39 | { 40 | // Example usage: 41 | // 42 | // using UnityEngine; 43 | // using UnityEditor; 44 | // using System.Collections; 45 | // using System.Collections.Generic; 46 | // 47 | // public class MiniJSONTest : MonoBehaviour { 48 | // void Start () { 49 | // var jsonString = "{ \"array\": [1.44,2,3], " + 50 | // "\"object\": {\"key1\":\"value1\", \"key2\":256}, " + 51 | // "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " + 52 | // "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " + 53 | // "\"int\": 65536, " + 54 | // "\"float\": 3.1415926, " + 55 | // "\"bool\": true, " + 56 | // "\"null\": null }"; 57 | // 58 | // var dict = Json.Deserialize (jsonString) as Dictionary; 59 | // 60 | // Debug.Log ("deserialized: " + dict.GetType ()); 61 | // Debug.Log ("dict['array'][0]: " + ((List) dict["array"])[0]); 62 | // Debug.Log ("dict['string']: " + (string) dict["string"]); 63 | // Debug.Log ("dict['float']: " + (double) dict["float"]); // floats come out as doubles 64 | // Debug.Log ("dict['int']: " + (long) dict["int"]); // ints come out as longs 65 | // Debug.Log ("dict['unicode']: " + (string) dict["unicode"]); 66 | // 67 | // var str = Json.Serialize (dict); 68 | // 69 | // Debug.Log ("serialized: " + str); 70 | // } 71 | // } 72 | 73 | /// 74 | /// This class encodes and decodes JSON strings. 75 | /// Spec. details, see http://www.json.org/ 76 | /// 77 | /// JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary. 78 | /// All numbers are parsed to doubles. 79 | /// 80 | internal static class Json 81 | { 82 | /// 83 | /// Parses the string json into a value 84 | /// 85 | /// A JSON string. 86 | /// An List<object>, a Dictionary<string, object>, a double, an integer,a string, null, true, or false 87 | public static object Deserialize (string json) 88 | { 89 | // save the string for debug information 90 | if (json == null) 91 | { 92 | return null; 93 | } 94 | 95 | return Parser.Parse (json); 96 | } 97 | 98 | sealed class Parser : IDisposable 99 | { 100 | const string WORD_BREAK = "{}[],:\""; 101 | 102 | public static bool IsWordBreak (char c) 103 | { 104 | return Char.IsWhiteSpace (c) || WORD_BREAK.IndexOf (c) != -1; 105 | } 106 | 107 | enum TOKEN 108 | { 109 | NONE, 110 | CURLY_OPEN, 111 | CURLY_CLOSE, 112 | SQUARED_OPEN, 113 | SQUARED_CLOSE, 114 | COLON, 115 | COMMA, 116 | STRING, 117 | NUMBER, 118 | TRUE, 119 | FALSE, 120 | NULL 121 | }; 122 | 123 | StringReader json; 124 | 125 | Parser (string jsonString) 126 | { 127 | json = new StringReader (jsonString); 128 | } 129 | 130 | public static object Parse (string jsonString) 131 | { 132 | using (var instance = new Parser (jsonString)) 133 | { 134 | return instance.ParseValue (); 135 | } 136 | } 137 | 138 | public void Dispose () 139 | { 140 | json.Dispose (); 141 | json = null; 142 | } 143 | 144 | Dictionary ParseObject () 145 | { 146 | Dictionary table = new Dictionary (); 147 | 148 | // ditch opening brace 149 | json.Read (); 150 | 151 | // { 152 | while (true) 153 | { 154 | switch (NextToken) 155 | { 156 | case TOKEN.NONE: 157 | return null; 158 | case TOKEN.COMMA: 159 | continue; 160 | case TOKEN.CURLY_CLOSE: 161 | return table; 162 | default: 163 | // name 164 | string name = ParseString (); 165 | if (name == null) 166 | { 167 | return null; 168 | } 169 | 170 | // : 171 | if (NextToken != TOKEN.COLON) 172 | { 173 | return null; 174 | } 175 | // ditch the colon 176 | json.Read (); 177 | 178 | // value 179 | table[name] = ParseValue (); 180 | break; 181 | } 182 | } 183 | } 184 | 185 | List ParseArray () 186 | { 187 | List array = new List (); 188 | 189 | // ditch opening bracket 190 | json.Read (); 191 | 192 | // [ 193 | var parsing = true; 194 | while (parsing) 195 | { 196 | TOKEN nextToken = NextToken; 197 | 198 | switch (nextToken) 199 | { 200 | case TOKEN.NONE: 201 | return null; 202 | case TOKEN.COMMA: 203 | continue; 204 | case TOKEN.SQUARED_CLOSE: 205 | parsing = false; 206 | break; 207 | default: 208 | object value = ParseByToken (nextToken); 209 | 210 | array.Add (value); 211 | break; 212 | } 213 | } 214 | 215 | return array; 216 | } 217 | 218 | object ParseValue () 219 | { 220 | TOKEN nextToken = NextToken; 221 | return ParseByToken (nextToken); 222 | } 223 | 224 | object ParseByToken (TOKEN token) 225 | { 226 | switch (token) 227 | { 228 | case TOKEN.STRING: 229 | return ParseString (); 230 | case TOKEN.NUMBER: 231 | return ParseNumber (); 232 | case TOKEN.CURLY_OPEN: 233 | return ParseObject (); 234 | case TOKEN.SQUARED_OPEN: 235 | return ParseArray (); 236 | case TOKEN.TRUE: 237 | return true; 238 | case TOKEN.FALSE: 239 | return false; 240 | case TOKEN.NULL: 241 | return null; 242 | default: 243 | return null; 244 | } 245 | } 246 | 247 | string ParseString () 248 | { 249 | StringBuilder s = new StringBuilder (); 250 | char c; 251 | 252 | // ditch opening quote 253 | json.Read (); 254 | 255 | bool parsing = true; 256 | while (parsing) 257 | { 258 | 259 | if (json.Peek () == -1) 260 | { 261 | parsing = false; 262 | break; 263 | } 264 | 265 | c = NextChar; 266 | switch (c) 267 | { 268 | case '"': 269 | parsing = false; 270 | break; 271 | case '\\': 272 | if (json.Peek () == -1) 273 | { 274 | parsing = false; 275 | break; 276 | } 277 | 278 | c = NextChar; 279 | switch (c) 280 | { 281 | case '"': 282 | case '\\': 283 | case '/': 284 | s.Append (c); 285 | break; 286 | case 'b': 287 | s.Append ('\b'); 288 | break; 289 | case 'f': 290 | s.Append ('\f'); 291 | break; 292 | case 'n': 293 | s.Append ('\n'); 294 | break; 295 | case 'r': 296 | s.Append ('\r'); 297 | break; 298 | case 't': 299 | s.Append ('\t'); 300 | break; 301 | case 'u': 302 | var hex = new char[4]; 303 | 304 | for (int i=0; i< 4; i++) 305 | { 306 | hex[i] = NextChar; 307 | } 308 | 309 | s.Append ((char) Convert.ToInt32 (new string (hex), 16)); 310 | break; 311 | } 312 | break; 313 | default: 314 | s.Append (c); 315 | break; 316 | } 317 | } 318 | 319 | return s.ToString (); 320 | } 321 | 322 | object ParseNumber () 323 | { 324 | string number = NextWord; 325 | 326 | if (number.IndexOf ('.') == -1) 327 | { 328 | long parsedInt; 329 | Int64.TryParse (number, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out parsedInt); 330 | return parsedInt; 331 | } 332 | 333 | double parsedDouble; 334 | Double.TryParse (number, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out parsedDouble); 335 | return parsedDouble; 336 | } 337 | 338 | void EatWhitespace () 339 | { 340 | while (Char.IsWhiteSpace (PeekChar)) 341 | { 342 | json.Read (); 343 | 344 | if (json.Peek () == -1) 345 | { 346 | break; 347 | } 348 | } 349 | } 350 | 351 | char PeekChar 352 | { 353 | get 354 | { 355 | return Convert.ToChar (json.Peek ()); 356 | } 357 | } 358 | 359 | char NextChar 360 | { 361 | get 362 | { 363 | return Convert.ToChar (json.Read ()); 364 | } 365 | } 366 | 367 | string NextWord 368 | { 369 | get 370 | { 371 | StringBuilder word = new StringBuilder (); 372 | 373 | while (!IsWordBreak (PeekChar)) 374 | { 375 | word.Append (NextChar); 376 | 377 | if (json.Peek () == -1) 378 | { 379 | break; 380 | } 381 | } 382 | 383 | return word.ToString (); 384 | } 385 | } 386 | 387 | TOKEN NextToken 388 | { 389 | get 390 | { 391 | EatWhitespace (); 392 | 393 | if (json.Peek () == -1) 394 | { 395 | return TOKEN.NONE; 396 | } 397 | 398 | switch (PeekChar) 399 | { 400 | case '{': 401 | return TOKEN.CURLY_OPEN; 402 | case '}': 403 | json.Read (); 404 | return TOKEN.CURLY_CLOSE; 405 | case '[': 406 | return TOKEN.SQUARED_OPEN; 407 | case ']': 408 | json.Read (); 409 | return TOKEN.SQUARED_CLOSE; 410 | case ',': 411 | json.Read (); 412 | return TOKEN.COMMA; 413 | case '"': 414 | return TOKEN.STRING; 415 | case ':': 416 | return TOKEN.COLON; 417 | case '0': 418 | case '1': 419 | case '2': 420 | case '3': 421 | case '4': 422 | case '5': 423 | case '6': 424 | case '7': 425 | case '8': 426 | case '9': 427 | case '-': 428 | return TOKEN.NUMBER; 429 | } 430 | 431 | switch (NextWord) 432 | { 433 | case "false": 434 | return TOKEN.FALSE; 435 | case "true": 436 | return TOKEN.TRUE; 437 | case "null": 438 | return TOKEN.NULL; 439 | } 440 | 441 | return TOKEN.NONE; 442 | } 443 | } 444 | } 445 | 446 | /// 447 | /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string 448 | /// 449 | /// A Dictionary<string, object> / List<object> 450 | /// A JSON encoded string, or null if object 'json' is not serializable 451 | public static string Serialize (object obj) 452 | { 453 | return Serializer.Serialize (obj); 454 | } 455 | 456 | sealed class Serializer 457 | { 458 | StringBuilder builder; 459 | 460 | Serializer () 461 | { 462 | builder = new StringBuilder (); 463 | } 464 | 465 | public static string Serialize (object obj) 466 | { 467 | var instance = new Serializer (); 468 | 469 | instance.SerializeValue (obj); 470 | 471 | return instance.builder.ToString (); 472 | } 473 | 474 | void SerializeValue (object value) 475 | { 476 | IList asList; 477 | IDictionary asDict; 478 | string asStr; 479 | 480 | if (value == null) 481 | { 482 | builder.Append ("null"); 483 | } 484 | else if ((asStr = value as string) != null) 485 | { 486 | SerializeString (asStr); 487 | } 488 | else if (value is bool) 489 | { 490 | builder.Append ((bool) value ? "true" : "false"); 491 | } 492 | else if ((asList = value as IList) != null) 493 | { 494 | SerializeArray (asList); 495 | } 496 | else if ((asDict = value as IDictionary) != null) 497 | { 498 | SerializeObject (asDict); 499 | } 500 | else if (value is char) 501 | { 502 | SerializeString (new string ((char) value, 1)); 503 | } 504 | else 505 | { 506 | SerializeOther (value); 507 | } 508 | } 509 | 510 | void SerializeObject (IDictionary obj) 511 | { 512 | bool first = true; 513 | 514 | builder.Append ('{'); 515 | 516 | foreach (object e in obj.Keys) 517 | { 518 | if (!first) 519 | { 520 | builder.Append (','); 521 | } 522 | 523 | SerializeString (e.ToString ()); 524 | builder.Append (':'); 525 | 526 | SerializeValue (obj[e]); 527 | 528 | first = false; 529 | } 530 | 531 | builder.Append ('}'); 532 | } 533 | 534 | void SerializeArray (IList anArray) 535 | { 536 | builder.Append ('['); 537 | 538 | bool first = true; 539 | 540 | foreach (object obj in anArray) 541 | { 542 | if (!first) 543 | { 544 | builder.Append (','); 545 | } 546 | 547 | SerializeValue (obj); 548 | 549 | first = false; 550 | } 551 | 552 | builder.Append (']'); 553 | } 554 | 555 | void SerializeString (string str) 556 | { 557 | builder.Append ('\"'); 558 | 559 | char[] charArray = str.ToCharArray (); 560 | foreach (var c in charArray) 561 | { 562 | switch (c) 563 | { 564 | case '"': 565 | builder.Append ("\\\""); 566 | break; 567 | case '\\': 568 | builder.Append ("\\\\"); 569 | break; 570 | case '\b': 571 | builder.Append ("\\b"); 572 | break; 573 | case '\f': 574 | builder.Append ("\\f"); 575 | break; 576 | case '\n': 577 | builder.Append ("\\n"); 578 | break; 579 | case '\r': 580 | builder.Append ("\\r"); 581 | break; 582 | case '\t': 583 | builder.Append ("\\t"); 584 | break; 585 | default: 586 | int codepoint = Convert.ToInt32 (c); 587 | if ((codepoint >= 32) && (codepoint <= 126)) 588 | { 589 | builder.Append (c); 590 | } 591 | else 592 | { 593 | builder.Append ("\\u"); 594 | builder.Append (codepoint.ToString ("x4")); 595 | } 596 | break; 597 | } 598 | } 599 | 600 | builder.Append ('\"'); 601 | } 602 | 603 | void SerializeOther (object value) 604 | { 605 | // NOTE: decimals lose precision during serialization. 606 | // They always have, I'm just letting you know. 607 | // Previously floats and doubles lost precision too. 608 | if (value is float) 609 | { 610 | builder.Append (((float) value).ToString ("R", System.Globalization.CultureInfo.InvariantCulture)); 611 | } 612 | else if (value is int || value is uint || value is long || value is sbyte || value is byte || value is short || value is ushort || value is ulong) 613 | { 614 | builder.Append (value); 615 | } 616 | else if (value is double || value is decimal) 617 | { 618 | builder.Append (Convert.ToDouble (value).ToString ("R", System.Globalization.CultureInfo.InvariantCulture)); 619 | } 620 | else 621 | { 622 | Dictionary map = new Dictionary (); 623 | List fields = value.GetType ().GetFields (BindingFlags.Instance | BindingFlags.Public).ToList (); 624 | foreach (FieldInfo field in fields) 625 | { 626 | map.Add (field.Name, field.GetValue (value)); 627 | } 628 | List properties = value.GetType ().GetProperties (BindingFlags.Instance | BindingFlags.Public).ToList (); 629 | foreach (PropertyInfo property in properties) 630 | { 631 | map.Add (property.Name, property.GetValue (value, null)); 632 | } 633 | SerializeObject (map); 634 | } 635 | } 636 | } 637 | } 638 | } 639 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Github/MiniJSON.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2e95ac95fc5545ad8436ed72cacdbb0 3 | timeCreated: 1522114351 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdbf8801547f74d2db6b5a4463f64f2f 3 | folderAsset: yes 4 | timeCreated: 1514747740 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 039a120d96d50475fb31a9d54de6f2de 3 | folderAsset: yes 4 | timeCreated: 1514748059 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/emojitexture-debug.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iBicha/EmojiTexture/99fce607f96357ea2848c83765d42c9c3b2adf67/Assets/EmojiTexture/Plugins/Android/emojitexture-debug.aar -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/emojitexture-debug.aar.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aab0edfa205d44442a2efe342bd89e50 3 | timeCreated: 1519408637 4 | licenseType: Free 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Android: Android 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Any: 20 | second: 21 | enabled: 0 22 | settings: {} 23 | - first: 24 | Editor: Editor 25 | second: 26 | enabled: 0 27 | settings: 28 | DefaultValueInitialized: true 29 | userData: 30 | assetBundleName: 31 | assetBundleVariant: 32 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.0' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 4 | 5 | add_library( emojiTextureHelper 6 | 7 | SHARED 8 | 9 | src/main/cpp/TextureHelper.cpp ) 10 | 11 | include_directories(src/main/cpp/) 12 | 13 | target_link_libraries(emojiTextureHelper 14 | android 15 | log) 16 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | defaultConfig { 7 | minSdkVersion 17 8 | targetSdkVersion 26 9 | versionCode 1 10 | versionName "1.0" 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | ndk { 15 | abiFilters 'x86', 'armeabi-v7a' 16 | } 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | externalNativeBuild { 27 | cmake { 28 | path 'CMakeLists.txt' 29 | } 30 | } 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | 36 | implementation 'com.android.support:appcompat-v7:26.1.0' 37 | testImplementation 'junit:junit:4.12' 38 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 39 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 40 | } 41 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/androidTest/java/com/ibicha/emojitexture/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ibicha.emojitexture; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.ibicha.emojitexture.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/cpp/TextureHelper.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Brahim Hadriche on 2018-04-22. 3 | // 4 | #include 5 | #include "Unity/IUnityRenderingExtensions.h" 6 | 7 | typedef void* (*BUFFER_BY_INDEX_DELEGATE)(int index); 8 | static BUFFER_BY_INDEX_DELEGATE s_getBufferByIndex; 9 | 10 | extern "C" void UNITY_INTERFACE_EXPORT 11 | EmojiTexture_SetBufferRefByIndexFunction(BUFFER_BY_INDEX_DELEGATE fn) 12 | { 13 | s_getBufferByIndex = fn; 14 | } 15 | 16 | void TextureUpdateCallback(int eventID, void* data) 17 | { 18 | auto event = static_cast(eventID); 19 | 20 | if (event == kUnityRenderingExtEventUpdateTextureBegin) 21 | { 22 | // UpdateTextureBegin: Generate and return texture image data. 23 | auto params = reinterpret_cast(data); 24 | 25 | if (s_getBufferByIndex == NULL) 26 | return; 27 | 28 | void* texData = s_getBufferByIndex((int)params->userData); 29 | params->texData = texData; 30 | } 31 | } 32 | 33 | extern "C" JNIEXPORT jlong JNICALL 34 | Java_com_ibicha_emojitexture_EmojiTexture_GetTextureUpdateCallback(){ 35 | return (jlong)TextureUpdateCallback; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/cpp/Unity/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed 7 | //kUnityGfxRendererD3D9 = 1, // Direct3D 9, removed 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 12 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 13 | kUnityGfxRendererGXM = 12, // PlayStation Vita 14 | kUnityGfxRendererPS4 = 13, // PlayStation 4 15 | kUnityGfxRendererXboxOne = 14, // Xbox One 16 | kUnityGfxRendererMetal = 16, // iOS Metal 17 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 18 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 19 | kUnityGfxRendererVulkan = 21, // Vulkan 20 | kUnityGfxRendererNvn = 22, // Nintendo Switch NVN API 21 | kUnityGfxRendererXboxOneD3D12 = 23 // MS XboxOne Direct3D 12 22 | } UnityGfxRenderer; 23 | 24 | typedef enum UnityGfxDeviceEventType 25 | { 26 | kUnityGfxDeviceEventInitialize = 0, 27 | kUnityGfxDeviceEventShutdown = 1, 28 | kUnityGfxDeviceEventBeforeReset = 2, 29 | kUnityGfxDeviceEventAfterReset = 3, 30 | } UnityGfxDeviceEventType; 31 | 32 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 33 | 34 | // Should only be used on the rendering thread unless noted otherwise. 35 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 36 | { 37 | UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 38 | 39 | // This callback will be called when graphics device is created, destroyed, reset, etc. 40 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 41 | // when the graphics device is already created. 42 | void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 43 | void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 44 | int(UNITY_INTERFACE_API * ReserveEventIDRange)(int count); // reserves 'count' event IDs. Plugins should use the result as a base index when issuing events back and forth to avoid event id clashes. 45 | }; 46 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics) 47 | 48 | 49 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 50 | // Provide them with an address to a function of this signature. 51 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 52 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 53 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/cpp/Unity/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | // IUnityInterface is a registry of interfaces we choose to expose to plugins. 22 | // 23 | // USAGE: 24 | // --------- 25 | // To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: 26 | // 27 | // IMyInterface * ptr = registry->Get(); 28 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 | 30 | // Unity Interface GUID 31 | // Ensures global uniqueness. 32 | // 33 | // Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. 34 | // The net result should compile down to passing around the GUID. 35 | // 36 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. 37 | // The interface structure and the registration GUID are all that is required to expose the interface to other systems. 38 | struct UnityInterfaceGUID 39 | { 40 | #ifdef __cplusplus 41 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 42 | : m_GUIDHigh(high) 43 | , m_GUIDLow(low) 44 | { 45 | } 46 | 47 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 48 | { 49 | m_GUIDHigh = other.m_GUIDHigh; 50 | m_GUIDLow = other.m_GUIDLow; 51 | } 52 | 53 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 54 | { 55 | m_GUIDHigh = other.m_GUIDHigh; 56 | m_GUIDLow = other.m_GUIDLow; 57 | return *this; 58 | } 59 | 60 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 61 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 62 | #endif 63 | unsigned long long m_GUIDHigh; 64 | unsigned long long m_GUIDLow; 65 | }; 66 | #ifdef __cplusplus 67 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 68 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 69 | inline bool operator<(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 70 | inline bool operator>(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 71 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator<(left, right); } 72 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator>(left, right); } 73 | #else 74 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 75 | #endif 76 | 77 | 78 | #ifdef __cplusplus 79 | #define UNITY_DECLARE_INTERFACE(NAME) \ 80 | struct NAME : IUnityInterface 81 | 82 | // Generic version of GetUnityInterfaceGUID to allow us to specialize it 83 | // per interface below. The generic version has no actual implementation 84 | // on purpose. 85 | // 86 | // If you get errors about return values related to this method then 87 | // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with 88 | // your interface, or it is not visible at some point when you are 89 | // trying to retrieve or add an interface. 90 | template 91 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); 92 | 93 | // This is the macro you provide in your public interface header 94 | // outside of a namespace to allow us to map between type and GUID 95 | // without the user having to worry about it when attempting to 96 | // add or retrieve and interface from the registry. 97 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 98 | template<> \ 99 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 100 | { \ 101 | return UnityInterfaceGUID(HASHH,HASHL); \ 102 | } 103 | 104 | // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in 105 | // a particular namespace. As long as the namespace is visible at the time you call 106 | // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template 107 | // calls this will work fine, only the macro here needs to have the additional parameter 108 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ 109 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 110 | template<> \ 111 | inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ 112 | { \ 113 | return UnityInterfaceGUID(HASHH,HASHL); \ 114 | } 115 | 116 | // These macros allow for C compatibility in user code. 117 | #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() 118 | 119 | 120 | #else 121 | #define UNITY_DECLARE_INTERFACE(NAME) \ 122 | typedef struct NAME NAME; \ 123 | struct NAME 124 | 125 | // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that 126 | // can see a header containing this constant. However, it's only for C compatibility and thus should have 127 | // minimal impact. 128 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 129 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 130 | 131 | // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are 132 | // not going to be usable from C. 133 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) 134 | 135 | // These macros allow for C compatibility in user code. 136 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 137 | #endif 138 | 139 | // Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where 140 | // this may be needed. Unity code itself does not need this. 141 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterfaceSplit (UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDHigh, UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDLow); 142 | 143 | 144 | #ifdef __cplusplus 145 | struct IUnityInterface 146 | { 147 | }; 148 | #else 149 | typedef void IUnityInterface; 150 | #endif 151 | 152 | 153 | typedef struct IUnityInterfaces 154 | { 155 | // Returns an interface matching the guid. 156 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 157 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 158 | 159 | // Registers a new interface. 160 | void(UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface * ptr); 161 | 162 | // Split APIs for C 163 | IUnityInterface* (UNITY_INTERFACE_API * GetInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow); 164 | void(UNITY_INTERFACE_API * RegisterInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow, IUnityInterface * ptr); 165 | 166 | #ifdef __cplusplus 167 | // Helper for GetInterface. 168 | template 169 | INTERFACE* Get() 170 | { 171 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 172 | } 173 | 174 | // Helper for RegisterInterface. 175 | template 176 | void Register(IUnityInterface* ptr) 177 | { 178 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 179 | } 180 | 181 | #endif 182 | } IUnityInterfaces; 183 | 184 | 185 | #ifdef __cplusplus 186 | extern "C" { 187 | #endif 188 | 189 | // If exported by a plugin, this function will be called when the plugin is loaded. 190 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 191 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 192 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | 198 | struct RenderSurfaceBase; 199 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 200 | typedef unsigned int UnityTextureID; 201 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/cpp/Unity/IUnityRenderingExtensions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "IUnityGraphics.h" 5 | 6 | /* 7 | Low-level Native Plugin Rendering Extensions 8 | ============================================ 9 | 10 | On top of the Low-level native plugin interface, Unity also supports low level rendering extensions that can receive callbacks when certain events happen. 11 | This is mostly used to implement and control low-level rendering in your plugin and enable it to work with Unity’s multithreaded rendering. 12 | 13 | Due to the low-level nature of this extension the plugin might need to be preloaded before the devices get created. 14 | Currently the convention is name-based namely the plugin name must be prefixed by “GfxPlugin”. Example: GfxPluginMyFancyNativePlugin. 15 | 16 | 17 | // Native plugin code example 18 | 19 | enum PluginCustomCommands 20 | { 21 | kPluginCustomCommandDownscale = kUnityRenderingExtUserEventsStart, 22 | kPluginCustomCommandUpscale, 23 | 24 | // insert your own events here 25 | 26 | kPluginCustomCommandCount 27 | }; 28 | 29 | static IUnityInterfaces* s_UnityInterfaces = NULL; 30 | 31 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API 32 | UnityPluginLoad(IUnityInterfaces* unityInterfaces) 33 | { 34 | // initialization code here... 35 | } 36 | 37 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API 38 | UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data) 39 | { 40 | switch (event) 41 | { 42 | case kUnityRenderingExtEventBeforeDrawCall: 43 | // do some stuff 44 | break; 45 | case kUnityRenderingExtEventAfterDrawCall: 46 | // undo some stuff 47 | break; 48 | case kPluginCustomCommandDownscale: 49 | // downscale some stuff 50 | break; 51 | case kPluginCustomCommandUpscale: 52 | // upscale some stuff 53 | break; 54 | } 55 | } 56 | 57 | */ 58 | 59 | 60 | // These events will be propagated to all plugins that implement void UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data); 61 | 62 | enum UnityRenderingExtEventType 63 | { 64 | kUnityRenderingExtEventSetStereoTarget, // issued during SetStereoTarget and carrying the current 'eye' index as parameter 65 | kUnityRenderingExtEventSetStereoEye, // issued during stereo rendering at the beginning of each eye's rendering loop. It carries the current 'eye' index as parameter 66 | kUnityRenderingExtEventStereoRenderingDone, // issued after the rendering has finished 67 | kUnityRenderingExtEventBeforeDrawCall, // issued during BeforeDrawCall and carrying UnityRenderingExtBeforeDrawCallParams as parameter 68 | kUnityRenderingExtEventAfterDrawCall, // issued during AfterDrawCall. This event doesn't carry any parameters 69 | kUnityRenderingExtEventCustomGrab, // issued during GrabIntoRenderTexture since we can't simply copy the resources 70 | // when custom rendering is used - we need to let plugin handle this. It carries over 71 | // a UnityRenderingExtCustomBlitParams params = { X, source, dest, 0, 0 } ( X means it's irrelevant ) 72 | kUnityRenderingExtEventCustomBlit, // issued by plugin to insert custom blits. It carries over UnityRenderingExtCustomBlitParams as param. 73 | kUnityRenderingExtEventUpdateTextureBegin, // issued to update a texture. It carries over UnityRenderingExtTextureUpdateParams 74 | kUnityRenderingExtEventUpdateTextureEnd, // issued to signal the plugin that the texture update has finished. It carries over the same UnityRenderingExtTextureUpdateParams as kUnityRenderingExtEventUpdateTextureBegin 75 | 76 | // keep this last 77 | kUnityRenderingExtEventCount, 78 | kUnityRenderingExtUserEventsStart = kUnityRenderingExtEventCount 79 | }; 80 | 81 | 82 | enum UnityRenderingExtCustomBlitCommands 83 | { 84 | kUnityRenderingExtCustomBlitVRFlush, // This event is mostly used in multi GPU configurations ( SLI, etc ) in order to allow the plugin to flush all GPU's targets 85 | 86 | // keep this last 87 | kUnityRenderingExtCustomBlitCount, 88 | kUnityRenderingExtUserCustomBlitStart = kUnityRenderingExtCustomBlitCount 89 | }; 90 | 91 | /* 92 | This will be propagated to all plugins implementing UnityRenderingExtQuery. 93 | */ 94 | enum UnityRenderingExtQueryType 95 | { 96 | kUnityRenderingExtQueryOverrideViewport = 1 << 0, // The plugin handles setting up the viewport rects. Unity will skip its internal SetViewport calls 97 | kUnityRenderingExtQueryOverrideScissor = 1 << 1, // The plugin handles setting up the scissor rects. Unity will skip its internal SetScissor calls 98 | kUnityRenderingExtQueryOverrideVROcclussionMesh = 1 << 2, // The plugin handles its own VR occlusion mesh rendering. Unity will skip rendering its internal VR occlusion mask 99 | kUnityRenderingExtQueryOverrideVRSinglePass = 1 << 3, // The plugin uses its own single pass stereo technique. Unity will only traverse and render the render node graph once. 100 | // and it will clear the whole render target not just per-eye on demand. 101 | kUnityRenderingExtQueryKeepOriginalDoubleWideWidth_DEPRECATED = 1 << 4, // Instructs unity to keep the original double wide width. By default unity will try and have a power-of-two width for mip-mapping requirements. 102 | kUnityRenderingExtQueryRequestVRFlushCallback = 1 << 5, // Instructs unity to provide callbacks when the VR eye textures need flushing. Useful for multi GPU synchronization. 103 | }; 104 | 105 | 106 | enum UnityRenderingExtTextureFormat 107 | { 108 | kUnityRenderingExtFormatNone = 0, kUnityRenderingExtFormatFirst = kUnityRenderingExtFormatNone, 109 | 110 | // sRGB formats 111 | kUnityRenderingExtFormatR8_SRGB, 112 | kUnityRenderingExtFormatRG8_SRGB, 113 | kUnityRenderingExtFormatRGB8_SRGB, 114 | kUnityRenderingExtFormatRGBA8_SRGB, 115 | 116 | // 8 bit integer formats 117 | kUnityRenderingExtFormatR8_UNorm, 118 | kUnityRenderingExtFormatRG8_UNorm, 119 | kUnityRenderingExtFormatRGB8_UNorm, 120 | kUnityRenderingExtFormatRGBA8_UNorm, 121 | kUnityRenderingExtFormatR8_SNorm, 122 | kUnityRenderingExtFormatRG8_SNorm, 123 | kUnityRenderingExtFormatRGB8_SNorm, 124 | kUnityRenderingExtFormatRGBA8_SNorm, 125 | kUnityRenderingExtFormatR8_UInt, 126 | kUnityRenderingExtFormatRG8_UInt, 127 | kUnityRenderingExtFormatRGB8_UInt, 128 | kUnityRenderingExtFormatRGBA8_UInt, 129 | kUnityRenderingExtFormatR8_SInt, 130 | kUnityRenderingExtFormatRG8_SInt, 131 | kUnityRenderingExtFormatRGB8_SInt, 132 | kUnityRenderingExtFormatRGBA8_SInt, 133 | 134 | // 16 bit integer formats 135 | kUnityRenderingExtFormatR16_UNorm, 136 | kUnityRenderingExtFormatRG16_UNorm, 137 | kUnityRenderingExtFormatRGB16_UNorm, 138 | kUnityRenderingExtFormatRGBA16_UNorm, 139 | kUnityRenderingExtFormatR16_SNorm, 140 | kUnityRenderingExtFormatRG16_SNorm, 141 | kUnityRenderingExtFormatRGB16_SNorm, 142 | kUnityRenderingExtFormatRGBA16_SNorm, 143 | kUnityRenderingExtFormatR16_UInt, 144 | kUnityRenderingExtFormatRG16_UInt, 145 | kUnityRenderingExtFormatRGB16_UInt, 146 | kUnityRenderingExtFormatRGBA16_UInt, 147 | kUnityRenderingExtFormatR16_SInt, 148 | kUnityRenderingExtFormatRG16_SInt, 149 | kUnityRenderingExtFormatRGB16_SInt, 150 | kUnityRenderingExtFormatRGBA16_SInt, 151 | 152 | // 32 bit integer formats 153 | kUnityRenderingExtFormatR32_UInt, 154 | kUnityRenderingExtFormatRG32_UInt, 155 | kUnityRenderingExtFormatRGB32_UInt, 156 | kUnityRenderingExtFormatRGBA32_UInt, 157 | kUnityRenderingExtFormatR32_SInt, 158 | kUnityRenderingExtFormatRG32_SInt, 159 | kUnityRenderingExtFormatRGB32_SInt, 160 | kUnityRenderingExtFormatRGBA32_SInt, 161 | 162 | // HDR formats 163 | kUnityRenderingExtFormatR16_SFloat, 164 | kUnityRenderingExtFormatRG16_SFloat, 165 | kUnityRenderingExtFormatRGB16_SFloat, 166 | kUnityRenderingExtFormatRGBA16_SFloat, 167 | kUnityRenderingExtFormatR32_SFloat, 168 | kUnityRenderingExtFormatRG32_SFloat, 169 | kUnityRenderingExtFormatRGB32_SFloat, 170 | kUnityRenderingExtFormatRGBA32_SFloat, 171 | 172 | // Packed formats 173 | kUnityRenderingExtFormatRGB10A2_UNorm, 174 | kUnityRenderingExtFormatRGB10A2_UInt, 175 | kUnityRenderingExtFormatRGB10A2_SInt, 176 | kUnityRenderingExtFormatRGB9E5_UFloat, 177 | kUnityRenderingExtFormatRG11B10_UFloat, 178 | 179 | // Alpha format 180 | kUnityRenderingExtFormatA8_UNorm, 181 | kUnityRenderingExtFormatA16_UNorm, 182 | 183 | // BGR formats 184 | kUnityRenderingExtFormatBGR8_SRGB, 185 | kUnityRenderingExtFormatBGRA8_SRGB, 186 | kUnityRenderingExtFormatBGR8_UNorm, 187 | kUnityRenderingExtFormatBGRA8_UNorm, 188 | kUnityRenderingExtFormatBGR8_SNorm, 189 | kUnityRenderingExtFormatBGRA8_SNorm, 190 | kUnityRenderingExtFormatBGR8_UInt, 191 | kUnityRenderingExtFormatBGRA8_UInt, 192 | kUnityRenderingExtFormatBGR8_SInt, 193 | kUnityRenderingExtFormatBGRA8_SInt, 194 | 195 | kUnityRenderingExtFormatBGR10A2_UNorm, 196 | kUnityRenderingExtFormatBGR10A2_UInt, 197 | kUnityRenderingExtFormatBGR10A2XR_SRGB, 198 | kUnityRenderingExtFormatBGR10A2XR_UNorm, 199 | kUnityRenderingExtFormatBGR10XR_SRGB, 200 | kUnityRenderingExtFormatBGR10XR_UNorm, 201 | kUnityRenderingExtFormatBGRA10XR_SRGB, 202 | kUnityRenderingExtFormatBGRA10XR_UNorm, 203 | 204 | // 16 bit formats 205 | kUnityRenderingExtFormatRGBA4_UNorm, 206 | kUnityRenderingExtFormatBGRA4_UNorm, 207 | kUnityRenderingExtFormatR5G6B5_UNorm, 208 | kUnityRenderingExtFormatB5G6R5_UNorm, 209 | kUnityRenderingExtFormatRGB5A1_UNorm, 210 | kUnityRenderingExtFormatBGR5A1_UNorm, 211 | kUnityRenderingExtFormatA1RGB5_UNorm, 212 | 213 | // ARGB formats... TextureFormat legacy 214 | kUnityRenderingExtFormatARGB8_SRGB, 215 | kUnityRenderingExtFormatARGB8_UNorm, 216 | kUnityRenderingExtFormatARGB32_SFloat, 217 | 218 | // Depth Stencil for formats 219 | kUnityRenderingExtFormatDepth16_UInt, 220 | kUnityRenderingExtFormatDepth24_UInt, 221 | kUnityRenderingExtFormatDepth24_UInt_Stencil8_UInt, 222 | kUnityRenderingExtFormatDepth32_SFloat, 223 | kUnityRenderingExtFormatD32_SFloat_Stencil8_Uint, 224 | kUnityRenderingExtFormatStencil8_Uint, 225 | 226 | // Compression formats 227 | kUnityRenderingExtFormatRGB_DXT1_SRGB, kUnityRenderingExtFormatDXTCFirst = kUnityRenderingExtFormatRGB_DXT1_SRGB, 228 | kUnityRenderingExtFormatRGB_DXT1_UNorm, 229 | kUnityRenderingExtFormatRGBA_DXT3_SRGB, 230 | kUnityRenderingExtFormatRGBA_DXT3_UNorm, 231 | kUnityRenderingExtFormatRGBA_DXT5_SRGB, 232 | kUnityRenderingExtFormatRGBA_DXT5_UNorm, kUnityRenderingExtFormatDXTCLast = kUnityRenderingExtFormatRGBA_DXT5_UNorm, 233 | kUnityRenderingExtFormatR_BC4_UNorm, kUnityRenderingExtFormatRGTCFirst = kUnityRenderingExtFormatR_BC4_UNorm, 234 | kUnityRenderingExtFormatR_BC4_SNorm, 235 | kUnityRenderingExtFormatRG_BC5_UNorm, 236 | kUnityRenderingExtFormatRG_BC5_SNorm, kUnityRenderingExtFormatRGTCLast = kUnityRenderingExtFormatRG_BC5_SNorm, 237 | kUnityRenderingExtFormatRGB_BC6H_UFloat, kUnityRenderingExtFormatBPTCFirst = kUnityRenderingExtFormatRGB_BC6H_UFloat, 238 | kUnityRenderingExtFormatRGB_BC6H_SFloat, 239 | kUnityRenderingExtFormatRGBA_BC7_SRGB, 240 | kUnityRenderingExtFormatRGBA_BC7_UNorm, kUnityRenderingExtFormatBPTCLast = kUnityRenderingExtFormatRGBA_BC7_UNorm, 241 | 242 | kUnityRenderingExtFormatRGB_PVRTC_2Bpp_SRGB, kUnityRenderingExtFormatPVRTCFirst = kUnityRenderingExtFormatRGB_PVRTC_2Bpp_SRGB, 243 | kUnityRenderingExtFormatRGB_PVRTC_2Bpp_UNorm, 244 | kUnityRenderingExtFormatRGB_PVRTC_4Bpp_SRGB, 245 | kUnityRenderingExtFormatRGB_PVRTC_4Bpp_UNorm, 246 | kUnityRenderingExtFormatRGBA_PVRTC_2Bpp_SRGB, 247 | kUnityRenderingExtFormatRGBA_PVRTC_2Bpp_UNorm, 248 | kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_SRGB, 249 | kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_UNorm, kUnityRenderingExtFormatPVRTCLast = kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_UNorm, 250 | 251 | kUnityRenderingExtFormatRGB_ETC_UNorm, kUnityRenderingExtFormatETCFirst = kUnityRenderingExtFormatRGB_ETC_UNorm, 252 | kUnityRenderingExtFormatRGB_ETC2_SRGB, 253 | kUnityRenderingExtFormatRGB_ETC2_UNorm, 254 | kUnityRenderingExtFormatRGB_A1_ETC2_SRGB, 255 | kUnityRenderingExtFormatRGB_A1_ETC2_UNorm, 256 | kUnityRenderingExtFormatRGBA_ETC2_SRGB, 257 | kUnityRenderingExtFormatRGBA_ETC2_UNorm, kUnityRenderingExtFormatETCLast = kUnityRenderingExtFormatRGBA_ETC2_UNorm, 258 | 259 | kUnityRenderingExtFormatR_EAC_UNorm, kUnityRenderingExtFormatEACFirst = kUnityRenderingExtFormatR_EAC_UNorm, 260 | kUnityRenderingExtFormatR_EAC_SNorm, 261 | kUnityRenderingExtFormatRG_EAC_UNorm, 262 | kUnityRenderingExtFormatRG_EAC_SNorm, kUnityRenderingExtFormatEACLast = kUnityRenderingExtFormatRG_EAC_SNorm, 263 | 264 | kUnityRenderingExtFormatRGBA_ASTC4X4_SRGB, kUnityRenderingExtFormatASTCFirst = kUnityRenderingExtFormatRGBA_ASTC4X4_SRGB, 265 | kUnityRenderingExtFormatRGBA_ASTC4X4_UNorm, 266 | kUnityRenderingExtFormatRGBA_ASTC5X5_SRGB, 267 | kUnityRenderingExtFormatRGBA_ASTC5X5_UNorm, 268 | kUnityRenderingExtFormatRGBA_ASTC6X6_SRGB, 269 | kUnityRenderingExtFormatRGBA_ASTC6X6_UNorm, 270 | kUnityRenderingExtFormatRGBA_ASTC8X8_SRGB, 271 | kUnityRenderingExtFormatRGBA_ASTC8X8_UNorm, 272 | kUnityRenderingExtFormatRGBA_ASTC10X10_SRGB, 273 | kUnityRenderingExtFormatRGBA_ASTC10X10_UNorm, 274 | kUnityRenderingExtFormatRGBA_ASTC12X12_SRGB, 275 | kUnityRenderingExtFormatRGBA_ASTC12X12_UNorm, kUnityRenderingExtFormatASTCLast = kUnityRenderingExtFormatRGBA_ASTC12X12_UNorm, 276 | 277 | // Video formats 278 | kUnityRenderingExtFormatYUV2, 279 | 280 | // Automatic formats, back-end decides 281 | kUnityRenderingExtFormatLDRAuto, 282 | kUnityRenderingExtFormatHDRAuto, 283 | kUnityRenderingExtFormatDepthAuto, 284 | kUnityRenderingExtFormatShadowAuto, 285 | kUnityRenderingExtFormatVideoAuto, kUnityRenderingExtFormatLast = kUnityRenderingExtFormatVideoAuto, 286 | }; 287 | 288 | 289 | struct UnityRenderingExtBeforeDrawCallParams 290 | { 291 | void* vertexShader; // bound vertex shader (platform dependent) 292 | void* fragmentShader; // bound fragment shader (platform dependent) 293 | void* geometryShader; // bound geometry shader (platform dependent) 294 | void* hullShader; // bound hull shader (platform dependent) 295 | void* domainShader; // bound domain shader (platform dependent) 296 | int eyeIndex; // the index of the current stereo "eye" being currently rendered. 297 | }; 298 | 299 | 300 | struct UnityRenderingExtCustomBlitParams 301 | { 302 | UnityTextureID source; // source texture 303 | UnityRenderBuffer destination; // destination surface 304 | unsigned int command; // command for the custom blit - could be any UnityRenderingExtCustomBlitCommands command or custom ones. 305 | unsigned int commandParam; // custom parameters for the command 306 | unsigned int commandFlags; // custom flags for the command 307 | }; 308 | 309 | struct UnityRenderingExtTextureUpdateParams 310 | { 311 | void* texData; // source data for the texture update. Must be set by the plugin 312 | unsigned int userData; // user defined data. Set by the plugin 313 | 314 | unsigned int textureID; // texture ID of the texture to be updated. 315 | UnityRenderingExtTextureFormat format; // format of the texture to be updated 316 | unsigned int width; // width of the texture 317 | unsigned int height; // height of the texture 318 | unsigned int bpp; // texture bytes per pixel. 319 | }; 320 | 321 | 322 | // Certain Unity APIs (GL.IssuePluginEventAndData, CommandBuffer.IssuePluginEventAndData) can callback into native plugins. 323 | // Provide them with an address to a function of this signature. 324 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 325 | 326 | 327 | #ifdef __cplusplus 328 | extern "C" { 329 | #endif 330 | 331 | // If exported by a plugin, this function will be called for all the events in UnityRenderingExtEventType 332 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data); 333 | // If exported by a plugin, this function will be called to query the plugin for the queries in UnityRenderingExtQueryType 334 | bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityRenderingExtQuery(UnityRenderingExtQueryType query); 335 | 336 | #ifdef __cplusplus 337 | } 338 | #endif 339 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/java/com/ibicha/emojitexture/EmojiTexture.java: -------------------------------------------------------------------------------- 1 | package com.ibicha.emojitexture; 2 | 3 | import android.content.res.Resources; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.graphics.Rect; 8 | import android.text.Layout; 9 | import android.text.StaticLayout; 10 | import android.text.TextPaint; 11 | import android.util.DisplayMetrics; 12 | import android.util.Log; 13 | import android.util.TypedValue; 14 | 15 | import java.nio.ByteBuffer; 16 | 17 | /** 18 | * Created by ibicha on 2018-01-01. 19 | */ 20 | 21 | public class EmojiTexture { 22 | 23 | private static final int DEFAULT_MIN_TEXT_SIZE = 8; 24 | private static final int DEFAULT_MAX_TEXT_SIZE = 999; 25 | private static final float DEFAULT_PRECISION = 0.5f; 26 | 27 | 28 | static { 29 | Log.d("EmojiTexture", "static initializer: emojiTextureHelper"); 30 | System.loadLibrary("emojiTextureHelper"); 31 | } 32 | 33 | static long jGetTextureUpdateCallback(){ 34 | Log.d("EmojiTexture", "jGetTextureUpdateCallback: " + GetTextureUpdateCallback()); 35 | return GetTextureUpdateCallback(); 36 | } 37 | 38 | public static native long GetTextureUpdateCallback(); 39 | 40 | static int render(String text, ByteBuffer byteBuffer, int width, int height, boolean sanitize){ 41 | TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); 42 | textPaint.setTextAlign(Paint.Align.CENTER); 43 | 44 | if(text == null) 45 | text = ""; 46 | 47 | if(sanitize && text.length() > 0){ 48 | Rect bounds = new Rect(); 49 | for (int i = text.length(); i > 1 ; i--) { 50 | textPaint.getTextBounds(text,0, i, bounds); 51 | if((float)bounds.width()/(float)bounds.height() < 1.2){ 52 | text = text.substring(0, i); 53 | break; 54 | } 55 | } 56 | } 57 | 58 | Resources r = Resources.getSystem(); 59 | DisplayMetrics displayMetrics = r.getDisplayMetrics(); 60 | 61 | float fontSize = getAutofitTextSize(text, textPaint, 62 | width, 1, DEFAULT_MIN_TEXT_SIZE, DEFAULT_MAX_TEXT_SIZE, DEFAULT_PRECISION, 63 | displayMetrics); 64 | 65 | textPaint.setTextSize(fontSize); 66 | 67 | Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 68 | Canvas canvas = new Canvas(bitmap); 69 | 70 | Rect textBounds = new Rect(); 71 | textPaint.getTextBounds(text, 0, text.length(), textBounds); 72 | 73 | canvas.scale(1f, -1f, width/2, height/2); 74 | canvas.drawText(text, width/2, height/2 - (textBounds.bottom + textBounds.top) / 2.0f, textPaint); 75 | 76 | //bitmap to buffer 77 | byteBuffer.rewind(); 78 | bitmap.copyPixelsToBuffer(byteBuffer); 79 | 80 | return text.length(); 81 | } 82 | 83 | //https://github.com/grantland/android-autofittextview/blob/master/library/src/main/java/me/grantland/widget/AutofitHelper.java#L141 84 | private static float getAutofitTextSize(CharSequence text, TextPaint paint, 85 | float targetWidth, int maxLines, float low, float high, float precision, 86 | DisplayMetrics displayMetrics) { 87 | 88 | float mid = (low + high) / 2.0f; 89 | int lineCount = 1; 90 | StaticLayout layout = null; 91 | 92 | paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid, 93 | displayMetrics)); 94 | 95 | if (maxLines != 1) { 96 | layout = new StaticLayout(text, paint, (int)targetWidth, Layout.Alignment.ALIGN_CENTER, 97 | 1.0f, 0.0f, true); 98 | lineCount = layout.getLineCount(); 99 | } 100 | 101 | 102 | if (lineCount > maxLines) { 103 | // For the case that `text` has more newline characters than `maxLines`. 104 | if ((high - low) < precision) { 105 | return low; 106 | } 107 | return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, 108 | displayMetrics); 109 | } 110 | else if (lineCount < maxLines) { 111 | return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, 112 | displayMetrics); 113 | } 114 | else { 115 | float maxLineWidth = 0; 116 | if (maxLines == 1) { 117 | maxLineWidth = paint.measureText(text, 0, text.length()); 118 | } else { 119 | for (int i = 0; i < lineCount; i++) { 120 | if (layout.getLineWidth(i) > maxLineWidth) { 121 | maxLineWidth = layout.getLineWidth(i); 122 | } 123 | } 124 | } 125 | 126 | if ((high - low) < precision) { 127 | return low; 128 | } else if (maxLineWidth > targetWidth) { 129 | return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, 130 | displayMetrics); 131 | } else if (maxLineWidth < targetWidth) { 132 | return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, 133 | displayMetrics); 134 | } else { 135 | return mid; 136 | } 137 | } 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EmojiTexture 3 | 4 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/emojitexture/src/test/java/com/ibicha/emojitexture/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ibicha.emojitexture; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iBicha/EmojiTexture/99fce607f96357ea2848c83765d42c9c3b2adf67/Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jan 01 13:31:31 MST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/Android/source~/EmojiTexture/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':emojitexture' 2 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/WebGL.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e96d8457c2592e1468ec4cedb94a5ba0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/WebGL/EmojiTexture.jslib: -------------------------------------------------------------------------------- 1 | const EmojiTexturePrefix = "EmojiTexture_"; 2 | 3 | var EmojiTextureHelper = { 4 | canvas: null, 5 | ToJsString : function (ptr) { 6 | return Pointer_stringify(ptr); 7 | } 8 | }; 9 | 10 | var EmojiTexturePlugin = { 11 | render : function (emojiTextPtr, buffer, width, height, /*ignored*/ sanitize) { 12 | if (!EmojiTextureHelper.canvas) 13 | { 14 | EmojiTextureHelper.canvas = document.createElement('canvas'); 15 | EmojiTextureHelper.canvas.style.display = "none"; 16 | EmojiTextureHelper.canvas.id = "emojiCanvas"; 17 | } 18 | 19 | var emojiText = EmojiTextureHelper.ToJsString(emojiTextPtr); 20 | 21 | EmojiTextureHelper.canvas.width = width; 22 | EmojiTextureHelper.canvas.height = height; 23 | 24 | var ctx = EmojiTextureHelper.canvas.getContext("2d"); 25 | ctx.textAlign = "center"; 26 | ctx.textBaseline = "middle" 27 | ctx.font = "256px sans-serif"; 28 | 29 | var size = width; 30 | var scaleFactor = size / ctx.measureText(emojiText).width; 31 | 32 | ctx.translate(size/2, size/2); 33 | ctx.scale(scaleFactor, -scaleFactor); 34 | ctx.translate(-size/2, -size/2); 35 | 36 | ctx.fillText(emojiText, size/2, size/2); 37 | 38 | var imageData = ctx.getImageData(0, 0, width, height); 39 | writeArrayToMemory(imageData.data, buffer); 40 | 41 | //TODO: handle 'sanitize' 42 | return emojiText.length; 43 | } 44 | }; 45 | 46 | function MergePlugins(plugins, prefixes) { 47 | if (!Array.isArray(plugins)) { 48 | plugins = [plugins]; 49 | } 50 | if (!Array.isArray(prefixes)) { 51 | prefixes = [prefixes]; 52 | } 53 | for (var i = 0; i < plugins.length; i++) { 54 | //keys 55 | for (var key in plugins[i]) { 56 | if (plugins[i].hasOwnProperty(key)) { 57 | plugins[i][prefixes[i] + key] = plugins[i][key]; 58 | delete plugins[i][key]; 59 | } 60 | } 61 | //helper 62 | plugins[i].$EmojiTextureHelper = EmojiTextureHelper; 63 | autoAddDeps(plugins[i], '$EmojiTextureHelper'); 64 | //merge 65 | mergeInto(LibraryManager.library, plugins[i]); 66 | } 67 | } 68 | 69 | MergePlugins(EmojiTexturePlugin, EmojiTexturePrefix); 70 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/WebGL/EmojiTexture.jslib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d63c7f24b299c2349a12588f26119408 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 0 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | Facebook: WebGL 24 | second: 25 | enabled: 1 26 | settings: {} 27 | - first: 28 | WebGL: WebGL 29 | second: 30 | enabled: 1 31 | settings: {} 32 | userData: 33 | assetBundleName: 34 | assetBundleVariant: 35 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da0ccfc94616c454fbff5a76de6a1e3a 3 | folderAsset: yes 4 | timeCreated: 1514748008 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/EmojiTexture.mm: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #include "IUnityRenderingExtensions.h" 4 | 5 | UILabel * getUILabel() 6 | { 7 | static UILabel * label = nil; 8 | if (label == nil) 9 | { 10 | label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 256, 256)]; 11 | [label setOpaque:NO]; 12 | label.font = [UIFont systemFontOfSize:999]; 13 | label.textAlignment = NSTextAlignmentCenter; 14 | label.baselineAdjustment = UIBaselineAdjustmentAlignCenters; 15 | label.lineBreakMode = NSLineBreakByClipping; 16 | label.minimumScaleFactor = 0.0001; 17 | label.adjustsFontSizeToFitWidth = YES; 18 | } 19 | return label; 20 | } 21 | 22 | NSInteger GetGlyphCount(NSMutableAttributedString *attributedString) 23 | { 24 | CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attributedString); 25 | NSInteger count = CTLineGetGlyphCount(line); 26 | CFRelease(line); 27 | return count; 28 | } 29 | 30 | extern "C" { 31 | int EmojiTexture_render(const char* text, unsigned char * buffer , int width, int height, int sanitize) 32 | { 33 | int textLength = 0; 34 | NSUInteger bytesPerPixel = 4; 35 | NSUInteger bytesPerRow = bytesPerPixel * width; 36 | NSUInteger bitsPerComponent = 8; 37 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 38 | CGContextRef context = CGBitmapContextCreate(buffer, width, height, 39 | bitsPerComponent, bytesPerRow, colorSpace, 40 | kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); 41 | CGContextClearRect(context, CGRectMake(0, 0, width, height)); 42 | if(text){ 43 | UILabel * label = getUILabel(); 44 | [label setFrame:CGRectMake(0,0,width,height)]; 45 | 46 | NSMutableAttributedString *attributedString = 47 | [[NSMutableAttributedString alloc] initWithString:[NSString stringWithUTF8String: text]]; 48 | 49 | if(sanitize){ 50 | while (GetGlyphCount(attributedString) > 1) { 51 | [attributedString deleteCharactersInRange:NSMakeRange([attributedString length]-1, 1)]; 52 | } 53 | } 54 | 55 | textLength = (int)[attributedString length]; 56 | label.attributedText = attributedString; 57 | 58 | [label.layer renderInContext:context]; 59 | } 60 | CGColorSpaceRelease(colorSpace); 61 | CGContextRelease(context); 62 | return textLength; 63 | } 64 | } 65 | 66 | typedef void* (*BUFFER_BY_INDEX_DELEGATE)(int index); 67 | static BUFFER_BY_INDEX_DELEGATE s_getBufferByIndex; 68 | 69 | void TextureUpdateCallback(int eventID, void* data) 70 | { 71 | auto event = static_cast(eventID); 72 | 73 | if (event == kUnityRenderingExtEventUpdateTextureBegin) 74 | { 75 | // UpdateTextureBegin: Generate and return texture image data. 76 | auto params = reinterpret_cast(data); 77 | 78 | if (s_getBufferByIndex == NULL) 79 | return; 80 | 81 | void* texData = s_getBufferByIndex((int)params->userData); 82 | params->texData = texData; 83 | } 84 | } 85 | 86 | extern "C" UnityRenderingEventAndData UNITY_INTERFACE_EXPORT 87 | EmojiTexture_GetTextureUpdateCallback() 88 | { 89 | return TextureUpdateCallback; 90 | } 91 | 92 | extern "C" void UNITY_INTERFACE_EXPORT 93 | EmojiTexture_SetBufferRefByIndexFunction(BUFFER_BY_INDEX_DELEGATE fn) 94 | { 95 | s_getBufferByIndex = fn; 96 | } 97 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/EmojiTexture.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d16d3895927bc434bbb009b9eaa241e9 3 | timeCreated: 1514760200 4 | licenseType: Free 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 0 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | - first: 25 | iPhone: iOS 26 | second: 27 | enabled: 1 28 | settings: {} 29 | - first: 30 | tvOS: tvOS 31 | second: 32 | enabled: 1 33 | settings: {} 34 | userData: 35 | assetBundleName: 36 | assetBundleVariant: 37 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed 7 | //kUnityGfxRendererD3D9 = 1, // Direct3D 9, removed 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 12 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 13 | kUnityGfxRendererGXM = 12, // PlayStation Vita 14 | kUnityGfxRendererPS4 = 13, // PlayStation 4 15 | kUnityGfxRendererXboxOne = 14, // Xbox One 16 | kUnityGfxRendererMetal = 16, // iOS Metal 17 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 18 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 19 | kUnityGfxRendererVulkan = 21, // Vulkan 20 | kUnityGfxRendererNvn = 22, // Nintendo Switch NVN API 21 | kUnityGfxRendererXboxOneD3D12 = 23 // MS XboxOne Direct3D 12 22 | } UnityGfxRenderer; 23 | 24 | typedef enum UnityGfxDeviceEventType 25 | { 26 | kUnityGfxDeviceEventInitialize = 0, 27 | kUnityGfxDeviceEventShutdown = 1, 28 | kUnityGfxDeviceEventBeforeReset = 2, 29 | kUnityGfxDeviceEventAfterReset = 3, 30 | } UnityGfxDeviceEventType; 31 | 32 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 33 | 34 | // Should only be used on the rendering thread unless noted otherwise. 35 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 36 | { 37 | UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 38 | 39 | // This callback will be called when graphics device is created, destroyed, reset, etc. 40 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 41 | // when the graphics device is already created. 42 | void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 43 | void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 44 | int(UNITY_INTERFACE_API * ReserveEventIDRange)(int count); // reserves 'count' event IDs. Plugins should use the result as a base index when issuing events back and forth to avoid event id clashes. 45 | }; 46 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics) 47 | 48 | 49 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 50 | // Provide them with an address to a function of this signature. 51 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 52 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 53 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityGraphics.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85914e2cb214c4166a21674aef0055c8 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 1 18 | Exclude Linux: 1 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 1 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 1 23 | Exclude Win64: 1 24 | Exclude iOS: 0 25 | - first: 26 | Any: 27 | second: 28 | enabled: 0 29 | settings: {} 30 | - first: 31 | Editor: Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | DefaultValueInitialized: true 36 | - first: 37 | Facebook: Win 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: None 42 | - first: 43 | Facebook: Win64 44 | second: 45 | enabled: 0 46 | settings: 47 | CPU: None 48 | - first: 49 | Standalone: Linux 50 | second: 51 | enabled: 0 52 | settings: 53 | CPU: None 54 | - first: 55 | Standalone: Linux64 56 | second: 57 | enabled: 0 58 | settings: 59 | CPU: None 60 | - first: 61 | Standalone: LinuxUniversal 62 | second: 63 | enabled: 0 64 | settings: 65 | CPU: None 66 | - first: 67 | Standalone: OSXUniversal 68 | second: 69 | enabled: 0 70 | settings: 71 | CPU: x86 72 | - first: 73 | Standalone: Win 74 | second: 75 | enabled: 0 76 | settings: 77 | CPU: None 78 | - first: 79 | Standalone: Win64 80 | second: 81 | enabled: 0 82 | settings: 83 | CPU: None 84 | - first: 85 | iPhone: iOS 86 | second: 87 | enabled: 1 88 | settings: {} 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | // IUnityInterface is a registry of interfaces we choose to expose to plugins. 22 | // 23 | // USAGE: 24 | // --------- 25 | // To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: 26 | // 27 | // IMyInterface * ptr = registry->Get(); 28 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 | 30 | // Unity Interface GUID 31 | // Ensures global uniqueness. 32 | // 33 | // Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. 34 | // The net result should compile down to passing around the GUID. 35 | // 36 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. 37 | // The interface structure and the registration GUID are all that is required to expose the interface to other systems. 38 | struct UnityInterfaceGUID 39 | { 40 | #ifdef __cplusplus 41 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 42 | : m_GUIDHigh(high) 43 | , m_GUIDLow(low) 44 | { 45 | } 46 | 47 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 48 | { 49 | m_GUIDHigh = other.m_GUIDHigh; 50 | m_GUIDLow = other.m_GUIDLow; 51 | } 52 | 53 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 54 | { 55 | m_GUIDHigh = other.m_GUIDHigh; 56 | m_GUIDLow = other.m_GUIDLow; 57 | return *this; 58 | } 59 | 60 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 61 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 62 | #endif 63 | unsigned long long m_GUIDHigh; 64 | unsigned long long m_GUIDLow; 65 | }; 66 | #ifdef __cplusplus 67 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 68 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 69 | inline bool operator<(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 70 | inline bool operator>(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 71 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator<(left, right); } 72 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator>(left, right); } 73 | #else 74 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 75 | #endif 76 | 77 | 78 | #ifdef __cplusplus 79 | #define UNITY_DECLARE_INTERFACE(NAME) \ 80 | struct NAME : IUnityInterface 81 | 82 | // Generic version of GetUnityInterfaceGUID to allow us to specialize it 83 | // per interface below. The generic version has no actual implementation 84 | // on purpose. 85 | // 86 | // If you get errors about return values related to this method then 87 | // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with 88 | // your interface, or it is not visible at some point when you are 89 | // trying to retrieve or add an interface. 90 | template 91 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); 92 | 93 | // This is the macro you provide in your public interface header 94 | // outside of a namespace to allow us to map between type and GUID 95 | // without the user having to worry about it when attempting to 96 | // add or retrieve and interface from the registry. 97 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 98 | template<> \ 99 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 100 | { \ 101 | return UnityInterfaceGUID(HASHH,HASHL); \ 102 | } 103 | 104 | // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in 105 | // a particular namespace. As long as the namespace is visible at the time you call 106 | // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template 107 | // calls this will work fine, only the macro here needs to have the additional parameter 108 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ 109 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 110 | template<> \ 111 | inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ 112 | { \ 113 | return UnityInterfaceGUID(HASHH,HASHL); \ 114 | } 115 | 116 | // These macros allow for C compatibility in user code. 117 | #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() 118 | 119 | 120 | #else 121 | #define UNITY_DECLARE_INTERFACE(NAME) \ 122 | typedef struct NAME NAME; \ 123 | struct NAME 124 | 125 | // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that 126 | // can see a header containing this constant. However, it's only for C compatibility and thus should have 127 | // minimal impact. 128 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 129 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 130 | 131 | // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are 132 | // not going to be usable from C. 133 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) 134 | 135 | // These macros allow for C compatibility in user code. 136 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 137 | #endif 138 | 139 | // Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where 140 | // this may be needed. Unity code itself does not need this. 141 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterfaceSplit (UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDHigh, UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDLow); 142 | 143 | 144 | #ifdef __cplusplus 145 | struct IUnityInterface 146 | { 147 | }; 148 | #else 149 | typedef void IUnityInterface; 150 | #endif 151 | 152 | 153 | typedef struct IUnityInterfaces 154 | { 155 | // Returns an interface matching the guid. 156 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 157 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 158 | 159 | // Registers a new interface. 160 | void(UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface * ptr); 161 | 162 | // Split APIs for C 163 | IUnityInterface* (UNITY_INTERFACE_API * GetInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow); 164 | void(UNITY_INTERFACE_API * RegisterInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow, IUnityInterface * ptr); 165 | 166 | #ifdef __cplusplus 167 | // Helper for GetInterface. 168 | template 169 | INTERFACE* Get() 170 | { 171 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 172 | } 173 | 174 | // Helper for RegisterInterface. 175 | template 176 | void Register(IUnityInterface* ptr) 177 | { 178 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 179 | } 180 | 181 | #endif 182 | } IUnityInterfaces; 183 | 184 | 185 | #ifdef __cplusplus 186 | extern "C" { 187 | #endif 188 | 189 | // If exported by a plugin, this function will be called when the plugin is loaded. 190 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 191 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 192 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | 198 | struct RenderSurfaceBase; 199 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 200 | typedef unsigned int UnityTextureID; 201 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityInterface.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5d39d2e1bafd48d4bd5f0e723efe1e9 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 1 18 | Exclude Linux: 1 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 1 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 1 23 | Exclude Win64: 1 24 | Exclude iOS: 0 25 | - first: 26 | Any: 27 | second: 28 | enabled: 0 29 | settings: {} 30 | - first: 31 | Editor: Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | DefaultValueInitialized: true 36 | - first: 37 | Facebook: Win 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: None 42 | - first: 43 | Facebook: Win64 44 | second: 45 | enabled: 0 46 | settings: 47 | CPU: None 48 | - first: 49 | Standalone: Linux 50 | second: 51 | enabled: 0 52 | settings: 53 | CPU: None 54 | - first: 55 | Standalone: Linux64 56 | second: 57 | enabled: 0 58 | settings: 59 | CPU: None 60 | - first: 61 | Standalone: LinuxUniversal 62 | second: 63 | enabled: 0 64 | settings: 65 | CPU: None 66 | - first: 67 | Standalone: OSXUniversal 68 | second: 69 | enabled: 0 70 | settings: 71 | CPU: x86 72 | - first: 73 | Standalone: Win 74 | second: 75 | enabled: 0 76 | settings: 77 | CPU: None 78 | - first: 79 | Standalone: Win64 80 | second: 81 | enabled: 0 82 | settings: 83 | CPU: None 84 | - first: 85 | iPhone: iOS 86 | second: 87 | enabled: 1 88 | settings: {} 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityRenderingExtensions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "IUnityGraphics.h" 5 | 6 | /* 7 | Low-level Native Plugin Rendering Extensions 8 | ============================================ 9 | 10 | On top of the Low-level native plugin interface, Unity also supports low level rendering extensions that can receive callbacks when certain events happen. 11 | This is mostly used to implement and control low-level rendering in your plugin and enable it to work with Unity’s multithreaded rendering. 12 | 13 | Due to the low-level nature of this extension the plugin might need to be preloaded before the devices get created. 14 | Currently the convention is name-based namely the plugin name must be prefixed by “GfxPlugin”. Example: GfxPluginMyFancyNativePlugin. 15 | 16 | 17 | // Native plugin code example 18 | 19 | enum PluginCustomCommands 20 | { 21 | kPluginCustomCommandDownscale = kUnityRenderingExtUserEventsStart, 22 | kPluginCustomCommandUpscale, 23 | 24 | // insert your own events here 25 | 26 | kPluginCustomCommandCount 27 | }; 28 | 29 | static IUnityInterfaces* s_UnityInterfaces = NULL; 30 | 31 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API 32 | UnityPluginLoad(IUnityInterfaces* unityInterfaces) 33 | { 34 | // initialization code here... 35 | } 36 | 37 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API 38 | UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data) 39 | { 40 | switch (event) 41 | { 42 | case kUnityRenderingExtEventBeforeDrawCall: 43 | // do some stuff 44 | break; 45 | case kUnityRenderingExtEventAfterDrawCall: 46 | // undo some stuff 47 | break; 48 | case kPluginCustomCommandDownscale: 49 | // downscale some stuff 50 | break; 51 | case kPluginCustomCommandUpscale: 52 | // upscale some stuff 53 | break; 54 | } 55 | } 56 | 57 | */ 58 | 59 | 60 | // These events will be propagated to all plugins that implement void UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data); 61 | 62 | enum UnityRenderingExtEventType 63 | { 64 | kUnityRenderingExtEventSetStereoTarget, // issued during SetStereoTarget and carrying the current 'eye' index as parameter 65 | kUnityRenderingExtEventSetStereoEye, // issued during stereo rendering at the beginning of each eye's rendering loop. It carries the current 'eye' index as parameter 66 | kUnityRenderingExtEventStereoRenderingDone, // issued after the rendering has finished 67 | kUnityRenderingExtEventBeforeDrawCall, // issued during BeforeDrawCall and carrying UnityRenderingExtBeforeDrawCallParams as parameter 68 | kUnityRenderingExtEventAfterDrawCall, // issued during AfterDrawCall. This event doesn't carry any parameters 69 | kUnityRenderingExtEventCustomGrab, // issued during GrabIntoRenderTexture since we can't simply copy the resources 70 | // when custom rendering is used - we need to let plugin handle this. It carries over 71 | // a UnityRenderingExtCustomBlitParams params = { X, source, dest, 0, 0 } ( X means it's irrelevant ) 72 | kUnityRenderingExtEventCustomBlit, // issued by plugin to insert custom blits. It carries over UnityRenderingExtCustomBlitParams as param. 73 | kUnityRenderingExtEventUpdateTextureBegin, // issued to update a texture. It carries over UnityRenderingExtTextureUpdateParams 74 | kUnityRenderingExtEventUpdateTextureEnd, // issued to signal the plugin that the texture update has finished. It carries over the same UnityRenderingExtTextureUpdateParams as kUnityRenderingExtEventUpdateTextureBegin 75 | 76 | // keep this last 77 | kUnityRenderingExtEventCount, 78 | kUnityRenderingExtUserEventsStart = kUnityRenderingExtEventCount 79 | }; 80 | 81 | 82 | enum UnityRenderingExtCustomBlitCommands 83 | { 84 | kUnityRenderingExtCustomBlitVRFlush, // This event is mostly used in multi GPU configurations ( SLI, etc ) in order to allow the plugin to flush all GPU's targets 85 | 86 | // keep this last 87 | kUnityRenderingExtCustomBlitCount, 88 | kUnityRenderingExtUserCustomBlitStart = kUnityRenderingExtCustomBlitCount 89 | }; 90 | 91 | /* 92 | This will be propagated to all plugins implementing UnityRenderingExtQuery. 93 | */ 94 | enum UnityRenderingExtQueryType 95 | { 96 | kUnityRenderingExtQueryOverrideViewport = 1 << 0, // The plugin handles setting up the viewport rects. Unity will skip its internal SetViewport calls 97 | kUnityRenderingExtQueryOverrideScissor = 1 << 1, // The plugin handles setting up the scissor rects. Unity will skip its internal SetScissor calls 98 | kUnityRenderingExtQueryOverrideVROcclussionMesh = 1 << 2, // The plugin handles its own VR occlusion mesh rendering. Unity will skip rendering its internal VR occlusion mask 99 | kUnityRenderingExtQueryOverrideVRSinglePass = 1 << 3, // The plugin uses its own single pass stereo technique. Unity will only traverse and render the render node graph once. 100 | // and it will clear the whole render target not just per-eye on demand. 101 | kUnityRenderingExtQueryKeepOriginalDoubleWideWidth_DEPRECATED = 1 << 4, // Instructs unity to keep the original double wide width. By default unity will try and have a power-of-two width for mip-mapping requirements. 102 | kUnityRenderingExtQueryRequestVRFlushCallback = 1 << 5, // Instructs unity to provide callbacks when the VR eye textures need flushing. Useful for multi GPU synchronization. 103 | }; 104 | 105 | 106 | enum UnityRenderingExtTextureFormat 107 | { 108 | kUnityRenderingExtFormatNone = 0, kUnityRenderingExtFormatFirst = kUnityRenderingExtFormatNone, 109 | 110 | // sRGB formats 111 | kUnityRenderingExtFormatR8_SRGB, 112 | kUnityRenderingExtFormatRG8_SRGB, 113 | kUnityRenderingExtFormatRGB8_SRGB, 114 | kUnityRenderingExtFormatRGBA8_SRGB, 115 | 116 | // 8 bit integer formats 117 | kUnityRenderingExtFormatR8_UNorm, 118 | kUnityRenderingExtFormatRG8_UNorm, 119 | kUnityRenderingExtFormatRGB8_UNorm, 120 | kUnityRenderingExtFormatRGBA8_UNorm, 121 | kUnityRenderingExtFormatR8_SNorm, 122 | kUnityRenderingExtFormatRG8_SNorm, 123 | kUnityRenderingExtFormatRGB8_SNorm, 124 | kUnityRenderingExtFormatRGBA8_SNorm, 125 | kUnityRenderingExtFormatR8_UInt, 126 | kUnityRenderingExtFormatRG8_UInt, 127 | kUnityRenderingExtFormatRGB8_UInt, 128 | kUnityRenderingExtFormatRGBA8_UInt, 129 | kUnityRenderingExtFormatR8_SInt, 130 | kUnityRenderingExtFormatRG8_SInt, 131 | kUnityRenderingExtFormatRGB8_SInt, 132 | kUnityRenderingExtFormatRGBA8_SInt, 133 | 134 | // 16 bit integer formats 135 | kUnityRenderingExtFormatR16_UNorm, 136 | kUnityRenderingExtFormatRG16_UNorm, 137 | kUnityRenderingExtFormatRGB16_UNorm, 138 | kUnityRenderingExtFormatRGBA16_UNorm, 139 | kUnityRenderingExtFormatR16_SNorm, 140 | kUnityRenderingExtFormatRG16_SNorm, 141 | kUnityRenderingExtFormatRGB16_SNorm, 142 | kUnityRenderingExtFormatRGBA16_SNorm, 143 | kUnityRenderingExtFormatR16_UInt, 144 | kUnityRenderingExtFormatRG16_UInt, 145 | kUnityRenderingExtFormatRGB16_UInt, 146 | kUnityRenderingExtFormatRGBA16_UInt, 147 | kUnityRenderingExtFormatR16_SInt, 148 | kUnityRenderingExtFormatRG16_SInt, 149 | kUnityRenderingExtFormatRGB16_SInt, 150 | kUnityRenderingExtFormatRGBA16_SInt, 151 | 152 | // 32 bit integer formats 153 | kUnityRenderingExtFormatR32_UInt, 154 | kUnityRenderingExtFormatRG32_UInt, 155 | kUnityRenderingExtFormatRGB32_UInt, 156 | kUnityRenderingExtFormatRGBA32_UInt, 157 | kUnityRenderingExtFormatR32_SInt, 158 | kUnityRenderingExtFormatRG32_SInt, 159 | kUnityRenderingExtFormatRGB32_SInt, 160 | kUnityRenderingExtFormatRGBA32_SInt, 161 | 162 | // HDR formats 163 | kUnityRenderingExtFormatR16_SFloat, 164 | kUnityRenderingExtFormatRG16_SFloat, 165 | kUnityRenderingExtFormatRGB16_SFloat, 166 | kUnityRenderingExtFormatRGBA16_SFloat, 167 | kUnityRenderingExtFormatR32_SFloat, 168 | kUnityRenderingExtFormatRG32_SFloat, 169 | kUnityRenderingExtFormatRGB32_SFloat, 170 | kUnityRenderingExtFormatRGBA32_SFloat, 171 | 172 | // Packed formats 173 | kUnityRenderingExtFormatRGB10A2_UNorm, 174 | kUnityRenderingExtFormatRGB10A2_UInt, 175 | kUnityRenderingExtFormatRGB10A2_SInt, 176 | kUnityRenderingExtFormatRGB9E5_UFloat, 177 | kUnityRenderingExtFormatRG11B10_UFloat, 178 | 179 | // Alpha format 180 | kUnityRenderingExtFormatA8_UNorm, 181 | kUnityRenderingExtFormatA16_UNorm, 182 | 183 | // BGR formats 184 | kUnityRenderingExtFormatBGR8_SRGB, 185 | kUnityRenderingExtFormatBGRA8_SRGB, 186 | kUnityRenderingExtFormatBGR8_UNorm, 187 | kUnityRenderingExtFormatBGRA8_UNorm, 188 | kUnityRenderingExtFormatBGR8_SNorm, 189 | kUnityRenderingExtFormatBGRA8_SNorm, 190 | kUnityRenderingExtFormatBGR8_UInt, 191 | kUnityRenderingExtFormatBGRA8_UInt, 192 | kUnityRenderingExtFormatBGR8_SInt, 193 | kUnityRenderingExtFormatBGRA8_SInt, 194 | 195 | kUnityRenderingExtFormatBGR10A2_UNorm, 196 | kUnityRenderingExtFormatBGR10A2_UInt, 197 | kUnityRenderingExtFormatBGR10A2XR_SRGB, 198 | kUnityRenderingExtFormatBGR10A2XR_UNorm, 199 | kUnityRenderingExtFormatBGR10XR_SRGB, 200 | kUnityRenderingExtFormatBGR10XR_UNorm, 201 | kUnityRenderingExtFormatBGRA10XR_SRGB, 202 | kUnityRenderingExtFormatBGRA10XR_UNorm, 203 | 204 | // 16 bit formats 205 | kUnityRenderingExtFormatRGBA4_UNorm, 206 | kUnityRenderingExtFormatBGRA4_UNorm, 207 | kUnityRenderingExtFormatR5G6B5_UNorm, 208 | kUnityRenderingExtFormatB5G6R5_UNorm, 209 | kUnityRenderingExtFormatRGB5A1_UNorm, 210 | kUnityRenderingExtFormatBGR5A1_UNorm, 211 | kUnityRenderingExtFormatA1RGB5_UNorm, 212 | 213 | // ARGB formats... TextureFormat legacy 214 | kUnityRenderingExtFormatARGB8_SRGB, 215 | kUnityRenderingExtFormatARGB8_UNorm, 216 | kUnityRenderingExtFormatARGB32_SFloat, 217 | 218 | // Depth Stencil for formats 219 | kUnityRenderingExtFormatDepth16_UInt, 220 | kUnityRenderingExtFormatDepth24_UInt, 221 | kUnityRenderingExtFormatDepth24_UInt_Stencil8_UInt, 222 | kUnityRenderingExtFormatDepth32_SFloat, 223 | kUnityRenderingExtFormatD32_SFloat_Stencil8_Uint, 224 | kUnityRenderingExtFormatStencil8_Uint, 225 | 226 | // Compression formats 227 | kUnityRenderingExtFormatRGB_DXT1_SRGB, kUnityRenderingExtFormatDXTCFirst = kUnityRenderingExtFormatRGB_DXT1_SRGB, 228 | kUnityRenderingExtFormatRGB_DXT1_UNorm, 229 | kUnityRenderingExtFormatRGBA_DXT3_SRGB, 230 | kUnityRenderingExtFormatRGBA_DXT3_UNorm, 231 | kUnityRenderingExtFormatRGBA_DXT5_SRGB, 232 | kUnityRenderingExtFormatRGBA_DXT5_UNorm, kUnityRenderingExtFormatDXTCLast = kUnityRenderingExtFormatRGBA_DXT5_UNorm, 233 | kUnityRenderingExtFormatR_BC4_UNorm, kUnityRenderingExtFormatRGTCFirst = kUnityRenderingExtFormatR_BC4_UNorm, 234 | kUnityRenderingExtFormatR_BC4_SNorm, 235 | kUnityRenderingExtFormatRG_BC5_UNorm, 236 | kUnityRenderingExtFormatRG_BC5_SNorm, kUnityRenderingExtFormatRGTCLast = kUnityRenderingExtFormatRG_BC5_SNorm, 237 | kUnityRenderingExtFormatRGB_BC6H_UFloat, kUnityRenderingExtFormatBPTCFirst = kUnityRenderingExtFormatRGB_BC6H_UFloat, 238 | kUnityRenderingExtFormatRGB_BC6H_SFloat, 239 | kUnityRenderingExtFormatRGBA_BC7_SRGB, 240 | kUnityRenderingExtFormatRGBA_BC7_UNorm, kUnityRenderingExtFormatBPTCLast = kUnityRenderingExtFormatRGBA_BC7_UNorm, 241 | 242 | kUnityRenderingExtFormatRGB_PVRTC_2Bpp_SRGB, kUnityRenderingExtFormatPVRTCFirst = kUnityRenderingExtFormatRGB_PVRTC_2Bpp_SRGB, 243 | kUnityRenderingExtFormatRGB_PVRTC_2Bpp_UNorm, 244 | kUnityRenderingExtFormatRGB_PVRTC_4Bpp_SRGB, 245 | kUnityRenderingExtFormatRGB_PVRTC_4Bpp_UNorm, 246 | kUnityRenderingExtFormatRGBA_PVRTC_2Bpp_SRGB, 247 | kUnityRenderingExtFormatRGBA_PVRTC_2Bpp_UNorm, 248 | kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_SRGB, 249 | kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_UNorm, kUnityRenderingExtFormatPVRTCLast = kUnityRenderingExtFormatRGBA_PVRTC_4Bpp_UNorm, 250 | 251 | kUnityRenderingExtFormatRGB_ETC_UNorm, kUnityRenderingExtFormatETCFirst = kUnityRenderingExtFormatRGB_ETC_UNorm, 252 | kUnityRenderingExtFormatRGB_ETC2_SRGB, 253 | kUnityRenderingExtFormatRGB_ETC2_UNorm, 254 | kUnityRenderingExtFormatRGB_A1_ETC2_SRGB, 255 | kUnityRenderingExtFormatRGB_A1_ETC2_UNorm, 256 | kUnityRenderingExtFormatRGBA_ETC2_SRGB, 257 | kUnityRenderingExtFormatRGBA_ETC2_UNorm, kUnityRenderingExtFormatETCLast = kUnityRenderingExtFormatRGBA_ETC2_UNorm, 258 | 259 | kUnityRenderingExtFormatR_EAC_UNorm, kUnityRenderingExtFormatEACFirst = kUnityRenderingExtFormatR_EAC_UNorm, 260 | kUnityRenderingExtFormatR_EAC_SNorm, 261 | kUnityRenderingExtFormatRG_EAC_UNorm, 262 | kUnityRenderingExtFormatRG_EAC_SNorm, kUnityRenderingExtFormatEACLast = kUnityRenderingExtFormatRG_EAC_SNorm, 263 | 264 | kUnityRenderingExtFormatRGBA_ASTC4X4_SRGB, kUnityRenderingExtFormatASTCFirst = kUnityRenderingExtFormatRGBA_ASTC4X4_SRGB, 265 | kUnityRenderingExtFormatRGBA_ASTC4X4_UNorm, 266 | kUnityRenderingExtFormatRGBA_ASTC5X5_SRGB, 267 | kUnityRenderingExtFormatRGBA_ASTC5X5_UNorm, 268 | kUnityRenderingExtFormatRGBA_ASTC6X6_SRGB, 269 | kUnityRenderingExtFormatRGBA_ASTC6X6_UNorm, 270 | kUnityRenderingExtFormatRGBA_ASTC8X8_SRGB, 271 | kUnityRenderingExtFormatRGBA_ASTC8X8_UNorm, 272 | kUnityRenderingExtFormatRGBA_ASTC10X10_SRGB, 273 | kUnityRenderingExtFormatRGBA_ASTC10X10_UNorm, 274 | kUnityRenderingExtFormatRGBA_ASTC12X12_SRGB, 275 | kUnityRenderingExtFormatRGBA_ASTC12X12_UNorm, kUnityRenderingExtFormatASTCLast = kUnityRenderingExtFormatRGBA_ASTC12X12_UNorm, 276 | 277 | // Video formats 278 | kUnityRenderingExtFormatYUV2, 279 | 280 | // Automatic formats, back-end decides 281 | kUnityRenderingExtFormatLDRAuto, 282 | kUnityRenderingExtFormatHDRAuto, 283 | kUnityRenderingExtFormatDepthAuto, 284 | kUnityRenderingExtFormatShadowAuto, 285 | kUnityRenderingExtFormatVideoAuto, kUnityRenderingExtFormatLast = kUnityRenderingExtFormatVideoAuto, 286 | }; 287 | 288 | 289 | struct UnityRenderingExtBeforeDrawCallParams 290 | { 291 | void* vertexShader; // bound vertex shader (platform dependent) 292 | void* fragmentShader; // bound fragment shader (platform dependent) 293 | void* geometryShader; // bound geometry shader (platform dependent) 294 | void* hullShader; // bound hull shader (platform dependent) 295 | void* domainShader; // bound domain shader (platform dependent) 296 | int eyeIndex; // the index of the current stereo "eye" being currently rendered. 297 | }; 298 | 299 | 300 | struct UnityRenderingExtCustomBlitParams 301 | { 302 | UnityTextureID source; // source texture 303 | UnityRenderBuffer destination; // destination surface 304 | unsigned int command; // command for the custom blit - could be any UnityRenderingExtCustomBlitCommands command or custom ones. 305 | unsigned int commandParam; // custom parameters for the command 306 | unsigned int commandFlags; // custom flags for the command 307 | }; 308 | 309 | struct UnityRenderingExtTextureUpdateParams 310 | { 311 | void* texData; // source data for the texture update. Must be set by the plugin 312 | unsigned int userData; // user defined data. Set by the plugin 313 | 314 | unsigned int textureID; // texture ID of the texture to be updated. 315 | UnityRenderingExtTextureFormat format; // format of the texture to be updated 316 | unsigned int width; // width of the texture 317 | unsigned int height; // height of the texture 318 | unsigned int bpp; // texture bytes per pixel. 319 | }; 320 | 321 | 322 | // Certain Unity APIs (GL.IssuePluginEventAndData, CommandBuffer.IssuePluginEventAndData) can callback into native plugins. 323 | // Provide them with an address to a function of this signature. 324 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 325 | 326 | 327 | #ifdef __cplusplus 328 | extern "C" { 329 | #endif 330 | 331 | // If exported by a plugin, this function will be called for all the events in UnityRenderingExtEventType 332 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityRenderingExtEvent(UnityRenderingExtEventType event, void* data); 333 | // If exported by a plugin, this function will be called to query the plugin for the queries in UnityRenderingExtQueryType 334 | bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityRenderingExtQuery(UnityRenderingExtQueryType query); 335 | 336 | #ifdef __cplusplus 337 | } 338 | #endif 339 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/Plugins/iOS/IUnityRenderingExtensions.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb3cc8ba5a20d42f68103d328ba171dc 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 1 18 | Exclude Linux: 1 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 1 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 1 23 | Exclude Win64: 1 24 | Exclude iOS: 0 25 | - first: 26 | Any: 27 | second: 28 | enabled: 0 29 | settings: {} 30 | - first: 31 | Editor: Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | DefaultValueInitialized: true 36 | - first: 37 | Facebook: Win 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: None 42 | - first: 43 | Facebook: Win64 44 | second: 45 | enabled: 0 46 | settings: 47 | CPU: None 48 | - first: 49 | Standalone: Linux 50 | second: 51 | enabled: 0 52 | settings: 53 | CPU: None 54 | - first: 55 | Standalone: Linux64 56 | second: 57 | enabled: 0 58 | settings: 59 | CPU: None 60 | - first: 61 | Standalone: LinuxUniversal 62 | second: 63 | enabled: 0 64 | settings: 65 | CPU: None 66 | - first: 67 | Standalone: OSXUniversal 68 | second: 69 | enabled: 0 70 | settings: 71 | CPU: x86 72 | - first: 73 | Standalone: Win 74 | second: 75 | enabled: 0 76 | settings: 77 | CPU: None 78 | - first: 79 | Standalone: Win64 80 | second: 81 | enabled: 0 82 | settings: 83 | CPU: None 84 | - first: 85 | iPhone: iOS 86 | second: 87 | enabled: 1 88 | settings: {} 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/TMPro.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19aabd508cca6f044a209614b70a1b64 3 | folderAsset: yes 4 | timeCreated: 1518710778 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/TMPro/TMP_EmojiSupport.cs: -------------------------------------------------------------------------------- 1 | #if TMPRO_EMOJIS 2 | using System.Collections; 3 | using TMPro; 4 | using UnityEngine; 5 | 6 | namespace iBicha.TMPro 7 | { 8 | [RequireComponent(typeof(TMP_Text))] 9 | public class TMP_EmojiSupport : MonoBehaviour 10 | { 11 | public bool githubFallback = true; 12 | 13 | private TMP_Text textComponent; 14 | private string lastProcessedText = ""; 15 | private void Awake() 16 | { 17 | textComponent = GetComponent(); 18 | TMProEmojiAsset.HookTMP(textComponent); 19 | } 20 | 21 | private void OnEnable() 22 | { 23 | TMPro_EventManager.TEXT_CHANGED_EVENT.Add(OnTextChange); 24 | } 25 | 26 | private void OnDisable() 27 | { 28 | TMPro_EventManager.TEXT_CHANGED_EVENT.Remove(OnTextChange); 29 | } 30 | 31 | void OnTextChange(object obj) 32 | { 33 | TMP_Text tmp_Text = (TMP_Text)obj; 34 | if (tmp_Text == textComponent && lastProcessedText != textComponent.text) 35 | { 36 | var text = textComponent.text; 37 | lastProcessedText = text; 38 | 39 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR 40 | bool spriteSheetUpdated = TMProEmojiAsset.Process(text); 41 | 42 | if(spriteSheetUpdated){ 43 | StartCoroutine(ApplyChangesNextFrame()); 44 | } 45 | #else 46 | if(githubFallback){ 47 | StartCoroutine(ProcessAsync(text)); 48 | } 49 | #endif 50 | } 51 | } 52 | 53 | IEnumerator ProcessAsync(string text) 54 | { 55 | yield return TMProEmojiAsset.ProcessAsync(text); 56 | if(TMProEmojiAsset.didProcessAsync){ 57 | yield return ApplyChangesNextFrame(); 58 | } 59 | } 60 | 61 | IEnumerator ApplyChangesNextFrame() 62 | { 63 | yield return new WaitForEndOfFrame(); 64 | textComponent.havePropertiesChanged = true; 65 | } 66 | 67 | } 68 | 69 | } 70 | 71 | #else 72 | using UnityEngine; 73 | 74 | namespace iBicha.TMPro 75 | { 76 | public class TMP_EmojiSupport : MonoBehaviour 77 | { 78 | private void Start() 79 | { 80 | Debug.LogWarning("EmojiTexture for TextMesh Pro is not active, please add 'TMPRO_EMOJIS' to the Scripting Define Symbols in the Player Settings."); 81 | } 82 | } 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/TMPro/TMP_EmojiSupport.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebd182d32323948f28ba5938530b1c19 3 | timeCreated: 1522040082 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/EmojiTexture/TMPro/TMProEmojiAsset.cs: -------------------------------------------------------------------------------- 1 | #if TMPRO_EMOJIS 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using TMPro; 5 | using iBicha.Github; 6 | using UnityEngine; 7 | 8 | namespace iBicha.TMPro 9 | { 10 | public class TMProEmojiAsset 11 | { 12 | //I don't know if it is worth resizing downloaded images... 13 | const int EMOJI_SIZE = 128; //IMPORTANT! Github returns 128x128 images 14 | const int SHEET_TILES = 4; //4x4 emojis 15 | const int SHEET_SIZE = SHEET_TILES * EMOJI_SIZE; 16 | 17 | private static TMP_SpriteAsset rootEmojiAsset; 18 | private static TMP_SpriteAsset currentEmojiAsset; 19 | private static int currentEmojiIndex; 20 | 21 | private static bool textureNeedsApply; 22 | private static EmojiTexture emojiTexture; 23 | 24 | public static bool didProcessAsync { get; private set; } 25 | 26 | public static void HookTMP(TMP_Text tmp_Text) 27 | { 28 | if (tmp_Text == null) 29 | return; 30 | 31 | if (rootEmojiAsset == null) 32 | { 33 | rootEmojiAsset = CreateTMP_SpriteAsset(); 34 | currentEmojiAsset = rootEmojiAsset; 35 | currentEmojiIndex = 0; 36 | } 37 | 38 | if (emojiTexture == null) 39 | { 40 | emojiTexture = new EmojiTexture(EMOJI_SIZE); 41 | } 42 | 43 | if (tmp_Text.spriteAsset == null) 44 | { 45 | tmp_Text.spriteAsset = rootEmojiAsset; 46 | } 47 | else if(tmp_Text.spriteAsset != rootEmojiAsset) 48 | { 49 | if (tmp_Text.spriteAsset.fallbackSpriteAssets == null) 50 | tmp_Text.spriteAsset.fallbackSpriteAssets = new List(); 51 | 52 | if (!tmp_Text.spriteAsset.fallbackSpriteAssets.Contains(rootEmojiAsset)) 53 | tmp_Text.spriteAsset.fallbackSpriteAssets.Add(rootEmojiAsset); 54 | } 55 | } 56 | 57 | public static void UnhookTMP(TMP_Text tmp_Text) 58 | { 59 | if (tmp_Text == null || tmp_Text.spriteAsset == null) 60 | return; 61 | 62 | if(tmp_Text.spriteAsset == rootEmojiAsset) 63 | { 64 | tmp_Text.spriteAsset = null; 65 | return; 66 | } 67 | 68 | if (tmp_Text.spriteAsset.fallbackSpriteAssets != null && tmp_Text.spriteAsset.fallbackSpriteAssets.Contains(rootEmojiAsset)) 69 | tmp_Text.spriteAsset.fallbackSpriteAssets.Remove(rootEmojiAsset); 70 | } 71 | 72 | public static IEnumerator ProcessAsync(string text) 73 | { 74 | didProcessAsync = false; 75 | if (rootEmojiAsset == null) 76 | yield break; 77 | 78 | if (string.IsNullOrEmpty(text)) 79 | yield break; 80 | 81 | List detectedEmojis = new List(); 82 | 83 | string emojiText = null; 84 | while ((emojiText = EmojiTexture.GetFirstEmoji(text)) != null) 85 | { 86 | text = text.Substring(text.IndexOf(emojiText, System.StringComparison.Ordinal)); 87 | 88 | if (!string.IsNullOrEmpty(emojiText)) 89 | { 90 | int spriteIndex = -1; 91 | TMP_SpriteAsset spriteAsset = TMP_SpriteAsset 92 | .SearchForSpriteByUnicode(rootEmojiAsset, char.ConvertToUtf32(emojiText, 0), true, out spriteIndex); 93 | if (spriteAsset == null) 94 | { 95 | detectedEmojis.Add(emojiText); 96 | } 97 | text = text.Substring(emojiText.Length); 98 | } 99 | else 100 | { 101 | break; 102 | } 103 | } 104 | 105 | if (detectedEmojis.Count > 0) 106 | yield return GithubHelper.Initialize(); 107 | 108 | foreach (var detectedEmoji in detectedEmojis) 109 | { 110 | string hex = char.ConvertToUtf32(detectedEmoji, 0).ToString("X"); 111 | 112 | if(GithubHelper.IsValid(hex)){ 113 | yield return emojiTexture.SetGithubEmoji(hex); 114 | if(emojiTexture.didDownloadTexture){ 115 | PushSprite(emojiTexture); 116 | didProcessAsync = true; 117 | } 118 | } 119 | } 120 | 121 | //If the texture has unsaved changes, we apply them here 122 | //And make it non readable if it is full 123 | if (textureNeedsApply) 124 | { 125 | var makeNoLongerReadable = currentEmojiIndex == SHEET_TILES * SHEET_TILES; 126 | ((Texture2D)currentEmojiAsset.spriteSheet).Apply(false, makeNoLongerReadable); 127 | textureNeedsApply = false; 128 | } 129 | } 130 | 131 | public static bool Process(string text) 132 | { 133 | bool spriteSheetUpdated = false; 134 | 135 | if (rootEmojiAsset == null) 136 | return spriteSheetUpdated; 137 | 138 | if (string.IsNullOrEmpty(text)) 139 | return spriteSheetUpdated; 140 | 141 | int index = -1; 142 | while ((index = EmojiTexture.IndexOfFirstEmoji(text)) != -1) 143 | { 144 | text = text.Substring(index); 145 | emojiTexture.Text = text; 146 | 147 | if(!string.IsNullOrEmpty(emojiTexture.Text)){ 148 | int spriteIndex = -1; 149 | TMP_SpriteAsset spriteAsset = TMP_SpriteAsset 150 | .SearchForSpriteByUnicode(rootEmojiAsset, emojiTexture.Unicode, true, out spriteIndex); 151 | if (spriteAsset == null) 152 | { 153 | PushSprite(emojiTexture); 154 | spriteSheetUpdated = true; 155 | } 156 | text = text.Substring(emojiTexture.Text.Length); 157 | } else { 158 | break; 159 | } 160 | } 161 | 162 | //If the texture has unsaved changes, we apply them here 163 | //And make it non readable if it is full 164 | if (textureNeedsApply) 165 | { 166 | var makeNoLongerReadable = currentEmojiIndex == SHEET_TILES * SHEET_TILES; 167 | ((Texture2D)currentEmojiAsset.spriteSheet).Apply(false, makeNoLongerReadable); 168 | textureNeedsApply = false; 169 | } 170 | 171 | return spriteSheetUpdated; 172 | } 173 | 174 | private static TMP_SpriteAsset CreateTMP_SpriteAsset() 175 | { 176 | var texture = new Texture2D(SHEET_SIZE, SHEET_SIZE, TextureFormat.RGBA32, false); 177 | if (EmojiTexture.CanCopyTextures) 178 | { 179 | //If we can copy textures on the GPU, we make it 180 | //non readable to free up the RAM copy 181 | //TODO: can we create a non readable texture in the first place? 182 | texture.Apply(false, true); 183 | } 184 | var spriteAsset = ScriptableObject.CreateInstance(); 185 | spriteAsset.fallbackSpriteAssets = new List(); 186 | spriteAsset.spriteInfoList = new List(); 187 | spriteAsset.spriteSheet = texture; 188 | spriteAsset.material = new Material(Shader.Find("TextMeshPro/Sprite")); 189 | spriteAsset.material.mainTexture = spriteAsset.spriteSheet; 190 | return spriteAsset; 191 | } 192 | 193 | private static void PushSprite(EmojiTexture emojiTex) 194 | { 195 | if (currentEmojiIndex >= SHEET_TILES * SHEET_TILES) 196 | { 197 | var newSheet = CreateTMP_SpriteAsset(); 198 | rootEmojiAsset.fallbackSpriteAssets.Add(newSheet); 199 | currentEmojiAsset = newSheet; 200 | currentEmojiIndex = 0; 201 | } 202 | 203 | int row = currentEmojiIndex % SHEET_TILES; 204 | int column = currentEmojiIndex / SHEET_TILES; 205 | 206 | if (EmojiTexture.CanCopyTextures) 207 | { 208 | Graphics.CopyTexture(emojiTex, 0, 0, 0, 0, EMOJI_SIZE, EMOJI_SIZE, 209 | currentEmojiAsset.spriteSheet, 0, 0, row * EMOJI_SIZE, 210 | (SHEET_SIZE) - ((column + 1) * EMOJI_SIZE)); 211 | } 212 | else 213 | { 214 | //If we can't copy on the GPU, we copy on the CPU 215 | var pixels = ((Texture2D)emojiTex).GetPixels32(0); 216 | ((Texture2D)currentEmojiAsset.spriteSheet).SetPixels32( 217 | row * EMOJI_SIZE, (SHEET_SIZE) - ((column + 1) * EMOJI_SIZE), EMOJI_SIZE, EMOJI_SIZE, pixels, 0); 218 | 219 | //Free CPU copy of the texture (mark as non readable) if it's full 220 | var makeNoLongerReadable = currentEmojiIndex == SHEET_TILES * SHEET_TILES - 1; 221 | if (makeNoLongerReadable) 222 | { 223 | ((Texture2D)currentEmojiAsset.spriteSheet).Apply(false, makeNoLongerReadable); 224 | } 225 | textureNeedsApply = !makeNoLongerReadable; 226 | } 227 | 228 | TMP_Sprite tmp_Sprite = new TMP_Sprite(); 229 | 230 | tmp_Sprite.hashCode = TMP_TextUtilities.GetSimpleHashCode(emojiTex.Text); 231 | tmp_Sprite.height = EMOJI_SIZE; 232 | tmp_Sprite.id = currentEmojiIndex; 233 | tmp_Sprite.name = emojiTex.Text; 234 | tmp_Sprite.pivot = Vector2.one * 0.5f; 235 | tmp_Sprite.scale = 1; 236 | tmp_Sprite.unicode = emojiTexture.Unicode; 237 | tmp_Sprite.width = EMOJI_SIZE; 238 | tmp_Sprite.x = row * EMOJI_SIZE; 239 | tmp_Sprite.xAdvance = EMOJI_SIZE; 240 | tmp_Sprite.xOffset = 0; 241 | tmp_Sprite.y = (SHEET_SIZE) - ((column + 1) * EMOJI_SIZE); 242 | tmp_Sprite.yOffset = EMOJI_SIZE * 0.9f; 243 | 244 | currentEmojiAsset.spriteInfoList.Add(tmp_Sprite); 245 | currentEmojiAsset.UpdateLookupTables(); 246 | currentEmojiIndex++; 247 | } 248 | } 249 | } 250 | #endif -------------------------------------------------------------------------------- /Assets/EmojiTexture/TMPro/TMProEmojiAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d114a49e5d77474aaa3206aa7e40b82 3 | timeCreated: 1518632160 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Brahim Hadriche 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | "MiniJSON" is a third party Copyright (c) 2013 Calvin Rien, and is subject 16 | to its own license, included atthe top of the file in question "MiniJSON.cs"as 17 | a copyright notice. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.textmeshpro": "1.2.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/EmojiTexture/Example/EmojiExample.unity 10 | guid: 6725bd42fe5684f489e2924a6bfa7f12 11 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 1 10 | m_DefaultBehaviorMode: 1 11 | m_SpritePackerMode: 4 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.2.0b1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EmojiTexture 2 | ##### :warning: Unity now supports [Emojis using TextMesh Pro](https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.2/manual/ColorEmojis.html). Please use that package instead, since this project hasn't been updated for a while. 3 | 4 | A Unity plugin to render Emojis ☺ ❤ 🍆 🍑 to a texture. Currently for iOS and Android only. 5 | 6 | Please note that the editor is not supported. It will only render on device (should work on simulator as well) 7 | 8 | ## Preview 9 | 10 | 11 | 12 | ## Usage 13 | As simple as: 14 | ```csharp 15 | material.mainTexture = new EmojiTexture("❤"); 16 | ``` 17 | You can also do these things: 18 | ```csharp 19 | //Create an EmojiTexture with a specific size (best if power of 2) 20 | var emojiTexture = new EmojiTexture(128); 21 | 22 | //Change an existing EmojiTexture 23 | emojiTexture.Text = "❤"; 24 | 25 | //Get the texture as an array of bytes, in case you want to do something with it 26 | var bytes = emojiTexture.ByteBuffer; 27 | 28 | //Know the code of the emoji? Set it directly as an integer! 29 | //E.g. https://emojipedia.org/smiling-face-with-smiling-eyes/ 30 | emojiTexture.Unicode = 0x1F60A; //😊 Smiling Face With Smiling Eyes 31 | 32 | ``` 33 | ## Github emoji API (Experimental) 34 | When not running Android or iOS, EmojiTexture can use [Github emoji API](https://developer.github.com/v3/emojis/). 35 | This require network connection. While the list of emojis is cached, individual images are not. 36 | 37 | Setting emojis from Github needs to run in a `Coroutine`, because it is an async operation. 38 | It is possible to set the emoji text (same as above) 39 | ``` 40 | yield return emojiTexture.SetGithubEmoji("❤"); 41 | ``` 42 | Or using keywords 43 | ``` 44 | yield return emojiTexture.SetGithubEmoji(":heart:"); 45 | ``` 46 | 47 | Please check out example scene for usage (it includes a native emoji, a github emoji and TextMesh Pro examples, that shuffle emojis from script or read user imput with touch screen). 48 | 49 | 50 | ## TextMesh Pro support (Experimental) 51 | [TextMesh Pro](https://assetstore.unity.com/packages/essentials/beta-projects/textmesh-pro-84126) already supports emojis as sprites, but they need to be prepared beforehand, which makes it troublesome in terms of build size (and also a lot of manual work), if you want to support as many emojis as possible. This is where EmojiTexture comes in. It generates these sprites on the fly as they are needed. 52 | 53 | ## Setup 54 | ~~- Import TextMesh Pro from the [Asset Store](https://assetstore.unity.com/packages/essentials/beta-projects/textmesh-pro-84126)~~ Use the new **Package Manager** to install TextMesh Pro (this should happen automatically since it is a project dependency) 55 | - In the Player Settings, add `TMPRO_EMOJIS` to the [Scripting Define Symbols](https://docs.unity3d.com/Manual/PlatformDependentCompilation.html) 56 | 57 | ![Scripting Define Symbols](https://docs.unity3d.com/uploads/Main/ScriptDefines.png) 58 | - Add the component `TMP_EmojiSupport` on the same game object as your `TextMeshPro` or `TextMeshProUGUI` component. 59 | That's about it. You should have emoji support out of the box. 60 | - On the `TMP_EmojiSupport` component, if `Github fallback` is checked, the emojis will be downloaded from github if you are not running on Android or iOS (and if you have network) 61 | 62 | ## Optimizations 63 | Few pointers to consider: 64 | 65 | 66 | - Emojis are stored in sprite sheets of the size 4 by 4 (16 emojis) with an emoji texture of `128x128` pixels (which makes a `512x512` per sprite sheet.) These are constants defined in `TMProEmojiAsset.EMOJI_SIZE` and `TMProEmojiAsset.SHEET_TILES`. Optimize these values according to your use case. **BE AWARE** currently, github returns enoji images as `128x128`, and they share the same sprite sheet. Changing these constants will probably break emojis from github. (A resizing method needs to be implemented for that purpose, but that would be at the cost of performance) 67 | 68 | - When a sprite sheet is full, a new one is created. 69 | - Currently cleaning up unused emojis is not yet supported. This will be added in the future. 70 | 71 | ## Known issues. 72 | - While the native emoji renderer (Android/iOS) tries to estimate the correct rendering, Github emojis and TMP both have trouble with complex emojis (such as flags, emojis with skintones, etc). These will be addressed in the future, as there is room for improvement. 73 | - Some rendering issues are due to how TMP works, because it scans for unicode characters, and we get to feed it sprites. This needs to be fixed on TMP's side. 74 | 75 | -------------------------------------------------------------------------------- /preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iBicha/EmojiTexture/99fce607f96357ea2848c83765d42c9c3b2adf67/preview.gif --------------------------------------------------------------------------------