Пример #1
0
 // Token: 0x0600015D RID: 349 RVA: 0x0000CE04 File Offset: 0x0000B004
 public Func <string, string[], string[]> ReplaceMenuFunc()
 {
     this.replaceFiles = new List <ReplacedInfo>();
     return(delegate(string key, string[] param)
     {
         if (key != null)
         {
             if (!(key == "additem"))
             {
                 if (!(key == "マテリアル変更"))
                 {
                     return param;
                 }
             }
             else
             {
                 if (param.Length < 2)
                 {
                     return param;
                 }
                 string text = param[1];
                 try
                 {
                     TBody.SlotID key2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), text, false);
                     Item item = this.menu.itemSlots[key2];
                     if (item.needUpdate)
                     {
                         string text2 = param[0];
                         string text3;
                         if (item.filename == text2)
                         {
                             item.worksuffix = null;
                             text3 = item.EditFileName();
                         }
                         else
                         {
                             item.worksuffix = this.suffix;
                             text3 = item.EditFileName();
                             this.replaceFiles.Add(new ReplacedInfo(text2, text3, this, item));
                         }
                         param[0] = text3;
                     }
                     return param;
                 }
                 catch (Exception ex)
                 {
                     LogUtil.Debug(new object[]
                     {
                         "failed to parse SlotID:",
                         text,
                         ex
                     });
                     return param;
                 }
             }
             string slot = param[0];
             int matNo = int.Parse(param[1]);
             string text4 = param[2];
             TargetMaterial material = this.menu.GetMaterial(slot, matNo);
             material.worksuffix = null;
             if (material.filename == text4)
             {
                 param[2] = material.EditFileName();
             }
             else if (material.shaderChanged || material.hasParamChanged || material.hasTexFileChanged || material.hasTexColorChanged)
             {
                 material.worksuffix = this.suffix;
                 string text5 = material.EditFileName();
                 param[2] = text5;
                 ReplacedInfo item2 = new ReplacedInfo(text4, text5, this, material);
                 this.replaceFiles.Add(item2);
             }
         }
         return param;
     });
 }
Пример #2
0
        public Func <string, string[], string[]> ReplaceMenuFunc()
        {
            replaceFiles = new List <ReplacedInfo>();
            // menuファイル中のmodelとmateを更新する
            // それ以外はそのまま出力
            return((key, param) => {
                switch (key)
                {
                case "additem":
                    if (param.Length >= 2)
                    {
                        var slot0 = param[1];
                        try {
                            var slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), slot0, false);
                            var item = menu.itemSlots[slot];

                            // 対応するスロットのアイテムが更新される場合にのみ出力
                            if (item.needUpdate)
                            {
                                var filename0 = param[0];
                                string editfile;
                                // 元のmodelファイルが同一であれば、すでに出力済みと見なす
                                if (item.filename == filename0)
                                {
                                    item.worksuffix = null;
                                    editfile = item.EditFileName();
                                }
                                else
                                {
                                    item.worksuffix = suffix;
                                    editfile = item.EditFileName();
                                    replaceFiles.Add(new ReplacedInfo(filename0, editfile, this, item));
                                }
                                param[0] = editfile;
                            }
                        } catch (Exception e) {
                            LogUtil.Debug("failed to parse SlotID:", slot0, e);
                            // LogUtil.DebugLog("failed to parse additem slot", slot0, e);
                        }
                    }
                    break;

                case "マテリアル変更":
                    var slotName = param[0];
                    var matNo = int.Parse(param[1]);
                    var filename1 = param[2];
                    var tm = menu.GetMaterial(slotName, matNo);
                    // 上位menuと同名ファイルであれば、出力済のファイル名を指定 (上位側が変更されていなければそのまま)
                    tm.worksuffix = null;
                    if (tm.filename == filename1)
                    {
                        param[2] = tm.EditFileName();
                    }
                    else
                    {
                        if (tm.shaderChanged || tm.hasParamChanged || tm.hasTexFileChanged || tm.hasTexColorChanged)
                        {
                            tm.worksuffix = suffix;
                            var editfile = tm.EditFileName();
                            param[2] = editfile;
                            var replaced = new ReplacedInfo(filename1, editfile, this, tm);
                            replaceFiles.Add(replaced);
                        }
                        // マテリアルの内容が変更されていない場合は変更しない
                    }
                    break;
                }
                return param;
            });
        }
 public Func<string, string[], string[]> ReplaceMenuFunc() {
     replaceFiles = new List<ReplacedInfo>();
     // menuファイル中のmodelとmateを更新する
     // それ以外はそのまま出力
     return (string key, string[] param) => {
         switch (key) {
             case "additem":
                 if (param.Length >= 2) {
                     string slot0 = param[1];
                     try {
                         var slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), slot0, false);
                         Item item = menu.itemSlots[slot];
 
                         // 対応するスロットのアイテムが更新される場合にのみ出力
                         if (item.needUpdate) {
                             var filename0 = param[0];
                             string editfile;
                             // 元のmodelファイルが同一であれば、すでに出力済みと見なす
                             if (item.filename == filename0) {
                                 item.worksuffix = null;
                                 editfile = item.EditFileName();
                             } else {
                                 item.worksuffix = suffix;
                                 editfile = item.EditFileName();
                                 replaceFiles.Add( new ReplacedInfo(filename0, editfile, this, item) );
                             }
                             param[0] = editfile;
                         }
                     } catch(Exception e) {
                         LogUtil.Debug("failed to parse SlotID:", slot0, e);
                         // LogUtil.DebugLog("failed to parse additem slot", slot0, e);
                     }
                 }
                 break;
 
             case "マテリアル変更":
                 string slotName  = param[0];
                 int matNo        = int.Parse(param[1]);
                 string filename1 = param[2];
                 TargetMaterial tm = menu.GetMaterial(slotName, matNo);
                 // 上位menuと同名ファイルであれば、出力済のファイル名を指定 (上位側が変更されていなければそのまま)
                 tm.worksuffix = null;
                 if (tm.filename == filename1) {
                     param[2] = tm.EditFileName();
                 } else {
                     if (tm.shaderChanged || tm.hasParamChanged || tm.hasTexFileChanged || tm.hasTexColorChanged) {
                         tm.worksuffix = suffix;
                         var editfile = tm.EditFileName();
                         param[2] = editfile;
                         var replaced = new ReplacedInfo(filename1, editfile, this, tm);
                         replaceFiles.Add(replaced);
                     }
                     // マテリアルの内容が変更されていない場合は変更しない
                 }
                 break;
         }
         return param;
     };
 }