public bool ObjBool(int id, string Lay, string Tag, string stat) { try { var M = KMaps[id]; var L = M.Layers[Lay]; var T = L.FromTag(Tag); switch (stat.ToUpper()) { case "VISIBLE": return(T.Visible); case "IMPASSIBLE": return(T.Impassible); case "FORCEPASSIBLE": return(T.ForcePassible); default: throw new Exception($"There is no boolean field named: {stat}"); } } catch (Exception shit) { SBubble.MyError($"Kthura.ObjBool({id},\"{Lay}\",\"{Tag}\",\"{stat}\"):", shit.Message, LuaTrace); return(false); } }
public string GrabScreen(string assign = "") { try { var tag = assign; var at = 0; if (tag == "") { do { at++; tag = $"IMAGE:{at}"; } while (Images.ContainsKey(tag)); } Images[tag] = TQMG.GrabImage(); if (Images[tag] == null) { throw new Exception("Grabbed image == null!"); } return(tag); } catch (Exception Catastrophe) { #if DEBUG SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}"); #else SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}"); #endif return("Il ya une catastrophe"); } }
public void SetObjBool(int id, string Lay, string Tag, string stat, bool value) { try { var M = KMaps[id]; var L = M.Layers[Lay]; var T = L.FromTag(Tag); switch (stat.ToUpper()) { case "VISIBLE": T.Visible = value; break; case "IMPASSIBLE": T.Impassible = value; break; case "FORCEPASSIBLE": T.ForcePassible = value; break; default: throw new Exception($"There is no object integer field named: {stat}!"); } } catch (Exception shit) { SBubble.MyError($"Kthura.ObjInt({id},\"{Lay}\",\"{Tag}\",\"{stat}\"):", shit.Message, LuaTrace); return; } }
public string Load(string file, string assign = "") { try { var tag = assign; var at = 0; if (tag == "") { do { at++; tag = $"IMAGE:{at}"; } while (Images.ContainsKey(tag)); } if (qstr.Suffixed(file.ToLower(), ".jpbf")) { Images[tag] = TQMG.GetBundle(file); } else { Images[tag] = TQMG.GetImage(file); } if (Images[tag] == null) { throw new Exception($"Filed loading {file} at {tag}\n{UseJCR6.JCR6.JERROR}"); } return(tag); } catch (Exception Catastrophe) { #if DEBUG SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}"); #else SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}"); #endif return("Il ya une catastrophe"); } }
public int Load(string name) { try { var mappath = $"Maps/Kthura/{name.Trim()}/"; BubConsole.WriteLine($"Loading Kthura map {mappath}", 180, 0, 255); if (!(SBubble.JCR.Exists($"{mappath}Objects") && SBubble.JCR.Exists($"{mappath}Data"))) { SBubble.MyError("Kthura LoadMap Error", $"Error finding the two required files for map {name}", $"Found({mappath}Objects) => {SBubble.JCR.Exists($"{mappath}Objects")}\nFound({mappath}Data) => {SBubble.JCR.Exists($"{mappath}Data")}"); return(0); } var KMap = Kthura.Load(SBubble.JCR, mappath, SBubble.JCR); BubConsole.WriteLine($"Kthura map {mappath} loaded", 180, 0, 255); return(Assign(KMap)); } catch (Exception Ellende) { if (JCR6.JERROR != "") { Crash(JCR6.JERROR); } else { Crash(Ellende); } BubConsole.CSay(Ellende.StackTrace); return(0); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { try { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); #region Tricky's Quick Monogame Graphics if (SBubble.JCR == null) { System.Diagnostics.Debug.WriteLine("EEP! JCR resource is null! But how?"); } TQMG.Init(graphics, GraphicsDevice, spriteBatch, SBubble.JCR); #endregion BubbleInit.LetsGo(); TrickyGameJolt.GJAPI.ERRORFUNCTION = delegate(string msg) { #if FATAL_GAMEJOLT SBubble.MyError("Game Jolt API Error", msg, ""); #else BubConsole.WriteLine("GAME JOLT ERROR", 255, 0, 0); System.Console.Beep(); BubConsole.WriteLine(msg); #endif }; } catch (System.Exception Allemaal_naar_de_klote) { #if DEBUG Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\n{Allemaal_naar_de_klote.StackTrace}\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error); #else Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\nDid you install everything propely, or is the engine broken?\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error); #endif System.Environment.Exit(10); } }
public void VisibleOnlyByZone(int id, string tag, bool inzone) { try { var lname = Layers[id]; var m = KMaps[id]; var l = m.Layers[lname]; if (!l.HasTag(tag)) { throw new Exception("I cannot hide or show by a non-existent zone"); } var zone = l.FromTag(tag); if (zone.kind != "TiledArea" && zone.kind != "Zone") { throw new Exception($"Object '{tag}' is a {zone.kind} which is not valid for a visible by zone change!"); } foreach (KthuraObject o in l.Objects) { if (o != zone) { if (inzone) { o.Visible = o.x >= zone.x && o.y >= zone.y && o.x <= zone.x + zone.w && o.y <= zone.y + zone.h; } else { o.Visible = !(o.x >= zone.x && o.y >= zone.y && o.x <= zone.x + zone.w && o.y <= zone.y + zone.h); } } } } catch (Exception EpicFail) { SBubble.MyError($"Kthura.VisilityOnlyByZone[{id},\"{tag}\"]={inzone}:", EpicFail.Message, LuaTrace); } }
void VisByLabel(int ID, string label, bool value) { try { var L = KMaps[ID].Layers[Layers[ID]]; if (!L.LabelMap.ContainsKey(label)) { Console.Beep(); BubConsole.CSay($"WARNING! Label '{label}' not found!"); foreach (string k in L.LabelMap.Keys) { BubConsole.CSay("= Has label: '{label}'"); } } foreach (KthuraObject O in L.LabelMap[label]) { O.Visible = value; } } catch (Exception Poepzooitje) { #if DEBUG SBubble.MyError($"Kthura.VisByLabel({ID},\"{label}\",{value}):", Poepzooitje.Message, $"{LuaTrace}\n\nC# Trace{Poepzooitje.StackTrace}"); #else SBubble.MyError($"Kthura.VisByLabel({ID},\"{label}\",{value}):", Poepzooitje.Message, LuaTrace); #endif } }
public static bool SwapLoad(UseJCR6.TJCRDIR j, string dir) { try { //if (SwapMap == null) SwapMap = new Swap("Swap"); InitSwap(); SwapMap.Clear(); foreach (string k in j.Entries.Keys) { if (qstr.ExtractDir(k) == $"XTRA/{dir.ToUpper()}") { var key = qstr.StripDir(k); SwapMap[key] = j.LoadString(k); } } return(true); } catch (Exception EpicFail) { SBubble.MyError("Error while extracting swap data", EpicFail.Message, #if DEBUG EpicFail.StackTrace); #else ""); #endif return(false); } }
public string IPlay(string buf, bool loop) { var tag = ""; try { if (!AudioMap.ContainsKey(buf)) { throw new Exception($"No audio buffer tagged {buf} available"); } var i = AudioMap[buf].CreateInstance(); var c = 0; do { c++; tag = $"INSTANCE{c.ToString("X10")}"; } while (InstanceMap.ContainsKey(tag)); InstanceAudioMap[tag] = buf; InstanceMap[tag] = i; i.IsLooped = loop; i.Play(); } catch (Exception huh) { SBubble.MyError("Odd things happen here!", huh.Message, huh.StackTrace); } return(tag); }
public void DoStateNIL(string s, string script, string chunk = "NIL:DOSTATE") { try { SBubble.DoNIL(s, script, chunk); } catch (Exception Uitzondering) { SBubble.MyError($"NILDoString(\"{s}\",\"{script}\",\"{chunk}\"):", Uitzondering.Message, ""); } }
public void DoStateLua(string s, string script, string chunk = "LUA:DOSTATE") { try { SBubble.State(s).DoString(script, chunk); } catch (Exception Uitzondering) { SBubble.MyError($"LuaDoString(\"{s}\",\"{script}\",\"{chunk}\"):", Uitzondering.Message, ""); } }
public static void LetsGo() { #region Install Error Manager, and the global engine! NALACore.Core.Window.Title = SBubble.Title; #endregion #region The base MonoGame stuff SBubble.AddInit(delegate(string v) { SBubble.State(v).DoString($"function {FlowManager.NOTHING}() end", "Alright move along, nothing to see here!"); }); SBubble.AddInit(BubbleConsole.StateInit); SBubble.AddInit(BubbleGraphics.InitGraphics); SBubble.AddInit(Bubble_Audio.Init); SBubble.AddInit(APIFlow.Init); SBubble.AddInit(BubbleSuperGlobal.Init); SBubble.AddInit(Bubble_Input.Init); SBubble.AddInit(Bubble_Save.Init); SBubble.AddInit(Bubble_Conf.Init); SBubble.AddInit(Bubble_GameJolt.Init); SBubble.AddInit(BubbleTimer.Init); SBubble.AddInit(Bubble_Swap.Init); #endregion #region Extras to use in savegames Bubble_Save.SaveXtra["RPGPARTY"] = delegate(UseJCR6.TJCRCreate j, string dir) { RPG.RPGSave(j, $"XTRA/{dir}"); }; Bubble_Save.LoadXtra["RPGPARTY"] = delegate(UseJCR6.TJCRDIR j, string dir) { RPG.RPGLoad(j, $"XTRA/{dir}"); return(true); }; Bubble_Save.SaveXtra["SWAP"] = Bubble_Swap.SwapSave; Bubble_Save.LoadXtra["SWAP"] = Bubble_Swap.SwapLoad; #endregion #region The stuff needed for NALA in particular // Own APIs for NIL and Lua //SBubble.AddInit(MapScriptAPI.API_Init); SBubble.AddInit(RPG_API.Init); // Kthura Init Kthura.SetDefaultTextureJCR(SBubble.JCR); // Textures are all in the same project KthuraDraw.DrawDriver = new KthuraDrawMonoGame(); // Tell Kthura to use the MonoGame Driver to display the map KthuraDrawMonoGame.CrashOnNoTex = delegate(string msg) { SBubble.MyError("Kthura Texture Error", msg, ""); }; // SBubble Kthura API SBubble.AddInit(KthuraBubble.KthuraBubble.Init); SBubble.AddInit(KthuraBubble.KthBlockAPI.Init); SBubble.AddInit(KthuraBubble.KthuraAbyssGenerator.Init); // TODO: API for TeddyBear // TODO: API for Swap Data Manager // TODO: API for RPGStat RPG.JCRSTORAGE = "lzma"; #endregion // Start init script FlowManager.StartInitFlow(); }
public string GetValue(string k) { try { InitSwap(); return(SwapMap[k]); } catch (Exception E) { SBubble.MyError($"Swap.Data[\"{k}\"]:", E.Message, SBubble.TraceLua(statename)); return("ERROR"); } }
public string getPartyMember(int index) { if (index - 1 >= RPG.RPGParty.Length || index <= 0) { SBubble.MyError("RPG API Error", "Party Member index out of bounds", SBubble.TraceLua(statename)); return(""); } return(RPG.RPGParty[index - 1]); }
public void setPartyMember(int index, string tag) { if (index - 1 >= RPG.RPGParty.Length || index <= 0) { SBubble.MyError("RPG API Error", "Party Member index out of bounds", SBubble.TraceLua(statename)); return; } RPG.RPGParty[index - 1] = tag; }
public void ComeToMe(int ID, string Lay, int x, int y) { try { var m = KthuraBubble.GetMap(ID); BubBlockMap.ComeToMe(FlowManager.GetHardFlow, m, Lay, x, y); } catch (Exception Crap) { SBubble.MyError("Kthura Blockmap Debug Error", Crap.Message, $"{ID}/{Lay}/({x},{y})"); } }
public bool HasTag(int id, string layer, string tag) { try { return(KMaps[id].Layers[layer].HasTag(tag)); } catch (Exception FuckYou) { SBubble.MyError($"BubbleKthura.Map[{id}].Layer[\"{layer}\"].HasTag(\"{tag}\"): ", FuckYou.Message, LuaTrace); return(false); } }
public void SetObjTex(int ID, string tag, string value) { try { var L = KMaps[ID].Layers[Layers[ID]]; L.FromTag(tag).Texture = value; } catch (Exception Calamity) { SBubble.MyError($"Setting texture of object {ID}:{tag}", Calamity.Message, LuaTrace); } }
public void SetVisible(int ID, string tag, bool vis) { try { var L = KMaps[ID].Layers[Layers[ID]]; var O = L.FromTag(tag); O.Visible = vis; } catch (Exception VisWijf) { SBubble.MyError($"Kthura.SetVisible({ID},\"{tag}\",{vis}):", VisWijf.Message, LuaTrace); } }
public string GetObjTex(int ID, string tag) { try { var L = KMaps[ID].Layers[Layers[ID]]; return(L.FromTag(tag).Texture); } catch (Exception Calamity) { SBubble.MyError($"Getting texture of object {ID}:{tag}", Calamity.Message, ""); return("ERROR"); } }
public void SetObjInt(int id, string Lay, string Tag, string stat, int value) { try { var M = KMaps[id]; var L = M.Layers[Lay]; var T = L.FromTag(Tag); switch (stat.ToUpper()) { case "X": T.x = value; break; case "Y": T.y = value; break; case "W": case "WIDTH": T.w = value; break; case "H": case "HEIGHT": T.h = value; break; case "DOMINANCE": T.Dominance = value; break; case "R": case "RED": T.R = value; break; case "G": case "GREEN": T.G = value; break; case "B": case "BLUE": T.B = value; break; case "OBJECTWIDTH": throw new Exception("Object Width cannot yet be changed!"); //return KthuraDraw.DrawDriver.ObjectWidth(T); case "OBJECTHEIGHT": throw new Exception("Object Height cannot yet be changed"); // return KthuraDraw.DrawDriver.ObjectHeight(T); case "SCALEX": T.ScaleX = value; break; case "SCALEY": T.ScaleY = value; break; case "INSERTX": T.insertx = value; break; case "INSERTY": T.inserty = value; break; case "ALPHA": T.Alpha1000 = value; break; case "ROTATION": case "ROTATIONDEGREES": T.RotationDegrees = value; break; //case "ROTATIONRADIANS": T.RotationRadians = value; break; default: throw new Exception($"There is no object integer field named: {stat}!"); } } catch (Exception shit) { SBubble.MyError($"Kthura.ObjInt({id},\"{Lay}\",\"{Tag}\",\"{stat}\"):", shit.Message, LuaTrace); return; } }
public void DomRemap(int id) { try { var lname = Layers[id]; var m = KMaps[id]; var l = m.Layers[lname]; l.RemapDominance(); } catch (Exception EpicFail) { SBubble.MyError($"Kthura.DominanceRemap({id}):", EpicFail.Message, LuaTrace); } }
public void SetObjData(int id, string Lay, string Tag, string Fld, string Value) { try { var M = KMaps[id]; var L = M.Layers[Lay]; var T = L.FromTag(Tag); T.MetaData[Fld] = Value; } catch (Exception Stront) { SBubble.MyError($"Kthura.SetObjData({id},\"{Lay}\",\"{Tag}\",\"{Fld}\",\"{Value}\"):", Stront.Message, LuaTrace); } }
public int ObjInt(int id, string Lay, string Tag, string stat) { try { var M = KMaps[id]; var L = M.Layers[Lay]; var T = L.FromTag(Tag); switch (stat.ToUpper()) { case "X": return(T.x); case "Y": return(T.y); case "W": case "WIDTH": return(T.w); case "H": case "HEIGHT": return(T.h); case "DOMINANCE": return(T.Dominance); case "R": case "RED": return(T.R); case "G": case "GREEN": return(T.G); case "B": case "BLUE": return(T.B); case "OBJECTWIDTH": return(KthuraDraw.DrawDriver.ObjectWidth(T)); case "OBJECTHEIGHT": return(KthuraDraw.DrawDriver.ObjectHeight(T)); case "SCALEX": return(T.ScaleX); case "SCALEY": return(T.ScaleY); case "INSERTX": return(T.insertx); case "INSERTY": return(T.inserty); case "ALPHA": return(T.Alpha1000); case "ROTATION": case "ROTATIONDEGREES": return(T.RotationDegrees); default: throw new Exception($"There is no integer field named: {stat}"); } } catch (Exception shit) { SBubble.MyError($"Kthura.ObjNum({id},\"{Lay}\",\"{Tag}\",\"{stat}\"):", shit.Message, LuaTrace); return(0); } }
public void SetSwapFolder(string s) { if (SwapMap != null) { SBubble.MyError("Swap error", "The first swap call has already been done, and the folder cannot be changed after that anymore!", SBubble.TraceLua(statename)); } else { SwapFolderSet = s; } }
public void Draw(string tag, int x, int y, int frame) { if (!Images.ContainsKey(tag)) { SBubble.MyError("Bubble Graphics Error", $"There is no image tagged'{tag}'", SBubble.TraceLua(FlowManager.CurrentFlow)); } try { Images[tag].Draw(x, y, frame); } catch (Exception e) { SBubble.MyError($".NET: Draw(\"{tag}\",{x},{y},{frame}):", e.Message, $"FLOW:\n{SBubble.TraceLua(FlowManager.CurrentFlow)}"); } }
public void StretchDraw(string tag, int x, int y, int w, int h, int frame) { try { if (!Images.ContainsKey(tag)) { SBubble.MyError("Bubble Graphics Error", $"There is no image tagged'{tag}'", SBubble.TraceLua(FlowManager.CurrentFlow)); } Images[tag].StretchDraw(x, y, w, h, frame); } catch (Exception KakkieDeKakkerlak) { SBubble.MyError($"StretchDraw(\"{tag}\", {x}, {y}, {frame}):", KakkieDeKakkerlak.Message, SBubble.TraceLua(FlowManager.CurrentFlow)); } }
public void StopInstance(string buf) { try { if (!InstanceMap.ContainsKey(buf)) { throw new Exception($"No audio instance tagged {buf} available"); } InstanceMap[buf].Stop(); } catch (Exception Error) { SBubble.MyError($"Error on audio instance {buf}", Error.Message, ""); } }
public override void Update(GameTime gameTime) { try { State.DoString($"(BUB_Update or {FlowManager.NOTHING})()", "Draw"); } catch (Exception err) { var trace = SBubble.TraceLua(FlowManager.CurrentFlow); //trace = State.GetDebugTraceback(); #if DEBUG trace += $"\n\n{err.StackTrace}"; #endif SBubble.MyError("Update Callback error", err.Message, trace); } }