示例#1
0
 public void Dispose()
 {
     NewgameWindowValue = null;
     BackButtonValue    = null;
     StartButtonValue   = null;
     NameLabelValue     = null;
     NameTextfieldValue = null;
 }
    public void Start()
    {
        Component[] windows = gameObject.GetComponents(typeof(BitWindow));
        BitWindow   window  = null;

        for (int i = 0; i < windows.Length; i++)
        {
            if (windows[i].name == "webimagetest_window")
            {
                window = (BitWindow)windows[i];
                break;
            }
        }

        if (window == null)
        {
            Debug.LogError("Main window not found.");
            return;
        }

        BitButton    loadButton   = window.FindControl <BitButton>("load_button");
        BitTextField urlTextfield = window.FindControl <BitTextField>("url_textfield");

        pictureWebimage = window.FindControl <BitWebImage>("picture_webimage");
        consoleTextarea = window.FindControl <BitTextArea>("console_textarea");
        pictureHorizontalprogressbar = window.FindControl <BitHorizontalProgressBar>("picture_horizontalprogressbar");

        loadButton.MouseClick +=
            delegate
        {
            string url = urlTextfield.Text;
            url = url.Substring(url.LastIndexOf('/') + 1);

            BitWebImage.LoadImageResponse result = pictureWebimage.LoadImage(urlTextfield.Text);
            switch (result)
            {
            case BitWebImage.LoadImageResponse.ALREADY_LOADED:
                consoleTextarea.Text += "Image already loaded... " + url + Environment.NewLine;
                break;

            case BitWebImage.LoadImageResponse.OTHER_LOADING:
                consoleTextarea.Text += "Other loading in progress... " + Environment.NewLine;
                break;

            case BitWebImage.LoadImageResponse.OK:
                consoleTextarea.Text += "Loading image... " + url + Environment.NewLine;
                pictureHorizontalprogressbar.Value = 0;
                break;
            }
        };
    }
示例#3
0
    private void Start()
    {
        _form = gameObject.GetComponent <BitEditorStage>();
        if (_form == null)
        {
            Debug.LogError("Form not found");
            return;
        }


        _window = _form.FindControl <BitWindow>("main_window");
        if (_window == null)
        {
            Debug.LogError("'main_window' not found");
            return;
        }

        _simpleButton = _window.FindControl <BitButton>("SimpleButton");

        if (_simpleButton == null)
        {
            Debug.LogWarning("'SimpleButton' not found!");
        }
        else
        {
            _simpleButton.MouseClick += SimpleButton_MouseClick;
        }

        _repeatButton = _window.FindControl <BitRepeatButton>("RepeatButton");
        if (_repeatButton == null)
        {
            Debug.LogWarning("'RepeatButton' not found!");
        }
        else
        {
            _repeatButton.MouseHold += RepeatButtonMouseHold;
        }

        _textGroup = _window.FindControl <BitGroup>("TextGroup");
        if (_textGroup == null)
        {
            Debug.Log("'TextGroup' not fount!");
        }

        _toggle = _window.FindControl <BitToggle>("Toggle");
        if (_toggle == null)
        {
            Debug.LogWarning("'Toggle' not found!");
        }
        else
        {
            _toggle.ValueChanged += Toggle_ValueChanged;
            if (_textGroup != null)
            {
                _textGroup.Enabled = false;
            }
        }

        if (_textGroup != null)
        {
            _textField = _textGroup.FindControl <BitTextField>("TextField");
            if (_textField == null)
            {
                Debug.LogWarning("'TextField' not found!");
            }
            else
            {
                _textField.TextChanged += TextChanged;
            }

            _textArea = _textGroup.FindControl <BitTextArea>("TextArea");
            if (_textArea == null)
            {
                Debug.LogWarning("'TextArea' not found!");
            }
            else
            {
                _textArea.TextChanged += TextChanged;
            }

            _passwordField = _textGroup.FindControl <BitPasswordField>("PasswordField");
            if (_passwordField == null)
            {
                Debug.LogWarning("'PasswordField' not found!");
            }
            else
            {
                _passwordField.TextChanged += TextChanged;
            }
        }

        _textureGroup = _window.FindControl <BitGroup>("TextureGroup");
        if (_textureGroup == null)
        {
            Debug.LogWarning("'TextureGroup' not found!");
        }
        else
        {
//			_texture = _textureGroup.FindControl<BitDrawTexture>("Texture");
//			if (_texture == null)
//			{
//				Debug.LogWarning("'Texture' not found!");
//			}
        }

        _hsLabel = _window.FindControl <BitLabel>("HorizontalSlider Label");
        if (_hsLabel == null)
        {
            Debug.LogWarning("'HorizontalSlider Label' not found!");
        }

        _horizontalSlider = _window.FindControl <BitHorizontalSlider>("HorizontalSlider");
        if (_horizontalSlider == null)
        {
            Debug.LogWarning("'HorizontalSlider' not found!");
        }
        else
        {
            _horizontalSlider.ValueChanged += HorizontalSlider_ValueChanged;
        }

        _vsLabel = _window.FindControl <BitLabel>("VerticalSlider Label");
        if (_vsLabel == null)
        {
            Debug.LogWarning("'VerticalSlider Label' not found!");
        }

        _verticalSlider = _window.FindControl <BitVerticalSlider>("VerticalSlider");
        if (_verticalSlider == null)
        {
            Debug.LogWarning("'HorizontalSlider' not found!");
        }
        else
        {
            _verticalSlider.ValueChanged += VerticalSlider_ValueChanged;
        }

        _gridList = _window.FindControl <BitGridList>("GridList");
        if (_gridList == null)
        {
            Debug.LogWarning("'GridList' not found!");
        }
        else
        {
            _gridList.Populator = new DefaultBitListPopulator();
        }

        _multiselectionToggle = _window.FindControl <BitToggle>("MultiSelection Toggle");
        if (_multiselectionToggle == null)
        {
            Debug.LogWarning("'MultiSelection Toggle' not found!");
        }
        else
        {
            _multiselectionToggle.ValueChanged += MultiselectionToggle_ValueChanged;
        }

        _list = _window.FindControl <BitList>("List");
        if (_list == null)
        {
            Debug.LogWarning("'List' not found!");
        }
        else
        {
            _list.Populator         = new MyListPopulator();
            _list.SelectionChanged += List_SelectionChanged;
        }

        _listSelectionLabel = _window.FindControl <BitLabel>("ListSelection Label");
        if (_listSelectionLabel == null)
        {
            Debug.LogWarning("'ListSelection Label' not found!");
        }

        _labelWithPopup = _window.FindControl <BitLabel>("Label With Popup");
        if (_labelWithPopup == null)
        {
            Debug.LogWarning("'Label With Popup' not found!");
        }

        PopulateDropDown();

        PopulateContextMenu();
    }