Ejemplo n.º 1
0
        /// <summary>
        /// メニューファイルを読み込む
        /// </summary>
        /// <returns></returns>
        bool loadMenu()
        {
            nodes = new Dictionary<string, int>();
            foreach (var nodekey in Params.Nodenames.Keys)
            {
                if (menuFile.delNodes.Contains(nodekey))
                {
                    nodes.Add(nodekey, 1);
                }
                else if (menuFile.showNodes.Contains(nodekey))
                {
                    nodes.Add(nodekey, 2);
                }
                else
                {
                    nodes.Add(nodekey, 0);
                }
            }
            masks = new Dictionary<string, bool>();
            foreach (var slotkey in Params.Slotnames.Keys)
            {
                if (menuFile.maskItems.Contains(slotkey))
                {
                    masks.Add(slotkey, true);
                }
                else
                {
                    masks.Add(slotkey, false);
                }
            }

            addItems = new List<ModelFile>();
            foreach (var target in menuFile.addItems)
            {
                if (Params.Slotnames.Keys.Contains(target[1]))
                {
                    ModelFile model = new ModelFile();
                    if (model.LoadFile(target[0]))
                    {
                        model.category = menuFile.category;
                        model.slotname = target[1];
                        if (Params.AttachPoints.ContainsKey(target[1]))
                        {
                            //手持ちアイテム
                            model.addItemType = ModelFile.AddItemType.handItem;
                            model.attachSlot = MenuFile.AttachBoneString;
                            model.attachName = Params.AttachPoints[target[1]];
                        }
                        else if (target.Length == 4 && target[2] == MenuFile.AttachBoneString)
                        {
                            //ボーンにアタッチ
                            model.addItemType = ModelFile.AddItemType.attachBone;
                            model.attachSlot = MenuFile.AttachBoneString;
                            model.attachName = target[3];
                        }
                        else if (target.Length == 5 && target[2] == MenuFile.AttachString)
                        {
                            //アタッチ
                            model.addItemType = ModelFile.AddItemType.attach;
                            model.attachSlot = target[3];
                            model.attachName = target[4];
                        }
                        addItems.Add(model);
                    }
                }
            }

            mateFiles = new List<MateFile>();
            foreach (var target in menuFile.materials)
            {
                if (Params.Slotnames.Keys.Contains(target[0]))
                {
                    int matno;
                    if (int.TryParse(target[1], out matno))
                    {
                        MateFile mate = new MateFile();
                        if (mate.LoadFile(target[2]))
                        {
                            mate.matno = matno;
                            mate.category = menuFile.category;
                            mate.slotname = target[0];
                            mateFiles.Add(mate);
                        }
                    }
                }
            }

            resourceFiles = new List<MenuFile>();
            foreach (var target in menuFile.resources)
            {
                MenuFile menu = new MenuFile();
                if (menu.LoadFile(target[1]))
                {
                    menu.resourceName = target[0];
                    resourceFiles.Add(menu);
                }
            }


            delItems = new Dictionary<string, bool>();
            foreach (var slot in Params.Slotnames.Keys)
            {
                // 削除アイテムのチェック
                bool exists = false;
                foreach (var target in menuFile.items)
                {
                    if (target.Contains(slot) && target.Contains("_del"))
                    {
                        exists = true;
                        break;
                    }
                }
                delItems.Add(slot, exists);
            }
            scrollPos = Vector2.zero;
            wearMpnsCombo.SelectedItemIndex = 0;
            foreach (var category in wearMpns)
            {
                if (category.text == menuFile.category)
                {
                    break;
                }
                wearMpnsCombo.SelectedItemIndex++;
            }
            return true;
        }
Ejemplo n.º 2
0
 void onSelectMPN(int winId)
 {
     GUILayout.BeginVertical(GUI.skin.box);
     GUILayout.Label("MOD Assist", labelStyle);
     mpnScrollPos = GUILayout.BeginScrollView(mpnScrollPos);
     foreach (var mpnkey in Params.WearMPNs.Keys)
     {
         if (GUILayout.Button(Params.WearMPNs[mpnkey], buttonStyle))
         {
             MaidProp prop = maid.GetProp(mpnkey);
             menuFile = new MenuFile();
             if (!menuFile.LoadFile(prop.strFileName))
             {
                 return;
             }
             if (loadMenu())
             {
                 showMainWindow = true;
             }
         }
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUI.DragWindow();
 }