예제 #1
0
    private void Update()
    {
        if (Input.GetKeyDown(refreshKey))
        {
            SceneManager.LoadScene("Scenes/Game");
        }

        if (!_buildComplete || _sealed)
        {
            return;
        }
        HandleBuildComplete?.Invoke(this);
        _sealed = true;
    }
예제 #2
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();
        }
예제 #3
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);
                    }
                });
            });
        }