Skip to content

Commit fa8d331

Browse files
authored
[#12] feat(VirtualObject): Add interfaces for all Vob types
* add(I*VirtualObject): Add interfaces for all Vob types. * update(I*VirtualObject): Checked on Fields returning classes. Altered them to remove interfaces instead.
1 parent d67fe12 commit fa8d331

29 files changed

+735
-171
lines changed

ZenKit/Vobs/Animate.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class Animate : VirtualObject
5+
public interface IAnimate : IVirtualObject
6+
{
7+
bool StartOn { get; set; }
8+
}
9+
10+
public class Animate : VirtualObject, IAnimate
611
{
712
public Animate() : base(Native.ZkVirtualObject_new(VirtualObjectType.zCVobAnimate))
813
{
@@ -33,4 +38,4 @@ protected override void Delete()
3338
Native.ZkAnimate_del(Handle);
3439
}
3540
}
36-
}
41+
}

ZenKit/Vobs/CodeMaster.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@
55

66
namespace ZenKit.Vobs
77
{
8-
public class CodeMaster : VirtualObject
8+
public interface ICodeMaster : IVirtualObject
9+
{
10+
string Target { get; set; }
11+
bool Ordered { get; set; }
12+
bool FirstFalseIsFailure { get; set; }
13+
string FailureTarget { get; set; }
14+
bool UntriggeredCancels { get; set; }
15+
int SlaveCount { get; }
16+
List<string> Slaves { get; }
17+
string GetSlave(int i);
18+
void AddSlave(string slave);
19+
void RemoveSlave(int i);
20+
void RemoveSlaves(Predicate<string> pred);
21+
}
22+
23+
public class CodeMaster : VirtualObject, ICodeMaster
924
{
1025
private static readonly Native.Callbacks.ZkStringEnumerator RemoveSlavesEnumerator = _enumerateSlavesHandler;
1126

@@ -111,4 +126,4 @@ private static bool _enumerateSlavesHandler(IntPtr ctx, IntPtr ptr)
111126
return cb(ptr.MarshalAsString()!);
112127
}
113128
}
114-
}
129+
}

ZenKit/Vobs/Container.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@
33

44
namespace ZenKit.Vobs
55
{
6-
public class Container : InteractiveObject
6+
public interface IContainer : IInteractiveObject
7+
{
8+
bool IsLocked { get; set; }
9+
string Key { get; set; }
10+
string PickString { get; set; }
11+
string Contents { get; set; }
12+
int ItemCount { get; }
13+
List<IItem> Items { get; }
14+
void AddItem(Item item);
15+
void RemoveItem(int i);
16+
}
17+
18+
public class Container : InteractiveObject, IContainer
719
{
820
public Container() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobContainer))
921
{
@@ -49,11 +61,11 @@ public string Contents
4961

5062
public int ItemCount => (int)Native.ZkContainer_getItemCount(Handle);
5163

52-
public List<Item> Items
64+
public List<IItem> Items
5365
{
5466
get
5567
{
56-
var items = new List<Item>();
68+
var items = new List<IItem>();
5769

5870
for (var i = 0; i < ItemCount; ++i)
5971
{
@@ -80,4 +92,4 @@ protected override void Delete()
8092
Native.ZkContainer_del(Handle);
8193
}
8294
}
83-
}
95+
}

ZenKit/Vobs/CutsceneCamera.cs

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,24 @@ public enum CameraMotion
3636
Custom = 6
3737
}
3838

39-
public class CameraTrajectoryFrame : VirtualObject
39+
public interface ICameraTrajectoryFrame : IVirtualObject
40+
{
41+
float Time { get; set; }
42+
float RollAngle { get; set; }
43+
float FovScale { get; set; }
44+
CameraMotion MotionType { get; set; }
45+
CameraMotion MotionTypeFov { get; set; }
46+
CameraMotion MotionTypeRoll { get; set; }
47+
CameraMotion MotionTypeTimeScale { get; set; }
48+
float Tension { get; set; }
49+
float CamBias { get; set; }
50+
float Continuity { get; set; }
51+
float TimeScale { get; set; }
52+
bool TimeFixed { get; set; }
53+
Matrix4x4 OriginalPose { get; set; }
54+
}
55+
56+
public class CameraTrajectoryFrame : VirtualObject, ICameraTrajectoryFrame
4057
{
4158
public CameraTrajectoryFrame() : base(Native.ZkVirtualObject_new(VirtualObjectType.zCCamTrj_KeyFrame))
4259
{
@@ -129,7 +146,30 @@ protected override void Delete()
129146
}
130147
}
131148

132-
public class CutsceneCamera : VirtualObject
149+
public interface ICutsceneCamera : IVirtualObject
150+
{
151+
CameraTrajectory TrajectoryFOR { get; set; }
152+
CameraTrajectory TargetTrajectoryFOR { get; set; }
153+
CameraLoopType LoopMode { get; set; }
154+
CameraLerpType LerpMode { get; set; }
155+
bool IgnoreFORVobRotation { get; set; }
156+
bool IgnoreFORVobRotationTarget { get; set; }
157+
bool Adapt { get; set; }
158+
bool EaseFirst { get; set; }
159+
bool EaseLast { get; set; }
160+
float TotalDuration { get; set; }
161+
string AutoFocusVob { get; set; }
162+
bool AutoPlayerMovable { get; set; }
163+
bool AutoUntriggerLast { get; set; }
164+
float AutoUntriggerLastDelay { get; set; }
165+
int PositionCount { get; }
166+
int TargetCount { get; }
167+
int FrameCount { get; }
168+
List<ICameraTrajectoryFrame> Frames { get; }
169+
ICameraTrajectoryFrame GetFrame(int i);
170+
}
171+
172+
public class CutsceneCamera : VirtualObject, ICutsceneCamera
133173
{
134174
public CutsceneCamera() : base(Native.ZkVirtualObject_new(VirtualObjectType.zCCSCamera))
135175
{
@@ -239,11 +279,11 @@ public float AutoUntriggerLastDelay
239279
public int TargetCount => Native.ZkCutsceneCamera_getTargetCount(Handle);
240280
public int FrameCount => (int)Native.ZkCutsceneCamera_getFrameCount(Handle);
241281

242-
public List<CameraTrajectoryFrame> Frames
282+
public List<ICameraTrajectoryFrame> Frames
243283
{
244284
get
245285
{
246-
var frames = new List<CameraTrajectoryFrame>();
286+
var frames = new List<ICameraTrajectoryFrame>();
247287
var count = FrameCount;
248288
for (var i = 0; i < count; ++i) frames.Add(GetFrame(i));
249289
return frames;
@@ -255,10 +295,10 @@ protected override void Delete()
255295
Native.ZkCutsceneCamera_del(Handle);
256296
}
257297

258-
public CameraTrajectoryFrame GetFrame(int i)
298+
public ICameraTrajectoryFrame GetFrame(int i)
259299
{
260300
var handle = Native.ZkCutsceneCamera_getFrame(Handle, (ulong)i);
261301
return new CameraTrajectoryFrame(Native.ZkObject_takeRef(handle));
262302
}
263303
}
264-
}
304+
}

ZenKit/Vobs/Door.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class Door : InteractiveObject
5+
public interface IDoor : IInteractiveObject
6+
{
7+
bool IsLocked { get; set; }
8+
string Key { get; set; }
9+
string PickString { get; set; }
10+
}
11+
12+
public class Door : InteractiveObject, IDoor
613
{
714
public Door() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobDoor))
815
{
@@ -45,4 +52,4 @@ protected override void Delete()
4552
Native.ZkDoor_del(Handle);
4653
}
4754
}
48-
}
55+
}

ZenKit/Vobs/Earthquake.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
namespace ZenKit.Vobs
55
{
6-
public class Earthquake : VirtualObject
6+
public interface IEarthquake : IVirtualObject
7+
{
8+
float Radius { get; set; }
9+
TimeSpan Duration { get; set; }
10+
Vector3 Amplitude { get; set; }
11+
}
12+
13+
public class Earthquake : VirtualObject, IEarthquake
714
{
815
public Earthquake() : base(Native.ZkVirtualObject_new(VirtualObjectType.zCEarthquake))
916
{
@@ -46,4 +53,4 @@ protected override void Delete()
4653
Native.ZkEarthquake_del(Handle);
4754
}
4855
}
49-
}
56+
}

ZenKit/Vobs/Fire.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class Fire : InteractiveObject
5+
public interface IFire : IInteractiveObject
6+
{
7+
string Slot { get; set; }
8+
string VobTree { get; set; }
9+
}
10+
11+
public class Fire : InteractiveObject, IFire
612
{
713
public Fire() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobFire))
814
{
@@ -39,4 +45,4 @@ protected override void Delete()
3945
Native.ZkFire_del(Handle);
4046
}
4147
}
42-
}
48+
}

ZenKit/Vobs/InteractiveObject.cs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class InteractiveObject : MovableObject
5+
public interface IInteractiveObject : IMovableObject
6+
{
7+
int State { get; set; }
8+
string Target { get; set; }
9+
string Item { get; set; }
10+
string ConditionFunction { get; set; }
11+
string OnStateChangeFunction { get; set; }
12+
bool Rewind { get; set; }
13+
}
14+
15+
public class InteractiveObject : MovableObject, IInteractiveObject
616
{
717
public InteractiveObject() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobInter))
818
{
@@ -69,7 +79,11 @@ protected override void Delete()
6979
}
7080
}
7181

72-
public class Bed : InteractiveObject
82+
public interface IBed : IInteractiveObject
83+
{
84+
}
85+
86+
public class Bed : InteractiveObject, IBed
7387
{
7488
public Bed() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobBed))
7589
{
@@ -80,7 +94,11 @@ internal Bed(UIntPtr handle) : base(handle)
8094
}
8195
}
8296

83-
public class Ladder : InteractiveObject
97+
public interface ILadder : IInteractiveObject
98+
{
99+
}
100+
101+
public class Ladder : InteractiveObject, ILadder
84102
{
85103
public Ladder() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobLadder))
86104
{
@@ -91,7 +109,11 @@ internal Ladder(UIntPtr handle) : base(handle)
91109
}
92110
}
93111

94-
public class Switch : InteractiveObject
112+
public interface ISwitch : IInteractiveObject
113+
{
114+
}
115+
116+
public class Switch : InteractiveObject, ISwitch
95117
{
96118
public Switch() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobSwitch))
97119
{
@@ -102,7 +124,11 @@ internal Switch(UIntPtr handle) : base(handle)
102124
}
103125
}
104126

105-
public class Wheel : InteractiveObject
127+
public interface IWheel : IInteractiveObject
128+
{
129+
}
130+
131+
public class Wheel : InteractiveObject, IWheel
106132
{
107133
public Wheel() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCMobWheel))
108134
{
@@ -112,4 +138,4 @@ internal Wheel(UIntPtr handle) : base(handle)
112138
{
113139
}
114140
}
115-
}
141+
}

ZenKit/Vobs/Item.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class Item : VirtualObject
5+
public interface IItem : IVirtualObject
6+
{
7+
string Instance { get; set; }
8+
int Amount { get; set; }
9+
int Flags { get; set; }
10+
}
11+
12+
public class Item : VirtualObject, IItem
613
{
714
public Item() : base(Native.ZkVirtualObject_new(VirtualObjectType.oCItem))
815
{
@@ -46,4 +53,4 @@ protected override void Delete()
4653
Native.ZkItem_del(Handle);
4754
}
4855
}
49-
}
56+
}

ZenKit/Vobs/LensFlare.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
namespace ZenKit.Vobs
44
{
5-
public class LensFlare : VirtualObject
5+
public interface ILensFlare : IVirtualObject
6+
{
7+
string Effect { get; set; }
8+
}
9+
10+
public class LensFlare : VirtualObject, ILensFlare
611
{
712
public LensFlare() : base(Native.ZkVirtualObject_new(VirtualObjectType.zCVobLensFlare))
813
{
@@ -34,4 +39,4 @@ protected override void Delete()
3439
Native.ZkLensFlare_del(Handle);
3540
}
3641
}
37-
}
42+
}

0 commit comments

Comments
 (0)