public string currentDeviceSuffix(bool keep2x)
        {
            CCSize scrSize = LHDevice.LH_SCREEN_RESOLUTION(this.Window);

            foreach (LHDevice dev in devices)
            {
                CCSize devSize = dev.getSize();

                if (devSize.Equals(scrSize) ||
                    (devSize.Width == scrSize.Height && devSize.Height == scrSize.Width))
                {
                    string suffix = dev.getSuffix();

                    if (false == keep2x)
                    {
                        suffix = suffix.Replace("2x", "");
                    }
                    return(suffix);
                }
            }
            return("");
        }
 public static LHDevice currentDeviceFromArray(List <LHDevice> devices, CCScene scene)
 {
     return(LHDevice.currentDeviceFromArray(devices, scene.Window));
 }
 public static LHDevice currentDeviceFromArray(List <LHDevice> devices, CCWindow window)
 {
     return(LHDevice.deviceFromArrayWithSize(devices, LHDevice.LH_SCREEN_RESOLUTION(window)));
 }
        //--------------------------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------------------------
        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);
        }
 public CCSize currentDeviceSize()
 {
     return(LHDevice.LH_SCREEN_RESOLUTION(this.Window));
 }