コード例 #1
0
ファイル: CoronaGameBuilder.cs プロジェクト: slagusev/Krea
        public void CreateConfigLua(bool isCustomBuild, float XRatio, float YRatio)
        {
            string path = this.project.BuildFolderPath + "\\config.lua";

            this.project.updateConfigFields(XRatio, YRatio);

            StringBuilder sb = new StringBuilder();

            //Application Section
            String contentToWrite = "application =\n";

            contentToWrite += "{\n";
            //Content SubSection
            contentToWrite += "\tcontent =\n";
            contentToWrite += "\t{\n";

            ////Write Parameters
            //contentToWrite += "\t\twidth = " + (this.project.width * XRatio).ToString().Replace(",", ".") + ",\n";
            //contentToWrite += "\t\theight = " + (this.project.height * YRatio).ToString().Replace(",", ".") + ",\n";
            //contentToWrite += "\t\tscale = \"" + this.project.scale + "\",\n";
            //contentToWrite += "\t\txAlign =  \"" + this.project.ScreenXAlign.ToString() + "\",\n";
            //contentToWrite += "\t\tyAlign = \"" + this.project.ScreenYAlign.ToString() + "\",\n";
            //contentToWrite += "\t\tfps = " + this.project.fps.ToString() + ",\n";
            //contentToWrite += "\t\tantialias = " + this.project.antialias.ToString().ToLower() + ",\n";
            ConfigField contentField = this.project.getFieldByName(this.project.CustomConfigFields, "content");

            int indentCount = 2;

            for (int i = 0; i < contentField.Children.Count; i++)
            {
                ConfigField contentChild = contentField.Children[i];
                contentToWrite += contentChild.ToLua(indentCount);
            }

            if (isCustomBuild == false)
            {
                //ImageSuffix SubSection
                if (this.project.ImageSuffix.Count > 0)
                {
                    contentToWrite += "\t\timageSuffix =\n";
                    contentToWrite += "\t\t{\n";
                    for (int i = 0; i < this.project.ImageSuffix.Count; i++)
                    {
                        contentToWrite += "\t\t\t" + this.project.ImageSuffix[i].ToString() + ",\n";
                    }
                    //Close ImageSuffix SubSection
                    contentToWrite += "\t\t},\n";
                }
            }



            //Close Content SubSection
            contentToWrite += "\t},\n";

            indentCount = 1;
            ConfigField applicationField = this.project.getFieldByName(this.project.CustomConfigFields, "application");

            for (int i = 0; i < applicationField.Children.Count; i++)
            {
                ConfigField applicationChild = applicationField.Children[i];

                if (!applicationChild.Name.Equals("content"))
                {
                    contentToWrite += applicationChild.ToLua(indentCount);
                }
            }
            //Application Content SubSection
            contentToWrite += "}\n";

            sb.Append(contentToWrite);

            FileStream fs = File.Create(path);

            fs.Close();

            File.AppendAllText(path, sb.ToString());
            sb.Clear();
            sb = null;
        }
コード例 #2
0
ファイル: CoronaGameBuilder.cs プロジェクト: slagusev/Krea
        public void CreateBuildSettings()
        {
            string path = this.project.BuildFolderPath + "\\build.settings";

            this.project.updateBuildFields();


            StringBuilder sb = new StringBuilder();

            sb.AppendLine("settings  =");
            sb.AppendLine("{\n");

            ConfigField settingsField = this.project.getFieldByName(this.project.CustomBuildFields, "settings");

            int indentCount = 1;

            for (int i = 0; i < settingsField.Children.Count; i++)
            {
                ConfigField settingsChild = settingsField.Children[i];
                sb.Append(settingsChild.ToLua(indentCount));
            }

            sb.AppendLine("}");
            ////settings Section
            //String contentToWrite = "settings  = \n";
            //contentToWrite += "{\n";

            //contentToWrite += "\tiphone = \n";
            //contentToWrite += "\t{\n";
            //     contentToWrite += "\t\tcomponents = {}\n";
            //contentToWrite += "\t},\n";

            ////android SubSection
            //if (this.project.AndroidVersionCode != null)
            //{
            //    contentToWrite += "\tandroid = \n";
            //    contentToWrite += "\t{\n";

            //    contentToWrite += "\t\tVersionCode = \"" + this.project.AndroidVersionCode + "\"\n";

            //    //close android SubSection
            //    contentToWrite += "\t},\n";
            //}

            ////androidPermissions SubSection
            //if (this.project.AndroidPermissions.Count > 0)
            //{
            //    contentToWrite += "\tandroidPermissions  = " + "\n";
            //    contentToWrite += "\t{\n";

            //    for (int i = 0; i < this.project.AndroidPermissions.Count; i++)
            //    {
            //        contentToWrite += "\t\t\"" + this.project.AndroidPermissions[i] + "\"";
            //        if (i != this.project.AndroidPermissions.Count - 1)
            //        {
            //            contentToWrite += ",";
            //        }
            //        contentToWrite += "\n";
            //    }
            //    //close androidPermissions SubSection
            //    contentToWrite += "\t},\n";
            //}

            ////orientation SubSection
            //contentToWrite += "\torientation  = " + "\n";
            //contentToWrite += "\t{\n";

            //contentToWrite += "\t\tdefault = \"" + this.project.Orientation.ToString().ToLower() + "\",\n";
            //contentToWrite += "\t\tcontent = \"" + this.project.Orientation.ToString().ToLower() + "\",\n";

            ////orientation supported SubSection
            //if (this.project.SupportedOrientation.Count > 0)
            //{
            //    contentToWrite += "\t\tsupported   = " + "\n";
            //    contentToWrite += "\t\t{\n";

            //    for (int i = 0; i < this.project.SupportedOrientation.Count; i++)
            //    {
            //        contentToWrite += "\t\t\t\"" + this.project.SupportedOrientation[i] + "\",";
            //    }
            //    contentToWrite += "\n";
            //    // close orientation supported SubSection
            //    contentToWrite += "\t\t},\n";
            //}
            ////close orientation SubSection
            //contentToWrite += "\t},\n";

            ////Builds Fonts
            //contentToWrite += this.GenerateIphoneFontsProperties(this.project.AvailableFont);

            ////build  SubSection
            //if (this.project.CustomBuildName != null)
            //{
            //    contentToWrite += "\tbuild  = \n";
            //    contentToWrite += "\t{\n";

            //    contentToWrite += "\t\tcustom  = \"" + this.project.CustomBuildName + "\",\n";

            //    //Close build  SubSection
            //    contentToWrite += "\t},\n";
            //}
            ////settings Content SubSection
            //contentToWrite += "}\n";


            FileStream fs = File.Create(path);

            fs.Close();

            File.AppendAllText(path, sb.ToString());
            sb.Clear();
            sb = null;
        }