浏览代码

Merge pull request #112 from Unity-Technologies/siyaoH/1.17/android

fix android file load and pointer convert
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
581bf6e4
共有 3 个文件被更改,包括 14 次插入3 次删除
  1. 5
      com.unity.uiwidgets/Runtime/engine2/AndroidPlatformUtil.cs
  2. 9
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  3. 3
      com.unity.uiwidgets/Runtime/ui2/text.cs

5
com.unity.uiwidgets/Runtime/engine2/AndroidPlatformUtil.cs


dir = "";
return dir + file;
}
File.WriteAllBytes(dir + file, unpackerWWW.bytes); // 64MB limit on File.WriteAllBytes.
System.IO.FileInfo fileInfo = new System.IO.FileInfo(dir + file);
fileInfo.Directory.Create();
System.IO.File.WriteAllBytes(fileInfo.FullName, unpackerWWW.bytes);
}
return dir + file;

9
com.unity.uiwidgets/Runtime/painting/image_provider.cs


}
Future<Codec> _loadAsync(FileImage key, DecoderCallback decode) {
#if UNITY_ANDROID && !UNITY_EDITOR
var path = Path.Combine(Application.streamingAssetsPath, key.file);
WWW unpackerWWW = new WWW(Path.Combine(Application.streamingAssetsPath, key.file));
while (!unpackerWWW.isDone) {
} // This will block in the webplayer.
byte[] bytes = unpackerWWW.bytes;
#else
#endif
if (bytes.Length > 0) {
return decode(bytes);
}

3
com.unity.uiwidgets/Runtime/ui2/text.cs


internal static unsafe void setFloat(this byte[] bytes, int byteOffset, float value) {
D.assert(byteOffset >= 0 && byteOffset + 4 < bytes.Length);
var intVal = *(int*) &value;
*(float*) b = value;
*(int*) b = intVal;
}
}

正在加载...
取消
保存