Пример #1
0
 private void Button5_Click(object sender, EventArgs e)
 {
     if (indexOfLastSelection >= 0 && indexOfLastSelection < listView1.Items.Count)
     {
         if (paths[indexOfLastSelection].Contains("steamapps"))
         {
             EdLib.AskMsg(Form1.loadOnlinePackageWarning);
         }
         else
         {
             if (EdLib.HasFile(paths[indexOfLastSelection], true))
             {
                 if (EdLib.AskMsg("确认要移除该资源包吗? 该操作将无法挽回,确定吗?"))
                 {
                     try {
                         System.IO.Directory.Delete(paths[indexOfLastSelection]);
                         indexOfLastSelection = -2;
                         //FileSystem.DeleteDirectory(paths[indexOfLastSelection], UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                         reloadList();
                     }
                     catch (Exception E)
                     {
                         EdLib.AskMsg("由于文件夹被占用或无法正常处理(被防病毒软件阻止),因此删除操作已取消。");
                     }
                 }
             }
         }
     }
 }
Пример #2
0
        void LoadCSV(string pos)
        {
            ReoMain.Worksheets.Clear();
            string[] folders = System.IO.Directory.GetFiles(pos);
            for (int i = 0; i < folders.Length; i++)
            {
                string folder  = folders[i];
                string oneInfo = System.IO.Path.GetFileName(folder);
                string ex      = System.IO.Path.GetExtension(folder);
                string name    = System.IO.Path.GetFileNameWithoutExtension(folder);

                if (ex == ".csv")
                {
                    var worksheet = ReoMain.CreateWorksheet(name);
                    ReoMain.Worksheets.Add(worksheet);
                    try
                    {
                        LoadCsv(File.OpenRead(pos + oneInfo), worksheet);
                    }
                    catch (Exception d)
                    {
                        EdLib.AskMsg("读取资料库时发生严重异常,错误信息:\n" + d.ToString() + "\n" + d.Message);
                    }
                    //EdLib.AskMsg("Worksheets.Count = " + ReoMain.Worksheets.Count);
                }
            }
        }
Пример #3
0
        public void CreateNewPackage()
        {
            string infoName  = EdLib.InputBox("请输入资源包文件夹名称 (英文)").Trim();
            string infoName2 = EdLib.InputBox("请输入MOD名称").Trim();
            string infoIntro = EdLib.InputBox("请输入MOD简介").Trim();

            if (infoName.Trim() == "" || infoName2.Trim() == "")
            {
                return;
            }
            EdLib.AskMsg("准备按程序生成默认资源,这将需要一些时间,请耐心等待。");
            var pos = Form1.GetPath(Form1.path_UserPackage) + "\\" + infoName;

            System.IO.Directory.CreateDirectory(pos);
            System.IO.Directory.CreateDirectory(pos + "\\DataBase");
            System.IO.Directory.CreateDirectory(pos + "\\CardArt");
            System.IO.Directory.CreateDirectory(pos + "\\CharacterModel");
            System.IO.Directory.CreateDirectory(pos + "\\Effect");
            System.IO.Directory.CreateDirectory(pos + "\\Emoji");
            System.IO.Directory.CreateDirectory(pos + "\\EnvironmentModel");
            System.IO.Directory.CreateDirectory(pos + "\\Illustration");
            System.IO.Directory.CreateDirectory(pos + "\\MinimapModel");
            System.IO.Directory.CreateDirectory(pos + "\\Music");
            System.IO.Directory.CreateDirectory(pos + "\\Sound");
            System.IO.Directory.CreateDirectory(pos + "\\StageMap");
            System.IO.File.Copy(Form1.GetPath(Form1.path_GameApp) + "\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\Database\\Database.xls", pos + "\\DataBase\\DataBase.xls");
            System.IO.File.Copy(EdLib.path_AppData + "\\icon.png", pos + "\\icon.png");
            if (!EdLib.HasFile(pos + "\\PackageInfo.json", false))
            {
                System.IO.File.WriteAllText(pos + "\\PackageInfo.json", @"{
    ""id"": """ + infoName + @""",
    ""displayName"": """ + infoName2 + @""",
    ""description"": """ + infoIntro + @""",
    ""publishedTags"": [
        ""Card""
    ]
}
               ");
            }
            path_CurrentPackage = pos;
            loadAll();
            foreach (var item in ReoMain.Worksheets)
            {
                for (int i = 1; i < item.RowCount - 1; i++)
                {
                    for (int d = 0; d < item.ColumnCount; d++)
                    {
                        if (item[i, d] != null)
                        {
                            item[i, d] = null;
                        }
                    }
                }
            }
            SaveFile();
            EdLib.AskMsg("资源包创建完毕");
            System.Diagnostics.Process.Start(pos);
        }
Пример #4
0
        private void 关于我们ToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            EdLib.AskMsg(@"程序:Tamill
联系:[email protected]
适用游戏: Tetra Project (原石计划) Steam 版
如有bug 欢迎加群:951022336 汇报。
如加入 mod 制作队伍,欢迎加群:652279837。 

©2016-2019 Yiyin Tang Studio. All rights reserved.
Game Development: Alive Game Studio
");
        }
Пример #5
0
        /*
         *      if (control == pictureBox1 || control == pictureBox2 || control == pictureBox3 || control == pictureBox4 || control == label4 || control == label5 || control == label6 || control == label7 || control == label8)
         *      {
         *
         *          continue;
         *      }
         */



        private void StartFirstUsingSettings()
        {
            if (!EdLib.HasFile(path_UserPackage, true))
            {
                path_UserPackage = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\TetraProject\\Packages";
                if (!EdLib.HasFile(path_UserPackage, true))
                {
                    EdLib.AskMsg("未能自动找到您的 Packages 路径,请您手动设置。");
                }
            }
            EdLib.path_FileSelection = GetPath("{game}");
            var pos = GetPath("{localgame}");

            if (EdLib.HasFile(pos, true) && !pos.Contains("Debug"))
            {
                path_GameApp        = GetPath(pos);
                path_CurrentPackage = PackageSelection();
                SaveUserInfo();
                loadAll();
                return;
            }
            else
            {
                EdLib.AskMsg(GetPath("无法自动获取游戏目录,请您手动选择一些文件 TetraProject.exe, \n错误信息:{localgame}"));
            }


StartFirstUsingSettingsFlag:

            EdLib.ShowFileSelection("找到您的游戏 TetraProject.exe");
            if (EdLib.GetFileSelection())
            {
                var path = System.IO.Path.GetFileName(EdLib.path_FileSelection);
                if (path != "TetraProject.exe")
                {
                    if (EdLib.AskMsg("不是 TetraProject.exe,是否重新开始选择?。"))
                    {
                        goto StartFirstUsingSettingsFlag;
                    }
                }
                else
                {
                    path_GameApp = EdLib.path_FileSelection;
                }
            }



            path_CurrentPackage = PackageSelection();
            SaveUserInfo();
            loadAll();
        }
Пример #6
0
 private void 打开资源包文件夹ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EdLib.HasFile(path_CurrentPackage, true))
     {
         if (IsCurrentPackageSteamWorkshop)
         {
             EdLib.AskMsg(loadOnlinePackageWarning);
         }
         else
         {
             System.Diagnostics.Process.Start(path_CurrentPackage);
         }
     }
 }
Пример #7
0
 public void SaveFile()
 {
     if (EdLib.HasFile(path_CurrentPackage, true))
     {
         if (IsCurrentPackageSteamWorkshop)
         {
             EdLib.AskMsg(loadOnlinePackageWarning);
         }
         else
         {
             ReoMain.Save(GetPath(path_CurrentPackage) + "\\Database\\database.xlsx", unvell.ReoGrid.IO.FileFormat.Excel2007);
             foreach (var item in ReoMain.Worksheets)
             {
                 item.ExportAsCSV(GetPath(path_CurrentPackage) + "\\Database\\" + item.Name + ".csv");
             }
         }
     }
 }
Пример #8
0
 private void Button4_Click(object sender, EventArgs e)
 {
     if (indexOfLastSelection >= 0 && indexOfLastSelection < listView1.Items.Count)
     {
         if (paths[indexOfLastSelection].Contains("steamapps"))
         {
             EdLib.AskMsg(Form1.loadOnlinePackageWarning);
         }
         else
         {
             if (EdLib.HasFile(paths[indexOfLastSelection] + "\\PackageInfo.json"))
             {
                 string  json    = System.IO.File.ReadAllText(paths[indexOfLastSelection] + "\\PackageInfo.json");
                 dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
                 jsonObj["description"] = richTextBox1.Text;
                 string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);
                 System.IO.File.WriteAllText(paths[indexOfLastSelection] + "\\PackageInfo.json", output);
                 descs[indexOfLastSelection] = richTextBox1.Text;
             }
         }
     }
 }
Пример #9
0
        public void loadAll()
        {
            var pos2 = GetPath("{game}\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\Database\\CardCommand.csv");

            if (EdLib.HasFile(pos2))
            {
                if (AutoCompleteData == null)
                {
                    AutoCompleteData = new List <ICompletionData>();
                    var obj = new ReoGridControl();
                    obj.Load(pos2, unvell.ReoGrid.IO.FileFormat.CSV);
                    for (int i = 1; i < obj.CurrentWorksheet.RowCount; i++)
                    {
                        if (obj.CurrentWorksheet[i, 0] != null)
                        {
                            if (obj.CurrentWorksheet[i, 1] != null)
                            {
                                AutoCompleteData.Add(new MyCompletionData(obj.CurrentWorksheet[i, 0].ToString(), obj.CurrentWorksheet[i, 1].ToString()));
                            }
                        }
                    }
                    obj.Dispose();
                }
            }


            if (EdLib.HasFile(path_CurrentPackage, true))
            {
                //sheet.SetColumnsWidth(0, 1, 50);
                IsCurrentPackageSteamWorkshop = false;
                var pos = GetPath(path_CurrentPackage) + "\\Database\\";
                if (path_CurrentPackage.Contains("steamapps"))
                {
                    IsCurrentPackageSteamWorkshop = true;
                }
                //return;
                try
                {
                    if (IsCSVLoader)
                    {
                        LoadCSV(pos);
                    }
                    else
                    {
                        if (EdLib.HasFile(pos + "database.xlsx"))
                        {
                            ReoMain.Load(pos + "database.xlsx", unvell.ReoGrid.IO.FileFormat.Excel2007);
                        }
                        else
                        {
                            ReoMain.Load(pos + "database.xls", unvell.ReoGrid.IO.FileFormat.Excel2007);
                        }
                    }
                }
                catch (Exception e)
                {
                    if (e.Message.Contains("ZipFile"))
                    {
                        //直接读取--- csv
                        LoadCSV(pos);
                    }
                    else
                    {
                        EdLib.AskMsg("读取资料库时发生严重异常,错误信息:\n" + e.ToString() + "\n" + e.Message);

                        return;
                    }
                }

                ReoMain.Readonly = IsCurrentPackageSteamWorkshop;

                foreach (var item in reoGridControl2.Worksheets)
                {
                    item.NameTextColor          = EdLib.CFore;
                    item.NameBackColor          = EdLib.CBack;
                    item.SelectionRangeChanged += Item_SelectionRangeChanged;
                    if (item.Name == "Card")
                    {
                        ReoMain.CurrentWorksheet = item;
                    }
                }

                LoadSheet();
                return;
            }
        }
Пример #10
0
 private void 官方教程档案ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     EdLib.AskMsg("敬请期待!");
 }