예제 #1
0
        private void btn_editSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_settingSaveName.Text))
            {
                MessageBox.Show("Setting Name Required");
                return;
            }

            ABSetting setting = GetSettingsFromForm();

            if (grd_settingsList.SelectedRows.Count > 0)
            {
                object pkId = grd_settingsList.SelectedRows[0].Cells["PkId"].Value;
                setting.PkId = Convert.ToInt32(pkId);
                SettingDAL.UpdateSetting(setting);
            }
            else
            {
                SettingDAL.SaveSetting(setting);
            }

            SettingList_Load(sender, e);

            HideSettingForm();
        }
예제 #2
0
 private void FillFormFormSetting(ABSetting setting)
 {
     if (setting != null)
     {
         txt_settingSaveName.Text   = setting.Name;
         txt_buyPrice.Text          = setting.BuyPrice;
         txt_listPrice.Text         = setting.ListPrice;
         chk_sellBoughtCard.Checked = setting.SellBoughtItem;
         chk_sellAllCards.Checked   = setting.SellTransferList;
     }
 }
예제 #3
0
        private void btn_editSetting_Click(object sender, EventArgs e)
        {
            if (grd_settingsList.SelectedRows.Count > 0)
            {
                object    pkId    = grd_settingsList.SelectedRows[0].Cells["PkId"].Value;
                ABSetting setting = SettingDAL.GetSetting(pkId);

                FillFormFormSetting(setting);
            }

            ShowSettingForm();
        }
예제 #4
0
        private ABSetting GetSettingsFromForm()
        {
            ABSetting setting = new ABSetting
            {
                Name             = txt_settingSaveName.Text,
                BuyPrice         = txt_buyPrice.Text,
                ListPrice        = txt_listPrice.Text,
                SellBoughtItem   = chk_sellBoughtCard.Checked,
                SellTransferList = chk_sellAllCards.Checked,
            };

            return(setting);
        }
예제 #5
0
        public static void SetupABNames()
        {
            var setting = ABSetting.GetSetting();

            beDepInfoDict.Clear();
            int progressCount = 0;

            AssetDatabase.StartAssetEditing();
            foreach (var info in setting.infos)
            {
                progressCount++;
                EditorUtility.DisplayProgressBar("设置AB包配置", "设置" + info.ABName, (float)progressCount / (float)setting.infos.Count);

                //添加一个文件夹是 一个ab包资源
                if (info.subFolderLevel == 0)
                {
                    for (int j = 0; j < info.paths.Count; j++)
                    {
                        var path = AssetDatabase.GetAssetPath(info.paths[j]).Replace("\\", "/");
                        var ab   = GenABBuild(info.ABName, GetFiles(path));
                        SetFileABName(ab.assetBundleName, ab.assetNames);
                    }
                }
                //添加一个二级文件夹是一个ab包资源
                if (info.subFolderLevel == 1)
                {
                    //这里的ab name必须路径的子目录一个名字。
                    var ab = GenABBuild2(info.ABName);
                    foreach (var a in ab)
                    {
                        SetFileABName(a.assetBundleName, a.assetNames);
                    }
                }
                //添加一个三级文件夹是一个ab包资源
                if (info.subFolderLevel == 2)
                {
                    //这里的ab name必须路径的子目录一个名字。
                    var ab = GenABBuild3(info.ABName);
                    foreach (var a in ab)
                    {
                        SetFileABName(a.assetBundleName, a.assetNames);
                    }
                }
                //添加一个场景文件夹
                if (info.subFolderLevel == 3)
                {
                    foreach (var folder in info.paths)
                    {
                        var path = AssetDatabase.GetAssetPath(folder).Replace("\\", "/");
                        var ab   = GenABBuildMap(path, info.ABName);
                        foreach (var a in ab)
                        {
                            SetFileABName(a.assetBundleName, a.assetNames);
                        }
                    }
                }
            }
            MarkResourceFolder();
            AssetDatabase.StopAssetEditing();
            EditorUtility.DisplayProgressBar("设置AB包配置", "完成设置", 1f);
            CheckDuplicatedAutoDepFile();
            AssetDatabase.RemoveUnusedAssetBundleNames();
            var allABNames = AssetDatabase.GetAllAssetBundleNames();

            //UnityEngine.Debug.Log("total ab name count:" + allABNames.Length);
            EditorUtility.ClearProgressBar();
            Debug.Log("finish set asset bundle name!");
        }