123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using UnityEngine;
- namespace SceneEditWindow
- {
- public class BaseCustomParts
- {
- public BaseCustomParts(Maid maid, TBody.SlotID slotId, string apName)
- {
- this.maid = maid;
- this.slotId = slotId;
- this.apName = ((!string.IsNullOrEmpty(apName)) ? apName : null);
- }
- public Maid maid { get; private set; }
- public TBody.SlotID slotId { get; private set; }
- public string apName { get; private set; }
- public bool enabled
- {
- get
- {
- return this.maid.body0.maid.body0.GetEnableAttachPointEdit(this.slotId, this.apName);
- }
- set
- {
- if (!value)
- {
- this.Reset();
- }
- this.maid.body0.maid.body0.SetEnableAttachPointEdit(value, this.slotId, this.apName);
- }
- }
- public Vector3 position
- {
- get
- {
- Vector3 result;
- Quaternion quaternion;
- Vector3 vector;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out result, out quaternion, out vector);
- return result;
- }
- set
- {
- Vector3 vector;
- Quaternion qRotWorld;
- Vector3 vScaleRate;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vector, out qRotWorld, out vScaleRate);
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, value, qRotWorld, vScaleRate);
- }
- }
- public Quaternion rotation
- {
- get
- {
- Vector3 vector;
- Quaternion result;
- Vector3 vector2;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vector, out result, out vector2);
- return result;
- }
- set
- {
- Vector3 vPosWorld;
- Quaternion quaternion;
- Vector3 vScaleRate;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vPosWorld, out quaternion, out vScaleRate);
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, vPosWorld, value, vScaleRate);
- }
- }
- public Vector3 scale
- {
- get
- {
- Vector3 vector;
- Quaternion quaternion;
- Vector3 result;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vector, out quaternion, out result);
- return result;
- }
- set
- {
- Vector3 vPosWorld;
- Quaternion qRotWorld;
- Vector3 vector;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vPosWorld, out qRotWorld, out vector);
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, vPosWorld, qRotWorld, value);
- }
- }
- public void SetTransformData(Transform transform, bool setWorldData = true)
- {
- if (setWorldData)
- {
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, transform.position, transform.rotation, transform.localScale);
- }
- else
- {
- this.maid.body0.SetAttachPointLocal(this.slotId, this.apName, transform.localPosition, transform.localRotation, transform.localScale);
- }
- }
- public void SetTransformData(Vector3 position, Quaternion rotation, Vector3 scale, bool setWorldData = true)
- {
- if (setWorldData)
- {
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, position, rotation, scale);
- }
- else
- {
- this.maid.body0.SetAttachPointLocal(this.slotId, this.apName, position, rotation, scale);
- }
- }
- public void GetTransformData(out Vector3 position, out Quaternion rotation, out Vector3 scale, bool getWorldData = true)
- {
- if (getWorldData)
- {
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out position, out rotation, out scale);
- }
- else
- {
- this.maid.body0.GetAttachPointLocal(this.slotId, this.apName, out position, out rotation, out scale);
- }
- }
- public void SaveBackup()
- {
- this.maid.body0.CopyAttachPoint(this.slotId, this.apName);
- }
- public void LoadBackup()
- {
- this.maid.body0.PasteAttachPoint(this.slotId, this.apName);
- }
- public void Reset()
- {
- this.maid.body0.ResetAttachPoint(this.slotId, this.apName);
- Vector3 vPosWorld;
- Quaternion qRotWorld;
- Vector3 vScaleRate;
- this.maid.body0.GetAttachPointWorld(this.slotId, this.apName, out vPosWorld, out qRotWorld, out vScaleRate);
- this.maid.body0.SetAttachPointWorld(this.slotId, this.apName, vPosWorld, qRotWorld, vScaleRate);
- }
- }
- }
|