public void InitUI(MGLayer parentLayer) { foreach (MGNode current in ChildList) { current.InitUI(parentLayer); } if (GetType() == typeof(MGButton)) { ((MGButton)this).Delegate = (IMGButtonDelegate)parentLayer; parentLayer.AddUIBase((MGUIBase)this); } }
public void Init(MGLayer layer) { _layer = layer; _thunderSprite = new ThunderSprite(); _spotSprite = new MGSprite[SpotCount]; _branchSprite = new MGSprite[BranchCount]; _layer.AddChild(_thunderSprite); for (int i = 0; i < SpotCount; i++) { _spotSprite[i] = MGSprite.MGSpriteWithSpriteFrameName("thunder_point.png"); _layer.AddChild(_spotSprite[i], 310); } for (int i = 0; i < BranchCount; i++) { _branchSprite[i] = MGSprite.MGSpriteWithSpriteFrameName("thunder_branch.png"); _layer.AddChild(_branchSprite[i], 310); } Hide(); }