Esempio n. 1
0
        public void updateConfigFields(float XRatio, float YRatio)
        {
            if (this.CustomConfigFields == null)
                this.CustomConfigFields = new List<ConfigField>();

            ConfigField applicationField = this.getFieldByName(this.CustomConfigFields, "application");
            if (applicationField == null)
            {
                applicationField = new ConfigField("application",true,true);
                this.CustomConfigFields.Add(applicationField);
            }

            ConfigField contentField = this.getFieldByName(applicationField.Children, "content");
            if (contentField == null)
            {
                contentField = new ConfigField("content", true, true);
                applicationField.Children.Add(contentField);
            }

            //CONTENT FIELDS
            ConfigField screenWidthField = this.getFieldByName(contentField.Children, "width");
            if (screenWidthField == null)
            {
                screenWidthField = new ConfigField("width", "NUMBER", (this.width * XRatio).ToString().Replace(",", "."), true, true);
                contentField.Children.Add(screenWidthField);
            }
            else
            {
                screenWidthField.Value = (this.width * XRatio).ToString().Replace(",", ".");
                screenWidthField.IsNamedField = true;
                screenWidthField.IsAutomaticField = true;
            }

            ConfigField screenHeightField = this.getFieldByName(contentField.Children, "height");
            if (screenHeightField == null)
            {
                screenHeightField = new ConfigField("height", "NUMBER", (this.height * YRatio).ToString().Replace(",", "."), true, true);
                contentField.Children.Add(screenHeightField);
            }
            else
            {
                screenHeightField.Value = (this.height * YRatio).ToString().Replace(",", ".");
                screenHeightField.IsNamedField = true;
                screenHeightField.IsAutomaticField = true;
            }

            ConfigField scaleField = this.getFieldByName(contentField.Children, "scale");
            if (scaleField == null)
            {
                scaleField = new ConfigField("scale", "STRING", this.scale, true, true);
                contentField.Children.Add(scaleField);
            }
            else
            {
                scaleField.Value = this.scale;
                scaleField.IsNamedField = true;
                scaleField.IsAutomaticField = true;
            }

            ConfigField xAlignField = this.getFieldByName(contentField.Children, "xAlign");
            if (xAlignField == null)
            {
                xAlignField = new ConfigField("xAlign", "STRING", this.ScreenXAlign.ToString(), true, true);
                contentField.Children.Add(xAlignField);
            }
            else
            {
                xAlignField.Value = this.ScreenXAlign.ToString();
                xAlignField.IsNamedField = true;
                xAlignField.IsAutomaticField = true;
            }

            ConfigField yAlignField = this.getFieldByName(contentField.Children, "yAlign");
            if (yAlignField == null)
            {
                yAlignField = new ConfigField("yAlign", "STRING", this.ScreenYAlign.ToString(), true, true);
                contentField.Children.Add(yAlignField);
            }
            else
            {
                yAlignField.Value = this.ScreenYAlign.ToString();
                yAlignField.IsNamedField = true;
                yAlignField.IsAutomaticField = true;
            }

            ConfigField fpsField = this.getFieldByName(contentField.Children, "fps");
            if (fpsField == null)
            {
                fpsField = new ConfigField("fps", "NUMBER", this.fps.ToString(), true, true);
                contentField.Children.Add(fpsField);
            }
            else
            {
                fpsField.Value = this.fps.ToString();
                fpsField.IsNamedField = true;
                fpsField.IsAutomaticField = true;
            }

            ConfigField antialiasField = this.getFieldByName(contentField.Children, "antialias");
            if (antialiasField == null)
            {
                antialiasField = new ConfigField("antialias", "BOOLEAN", this.antialias.ToString().ToLower(), true, true);
                contentField.Children.Add(antialiasField);
            }
            else
            {
                antialiasField.Value = this.antialias.ToString().ToLower();
                antialiasField.IsNamedField = true;
                antialiasField.IsAutomaticField = true;
            }
        }
Esempio n. 2
0
        public void updateBuildFields()
        {
            if (this.CustomBuildFields == null)
                this.CustomBuildFields = new List<ConfigField>();

            ConfigField settingsField = this.getFieldByName(this.CustomBuildFields, "settings");
            if (settingsField == null)
            {
                settingsField = new ConfigField("settings", true, true);
                this.CustomBuildFields.Add(settingsField);
            }

            ConfigField iPhoneField = this.getFieldByName(settingsField.Children, "iphone");
            if (iPhoneField == null)
            {
                iPhoneField = new ConfigField("iphone", true, true);
                settingsField.Children.Add(iPhoneField);
            }

            ConfigField componentsField = this.getFieldByName(iPhoneField.Children, "components");
            if (componentsField == null)
            {
                componentsField = new ConfigField("components", true, true);
                iPhoneField.Children.Add(componentsField);
            }

            ConfigField pListField = this.getFieldByName(iPhoneField.Children, "plist");
            if (pListField == null)
            {
                pListField = new ConfigField("plist", true, true);
                iPhoneField.Children.Add(pListField);
            }

            ConfigField UIAppFontsField = this.getFieldByName(this.CustomBuildFields, "UIAppFonts");
            if (UIAppFontsField == null)
            {
                UIAppFontsField = new ConfigField("UIAppFonts", true, true);
                pListField.Children.Add(UIAppFontsField);
            }

            for (int i = 0; i < this.AvailableFont.Count; i++)
            {
                string name = this.AvailableFont[i].NameForAndroid + ".ttf";
                ConfigField fontField = this.getFieldByName(UIAppFontsField.Children, name);
                if (fontField == null)
                {
                    fontField = new ConfigField(name, "STRING", name, true, false);
                    UIAppFontsField.Children.Add(fontField);
                }
                else
                {
                    fontField.Value = name;
                    fontField.IsNamedField = false;
                    fontField.IsAutomaticField = true;
                }
            }

            //--------
            ConfigField androidField = this.getFieldByName(this.CustomBuildFields, "android");
            if (androidField == null)
            {
                androidField = new ConfigField("android", true, true);
                settingsField.Children.Add(androidField);
            }

            if (this.AndroidVersionCode != null)
            {
                ConfigField VersionCodeField = this.getFieldByName(androidField.Children, "VersionCode");
                if (VersionCodeField == null)
                {
                    VersionCodeField = new ConfigField("VersionCode", "STRING", this.AndroidVersionCode, true, true);
                    androidField.Children.Add(VersionCodeField);
                }
                else
                {
                    VersionCodeField.Value = this.AndroidVersionCode;
                    VersionCodeField.IsNamedField = true;
                    VersionCodeField.IsAutomaticField = true;
                }
            }

            ConfigField androidPermissionsField = this.getFieldByName(this.CustomBuildFields, "androidPermissions");
            if (androidPermissionsField == null)
            {
                androidPermissionsField = new ConfigField("androidPermissions", true, true);
                settingsField.Children.Add(androidPermissionsField);
            }

            //androidPermissions SubSection

            for (int i = 0; i < this.AndroidPermissions.Count; i++)
            {
                string permissionStr = this.AndroidPermissions[i];
                ConfigField permField = this.getFieldByName(androidPermissionsField.Children, permissionStr);
                if (permField == null)
                {
                    permField = new ConfigField(permissionStr, "STRING", permissionStr, true, false);
                    androidPermissionsField.Children.Add(permField);
                }
                else
                {
                    permField.Value = permissionStr;
                    permField.IsNamedField = false;
                    permField.IsAutomaticField = true;
                }
            }

            //orientation SubSection

            ConfigField orientationField = this.getFieldByName(settingsField.Children, "orientation");
            if (orientationField == null)
            {
                orientationField = new ConfigField("orientation", true, true);
                settingsField.Children.Add(orientationField);
            }

            ConfigField defaultOrientationField = this.getFieldByName(orientationField.Children, "default");
            if (defaultOrientationField == null)
            {
                defaultOrientationField = new ConfigField("default", "STRING", this.Orientation.ToString().ToLower(), true, true);
                orientationField.Children.Add(defaultOrientationField);
            }
            else
            {
                defaultOrientationField.Value = this.Orientation.ToString().ToLower();
                defaultOrientationField.IsNamedField = true;
                defaultOrientationField.IsAutomaticField = true;
            }

            ConfigField contentOrientationField = this.getFieldByName(orientationField.Children, "content");
            if (contentOrientationField == null)
            {
                contentOrientationField = new ConfigField("content", "STRING", this.Orientation.ToString().ToLower(), true, true);
                orientationField.Children.Add(contentOrientationField);
            }
            else
            {
                contentOrientationField.Value = this.Orientation.ToString().ToLower();
                contentOrientationField.IsNamedField = true;
                contentOrientationField.IsAutomaticField = true;
            }

            if (this.SupportedOrientation.Count > 0)
            {
                ConfigField supportedOrientationField = this.getFieldByName(orientationField.Children, "supported");
                if (supportedOrientationField == null)
                {
                    supportedOrientationField = new ConfigField("supported", true, true);
                    orientationField.Children.Add(supportedOrientationField);
                }

                for (int i = 0; i < this.SupportedOrientation.Count; i++)
                {
                    string supportedOrientationStr = this.SupportedOrientation[i];
                    ConfigField supportedOrientationChild = this.getFieldByName(supportedOrientationField.Children, supportedOrientationStr);
                    if (supportedOrientationChild == null)
                    {
                        supportedOrientationChild = new ConfigField(supportedOrientationStr, "STRING", supportedOrientationStr, true, false);
                        supportedOrientationField.Children.Add(supportedOrientationChild);
                    }
                    else
                    {
                        supportedOrientationChild.Value = supportedOrientationStr;

                        supportedOrientationChild.IsNamedField = true;
                        supportedOrientationChild.IsAutomaticField = true;
                    }
                }
            }

            //build  SubSection
            if (this.CustomBuildName != null)
            {

                ConfigField buildField = this.getFieldByName(settingsField.Children, "build");
                if (buildField == null)
                {
                    buildField = new ConfigField("build", true, true);
                    settingsField.Children.Add(buildField);
                }

                ConfigField customBuildField = this.getFieldByName(buildField.Children, "custom");
                if (customBuildField == null)
                {
                    customBuildField = new ConfigField("custom", "STRING", this.CustomBuildName, true, true);
                    buildField.Children.Add(customBuildField);
                }
                else
                {
                    customBuildField.Value = this.CustomBuildName;
                    customBuildField.IsNamedField = true;
                    customBuildField.IsAutomaticField = true;
                }

            }
        }