Esempio n. 1
0
    /// <summary>
    /// Initialization
    /// </summary>
    public override void _Ready()
    {
        GDScript MyGDScript = (GDScript)GD.Load("res://API/Toast.gd");

        Godot.Object myGDScriptNode = (Godot.Object)MyGDScript.New(); // This is a Godot.Object
        myGDScriptNode.Call("displayToast");
    }
Esempio n. 2
0
    /// <summary>
    /// Initialization
    /// </summary>
    public override void _Ready()
    {
        GDScript fb = (GDScript)GD.Load("res://API/Facebook.gd");

        fbScript = (Godot.Object)fb.New();
        GDScript google = (GDScript)GD.Load("res://API/Google.gd");

        googleScript = (Godot.Object)google.New();
        studentBL    = new StudentBL();
        fbBtn        = GetNode <TextureButton>("FbLogin");
        googleBtn    = GetNode <TextureButton>("GoogleLogin");

        fbScript.Connect("info", this, nameof(InsertFb));
        googleScript.Connect("info2", this, nameof(InsertGoogle));
    }
Esempio n. 3
0
        private static Object GetGdFileUtils()
        {
            if (_gdFileUtils != null && Object.IsInstanceValid(_gdFileUtils))
            {
                return(_gdFileUtils);
            }

            GDScript script = GD.Load <GDScript>("res://Addons/Wayfarer/file_utils.gd");

            _gdFileUtils = (Object)script.New();

            if (_gdFileUtils == null)
            {
                throw new NullReferenceException();
            }

            return(_gdFileUtils);
        }
Esempio n. 4
0
    private Resource GetEventHandlerOrNull(string action)
    {
        if (!eventHandlers.ContainsKey(action))
        {
            // honestly kinda dangerous. arbitrary code can run!
            if (new Godot.Directory().FileExists($"res://Crawler/View/Events/{action}Event.gd") ||
                new Godot.Directory().FileExists($"res://Crawler/View/Events/{action}Event.gdc")) // for when you export compiled
            {
                GDScript script = GD.Load <GDScript>($"res://Crawler/View/Events/{action}Event.gd");
                eventHandlers.Add(action, script.New() as Resource);
            }
            else
            {
                eventHandlers.Add(action, null);
            }
        }

        return(eventHandlers[action]);
    }
Esempio n. 5
0
    /// <summary>
    /// Handles the logic whenever the Logout button is pressed
    /// </summary>
    private void _on_LogoutBtn_pressed()
    {
        GDScript fb     = (GDScript)GD.Load("res://API/Facebook.gd");
        GDScript google = (GDScript)GD.Load("res://API/Google.gd");

        if (Global.GoogleLoggedIn)
        {
            Godot.Object googleScript = (Godot.Object)google.New(); // This is a Godot.Object
            googleScript.Call("google_connect");
            googleScript.Call("google_disconnect");
        }
        else if (Global.FbLoggedIn)
        {
            Godot.Object fbScript = (Godot.Object)fb.New(); // This is a Godot.Object
            fbScript.Call("facebook_connect");
            fbScript.Call("logout");
        }

        GetTree().ChangeScene("res://Presentation/Login/Login.tscn");
    }
Esempio n. 6
0
    public void ConnectToModel(Model model)
    {
        // Connect to the signal.
        model.Connect("NewEvent", this, "OnModelNewEvent");

        // Copy the map.

        // Create all entities.
        // TODO: Rework things. This is silly.
        GDScript createEvent = GD.Load <GDScript>($"res://Crawler/View/Events/CreateEvent.gd");

        foreach (Entity e in model.GetEntities())
        {
            Dictionary fakeEvent = new Dictionary()
            {
                { "args", e }
            };
            createEvent.New(this, fakeEvent, roles);
        }

        ModelSync();
    }