Ejemplo n.º 1
0
        public static void Refresh(PartList partList)
        {
            if (partList == null)
            {
                return;
            }

            partList.partPacks = new List <PartPack>();
            List <string> sourcepath = GetSourcePath();

            foreach (string s in sourcepath)
            {
                List <Part> parts = EditorUtils.GetScriptables <Part>(s, true);
                foreach (Part p in parts)
                {
                    PartPack tpack = GetPack(p.category, partList.partPacks);
                    if (tpack == null)
                    {
                        tpack          = new PartPack();
                        tpack.category = p.category;
                        partList.partPacks.Add(tpack);
                    }

                    tpack.parts.Add(p);
                }
            }
            EditorUtility.SetDirty(partList);
            PartRefCustomMenu.RefreshPartReferers();
        }
Ejemplo n.º 2
0
        protected virtual void initializeTemplate()
        {
            _templates = EditorUtils.GetScriptables <PartTemplate>(WizardUtils.PartTemplateFolder);
            _stemp     = 0;
            _tempopt   = new Dictionary <string, TemplateOption[]>();
            if (_templates.Count <= 0)
            {
                _templateint    = new int[0];
                _templatestring = new string[0];
                _tempopt        = new Dictionary <string, TemplateOption[]>();
                return;
            }

            _templateint    = new int[_templates.Count];
            _templatestring = new string[_templates.Count];
            for (int i = 0; i < _templates.Count; i++)
            {
                _templateint[i]    = i;
                _templatestring[i] = _templates[i].ToString();
                _tempopt.Add(_templates[i].ToString(),
                             new TemplateOption[_templates[i].spriteNames.Count]);
                for (int j = 0; j < _templates[i].spriteNames.Count; j++)
                {
                    _tempopt[_templates[i].ToString()][j].spriteName = _templates[i].spriteNames[j];
                    _tempopt[_templates[i].ToString()][j].option     = true;
                }
            }
        }
Ejemplo n.º 3
0
        public static void RefreshPartPackage()
        {
            List <string> sourcepath = GetSourcePath();

            foreach (string s in sourcepath)
            {
                string      packagename = Path.GetFileNameWithoutExtension(s);
                List <Part> parts       = EditorUtils.GetScriptables <Part>(s, true);
                foreach (Part p in parts)
                {
                    if (p.packageName != packagename)
                    {
                        p.packageName = packagename;
                        EditorUtility.SetDirty(p);
                    }
                }
            }
        }