Exemple #1
0
 public override void WindowGUI()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     ActionBarGUI.ActionBarLabel("Importing file...");
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
Exemple #2
0
    public override void WindowGUI()
    {
        if (paused && pauseMenu == null)
        {
            paused              = false;
            Time.timeScale      = 1;
            AudioListener.pause = false;
            Destroy(fade);
        }

        if (pauseMenu != null)
        {
            pauseMenu.BringToFront();
        }

        GUILayout.BeginHorizontal();

        PlayerComponent player = PlayerComponent.instance;

        if (player != null)
        {
            wasAlive = true;
            if (player.health != lastHealth)
            {
                healthChangeTime = Time.time;
                hurt             = player.health < lastHealth;
                lastHealth       = player.health;
            }

            Color baseColor = GUI.color;
            if (Time.time - healthChangeTime < 1.0)
            {
                if (hurt)
                {
                    GUI.color *= Color.Lerp(Color.red, Color.white, Time.time - healthChangeTime);
                }
                else
                {
                    GUI.color *= Color.Lerp(Color.green, Color.white, Time.time - healthChangeTime);
                }
            }
            ActionBarGUI.ActionBarLabel("Health: " + (int)(player.health));
            GUI.color = baseColor;
        }
        else if (wasAlive)
        {
            ActionBarGUI.ActionBarLabel("you died :(");
        }

        //ActionBarGUI.ActionBarLabel((int)(1.0f / Time.smoothDeltaTime) + " FPS");

        GUILayout.FlexibleSpace();
        if (ActionBarGUI.ActionBarButton(GUIIconSet.instance.pause))
        {
            PauseGame();
        }
        GUILayout.EndHorizontal();
    }
Exemple #3
0
    public void Display()
    {
        Color baseColor = GUI.color;

        if (Time.time - changeTime < 1.0)
        {
            if (negativeChange)
            {
                GUI.color *= Color.Lerp(Color.red, Color.white, Time.time - changeTime);
            }
            else
            {
                GUI.color *= Color.Lerp(Color.green, Color.white, Time.time - changeTime);
            }
        }
        ActionBarGUI.ActionBarLabel(text + lastValue);
        GUI.color = baseColor;
    }
Exemple #4
0
    public override void WindowGUI()
    {
        if (paused && pauseMenu == null)
        {
            paused              = false;
            Time.timeScale      = 1;
            AudioListener.pause = false;
            Destroy(fade);
        }

        if (pauseMenu != null)
        {
            pauseMenu.BringToFront();
        }

        GUILayout.BeginHorizontal();

        PlayerComponent player = PlayerComponent.instance;

        if (player != null)
        {
            wasAlive = true;

            healthCounter.Update((int)player.health);
            scoreCounter.Update(player.score);
        }
        else if (wasAlive)
        {
            ActionBarGUI.ActionBarLabel("you died :(");
            scoreCounter.Display();
        }

        //ActionBarGUI.ActionBarLabel((int)(1.0f / Time.smoothDeltaTime) + " FPS");

        GUILayout.FlexibleSpace();
        if (ActionBarGUI.ActionBarButton(GUIIconSet.instance.pause))
        {
            PauseGame();
        }
        GUILayout.EndHorizontal();
    }
Exemple #5
0
    public override void WindowGUI()
    {
        if (GUIUtils.HighlightedButton("New", GUIStyleSet.instance.buttonLarge))
        {
            TextInputDialogGUI inputDialog = gameObject.AddComponent <TextInputDialogGUI>();
            inputDialog.prompt  = "Enter new world name...";
            inputDialog.handler = NewWorld;
        }
        scroll = GUILayout.BeginScrollView(scroll);
        for (int i = 0; i < worldPaths.Count; i++)
        {
            string path     = worldPaths[i];
            string name     = worldNames[i];
            bool   selected = worldOverflowMenu != null && path == selectedWorldPath;

            GUILayout.BeginHorizontal();
            if (GUIUtils.HighlightedButton(name, GUIStyleSet.instance.buttonLarge, selected))
            {
                OpenWorld(path, Scenes.EDITOR);
            }
            if (GUIUtils.HighlightedButton(GUIIconSet.instance.overflow, GUIStyleSet.instance.buttonLarge,
                                           selected, GUILayout.ExpandWidth(false)))
            {
                CreateWorldOverflowMenu(path);
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndScrollView();
        if (worldPaths.Count == 0)
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            ActionBarGUI.ActionBarLabel("Tap 'New' to create a new world.");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
        }
    }
Exemple #6
0
    public override void WindowGUI()
    {
        if (loadingWorld)
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("Loading world...");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
        }
        else if (!worldSelected)
        {
            scroll = GUILayout.BeginScrollView(scroll);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Choose a file to open in N-Space", GUIStyleSet.instance.buttonLarge))
            {
                ShareMap.OpenFileManager();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Label("Or import from a world...");
            for (int i = 0; i < worldPaths.Count; i++)
            {
                string path = worldPaths[i];
                string name = worldNames[i];

                if (GUILayout.Button(name, GUIStyleSet.instance.buttonLarge))
                {
                    worldSelected = true;
                    StartCoroutine(LoadWorldCoroutine(path));
                    scroll         = Vector2.zero;
                    scrollVelocity = Vector2.zero;
                }
            }
            GUILayout.EndScrollView();
        }
        else // world is selected
        {
            if (GUIUtils.HighlightedButton("Back to world list", GUIStyleSet.instance.buttonLarge))
            {
                worldSelected  = false;
                dataList       = null;
                scroll         = Vector2.zero;
                scrollVelocity = Vector2.zero;
                StopPlayer();
            }
            if (dataList != null && dataList.Count > 0)
            {
                foreach (EmbeddedData data in dataList)
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(data.name, GUIStyleSet.instance.buttonLarge))
                    {
                        dataAction(data);
                        Destroy(this);
                    }
                    if (playerFactory != null && GUIUtils.HighlightedButton(
                            GUIIconSet.instance.playAudio,
                            GUIStyleSet.instance.buttonLarge,
                            playingData == data,
                            GUILayout.ExpandWidth(false)))
                    {
                        if (StopPlayer() != data)
                        {
                            playingAudio = playerFactory(data.bytes);
                            playingData  = data;
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (errorMessage != null)
                {
                    ActionBarGUI.ActionBarLabel(errorMessage);
                }
                else
                {
                    ActionBarGUI.ActionBarLabel("World contains no " + type.ToString() + " files.");
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
        }
    }