Inheritance: MonoBehaviour
Esempio n. 1
0
    internal void CreateFadingPanel(string text, Color color, Sprite image)
    {
        GameObject  txtOverlay   = GameObject.Instantiate(FadingText, transform) as GameObject;
        FadingPanel floatingText = txtOverlay.GetComponent <FadingPanel>();

        floatingText.Init(image, color, text);
    }
Esempio n. 2
0
    public static void Initialize()
    {
        // Load the panel from resources
        GameObject resource = Resources.Load <GameObject>(PanelPath);

        // Check if the resource exists
        if (resource)
        {
            Instance = resource.GetComponent <FadingPanel>();

            // Check if the resource has the component on it
            if (Instance)
            {
                // Instantiate the game object
                resource = Instantiate(resource);
                Instance = resource.GetComponent <FadingPanel>();

                SceneManager.sceneLoaded += Instance.OnSceneLoaded;

                // Make sure it does not destroy on load
                DontDestroyOnLoad(resource);
            }
            else
            {
                Debug.LogWarning($"The game object {resource} " +
                                 $"has no fading panel script attached, so the fading panel " +
                                 $"will not be operable");
            }
        }
        else
        {
            Debug.LogWarning("No game object could be found at any path " +
                             $"Resources/{PanelPath}, so the fading panel will not be operable");
        }
    }
Esempio n. 3
0
    public void Initialize()
    {
        _panels = new List <PanelBase>();

        GameObject uiRootObj = GameObject.Instantiate(Resources.Load("UI Root")) as GameObject;

        Root = uiRootObj.GetComponent <UIRoot>();

        Root.manualHeight = Screen.height;
        Root.manualWidth  = Screen.width;

        UICamera = Root.transform.Find("UICamera").GetComponent <Camera>();


        BarkPanel = UICamera.transform.Find("BarkPanel").GetComponent <BarkPanel>();
        BarkPanel.Initialize();

        HUDPanel = UICamera.transform.Find("HUDPanel").GetComponent <HUDPanel>();
        HUDPanel.Initialize();

        WindowPanel = UICamera.transform.Find("WindowPanel").GetComponent <WindowPanel>();
        WindowPanel.Initialize();

        DialoguePanel = UICamera.transform.Find("DialoguePanel").GetComponent <DialoguePanel>();
        DialoguePanel.Initialize();

        RestingPanel = UICamera.transform.Find("RestingPanel").GetComponent <RestingPanel>();
        RestingPanel.Initialize();

        ConfirmPanel = UICamera.transform.Find("ConfirmPanel").GetComponent <ConfirmPanel>();
        ConfirmPanel.Initialize();

        FadingPanel = UICamera.transform.Find("FadingPanel").GetComponent <FadingPanel>();
        FadingPanel.Initialize();
        FadingPanel.Show();
        FadingPanel.FadeIn(2);

        QuestDebugPanel = UICamera.transform.Find("QuestDebugPanel").GetComponent <QuestDebugPanel>();
        QuestDebugPanel.Initialize();

        MapPanel = UICamera.transform.Find("MapPanel").GetComponent <MapPanel>();
        MapPanel.Initialize();

        IntroPanel = UICamera.transform.Find("IntroPanel").GetComponent <IntroPanel>();
        IntroPanel.Initialize();

        _panels.Add(IntroPanel);
        _panels.Add(MapPanel);
        _panels.Add(QuestDebugPanel);
        _panels.Add(DialoguePanel);
        _panels.Add(RestingPanel);
        _panels.Add(ConfirmPanel);
        _panels.Add(WindowPanel);
        _panels.Add(HUDPanel);
        _panels.Add(BarkPanel);


        UIZoom = 1;


        UIStateMachine = new UIStateMachine();
        UIStateMachine.Initialize();
    }