Beispiel #1
0
        //public virtual void Editor_Generate(string[] str)
        //{
        //    if (PageInfo.World == null) return;
        //    EditorVolume editor = new EditorVolume();
        //    editor.Texture_Up = Info.UrlToImage(str[1]);
        //    editor.Texture_In = Info.UrlToImage(str[2]);
        //    editor.Texture_Out = Info.UrlToImage(str[3]);
        //    string name = str[4] + ".png";

        //    string p = Info.address_Images_HDD + @"/Templates/";
        //    if (!Directory.Exists(p))
        //        Directory.CreateDirectory(p);
        //    p += name;

        //    editor.OnImage(p);

        //    string URL = Info.ImageToUrl(p);

        //    TemplateJSON template = new TemplateJSON(name, 1, 1, URL);
        //    if (Editor != null && template != null)
        //        Editor.Template(template);

        //    Add(new MsgJSON_Object("TEMPLATES", template));
        //    Add(new MsgJSON_String("EDITOR_GENERATE", URL));
        //}
        public virtual void Editor_Generate(string[] str)
        {
            if (PageInfo.World == null)
            {
                return;
            }
            EditorImage editor = new EditorImage();

            editor.Texture_Z = Info.UrlToImage(str[1]);
            editor.Texture_Y = Info.UrlToImage(str[2]);
            editor.Texture_X = Info.UrlToImage(str[3]);
            string name = str[4] + ".png";

            string p = Info.address_Images_HDD + @"/Templates/";

            if (!Directory.Exists(p))
            {
                Directory.CreateDirectory(p);
            }
            p += name;

            editor.OnImageCube(p);

            string URL = Info.ImageToUrl(p);

            TemplateJSON template = new TemplateJSON(name, 4, 4, URL);

            if (Editor != null && template != null)
            {
                Editor.Template(template);
            }

            Add(new MsgJSON_Object("TEMPLATES", template));
            Add(new MsgJSON_String("EDITOR_GENERATE", URL));
        }
Beispiel #2
0
        public static void SaveFileTemplateJSON(TemplateJSON template, string path)
        {
            SerializationWriter SW = new SerializationWriter(path);

            SW.Start("Info");
            SW.WriteJSON("TemplateJSON", template);
            SW.End();
        }
Beispiel #3
0
        public void Editor_Template(string[] str)
        {
            TemplateJSON template = Info.JSONDeserialize <TemplateJSON>(str[1]);

            if (Editor != null && template != null)
            {
                Editor.Template(template);
            }
        }
Beispiel #4
0
 public void Add(TemplateJSON template)
 {
     TemplateJSON[] temp = new TemplateJSON[Templates.Length + 1];
     for (int i = 0; i < Templates.Length; i++)
     {
         temp[i] = Templates[i];
     }
     temp[Templates.Length] = template;
     Templates = temp;
 }
Beispiel #5
0
        public static TemplateJSON LoadFileTemplateJSON(string path)
        {
            SerializationReader SR = new SerializationReader(path);

            SR.Read();
            SR.ReadDeclaration();
            SR.ReadStartElement();
            TemplateJSON template = SR.ReadJSON <TemplateJSON>();

            SR.Close();
            return(template);
        }
Beispiel #6
0
        public static World LoadWorld(string path)
        {
            if (!File.Exists(path + @"\World" + Info.extension))
            {
                return(null);
            }
            World world = LoadFileWorld(path + @"\World" + Info.extension);

            if (world == null)
            {
                return(null);
            }

            if (Directory.Exists(path + @"\Maps\"))
            {
                DirectoryInfo d = new DirectoryInfo(path + @"\Maps\");
                foreach (FileInfo file in d.GetFiles())
                {
                    Map map = LoadFileMap(file.FullName);
                    world.Add(map);
                }
            }
            if (Directory.Exists(path + @"\Animations\"))
            {
                DirectoryInfo dir = new DirectoryInfo(path + @"\Animations\");
                foreach (FileInfo file in dir.GetFiles())
                {
                    Animation animation = LoadFileAnimation(file.FullName);
                    world.Add(animation);
                }
            }
            if (Directory.Exists(path + @"\TemplateJSON\"))
            {
                DirectoryInfo direct = new DirectoryInfo(path + @"\TemplateJSON\");
                foreach (FileInfo file in direct.GetFiles())
                {
                    TemplateJSON template = LoadFileTemplateJSON(file.FullName);
                    world.Add(template);
                }
            }
            if (Directory.Exists(path + @"\Translators\"))
            {
                DirectoryInfo d = new DirectoryInfo(path + @"\Translators\");
                foreach (FileInfo file in d.GetFiles())
                {
                    Translator translator = LoadFileTranslator(file.FullName);
                    world.Add(translator);
                }
            }
            return(world);
        }