public LHSprite(CCSpriteFrame spriteFrame, PlistDictionary dict, CCNode prnt, String spriteFrameName, String imageDevPath) : base(spriteFrame) { Debug.WriteLine("DID INIT SPRITE WITH FRAME " + spriteFrame); this._spriteFrameName = spriteFrameName; this._imageFilePath = imageDevPath; prnt.AddChild(this); // [self setColor:[dict colorForKey:@"colorOverlay"]]; // _nodeProtocolImp.loadGenericInfoFromDictionary(dict, this); Debug.WriteLine("LOADING PHYSICS..................."); Debug.WriteLine("SPR NAME " + this.getSpriteFrameName()); Debug.WriteLine("IMG NAME " + this.getImageFilePath()); Debug.WriteLine(dict); _physicsProtocolImp.loadPhysicsInfoFromDictionary(dict["nodePhysics"].AsDictionary, this); LHNodeProtocolImp.loadChildrenForNode(this, dict); // // // _animationProtocolImp = [[LHNodeAnimationProtocolImp alloc] initAnimationProtocolImpWithDictionary:dict // node:self]; // } // }
public static void loadChildrenForNode(CCNode prntNode, PlistDictionary dict) { PlistArray childrenInfo = dict["children"].AsArray; if (null != childrenInfo) { foreach (PlistDictionary childInfo in childrenInfo) { /*CCNode node =*/ LHNodeProtocolImp.createLHNodeWithDictionary(childInfo, prntNode); } } }
public LHBackUINode(PlistDictionary dict, CCNode prnt) : base() { Debug.WriteLine("DID LOAD BACK UI NODE"); prnt.AddChild(this); _nodeProtocolImp.loadGenericInfoFromDictionary(dict, this); this.ZOrder = -1; this.Position = new CCPoint(); LHNodeProtocolImp.loadChildrenForNode(this, dict); }
//-------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------- public LHScene(PlistDictionary dict, string plistLevelFile, CCWindow mainWindow) : base(mainWindow) { _designResolutionSize = CCSize.Parse(dict ["designResolution"].AsString); foreach (PlistDictionary devInf in dict["devices"].AsArray) { devices.Add(new LHDevice(devInf)); } currentDev = LHDevice.currentDeviceFromArray(devices, this); CCSize sceneSize = currentDev.getSize(); float ratio = currentDev.getRatio(); sceneSize.Width = sceneSize.Width / ratio; sceneSize.Height = sceneSize.Height / ratio; var aspect = dict ["aspect"].AsInt; if (aspect == 0) //exact fit { sceneSize = _designResolutionSize; } else if (aspect == 1) //no borders { } else if (aspect == 2) //show all { _designOffset.X = (sceneSize.Width - _designResolutionSize.Width) * 0.5f; _designOffset.Y = (sceneSize.Height - _designResolutionSize.Height) * 0.5f; } //loadingInProgress = true; Debug.WriteLine("plistLevelFile:|" + plistLevelFile + "|"); this.relativePath = LHUtils.folderFromPath(plistLevelFile); // this.relativePath = Path.GetDirectoryName (plistLevelFile); Debug.WriteLine("SCENE REL |" + this.relativePath + "|"); // Console.WriteLine ("SCENE REL |" + this.relativePath + "|"); if (this.relativePath == null) { this.relativePath = ""; } // loadingInProgress = true; // [[CCDirector sharedDirector] setContentScaleFactor:ratio]; // #if __CC_PLATFORM_IOS // [[CCFileUtils sharedFileUtils] setiPhoneContentScaleFactor:curDev.ratio]; // #endif // [self setName:relativePath]; _nodeProtocolImp.loadGenericInfoFromDictionary(dict, this); // self.contentSize= CGSizeMake(curDev.size.width/curDev.ratio, curDev.size.height/curDev.ratio); // self.position = CGPointZero; PlistDictionary tracedFixInfo = dict["tracedFixtures"].AsDictionary; if (tracedFixInfo != null) { tracedFixtures = new PlistDictionary(); foreach (var pair in tracedFixInfo) { string fixUUID = pair.Key; PlistArray fixInfo = pair.Value.AsArray; if (null != fixInfo) { tracedFixtures.Add(fixUUID, fixInfo); } } } // supportedDevices = [[NSArray alloc] initWithArray:devices]; // [self loadBackgroundColorFromDictionary:dict]; // [self loadGameWorldInfoFromDictionary:dict]; LHNodeProtocolImp.loadChildrenForNode(this, dict); // [self loadGlobalGravityFromDictionary:dict]; // [self loadPhysicsBoundariesFromDictionary:dict]; // [self setUserInteractionEnabled:YES]; // #if __CC_PLATFORM_IOS // pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)]; // [[[CCDirector sharedDirector] view] addGestureRecognizer:pinchRecognizer]; // #endif // #if LH_USE_BOX2D // _box2dCollision = [[LHBox2dCollisionHandling alloc] initWithScene:self]; // #else//cocos2d // #endif // [self performLateLoading]; // loadingInProgress = false; Debug.WriteLine("SCENE has children count " + this.ChildrenCount); }