void Awake() { MusicStyle mystele; CANVAS_X_LEFT = -240; CANVAS_X_RIGHT = 240; CANVAS_Y_TOP = -480; CANVAS_Y_BOTTOM = -Screen.height; ALERT_BALL = false; ACTUAL_CHAR = PlayerPrefs.GetString("ACTUAL_CHAR"); s = this; Debug.Log("Globals Awake!ball y: " + globals.s.BALL_Y); BALL_Y = -8f; BALL_X = 0; HOLE_SPK_DIST = 2.6f; curGameScreen = GameScreen.MainMenu; previousGameScreen = GameScreen.MainMenu; //// // DontDestroyOnLoad (transform.gameObject); }
private async void delete_Clicked(object sender, EventArgs e) { if (String.IsNullOrEmpty(Item.Text) || String.IsNullOrEmpty(Amount.Text)) { await DisplayAlert("Alert", "Please select record to delete? ", "OK"); } else { var result = await DisplayAlert("Confirmation", "Are you sure?", "OK", "Cancel"); if (result == true && !Item.Text.Equals("") && !Amount.Text.Equals("")) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <addSalary>(); var updateMarks = conn.ExecuteScalar <spendMoney>("DELETE FROM Spend WHERE id = ?", ide); total = 0; global = new globals(); total = global.calculateTotal(oldAmount); var updateMoney = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", total); Item.Text = ""; Amount.Text = ""; } } OnAppearing(); } }
protected override async void OnAppearing() { try { base.OnAppearing(); global = new globals(); using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <addSalary>(); var now = DateTime.Now; var startOfMonth = new DateTime(now.Year, 08, 25); var foreign = conn.Query <addSalary>("SELECT id, mySalary, mySource, date FROM Money "); MyListView.ItemsSource = foreign; Total.Text = global.getTotal().ToString(); //} } } catch (Exception ex) { await DisplayAlert("Alert", ex.ToString(), "OK"); } }
public override void _Ready() { Show(); cam = GetNode("../playerSprite/Camera2D") as Camera2D; p = GetNode("../playerSprite") as player; g = GetNode("/root/globals") as globals; c = GetNode("../combatOps") as combatOps; oocMenu = GetNode("oocMenu") as Sprite; oocSel = GetNode("oocSel") as Sprite; oocTxt = GetNode("oocMenu/menuTxt") as Label; dialogueWin = GetNode("dialogueWin") as Sprite; dialogueTxt = GetNode("dialogueWin/dialogueTxt") as Label; mapSel = GetNode("mapSelector") as Sprite; combatUI = GetNode("combatUI") as Sprite; combatSel = GetNode("combatUI/selector") as Sprite; combatSelNo = 0; statLbl = GetNode("combatUI/charStats") as Label; menuLbl = GetNode("combatUI/menuSelTxt") as Label; feedbackLbl = GetNode("combatUI/feedbackTxt") as Label; scrip = System.IO.File.ReadAllLines("./scripts/dialogue.db"); combatUI.Hide(); oocMenu.Hide(); dialogueWin.Hide(); fadeTicker = new Timer(); this.AddChild(fadeTicker); }
private async void StartBudget_Clicked(object sender, EventArgs e) { try { } catch (Exception ex) { await DisplayAlert("Alert", ex.ToString(), "OK"); } var result = await DisplayAlert("Confirmation", "Are you sure?", "OK", "Cancel"); if (result == true) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <ActiveMoney>(); var foreign = conn.Query <ActiveMoney>("SELECT mySalary FROM ActiveMoney"); global = new globals(); totalBudget = global.calculateMinusOnTotal(getBudgetTotal()); var updateMarks = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", totalBudget); } } }
void Start() { rb = GetComponent <Rigidbody>(); ch_sounds = GetComponent <AudioSource>(); glbls = (globals)GameObject.FindObjectOfType(typeof(globals)); Random.InitState(100); }
private double UpdateAmount() { var updateAmount = 0.0; try { var newAmount = double.Parse(Salary.Text); var difference = 0.0; total = 0; global = new globals(); if (newAmount < oldAmount) { difference = oldAmount - newAmount; updateAmount = global.calculateMinusOnTotal(difference); } else { difference = newAmount - oldAmount; updateAmount = global.calculateTotal(difference); } } catch (Exception ex) { } return(updateAmount); }
private async void Edit_Clicked(object sender, EventArgs e) { if (String.IsNullOrEmpty(Item.Text) || String.IsNullOrEmpty(Amount.Text)) { await DisplayAlert("Alert", "Please enter all fields? ", "OK"); } else { var result = await DisplayAlert("Confirmation", "Are you sure? ", "OK", "Cancel"); if (result == true && !Item.Text.Equals("") && !Amount.Text.Equals("")) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <spendMoney>(); var updateMarks = conn.ExecuteScalar <spendMoney>("UPDATE Spend Set item = ? , amount = ? WHERE id = ?", Item.Text, Amount.Text, ide); total = 0; global = new globals(); total = global.calculateDifferenceOnTotal(oldAmount, double.Parse(Amount.Text)); var updateMoney = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", total); Item.Text = ""; Amount.Text = ""; } } OnAppearing(); } }
public override void _Ready() { g = GetNode("/root/globals") as globals; p = GetNode("../playerSprite") as player; c = GetNode("../combatOps") as combatOps; gui = GetNode("../UI") as UI; g.inputMode = inputModes.moving; }
public override void _Ready() { g = GetNode("/root/globals") as globals; ui = GetNode("../../UI") as UI; cam = GetNode("../Camera2D") as Camera2D; p = GetParent() as player; AddException(GetNode("../Area2D")); }
private void Start() { fillCon = gameObject.GetComponent <WaterFillController>(); timer = gameObject.GetComponent <timerScript>(); wallCon = gameObject.GetComponent <WallController>(); raycaster = gameObject.GetComponent <globals>(); timer.StartTimer(); }
private double UpdateAmountOnDelete() { var updateAmount = 0.0; global = new globals(); updateAmount = global.calculateTotal(global.getSavingsTotalById(ide.ToString())); return(updateAmount); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.FreezeAll; oldPosition = transform.position; glbls = (globals)GameObject.FindObjectOfType(typeof(globals)); }
public override void _Ready() { gui = GetNode("../UI") as UI; p = GetNode("../playerSprite") as player; ground = GetNode("../groundFX") as groundFX; g = GetNode("/root/globals") as globals; combatWaitTimer = new Timer(); this.AddChild(combatWaitTimer); }
public override void _Ready() { g = GetNode("/root/globals") as globals; c = GetNode("../combatOps") as combatOps; gui = GetNode("../UI") as UI; InitializeRays(); newt.Connect("timeout", this, "combatBeginNextTurn"); newt.OneShot = true; AddChild(newt); }
protected override void OnAppearing() { base.OnAppearing(); using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { global = new globals(); conn.CreateTable <spendMoney>(); var salarie = conn.Table <spendMoney>().ToList(); MyListView.ItemsSource = salarie; TotalSpend.Text = global.getSavingsTotal().ToString(); } }
public override void _Ready() { g = GetNode("/root/globals") as globals; gui = GetNode("../UI") as UI; for (var c = 1; c <= 4; c++) { diagonals[c - 1] = GetNode("diagonal" + c.ToString()) as RayCast2D; diagonals[c - 1].SetRotationDegrees(((c * 2) - 1) * 45f); diagonals[c - 1].AddException(this.GetNode("Area2D")); } laterals[0] = GetNode("playerRayDown") as RayCast2D; laterals[1] = GetNode("playerRayUp") as RayCast2D; laterals[2] = GetNode("playerRayLeft") as RayCast2D; laterals[3] = GetNode("playerRayRight") as RayCast2D; }
private double UpdateAmountOnDelete() { var updateAmount = 0.0; try { var newAmount = double.Parse(Salary.Text); global = new globals(); updateAmount = global.calculateMinusOnTotal(newAmount); } catch (Exception ex) { } return(updateAmount); }
private double UpdateAmountOnDeleteAsync() { double updateAmount = 0.0; try { var newAmount = double.Parse(Amount.Text); global = new globals(); updateAmount = global.budgetMinusOnTotal(newAmount); } catch (Exception ex) { } return(updateAmount); }
private async void ButtonDelete_Clicked(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(Salary.Text) || String.IsNullOrEmpty(source.Text)) { await DisplayAlert("Alert", "Please select record to delete? ", "OK"); } else { var result = await DisplayAlert("Confirmation", "Are you sure?", "OK", "Cancel"); if (result == true && !Salary.Text.Equals("") && !source.Text.Equals("")) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <addSalary>(); //conn.Execute("DELETE FROM Money"); var updateMarks = conn.ExecuteScalar <addSalary>("DELETE FROM Money WHERE id = ?", ide); total = 0; global = new globals(); total = UpdateAmountOnDelete(); conn.Execute("DELETE FROM ActiveMoney"); var updateMoney = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", total); Salary.Text = ""; source.Text = ""; } } OnAppearing(); } } catch (Exception ex) { await DisplayAlert("Alert", ex.ToString(), "OK"); } }
private async void deductFromTotal() { var result = await DisplayAlert("Confirmation", "Are you sure?", "OK", "Cancel"); if (result == true) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <ActiveMoney>(); var foreign = conn.Query <ActiveMoney>("SELECT mySalary FROM ActiveMoney"); global = new globals(); totalBudget = global.calculateMinusOnTotal(double.Parse(Amount.Text)); var updateMarks = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", totalBudget); } } }
public async Task EvaluateAsync(CommandContext ctx, [RemainingText, Description("Code to evaluate.")] string code) { var cs1 = code.IndexOf("```") + 3; cs1 = code.IndexOf('\n', cs1) + 1; var cs2 = code.LastIndexOf("```"); if (cs1 == -1 || cs2 == -1) { throw new ArgumentException("You need to wrap the code into a code block.", nameof(code)); } code = code.Substring(cs1, cs2 - cs1); var embed = new DiscordEmbedBuilder { Title = "Evaluating...", Color = new DiscordColor(0xD091B2) }; var msg = await ctx.RespondAsync("", embed : embed.Build()).ConfigureAwait(false); var globals = new globals { ctx = ctx, settings = discordUrie.Config, discordUrie = discordUrie }; var sopts = ScriptOptions.Default .WithImports("System", "System.Collections.Generic", "System.Diagnostics", "System.Linq", "System.Net.Http", "System.Net.Http.Headers", "System.Reflection", "System.Text", "System.Threading.Tasks", "DSharpPlus", "DSharpPlus.CommandsNext", "DSharpPlus.Entities", "DSharpPlus.EventArgs", "DSharpPlus.Exceptions") .WithReferences(AppDomain.CurrentDomain.GetAssemblies().Where(xa => !xa.IsDynamic && !string.IsNullOrWhiteSpace(xa.Location))); var sw1 = Stopwatch.StartNew(); var cs = CSharpScript.Create(code, sopts, typeof(globals)); var csc = cs.Compile(); sw1.Stop(); if (csc.Any(xd => xd.Severity == DiagnosticSeverity.Error)) { embed = new DiscordEmbedBuilder { Title = "Compilation failed", Description = string.Concat("Compilation failed after ", sw1.ElapsedMilliseconds.ToString("#,##0"), "ms with ", csc.Length.ToString("#,##0"), " errors."), Color = new DiscordColor(255, 0, 0) }; foreach (var xd in csc.Take(3)) { var ls = xd.Location.GetLineSpan(); embed.AddField(string.Concat("Error at ", ls.StartLinePosition.Line.ToString("#,##0"), ", ", ls.StartLinePosition.Character.ToString("#,##0")), Formatter.InlineCode(xd.GetMessage()), false); } if (csc.Length > 3) { embed.AddField("Some errors ommited", string.Concat((csc.Length - 3).ToString("#,##0"), " more errors not displayed"), false); } await msg.ModifyAsync(embed : embed.Build()).ConfigureAwait(false); return; } Exception rex = null; ScriptState <object> css = null; var sw2 = Stopwatch.StartNew(); try { css = await cs.RunAsync(globals).ConfigureAwait(false); rex = css.Exception; } catch (Exception ex) { rex = ex; } sw2.Stop(); if (rex != null) { embed = new DiscordEmbedBuilder { Title = "Execution failed", Description = string.Concat("Execution failed after ", sw2.ElapsedMilliseconds.ToString("#,##0"), "ms with `", rex.GetType(), ": ", rex.Message, "`."), Color = new DiscordColor(255, 0, 0), }; await msg.ModifyAsync(embed : embed.Build()).ConfigureAwait(false); return; } embed = new DiscordEmbedBuilder { Title = "Evaluation successful", Color = new DiscordColor(0, 255, 0), }; embed.AddField("Result", css.ReturnValue != null ? css.ReturnValue.ToString() : "No value returned", false) .AddField("Compilation time", string.Concat(sw1.ElapsedMilliseconds.ToString("#,##0"), "ms"), true) .AddField("Execution time", string.Concat(sw2.ElapsedMilliseconds.ToString("#,##0"), "ms"), true); if (css.ReturnValue != null) { embed.AddField("Return type", css.ReturnValue.GetType().ToString(), true); } await msg.ModifyAsync(embed : embed.Build()).ConfigureAwait(false); }
public bool ValidMove(globals.direction direction) { float width = globals.tileWidth; float height = globals.tileHeight; Vector3 vecPos; switch (direction) { case globals.direction.Left: vecPos = new Vector3(transform.position.x - width, transform.position.y, transform.position.z); break; case globals.direction.Right: vecPos = new Vector3(transform.position.x + width, transform.position.y, transform.position.z); break; case globals.direction.Top: vecPos = new Vector3(transform.position.x, transform.position.y + height, transform.position.z); break; case globals.direction.Bottom: vecPos = new Vector3(transform.position.x, transform.position.y - height, transform.position.z); break; case globals.direction.TopLeft: vecPos = new Vector3(transform.position.x - width, transform.position.y + height, transform.position.z); break; case globals.direction.TopRight: vecPos = new Vector3(transform.position.x + width, transform.position.y + height, transform.position.z); break; case globals.direction.BottomLeft: vecPos = new Vector3(transform.position.x - width, transform.position.y - height, transform.position.z); break; case globals.direction.BottomRight: vecPos = new Vector3(transform.position.x + width, transform.position.y - height, transform.position.z); break; default: vecPos = new Vector3(transform.position.x + width, transform.position.y - height, transform.position.z); break; } Collider[] objects = Physics.OverlapSphere(vecPos, (Mathf.Min(width, height) / 3)); if (objects.Length == 0) return false; if (objects.Length == 1) { OTSprite sprite = objects[0].GetComponent<OTSprite>(); if (sprite.tag.Equals("ground")) return true; else return false; } if (objects.Length == 2) { OTSprite[] sprites = objects[0].GetComponents<OTSprite>(); if (sprites[0].tag.Equals("zombie") || sprites[1].tag.Equals("zombie")) return false; else return true; } return true; }
private async void ButtonSalary_Clicked(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(Salary.Text) || String.IsNullOrEmpty(source.Text)) { await DisplayAlert("Alert", "Please enter all fields? ", "OK"); } else { var result = await DisplayAlert("Confirmation", "Are you sure? ", "Yes", "Cancel"); if (result == true) { addSalary add = new addSalary() { mySalary = Salary.Text, mySource = source.Text, date = DateTime.Now.ToString() }; using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <addSalary>(); int rows = conn.Insert(add); } // if (result == true && !Salary.Text.Equals("") && !source.Text.Equals("")) { using (SQLiteConnection conn = new SQLiteConnection(App.filePath)) { conn.CreateTable <ActiveMoney>(); var foreign = conn.Query <ActiveMoney>("SELECT mySalary FROM ActiveMoney"); if (foreign.Count == 0) { ActiveMoney addFunds = new ActiveMoney() { mySalary = Salary.Text, }; conn.CreateTable <ActiveMoney>(); int rows = conn.Insert(addFunds); } else { global = new globals(); total = global.calculateTotal(double.Parse(Salary.Text)); var updateMarks = conn.ExecuteScalar <ActiveMoney>("UPDATE ActiveMoney Set mySalary = ?", total); } } Salary.Text = ""; source.Text = ""; } OnAppearing(); } } } catch (Exception ex) { await DisplayAlert("Alert", ex.ToString(), "OK"); } }