Inheritance: MonoBehaviour
 private void Start()
 {
     _editorUI              = transform.parent.transform.parent.GetComponent <LevelEditorUI>();
     levelEditor            = _editorUI.GetLevelEditor;
     _scrollRect            = gameObject.GetComponent <ScrollRect>();
     _scrollRect.horizontal = false;
     content = GameObject.Find("Content");
 }
Esempio n. 2
0
    public void StopTest()
    {
        LevelEditorUI levelEditorUI = GameObject.FindObjectOfType <LevelEditorUI>();

        CurrentLevel.StopSpawner();
        CurrentLevel.DestroyPaddle();
        CurrentLevel.testMode = false;
        levelEditorUI.commandPalette.SetActive(true);
        levelEditorUI.ShowCommandPalette();
        CurrentLevel.StopPlaceableAnimations();
    }
Esempio n. 3
0
    public void TestLevel()
    {
        /// We need to...
        /// Clear the current UI
        /// switch to a widget with a stop test button
        GameObject    commandPalette = GameObject.Find("Command Palette");
        LevelEditorUI levelEditorUI  = GameObject.FindObjectOfType <LevelEditorUI>();

        if (CurrentLevel.levelData.LevelReady())
        {
            CurrentLevel.LoadPaddle();
            CurrentLevel.LoadSpawner();
            CurrentLevel.StartSpawner();
            CurrentLevel.levelData.GatherKeys();
            commandPalette.SetActive(false);
            levelEditorUI.HideAllCommands();
            CurrentLevel.StartPlaceableAnimations();
        }
        else
        {
            Debug.Log("No spawner in level");
        }
    }
 public void loadSettings()
 {
     le = (GameObject.Find ("Main Camera")).GetComponent("LevelEditorUI") as LevelEditorUI;
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     levelEditorUI = GameObject.FindObjectOfType <LevelEditorUI>();
 }
    public void PublishLevel()
    {
        if (GameManager.Instance.currentLevel == "Template.sld")
        {
            Debug.LogError("Cannot publish tutorial level.");
            return;
        }

        if (levelEditorUI == null)
        {
            // Hacky way to access hidden LevelEditorUI object from scene, without returning prefab
            LevelEditorUI[] levelEditorUIs = Resources.FindObjectsOfTypeAll <LevelEditorUI>();
            foreach (LevelEditorUI l in levelEditorUIs)
            {
                bool isActive = l.gameObject.activeSelf;

                l.gameObject.SetActive(true);

                if (l.gameObject.activeInHierarchy)
                {
                    levelEditorUI = l;
                }

                l.gameObject.SetActive(isActive);
            }
        }

        if (levelEditorUI == null)
        {
            Debug.LogError("No LevelEditorUI in scene. Level not published");
            return;
        }


        // Make sure we're logged in before saving
        if (!AccountManager.Instance.LoggedIn)
        {
            Debug.Log("You need to be logged in to publish levels.");
            AccountManager.Instance.ShowLoginDialog();
            return;
        }

        LevelManager.Instance.SerializeLevel();

        LevelManager.Instance.SaveLevelToDb(
            levelEditorUI.levelName.text,
            AccountManager.Instance.Uid,
            LevelManager.Instance.serializedData,
            levelInfo => {
            if (levelInfo != null)
            {
                if (string.IsNullOrEmpty(levelInfo.errorMessage))
                {
                    Debug.Log("Successfully saved level");

                    // Remove the local level
                    FileManager.DeleteLevel(GameManager.Instance.currentLevel);

                    // Get rid of finish screen
                    Destroy(this.gameObject);
                }
                else
                {
                    Debug.LogError("Failed to save level");
                }
            }
            else
            {
                Debug.LogError("Failed to save level");
            }
        });
    }
Esempio n. 7
0
 public LevelEditorNewLevelModal(LevelEditorUI _ui)
 {
     uiWindow = _ui;
     window   = GetWindow(typeof(LevelEditorNewLevelModal));
 }