Beispiel #1
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;
        }
Beispiel #2
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;
        }
Beispiel #3
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;
        }
Beispiel #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);
 }
Beispiel #5
0
    public static GuiBindData Connect(GameObject obj, GuiBindInData inData)
    {
        GuiBindData guiBindData = new GuiBindData();

        GuiNode[] componentsInChildren = obj.GetComponentsInChildren <GuiNode>(true);
        for (int i = componentsInChildren.Length - 1; i >= 0; i--)
        {
            componentsInChildren[i].Connect(inData, guiBindData);
        }
        return(guiBindData);
    }
Beispiel #6
0
        public MainScreen(PauseMenu owner, string root, GuiBindData data) : base(owner, root, data)
        {
            MenuScreen <PauseMenu> .BindClickEvent(data, "pause.back", new GuiNode.OnVoidFunc(this.ClickedBack));

            MenuScreen <PauseMenu> .BindClickEvent(data, "pause.quit", new GuiNode.OnVoidFunc(this.ClickedQuit));

            base.BindSwitchClickEvent(data, "pause.hint", "infoRoot");
            base.BindSwitchClickEvent(data, "pause.item", "itemRoot");
            MenuScreen <PauseMenu> .BindClickEvent(data, "pause.warp", new GuiNode.OnVoidFunc(this.ClickedWarp));

            base.BindSwitchClickEvent(data, "pause.options", "optionsRoot");
            base.BindSwitchClickEvent(data, "pause.map", "mapRoot");
        }
Beispiel #7
0
    void Setup()
    {
        GuiBindInData inData      = new GuiBindInData(null, null);
        GuiBindData   guiBindData = GuiNode.Connect(this._layout, inData);

        this.menuRoot = guiBindData.GetTracker <GuiWindow>("debugRoot");
        guiBindData.GetTrackerEvent <IGuiOnclick>("debug.done").onclick = new GuiNode.OnVoidFunc(this.ClickedDone);
        guiBindData.GetTrackerEvent <IGuiOnclick>("debug.back").onclick = new GuiNode.OnVoidFunc(this.ClickedCancel);
        GuiContentData guiContentData = new GuiContentData();

        guiContentData.SetValue("version", this._version.GetVersion());
        this.menuRoot.ApplyContent(guiContentData, true);

        // Modify the HUD to make it better
        ModifyUI();
    }
Beispiel #8
0
    void Start()
    {
        // Enable Unity debug logging
        DebugManager.EnableDebugging();

        // TEMP
        Utility.LoadLevel("MainMenu");

        GuiBindInData guiBindInData = new GuiBindInData(null, null);

        guiBindInData.Content.SetValue("gameLoading", false);
        MainMenu.ApplyUIData(PlatformInfo.Current.GetDataForUI("splash"), guiBindInData.Content);
        GuiBindData guiBindData = GuiNode.Connect(this._layout, guiBindInData);

        this.mainWnd = guiBindData.GetTracker <GuiWindow>("startRoot");
        this.mainWnd.Show(null, null);
        this.timer = this._time;
    }
Beispiel #9
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;
        }
Beispiel #10
0
 protected virtual void OnConnected(GuiBindInData inData, GuiBindData outData)
 {
 }
Beispiel #11
0
 public CardsScreen(PauseMenu owner, string root, GuiBindData data) : base(owner, root, data)
 {
 }
Beispiel #12
0
 public ItemScreen(PauseMenu owner, string root, GuiBindData data) : base(owner, root, data)
 {
     base.BindBackButton(data, "item.back");
     base.BindSwitchClickEvent(data, "item.cards", "cardsRoot");
 }
Beispiel #13
0
 public InfoScreen(PauseMenu owner, string root, GuiBindData data) : base(owner, root, data)
 {
     MenuScreen <PauseMenu> .BindClickEvent(data, "info.back", new GuiNode.OnVoidFunc(this.ClickedBack));
 }