public LHGameWorldNode getGameWorldNode() { if (null == _gameWorldNode) { foreach (CCNode child in this.Children) { if (child.GetType() == typeof(LHGameWorldNode)) { _gameWorldNode = (LHGameWorldNode)child; break; } } } return(_gameWorldNode); }
public static CCNode createLHNodeWithDictionary(PlistDictionary childInfo, CCNode prnt) { string nodeType = childInfo["nodeType"].AsString; LHScene scene = ((LHNodeProtocol)prnt).getScene(); string subclassNodeType = childInfo["subclassNodeType"].AsString; if (subclassNodeType != null && subclassNodeType.Length > 0) { //TODO handle subclasses //this will not work as we do not have the class included in the api // Class classObj = [scene createNodeObjectForSubclassWithName:subclassNodeType superTypeName:nodeType]; // if(classObj){ // return [classObj nodeWithDictionary:childInfo parent:prnt]; // } // else{ // NSLog(@"\n\nWARNING: Expected a class of type %@ subclassed from %@, but nothing was returned. Check your \"createNodeObjectForSubclassWithName:superTypeName:\" method and make sure you return a valid Class.\n\n", subclassNodeType, nodeType); // } } if (nodeType == "LHGameWorldNode") { LHGameWorldNode pNode = LHGameWorldNode.nodeWithDictionary(childInfo, prnt); pNode.ContentSize = scene._designResolutionSize; // #if LH_DEBUG // [pNode setDebugDraw:YES]; // #endif return(pNode); } else if (nodeType == "LHBackUINode") { LHBackUINode pNode = LHBackUINode.nodeWithDictionary(childInfo, prnt); return(pNode); } else if (nodeType == "LHUINode") { LHUINode pNode = LHUINode.nodeWithDictionary(childInfo, prnt); return(pNode); } else if (nodeType == "LHSprite") { LHSprite spr = LHSprite.nodeWithDictionary(childInfo, prnt); return(spr); } // else if([nodeType isEqualToString:@"LHNode"]) // { // LHNode* nd = [LHNode nodeWithDictionary:childInfo // parent:prnt]; // return nd; // } // else if([nodeType isEqualToString:@"LHBezier"]) // { // LHBezier* bez = [LHBezier nodeWithDictionary:childInfo // parent:prnt]; // return bez; // } // else if([nodeType isEqualToString:@"LHTexturedShape"]) // { // LHShape* sp = [LHShape nodeWithDictionary:childInfo // parent:prnt]; // return sp; // } // else if([nodeType isEqualToString:@"LHWaves"]) // { // LHWater* wt = [LHWater nodeWithDictionary:childInfo // parent:prnt]; // return wt; // } // else if([nodeType isEqualToString:@"LHAreaGravity"]) // { // LHGravityArea* gv = [LHGravityArea nodeWithDictionary:childInfo // parent:prnt]; // return gv; // } // else if([nodeType isEqualToString:@"LHParallax"]) // { // LHParallax* pr = [LHParallax nodeWithDictionary:childInfo // parent:prnt]; // return pr; // } // else if([nodeType isEqualToString:@"LHParallaxLayer"]) // { // LHParallaxLayer* lh = [LHParallaxLayer nodeWithDictionary:childInfo // parent:prnt]; // return lh; // } // else if([nodeType isEqualToString:@"LHAsset"]) // { // LHAsset* as = [LHAsset nodeWithDictionary:childInfo // parent:prnt]; // return as; // } // else if([nodeType isEqualToString:@"LHCamera"]) // { // LHCamera* cm = [LHCamera nodeWithDictionary:childInfo // parent:prnt]; // return cm; // } // else if([nodeType isEqualToString:@"LHRopeJoint"]) // { // LHRopeJointNode* jt = [LHRopeJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHWeldJoint"]) // { // LHWeldJointNode* jt = [LHWeldJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHRevoluteJoint"]){ // // LHRevoluteJointNode* jt = [LHRevoluteJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHDistanceJoint"]){ // // LHDistanceJointNode* jt = [LHDistanceJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // // } // else if([nodeType isEqualToString:@"LHPulleyJoint"]){ // // LHPulleyJointNode* jt = [LHPulleyJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHPrismaticJoint"]){ // // LHPrismaticJointNode* jt = [LHPrismaticJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHWheelJoint"]){ // // LHWheelJointNode* jt = [LHWheelJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // else if([nodeType isEqualToString:@"LHGearJoint"]){ // // LHGearJointNode* jt = [LHGearJointNode nodeWithDictionary:childInfo // parent:prnt]; // return jt; // } // // // else{ // NSLog(@"UNKNOWN NODE TYPE %@", nodeType); // } return(null); }