Exemple #1
0
 public static LureTexts get()
 {
     if (obj == null)
     {
         obj = new LureTexts();
     }
     return(obj);
 }
 public static LureTexts get()
 {
     if (obj == null)
         obj = new LureTexts();
     return obj;
 }
Exemple #3
0
        static void import(int id)
        {
            if (id == -1)
            {
                Console.WriteLine("import all");
                int    mode = LureConfig.get().textfmt;
                string ext  = ".xml";
                if (mode == 1)
                {
                    ext = ".txt";
                }
                string d = LureConfig.get().direcroty("./");
                if (!Directory.Exists(d))
                {
                    Directory.CreateDirectory(d);
                }
                if (d[d.Length - 1] != '\\' && d[d.Length - 1] != '/')
                {
                    d += "/";
                }
                foreach (LureConfig.LureFile f in LureConfig.get().lureFiles)
                {
                    switch (f.type)
                    {
                    case "font":
                        new LureFont(f.id).import(new System.Drawing.Bitmap(d + "lure_font.bmp"));
                        break;

                    case "text_decode_table":
                        TextDecoder.get().import(LureCommon.loadXml(d + "decoder.xml"));
                        break;

                    case "image":
                        int    w   = LureCommon.strToInt(f.node.Attributes["width"].Value);
                        int    h   = LureCommon.strToInt(f.node.Attributes["height"].Value);
                        string pal = f.node.Attributes["palette"].Value;
                        string nm  = "image" + f.id.ToString();
                        if (f.node.Attributes["name"] != null)
                        {
                            nm = f.node.Attributes["name"].Value;
                        }
                        new LureImage(f.id, w, h, pal).import(new System.Drawing.Bitmap(d + nm + ".bmp"));
                        break;

                    case "anim":
                        string apal = f.node.Attributes["palette"].Value;
                        string anm  = "anim" + f.id.ToString();
                        if (f.node.Attributes["name"] != null)
                        {
                            anm = f.node.Attributes["name"].Value;
                        }
                        new LureAnim(f.id, apal).import(new System.Drawing.Bitmap(d + anm + ".bmp"));
                        break;
                    }
                }
                LureTexts.getAllTexts().load(d + "lure_text" + ext, mode);
            }
            else
            {
                Console.WriteLine("import " + id.ToString());
                importResource(id);
            }
            LureDisks.saveAll();
        }