Example #1
0
        public void Run()
        {
            window = new RenderWindow(new VideoMode(800, 480), "sfml-ui Examples", Styles.Default);
            window.Closed += window_OnCloseRequest;
            window.Resized += window_Resized;

            uimanager = new UISceneManager();
            uimanager.Init(window);

            scene1 = new Scene(ScrollInputs.None);
            scene1.Size = new Vector2f(window.Size.X, window.Size.Y);
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 50) { Size = new Vector2f(800, 100), Color = Color.White, Text = "Hello World", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top, BackgroundColor = Colors.SteelBlue });
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 16) { Size = new Vector2f(600, 100), Position = new Vector2f(100, 150), Color = Color.Black, Text = "This is an example of sfml-ui, an ui library for SFML.Net", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top });
            scene1.AddComponent(new PictureControl("example-100.png") { Size = new Vector2f(100, 100), Position = new Vector2f(0, 0), Anchor = AnchorPoints.Left | AnchorPoints.Top });
            scene1.AddComponent(new ButtonControl(new Font("font.ttf"), 16, "button.png", "button_hover.png", "button_pressed.png") { Size = new Vector2f(150, 49), Position = new Vector2f(50, 250), Anchor = AnchorPoints.Left | AnchorPoints.Top, Text = "Press Me :)" });

            uimanager.CurrentScene = scene1;

            while (window.IsOpen())
            {
                window.DispatchEvents();
                window.Clear(Colors.WhiteSmoke);

                uimanager.Render(window);

                window.Display();
            }
        }
Example #2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        _instance = this;
        if (EntryManager._instance != null)
        {
            EntryManager._instance.onPlayerInEntry += Show;
        }
        BG = transform.Find("BG").gameObject;
        progressBar = BG.transform.Find("ProgressBar").GetComponent<UISlider>();

        BG.SetActive(false);
    }
Example #4
0
	// Use this for initialization
	void Start () {
        loadingUI = UISceneManager._instance;

        text = transform.Find("Panel/Text").GetComponent<UILabel>();
        textTweener = text.gameObject.GetComponent<UITweener>();

        textArea =transform.Find("Panel/TextArea").GetComponent<UILabel>();
        textAreaTweener = textArea.gameObject.GetComponent<UITweener>();

        picture =transform.Find("Panel/Picture").GetComponent<UISprite>();
        pictureTweener = picture.gameObject.GetComponent<UITweener>();

        textList = GameController._instance.LoadText(0);

        textTweener.PlayReverse();
        textAreaTweener.PlayReverse();
        pictureTweener.PlayReverse();
        //picture.spriteName = "手紙";
        StartCoroutine(Play());
    }
    // Use this for initialization
    void Awake()
    {
        LoadingBar = UISceneManager._instance;

    }
Example #6
0
 void Awake()
 {
     Instance = this;
     toHideCamera.gameObject.SetActive(false);
 }