virtual public void ExportTo(string path) { string content = ""; content += "--sprite...\n"; content += "name = \"" + this.نام + "\" ;\n"; content += "image = \"" + this.بافت + "\" ;\n"; content += "x = " + this.x.ToString() + " ;\n"; content += "y = " + this.y.ToString() + " ;\n"; content += "height = " + this.ارتفاع.ToString() + " ;\n"; content += "width = " + this.عرض.ToString() + " ;\n"; content += "rotation = " + this.زاویه_چرخش.ToString() + " ;\n"; content += "scale = " + this.مقیاس.ToString() + " ;\n"; content += "alpha = " + this.شفافیت.ToString() + " ;\n"; content += "isPhysical = " + this.دارای_خواص_فیزیکی.ToString().ToLower() + " ;\n"; content += "isStatic = " + this.ایستایی.ToString().ToLower() + " ;\n"; content += "mass = " + this.جرم.ToString() + " ;\n"; content += "inertia = " + this.اینرسی.ToString() + " ;\n"; content += "friction = " + this.ضريب_اصطكاك.ToString() + " ;\n"; content += "elastic = " + this.ضريب_كشسان.ToString() + " ;\n"; content += "-- Animation Attributes ...\n"; content += "anim_timer = " + this.توقف_در_هر_فریم.ToString() + " ;\n"; content += "totalFrames = " + this.تعدادفریم.ToString() + " ;\n"; content += "isRev = " + this.معکوس.ToString() + " ;\n"; content += "rows = " + this.سطر.ToString() + " ;\n"; content += "cols = " + this.ستون.ToString() + " ;\n"; if (this.دارای_خواص_فیزیکی) { content += "--Shapes...\n"; ////////////////////////////////////////////////////////////////////// //LineShapes content += " --LineShapes...\n"; content += " lineShapesCount = " + this.getLineShapeCount().ToString() + " ;\n"; int n = 0; for (int k = 0; k < this.shapesList.Count; k++) { if (this.shapesList[k].type == ShapeTypes.LINE) { content += " --lineShape_" + n.ToString() + "...\n"; LineShape lineShape = (LineShape)this.shapesList[k]; content += " lineShape_" + n.ToString() + "_aX = " + lineShape.aX.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_aY = " + lineShape.aY.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_bX = " + lineShape.bX.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_bY = " + lineShape.bY.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_thickness = " + lineShape.thickness.ToString() + " ;\n"; n++; } } content += " --End of LineShapes...\n"; ///////////////////////////////////////////////////////////////////////////// //CircleShapes content += " --CircleShapes...\n"; content += " circleShapesCount = " + this.getCircleShapeCount().ToString() + " ;\n"; n = 0; for (int k = 0; k < this.shapesList.Count; k++) { if (this.shapesList[k].type == ShapeTypes.CIRCLE) { content += " --circleShape_" + n.ToString() + "...\n"; CircleShape circleShape = (CircleShape)this.shapesList[k]; content += " circleShape_" + n.ToString() + "_x = " + circleShape.x.ToString() + " ;\n"; content += " circleShape_" + n.ToString() + "_y = " + circleShape.y.ToString() + " ;\n"; content += " circleShape_" + n.ToString() + "_r = " + circleShape.r.ToString() + " ;\n"; n++; } } content += " --End of CircleShapes...\n"; ///////////////////////////////////////////////////////////////////////////// //CircleShapes content += " -- PolyGonShapes...\n"; content += " polyGonShapesCount = " + this.getPolygonShapeCount().ToString() + " ;\n"; n = 0; ////// // // content += " --End of PolyGonShapes...\n"; } content += "--End of sprite...\n"; content += "\n--Functions ...\n"; content += this.script; content += "\n--End of Functions ..."; System.IO.File.WriteAllText(path, content); }
//public object Clone() //{ // return MemberwiseClone(); //} override public void ExportTo(string path) { string content = ""; content += "--Particle...\n"; content += "name = \"" + this.نام + "\" ;\n"; content += "image = \"" + this.بافت + "\" ;\n"; content += "x = " + this.x.ToString() + " ;\n"; content += "y = " + this.y.ToString() + " ;\n"; content += "height = " + this.ارتفاع.ToString() + " ;\n"; content += "width = " + this.عرض.ToString() + " ;\n"; content += "rotation = " + this.زاویه_چرخش.ToString() + " ;\n"; content += "scale = " + this.مقیاس.ToString() + " ;\n"; content += "alpha = " + this.شفافیت.ToString() + " ;\n"; content += "isPhysical = " + this.دارای_خواص_فیزیکی.ToString().ToLower() + " ;\n"; content += "isStatic = " + this.ایستایی.ToString().ToLower() + " ;\n"; content += "mass = " + this.جرم.ToString() + " ;\n"; content += "inertia = " + this.اینرسی.ToString() + " ;\n"; content += "friction = " + this.ضريب_اصطكاك.ToString() + " ;\n"; content += "elastic = " + this.ضريب_كشسان.ToString() + " ;\n"; //Particle Attributes content += "--Particle Attributes...\n"; content += "count = " + this.تعداد_ذرات.ToString() + " ;\n"; content += "startColor_R = " + this.رنگ_شروع_قرمز.ToString() + " ;\n"; content += "startColor_G = " + this.رنگ_شروع_سبز.ToString() + " ;\n"; content += "startColor_B = " + this.رنگ_شروع_آبي.ToString() + " ;\n"; content += "endColor_R = " + this.رنگ_پايان_قرمز.ToString() + " ;\n"; content += "endColor_G = " + this.رنگ_پايان_سبز.ToString() + " ;\n"; content += "endColor_B = " + this.رنگ_پايان_آبي.ToString() + " ;\n"; content += "startAlpha = " + this.شفافيت_آغاز_ذرات.ToString() + " ;\n"; content += "endAlpha = " + this.شفافيت_پايان_ذرات.ToString() + " ;\n"; content += "minParticleLifeTime = " + this.كمينه_زندگي_ذرات.ToString() + " ;\n"; content += "maxParticleLifeTime = " + this.بيشينه_زندگي_ذرات.ToString() + " ;\n"; content += "minStartSpeed = " + this.كمينه_سرعت_شروع.ToString() + " ;\n"; content += "maxStartSpeed = " + this.بيشينه_سرعت_شروع.ToString() + " ;\n"; content += "acceleration_x = " + this.شتاب_x.ToString() + " ;\n"; content += "acceleration_y = " + this.شتاب_y.ToString() + " ;\n"; content += "gravity_x = " + this.گرانش_x.ToString() + " ;\n"; content += "gravity_y = " + this.گرانش_y.ToString() + " ;\n"; content += "minScale = " + this.مقياس_كمينه.ToString() + " ;\n"; content += "maxScale = " + this.مقياس_بيشينه.ToString() + " ;\n"; content += "rpt = " + this.تكرار.ToString().ToLower() + " ;\n"; content += "--end of Particle Attributes...\n\n"; if (this.دارای_خواص_فیزیکی) { content += "--Shapes...\n"; ////////////////////////////////////////////////////////////////////// //LineShapes content += " --LineShapes...\n"; content += " lineShapesCount = " + this.getLineShapeCount().ToString() + " ;\n"; int n = 0; for (int k = 0; k < this.shapesList.Count; k++) { if (this.shapesList[k].type == ShapeTypes.LINE) { content += " --lineShape_" + n.ToString() + "...\n"; LineShape lineShape = (LineShape)this.shapesList[k]; content += " lineShape_" + n.ToString() + "_aX = " + lineShape.aX.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_aY = " + lineShape.aY.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_bX = " + lineShape.bX.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_bY = " + lineShape.bY.ToString() + " ;\n"; content += " lineShape_" + n.ToString() + "_thickness = " + lineShape.thickness.ToString() + " ;\n"; n++; } } content += " --End of LineShapes...\n"; ///////////////////////////////////////////////////////////////////////////// //CircleShapes content += " --CircleShapes...\n"; content += " circleShapesCount = " + this.getCircleShapeCount().ToString() + " ;\n"; n = 0; for (int k = 0; k < this.shapesList.Count; k++) { if (this.shapesList[k].type == ShapeTypes.CIRCLE) { content += " --circleShape_" + n.ToString() + "...\n"; CircleShape circleShape = (CircleShape)this.shapesList[k]; content += " circleShape_" + n.ToString() + "_x = " + circleShape.x.ToString() + " ;\n"; content += " circleShape_" + n.ToString() + "_y = " + circleShape.y.ToString() + " ;\n"; content += " circleShape_" + n.ToString() + "_r = " + circleShape.r.ToString() + " ;\n"; n++; } } content += " --End of CircleShapes...\n"; ///////////////////////////////////////////////////////////////////////////// //CircleShapes content += " -- PolyGonShapes...\n"; content += " polyGonShapesCount = " + this.getPolygonShapeCount().ToString() + " ;\n"; n = 0; ////// // // content += " --End of PolyGonShapes...\n"; } content += "--End of Particle...\n"; content += "\n--Functions ...\n"; content += this.script; content += "\n--End of Functions ..."; System.IO.File.WriteAllText(path, content); }