public Godot.Object MakeGDInkPath(Ink.Runtime.Path path) { var inkPath = (Godot.Object)InkPath.New(); inkPath.Call("_init_with_components_string", path.componentsString); return(inkPath); }
/// <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"); }
public TestController() { Assertions = new Assertions(); _Watcher = (Reference)Watcher.New(); _Yielder = (Timer)Yielder.New(); AddChild(_Yielder); _Yielder.Connect("finished", this, nameof(Next)); }
private Godot.Object MakeGDInkListItem(Ink.Runtime.InkListItem listItem) { object[] itemParams = new object[] { listItem.fullName }; var inkListItem = (Godot.Object)InkListItem.New(); inkListItem.Call("_init_with_full_name", itemParams); return(inkListItem); }
public void UpdateUsedProgNums(Array <int> usedProgramNumbers) { if (usedProgramNumbers == null) { throw new ArgumentNullException(nameof(usedProgramNumbers)); } var bank = BankGd.New(); bank.Call("init"); bank.Call("read_soundfont", _sf, usedProgramNumbers); Self = bank; }
private Godot.Object MakeGDListDefinition(Ink.Runtime.ListDefinition listDefinition) { var items = new Godot.Collections.Dictionary <Godot.Object, int>(); foreach (KeyValuePair <Ink.Runtime.InkListItem, int> kv in listDefinition.items) { var inkListItem = MakeGDInkListItem(kv.Key); items.Add(inkListItem, kv.Value); } var definitionParams = new object[] { listDefinition.name, items }; var inkListDefinition = (Godot.Object)InkListDefinition.New(definitionParams); return(inkListDefinition); }
/// <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)); }
public Bank(string soundFontFile, Array <int> usedProgramNumbers) { if (soundFontFile == null) { throw new ArgumentNullException(nameof(soundFontFile)); } if (usedProgramNumbers == null) { throw new ArgumentNullException(nameof(usedProgramNumbers)); } var soundFontReader = SoundFontGd.New(); _sf = soundFontReader.Call("read_file", soundFontFile) ?? throw new FileNotFoundException("Cannot find synth file."); UpdateUsedProgNums(usedProgramNumbers); }
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); }
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]); }
/// <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"); }
public void Run(Dictionary test) { if (Engine.EditorHint) { Test = (Test)((CSharpScript)test["script"]).New(); } else { Test = (Test)ResourceLoader.Load <CSharpScript>((string)test["path"]).New(); } //Test = WAT.Test.CreateInstance((CSharpScript) test["script"]); TestCase = (Node)Case.New(Test, test["path"]); Test.Assert = this.Assertions; Test.Watcher = this._Watcher; Test.Yielder = this._Yielder; Methods.Clear(); if (test.Contains("method")) { Methods.Add(test["method"]); } else { foreach (Dictionary method in Test.GetScriptMethodListWithArgs()) { Methods.Add(method); } } if (Methods.Count == 0) { GD.PushWarning("No Tests found in " + test["path"] + ""); CallDeferred("Complete"); } Test.Connect(nameof(Test.Described), TestCase, "_on_test_method_described"); Assertions.Connect(nameof(Assertions.Asserted), TestCase, "_on_asserted"); Assertions.Connect(nameof(Assertions.Asserted), Test, nameof(Test.OnLastAssertion)); AddChild(Test); Start(); }
public Godot.Object MakeGDInkList(Ink.Runtime.InkList list) { var inkListBase = new Godot.Collections.Dictionary <string, int>(); foreach (KeyValuePair <Ink.Runtime.InkListItem, int> kv in list) { inkListBase.Add(MakeGDInkListItem(kv.Key).Call("serialized") as string, kv.Value); } object[] inkListParams = new object[] { inkListBase, list.originNames.ToArray(), MakeGDInkListOrigins(list.origins) }; var inkList = (Godot.Object)InkList.New(); inkList.Call("_init_from_csharp", inkListParams); return(inkList); }
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(); }
public Godot.Object MakeFunctionResult(string textOutput, object returnValue) { var parameters = new object[] { textOutput ?? "", returnValue }; return((Godot.Object)InkFunctionResult.New(parameters)); }