Beispiel #1
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 #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
            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 #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
    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 #7
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 #8
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 #9
0
    void Setup()
    {
        GuiBindInData inData = new GuiBindInData(null, null);

        PrefabReplacer[] componentsInChildren = this._layout.GetComponentsInChildren <PrefabReplacer>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            componentsInChildren[i].Apply();
        }
        GuiBindData data;

        if (this._layoutIsPrefab)
        {
            data = GuiNode.CreateAndConnect(this._layout, inData);
        }
        else
        {
            data = GuiNode.Connect(this._layout, inData);
        }
        this.menuImpl = new MenuImpl <PauseMenu>(this);
        this.menuImpl.AddScreen(new PauseMenu.MainScreen(this, "pauseRoot", data));
        this.menuImpl.AddScreen(new PauseMenu.OptionsScreen(this, "optionsRoot", data));
        this.menuImpl.AddScreen(new PauseMenu.MapScreen(this, "mapRoot", data));
        this.menuImpl.AddScreen(new PauseMenu.InfoScreen(this, "infoRoot", data));
        this.menuImpl.AddScreen(new PauseMenu.ItemScreen(this, "itemRoot", data));
        this.menuImpl.AddScreen(new PauseMenu.CardsScreen(this, "cardsRoot", data));
        if (this._debugMenu != null)
        {
            this.menuImpl.AddScreen(new PauseMenu.DebugScreen(this, "debugRoot", data));
        }
        PerPlatformData.DebugCodeData debugCode = PlatformInfo.Current.DebugCode;
        if (debugCode != null && debugCode.useOverride)
        {
            this._debugStartCode     = debugCode.startCode;
            this._debugStartSequence = debugCode.sequence;
        }
    }
Beispiel #10
0
 protected virtual void OnConnected(GuiBindInData inData, GuiBindData outData)
 {
 }
Beispiel #11
0
    public static GuiBindData CreateAndConnect(GameObject prefab, GuiBindInData inData)
    {
        GameObject obj = GameObjectUtility.TransformInstantiate(prefab, inData.Root);

        return(GuiNode.Connect(obj, inData));
    }