void Awake()
 {
     Instantiate(prefabGM);
     preview = GetComponent <LevelPreview>();
     DontDestroyOnLoad(gameObject);
     SceneManager.sceneLoaded += SceneLoaded;
     GameManager.GM.Load(preview.levelName);
 }
Exemplo n.º 2
0
    void OnDrawGizmosSelected()
    {
        Color c = Color.red;

        Gizmos.color = c;
        for (int i = 1; i < path.Count; i++)
        {
            Gizmos.DrawLine(
                LevelPreview.CenterPoint(path[i - 1]),
                LevelPreview.CenterPoint(path[i]));
        }
    }
Exemplo n.º 3
0
 public TestSceneLevelOverview()
 {
     Children = new Drawable[]
     {
         new Box
         {
             Colour           = new Color4(95, 95, 95, 255),
             RelativeSizeAxes = Axes.Both
         },
         lvlOverview = new LevelPreview(null, 0)
     };
 }
Exemplo n.º 4
0
    private void SnapToIndex()
    {
        float target = index * spacing;

        rectTransform.localPosition = new Vector3(-target, rectTransform.localPosition.y);

        leftArrow.color  = new Color(1, 1, 1, index == 0 ? 0 : 0.5f);
        rightArrow.color = new Color(1, 1, 1, index == thumbs.Count - 1 ? 0 : 0.5f);

        SoundManager.PlayClickSound();
        LevelPreview.Create(maps[index]);
    }
Exemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        LevelPreview lp = (LevelPreview)target;

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Load", GUILayout.Width(120)))
        {
            lp.Reset();
            lp.Load();
        }
        GUILayout.EndHorizontal();
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     _animator     = GetComponent <Animator>();
     mask.enabled  = false;
     image.enabled = false;
     _animator.Play("mask-small-idle");
 }
Exemplo n.º 7
0
        public EditorScreen(int index, Level level)
        {
            RelativeSizeAxes = Axes.Both;

            Editor = new Editor(level);
            // TODO: Inject editor into dependencies to work with the other things

            RPC.UpdatePresence(Editor.Level.Name, "Editing a level", new Assets
            {
                LargeImageKey  = "gde",
                LargeImageText = "GD Edit"
            });

            i = index;

            AddRangeInternal(new Drawable[]
            {
                background = new Sprite
                {
                    Origin = Anchor.BottomLeft,
                    Anchor = Anchor.BottomLeft,
                    Depth  = float.MaxValue,
                    Colour = GDEColors.FromHex("4f4f4f"),
                    Size   = new Vector2(2048, 2048)
                },
                camera = new Camera(Editor)
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Children         = new Drawable[]
                    {
                        grid = new Grid
                        {
                            Size   = new Vector2(1.1f), //Doubles the size
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre
                        },
                        new GridOrigin
                        {
                            Size   = new Vector2(1.1f),
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre
                        },
                        preview = new LevelPreview(this, index)
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre
                        }
                    }
                },
                tools = new EditorTools(preview, camera)
                {
                    Size   = new Vector2(150, 300),
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft
                },
                OpenFileDialogBindable.Value = new OpenFileDialog
                {
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.8f),
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Depth            = -10
                },
                SaveFileDialogBindable.Value = new SaveFileDialog
                {
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.8f),
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Depth            = -10
                },
                IDMigrationPanel = new IDMigrationPanel(this)
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    LockDrag = true
                }
            });

            camera.PostInit();
        }
Exemplo n.º 8
0
        public EditorTools(LevelPreview level, Camera camera)
        {
            Children = new Drawable[]
            {
                panel = new ObjectAdditionPanel(camera)
                {
                    Size     = new Vector2(335, 557),
                    Position = new Vector2(DrawWidth + 10, DrawHeight / 2)
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 15,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = GDEColors.FromHex("1f1f1f")
                        }
                    }
                },
                new FillFlowContainer
                {
                    Direction        = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.White,
                    Padding          = new MarginPadding(15),
                    Children         = new Drawable[]
                    {
                        addObject = new GDEButton
                        {
                            Action           = panel.ToggleVisibility,
                            Text             = "Add Object",
                            BackgroundColour = GDEColors.FromHex("2f2f2f"),
                            RelativeSizeAxes = Axes.X
                        },
                        deleteSelectedObjects = new GDEButton
                        {
                            Action = () =>
                            {
                                //Always defaults to 0, so fix that
                                foreach (var o in ObjectBase.DrawableSelectedObjects)
                                {
                                    //Hide it for now
                                    o.Hide();
                                }

                                ObjectBase.DrawableSelectedObjects.Clear();
                                editor?.DeselectAll();
                            },
                            Text             = "Delete Selected Objects",
                            BackgroundColour = GDEColors.FromHex("2f2f2f"),
                            RelativeSizeAxes = Axes.X
                        }
                    }
                }
            };

            AbleToPlaceBlock.BindTo(panel.AbleToPlace);
        }
Exemplo n.º 9
0
        public override void LoadContent(ContentManager content)
        {
            next = new Button();
            next.LoadImage("buttons/next");
            next.Position = new Vector2(Game1.Instance.ScreenRect.Width - 200, Game1.Instance.ScreenRect.Height - 75);
            next.OnClick += Buttons_OnClick;

            prev = new Button();
            prev.LoadImage("buttons/prev");
            prev.Position = new Vector2(100, Game1.Instance.ScreenRect.Height - 75);
            prev.OnClick += Buttons_OnClick;

            LevelManager.Instance.LoadData();
            LevelManager.Instance.UnlockLevel(1);



            // You start on the first page
            showPrev = false;
            // if there are more then 8 there will be an extra page
            showNext = LevelManager.Instance.LevelCount > 8;

            // load preview buttons
            previews = new List <LevelPreview>();

            if (LevelManager.Instance.LevelCount % 8 == 0)
            {
                totalPages = LevelManager.Instance.LevelCount / 8;
                totalPages = totalPages > 0 ? totalPages : 1;
            }
            else
            {
                totalPages = (int)Math.Floor((double)LevelManager.Instance.LevelCount / 8);
                totalPages++;
            }

            int id = 0;

            for (int page = 0; page < totalPages; page++)
            {
                for (int row = 0; row < 2; row++)
                {
                    for (int col = 0; col < 4; col++)
                    {
                        if (id >= LevelManager.Instance.LevelCount)
                        {
                            continue;
                        }

                        LevelPreview preview = new LevelPreview(LevelManager.Instance.GetLevel(id));
                        preview.LoadContent(content);
                        preview.button.OnClick += button_OnClick;
                        preview.Position        = new Vector2(page * Game1.Instance.ScreenRect.Width + (75 + (col * (preview.Hitbox.Width + 25))), 10 + (row * (preview.Hitbox.Height + 50)));
                        preview.button.Tag      = preview.LevelID;
                        previews.Add(preview);
                        id++;
                    }
                }
            }

            base.LoadContent(content);
        }