1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 Jiang Yin. All rights reserved.
- // Homepage: https://gameframework.cn/
- // Feedback: mailto:ellan@gameframework.cn
- //------------------------------------------------------------
- using System.IO;
- using UnityEngine;
- namespace MetaClient.Editor.DataTableTools
- {
- public sealed partial class DataTableProcessor
- {
- private sealed class QuaternionProcessor : GenericDataProcessor<Quaternion>
- {
- public override bool IsSystem
- {
- get
- {
- return false;
- }
- }
- public override string LanguageKeyword
- {
- get
- {
- return "Quaternion";
- }
- }
- public override string[] GetTypeStrings()
- {
- return new string[]
- {
- "quaternion",
- "unityengine.quaternion"
- };
- }
- public override Quaternion Parse(string value)
- {
- string[] splitedValue = value.Split(',');
- return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
- }
- public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
- {
- Quaternion quaternion = Parse(value);
- binaryWriter.Write(quaternion.x);
- binaryWriter.Write(quaternion.y);
- binaryWriter.Write(quaternion.z);
- binaryWriter.Write(quaternion.w);
- }
- }
- }
- }
|