Ejemplo n.º 1
0
        private void Build()
        {
            bool confirm = EditorUtility.DisplayDialog("Build WebGL Player", "This might take a while... Continue?",
                                                       "Confirm", "Cancel");

            if (!confirm)
            {
                return;
            }

            var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions()
            {
                scenes           = EditorBuildSettings.scenes.Select((scene) => scene.path).ToArray(),
                target           = (BuildTarget)_settings.BuildTarget,
                locationPathName = _settings.GetBuildPath(),
                options          = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None,
            });

            OnBuildComplete?.Invoke(report);
            Share();
        }
Ejemplo n.º 2
0
        public void Build()
        {
            Task.Run(() =>
            {
                string dir           = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Shelf");
                Stack <string> stack = new Stack <string>();
                stack.Push(dir);

                while (stack.Count > 0)
                {
                    List <string> sorter = new List <string>();
                    Dictionary <string, string> lookup = new Dictionary <string, string>();
                    string d = stack.Pop();

                    ShelfBuilderItem child = null;
                    var tmp = d.Replace(dir, "");
                    if (string.IsNullOrEmpty(tmp))
                    {
                        child = Root;
                    }
                    else
                    {
                        child = Root.FindChild(d.Replace(dir, ""));
                    }

                    if (System.IO.Directory.Exists(d))
                    {
                        string[] subs = System.IO.Directory.GetDirectories(d);

                        foreach (string s in subs)
                        {
                            string ds  = System.IO.Path.Combine(d, s);
                            var split  = ds.Split(System.IO.Path.DirectorySeparatorChar);
                            var achild = new ShelfBuilderItem(split[split.Length - 1]);
                            child.Add(achild);
                            stack.Push(ds);
                        }

                        string[] files = System.IO.Directory.GetFiles(d);

                        foreach (string p in files)
                        {
                            if (System.IO.Path.GetExtension(p).Equals(".mtg") ||
                                System.IO.Path.GetExtension(p).Equals(".mti") ||
                                System.IO.Path.GetExtension(p).Equals(".mtga"))
                            {
                                string fname = System.IO.Path.GetFileNameWithoutExtension(p);
                                sorter.Add(fname);
                                lookup[fname] = System.IO.Path.Combine(d, p);
                            }
                        }

                        sorter.Sort();

                        foreach (string fname in sorter)
                        {
                            string p = null;
                            if (lookup.TryGetValue(fname, out p))
                            {
                                ShelfResourceItem r = new ShelfResourceItem();
                                r.Title             = fname;
                                if (System.IO.Path.GetExtension(p).Equals(".mtg") ||
                                    System.IO.Path.GetExtension(p).Equals(".mtga"))
                                {
                                    r.Type = p;
                                    child.Add(r);
                                }
                                else if (System.IO.Path.GetExtension(p).Equals(".mti"))
                                {
                                    r.Type = System.IO.File.ReadAllText(p);
                                    child.Add(r);
                                }
                            }
                        }
                    }
                }

                App.Current.Dispatcher.Invoke(() =>
                {
                    if (OnBuildComplete != null)
                    {
                        OnBuildComplete.Invoke(this);
                    }
                });
            });
        }