Exemplo n.º 1
0
        public void Initialize()
        {
            //Set slidable
            //nameTextMesh = gameObject.GetComponentInChildren<TextMesh>();
            slidable = gameObject.GetComponentInChildren <GuiSlidable>();

            //Find existing GUI node
            GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true);

            if (node == null)
            {
                return;
            }

            //Link this component to the node
            GuiBindInData inData      = new GuiBindInData(null, null);
            GuiBindData   guiBindData = GuiNode.Connect(this.gameObject, inData);
            string        trackerID   = "ScrollBar" + UIElement.GetNewTrackerID();

            guiBindData.AddTracker(trackerID, node);

            //Set delegate function
            IGuiOnchangeFloat tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeFloat>(trackerID);

            if (tryfind == null)
            {
                return;
            }
            tryfind.onchange = new GuiNode.OnFloatFunc(SliderMoved);

            //Set default step
            SliderStep        = 0.01f;
            AllowScroll       = true;
            _scrollMultiplier = 1;
        }
Exemplo n.º 2
0
        public void Initialize()
        {
            //Set TextMesh and switchable
            nameTextMesh = gameObject.GetComponentInChildren <TextMesh>();
            switchable   = gameObject.GetComponentInChildren <GuiSwitchable>();

            //Find existing GUI node
            GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true);

            if (node == null)
            {
                return;
            }

            //Link this component to the node
            GuiBindInData inData      = new GuiBindInData(null, null);
            GuiBindData   guiBindData = GuiNode.Connect(this.gameObject, inData);
            string        trackerID   = "CheckBox" + UIElement.GetNewTrackerID();

            guiBindData.AddTracker(trackerID, node);

            //Set delegate function
            IGuiOnchangeBool tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeBool>(trackerID);

            if (tryfind == null)
            {
                return;
            }
            tryfind.onchange = new GuiNode.OnBoolFunc(CheckBoxClicked);

            DefLineSize      = 185f;
            OriginalTextSize = nameTextMesh.transform.localScale;
            AutoTextResize   = true;
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            //Set TextMesh
            nameTextMesh = gameObject.GetComponentInChildren <TextMesh>();

            //Find existing GUI node
            GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true);

            if (node == null)
            {
                return;
            }

            //Link this component to the node
            GuiBindInData inData      = new GuiBindInData(null, null);
            GuiBindData   guiBindData = GuiNode.Connect(this.gameObject, inData);
            string        trackerID   = "Button" + UIElement.GetNewTrackerID();

            guiBindData.AddTracker(trackerID, node);

            //Set delegate function
            IGuiOnclick tryfind = guiBindData.GetTrackerEvent <IGuiOnclick>(trackerID);

            if (tryfind == null)
            {
                return;
            }
            tryfind.onclick = new GuiNode.OnVoidFunc(ButtonClicked);

            //Set text resizing variables
            DefLineSize      = 275f;
            OriginalTextSize = nameTextMesh.transform.localScale;
            AutoTextResize   = true;
        }
Exemplo n.º 4
0
 void Connect(GuiBindInData inData, GuiBindData outData)
 {
     if (!string.IsNullOrEmpty(this._trackId))
     {
         outData.AddTracker(this._trackId, this);
     }
     this.ApplyContent(inData.Content, false);
     this.OnConnected(inData, outData);
 }
Exemplo n.º 5
0
        public void Initialize()
        {
            //Set TextMesh, slidable and textframe
            nameTextMesh = gameObject.GetComponentInChildren <TextMesh>();
            slidable     = gameObject.GetComponentInChildren <GuiSlidable>();
            _display     = gameObject.GetComponentInChildren <UITextFrame>();
            UpdateDisplayValue();

            //Find existing GUI node
            GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true);

            if (node == null)
            {
                return;
            }

            //Link this component to the node
            GuiBindInData inData      = new GuiBindInData(null, null);
            GuiBindData   guiBindData = GuiNode.Connect(this.gameObject, inData);
            string        trackerID   = "Slider" + UIElement.GetNewTrackerID();

            guiBindData.AddTracker(trackerID, node);

            //Set delegate function
            IGuiOnchangeFloat tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeFloat>(trackerID);

            if (tryfind == null)
            {
                return;
            }
            tryfind.onchange = new GuiNode.OnFloatFunc(SliderMoved);

            //Text resizing
            DefLineSize      = 200f;
            OriginalTextSize = nameTextMesh.transform.localScale;
            AutoTextResize   = true;
        }