Skip to content

Commit 49b801d

Browse files
committed
增加脚本组件示例
1 parent 8cb6378 commit 49b801d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1019
-127
lines changed

Assets/Plugins/kbengine_unity3d_plugins/AccountBase.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/AvatarBase.cs

Lines changed: 87 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public virtual void onHP_MaxChanged(Int32 oldValue) {}
2727
public virtual void onMPChanged(Int32 oldValue) {}
2828
public Int32 MP_Max = 0;
2929
public virtual void onMP_MaxChanged(Int32 oldValue) {}
30+
public TestBase component1 = null;
31+
public TestBase component2 = null;
32+
public TestNoBaseBase component3 = null;
3033
public Int32 forbids = 0;
3134
public virtual void onForbidsChanged(Int32 oldValue) {}
3235
public UInt16 level = 0;
@@ -62,6 +65,45 @@ public virtual void onUtypeChanged(UInt32 oldValue) {}
6265

6366
public AvatarBase()
6467
{
68+
foreach (System.Reflection.Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
69+
{
70+
Type entityComponentScript = ass.GetType("KBEngine.Test");
71+
if(entityComponentScript != null)
72+
{
73+
component1 = (TestBase)Activator.CreateInstance(entityComponentScript);
74+
component1.owner = this;
75+
}
76+
}
77+
78+
if(component1 == null)
79+
throw new Exception("Please inherit and implement, such as: \"class Test : TestBase\"");
80+
81+
foreach (System.Reflection.Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
82+
{
83+
Type entityComponentScript = ass.GetType("KBEngine.Test");
84+
if(entityComponentScript != null)
85+
{
86+
component2 = (TestBase)Activator.CreateInstance(entityComponentScript);
87+
component2.owner = this;
88+
}
89+
}
90+
91+
if(component2 == null)
92+
throw new Exception("Please inherit and implement, such as: \"class Test : TestBase\"");
93+
94+
foreach (System.Reflection.Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
95+
{
96+
Type entityComponentScript = ass.GetType("KBEngine.TestNoBase");
97+
if(entityComponentScript != null)
98+
{
99+
component3 = (TestNoBaseBase)Activator.CreateInstance(entityComponentScript);
100+
component3.owner = this;
101+
}
102+
}
103+
104+
if(component3 == null)
105+
throw new Exception("Please inherit and implement, such as: \"class TestNoBase : TestNoBaseBase\"");
106+
65107
}
66108

67109
public override void onGetBase()
@@ -118,6 +160,15 @@ public override void onRemoteMethodCall(MemoryStream stream)
118160
Property pComponentPropertyDescription = sm.idpropertys[componentPropertyUType];
119161
switch(pComponentPropertyDescription.properUtype)
120162
{
163+
case 16:
164+
component1.onRemoteMethodCall(methodUtype, stream);
165+
break;
166+
case 21:
167+
component2.onRemoteMethodCall(methodUtype, stream);
168+
break;
169+
case 22:
170+
component3.onRemoteMethodCall(methodUtype, stream);
171+
break;
121172
default:
122173
break;
123174
}
@@ -201,6 +252,15 @@ public override void onUpdatePropertys(MemoryStream stream)
201252
Property pComponentPropertyDescription = pdatas[_t_utype];
202253
switch(pComponentPropertyDescription.properUtype)
203254
{
255+
case 16:
256+
component1.onUpdatePropertys(_t_child_utype, stream, -1);
257+
break;
258+
case 21:
259+
component2.onUpdatePropertys(_t_child_utype, stream, -1);
260+
break;
261+
case 22:
262+
component3.onUpdatePropertys(_t_child_utype, stream, -1);
263+
break;
204264
default:
205265
break;
206266
}
@@ -273,6 +333,15 @@ public override void onUpdatePropertys(MemoryStream stream)
273333
onMP_MaxChanged(oldval_MP_Max);
274334
}
275335

336+
break;
337+
case 16:
338+
component1.createFromStream(stream);
339+
break;
340+
case 21:
341+
component2.createFromStream(stream);
342+
break;
343+
case 22:
344+
component3.createFromStream(stream);
276345
break;
277346
case 40001:
278347
Vector3 oldval_direction = direction;
@@ -596,6 +665,12 @@ public override void callPropertysSetMethods()
596665
}
597666
}
598667

668+
component1.callPropertysSetMethods();
669+
670+
component2.callPropertysSetMethods();
671+
672+
component3.callPropertysSetMethods();
673+
599674
Vector3 oldval_direction = direction;
600675
Property prop_direction = pdatas[2];
601676
if(prop_direction.isBase())
@@ -618,7 +693,7 @@ public override void callPropertysSetMethods()
618693
}
619694

620695
Int32 oldval_forbids = forbids;
621-
Property prop_forbids = pdatas[8];
696+
Property prop_forbids = pdatas[11];
622697
if(prop_forbids.isBase())
623698
{
624699
if(inited && !inWorld)
@@ -639,7 +714,7 @@ public override void callPropertysSetMethods()
639714
}
640715

641716
UInt16 oldval_level = level;
642-
Property prop_level = pdatas[9];
717+
Property prop_level = pdatas[12];
643718
if(prop_level.isBase())
644719
{
645720
if(inited && !inWorld)
@@ -660,7 +735,7 @@ public override void callPropertysSetMethods()
660735
}
661736

662737
UInt32 oldval_modelID = modelID;
663-
Property prop_modelID = pdatas[10];
738+
Property prop_modelID = pdatas[13];
664739
if(prop_modelID.isBase())
665740
{
666741
if(inited && !inWorld)
@@ -681,7 +756,7 @@ public override void callPropertysSetMethods()
681756
}
682757

683758
Byte oldval_modelScale = modelScale;
684-
Property prop_modelScale = pdatas[11];
759+
Property prop_modelScale = pdatas[14];
685760
if(prop_modelScale.isBase())
686761
{
687762
if(inited && !inWorld)
@@ -702,7 +777,7 @@ public override void callPropertysSetMethods()
702777
}
703778

704779
Byte oldval_moveSpeed = moveSpeed;
705-
Property prop_moveSpeed = pdatas[12];
780+
Property prop_moveSpeed = pdatas[15];
706781
if(prop_moveSpeed.isBase())
707782
{
708783
if(inited && !inWorld)
@@ -723,7 +798,7 @@ public override void callPropertysSetMethods()
723798
}
724799

725800
string oldval_name = name;
726-
Property prop_name = pdatas[13];
801+
Property prop_name = pdatas[16];
727802
if(prop_name.isBase())
728803
{
729804
if(inited && !inWorld)
@@ -744,7 +819,7 @@ public override void callPropertysSetMethods()
744819
}
745820

746821
UInt16 oldval_own_val = own_val;
747-
Property prop_own_val = pdatas[14];
822+
Property prop_own_val = pdatas[17];
748823
if(prop_own_val.isBase())
749824
{
750825
if(inited && !inWorld)
@@ -786,7 +861,7 @@ public override void callPropertysSetMethods()
786861
}
787862

788863
UInt32 oldval_spaceUType = spaceUType;
789-
Property prop_spaceUType = pdatas[15];
864+
Property prop_spaceUType = pdatas[18];
790865
if(prop_spaceUType.isBase())
791866
{
792867
if(inited && !inWorld)
@@ -807,7 +882,7 @@ public override void callPropertysSetMethods()
807882
}
808883

809884
SByte oldval_state = state;
810-
Property prop_state = pdatas[16];
885+
Property prop_state = pdatas[19];
811886
if(prop_state.isBase())
812887
{
813888
if(inited && !inWorld)
@@ -828,7 +903,7 @@ public override void callPropertysSetMethods()
828903
}
829904

830905
Byte oldval_subState = subState;
831-
Property prop_subState = pdatas[17];
906+
Property prop_subState = pdatas[20];
832907
if(prop_subState.isBase())
833908
{
834909
if(inited && !inWorld)
@@ -849,7 +924,7 @@ public override void callPropertysSetMethods()
849924
}
850925

851926
UInt32 oldval_uid = uid;
852-
Property prop_uid = pdatas[18];
927+
Property prop_uid = pdatas[21];
853928
if(prop_uid.isBase())
854929
{
855930
if(inited && !inWorld)
@@ -870,7 +945,7 @@ public override void callPropertysSetMethods()
870945
}
871946

872947
UInt32 oldval_utype = utype;
873-
Property prop_utype = pdatas[19];
948+
Property prop_utype = pdatas[22];
874949
if(prop_utype.isBase())
875950
{
876951
if(inited && !inWorld)

Assets/Plugins/kbengine_unity3d_plugins/AvatarBase.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/Bundle.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/CustomDataTypes.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/DataTypes.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/Dbg.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/Entity.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/EntityCall.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/kbengine_unity3d_plugins/EntityCallAccountBase.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)