添加子对象模式更改为OnAdd中添加
This commit is contained in:
		
							parent
							
								
									df5f1c31b6
								
							
						
					
					
						commit
						7fb117a344
					
				|  | @ -140,6 +140,7 @@ class Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|     //被添加时  要刷新一下当前帧 |     //被添加时  要刷新一下当前帧 | ||||||
|     function OnAddchild(Parent) { |     function OnAddchild(Parent) { | ||||||
|  |         base.OnAddchild(Parent); | ||||||
|         FlushFrame(0); |         FlushFrame(0); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -67,12 +67,7 @@ class CL_BaseObject { | ||||||
| 
 | 
 | ||||||
|     //添加子对象 |     //添加子对象 | ||||||
|     function Addchild(Child) { |     function Addchild(Child) { | ||||||
|         Children[Child.GetId()] <- Child; |  | ||||||
|         Child.Parent = this.weakref(); |  | ||||||
|         //给自己解引用计数 |  | ||||||
| 
 |  | ||||||
|         Child.OnAddchild(this); |         Child.OnAddchild(this); | ||||||
|         BaseObject_Addchild(this.C_Object, Child.C_Object); |  | ||||||
|     } |     } | ||||||
|     //移除子对象 |     //移除子对象 | ||||||
|     function Removechild(Child) { |     function Removechild(Child) { | ||||||
|  | @ -91,8 +86,10 @@ class CL_BaseObject { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //被添加 |     //被添加 | ||||||
|     function OnAddchild(Parent) { |     function OnAddchild(ParentObj) { | ||||||
| 
 |         ParentObj.Children[GetId()] <- this; | ||||||
|  |         this.Parent = ParentObj.weakref(); | ||||||
|  |         BaseObject_Addchild(ParentObj.C_Object, this.C_Object); | ||||||
|     } |     } | ||||||
|     //被移除 |     //被移除 | ||||||
|     function OnRemove(Parent) { |     function OnRemove(Parent) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue