public override void Run() { if (isActive) { return; } hasBattery = hasBattery || Inventory.Instance.RemoveItem(ItemType.battery); hasLens = hasLens || Inventory.Instance.RemoveItem(ItemType.lens); if (hasBattery && hasLens) { TurnOnProjector(); SubtitlesController.Instance.Show(Loc.Get("projector_turned_on")); } else if (hasBattery) { SubtitlesController.Instance.Show(Loc.Get("projector_needs_lens")); } else if (hasLens) { SubtitlesController.Instance.Show(Loc.Get("projector_needs_battery")); } else { SubtitlesController.Instance.Show(Loc.Get("projector_needs_battery_and_lens")); } }
void Update() { if (Input.GetKeyUp(KeyCode.T)) { SubtitlesController.Instance.Show(Loc.Get("projector_needs_battery_and_lens")); } }
private void frmMain_Resize(object sender, EventArgs e) { this.ShowInTaskbar = (this.WindowState != FormWindowState.Minimized); if (!this.ShowInTaskbar && !isMinimizedMessageShown) { trayIcon.ShowBalloonTip(5000, Loc.Get("frmMain.trayIcon.BalloonTipTitle.CheckingRoutine.WindowMinimized", "Medoc Updates window has been minimized"), Loc.Get("frmMain.trayIcon.BalloonTipText.CheckingRoutine.WindowMinimized", "You can reach Medoc Updates through the tray icon now"), ToolTipIcon.Info); isMinimizedMessageShown = true; } }
private void InitializeLocalization() { this.btnDone.Text = Loc.Get("frmNotificationsDelay.btnDone.Text", "Delay"); this.btnCancel.Text = Loc.Get("frmNotificationsDelay.btnCancel.Text", "Cancel"); this.rbByHour.Text = Loc.Get("frmNotificationsDelay.rbByHour.Text", "by a hour"); this.rbBy5Hours.Text = Loc.Get("frmNotificationsDelay.rbBy5Hours.Text", "by a 5 hours"); this.rbByManual.Text = Loc.Get("frmNotificationsDelay.rbByManual.Text", "manually"); this.rbByCustom.Text = Loc.Get("frmNotificationsDelay.rbByCustom.Text", "custom interval:"); this.gbDelays.Text = Loc.Get("frmNotificationsDelay.gbDelays.Text", "Delay notifications..."); this.Text = Loc.Get("frmNotificationsDelay.Text", "Medoc Updates - Delay notifications"); }
private void InitializeLocalization() { this.label1.Text = Loc.Get("frmFirstRun.label1.Text", "Hello. Looks like you\'ve run this application for the first time.\r\nLet\'s proceed you through the important settings."); this.lblTelegramToken.Text = Loc.Get("frmFirstRun.lblTelegramToken.Text", "Telegram token:"); this.lblDownloadPath.Text = Loc.Get("frmFirstRun.lblDownloadPath.Text", "Downloads path:"); this.lblLogLevels.Text = Loc.Get("frmFirstRun.lblLogLevels.Text", "Level of logs:"); this.btnCancel.Text = Loc.Get("frmFirstRun.btnCancel.Text", "Quit"); this.btnSave.Text = Loc.Get("frmFirstRun.btnSave.Text", "Next >"); this.btnDownloadsPathBrowse.Text = Loc.Get("frmFirstRun.btnDownloadsPathBrowse.Text", "Browse..."); this.label2.Text = Loc.Get("frmFirstRun.label2.Text"); // resources.GetString("label2.Text") this.Text = Loc.Get("frmFirstRun.Text", "Medoc Updates - First run"); this.lblLanguage.Text = Loc.Get("frmFirstRun.lblLanguage.Text", "Language:"); this.lblLanguageNote.Text = Loc.Get("frmFirstRun.lblLanguageNote.Text", "Note that the language will change only after the application restart."); }
public override void Run() { if (!isOpen) { isOpen = Inventory.Instance.RemoveItem(ItemType.safeCode); if (isOpen) { SubtitlesController.Instance.Show(Loc.Get("safe_opened")); opened.active = true; } else { SubtitlesController.Instance.Show(Loc.Get("safe_closed")); } } }
public bool CheckPushing(Vector direction) { var newLoc = Loc + direction; if (newLoc.Get(Model.Data).TypeOfCell == CellType.None) { if (Pushing) { Loc.Get(Model.Data).MovingAnimationDir = direction.Equals(Vector.Left)? "L":"R"; NextLoc = newLoc; return(true); } Pushing = true; } return(false); }
private async void frmMUUpdates_Load(object sender, EventArgs e) { if (await MUVersion.Init() == null) { Log.Write("frmMUUpdates: Cannot retrieve the latest releases from Github. Check your Internet connection"); return; } this.remoteVersion = MUVersion.GetRemoteData(); this.localVersion = MUVersion.GetLocalData(); if (this.remoteVersion == null || this.localVersion == null) { Log.Write(String.Format("frmMUUpdates: Cannot get any of the versions (remote is {0}, local is {1})", (this.remoteVersion == null ? "null" : "not null"), (this.localVersion == null ? "null" : "not null"))); return; } int updateState = GetUpdateState(); switch (updateState) { case 0: lblUpdateStatus.Text = String.Format(Loc.Get("frmMUUpdates.UpdateState.NoUpdates", "No updates for MedocUpdates\r\nVersion {0}"), this.remoteVersion); break; case 1: lblUpdateStatus.Text = String.Format(Loc.Get("frmMUUpdates.UpdateState.NewUpdates", "New build of MedocUpdates was released!\r\n\r\nRemote version: {0}\r\nLocal version: {1}"), this.remoteVersion, this.localVersion); break; case -1: lblUpdateStatus.Text = String.Format(Loc.Get("frmMUUpdates.UpdateState.DevBuild", "You probably have a development build. It's not recommended to update from the public builds\r\n\r\nRemote version: {0}\r\nLocal version: {1}"), this.remoteVersion, this.localVersion); break; default: lblUpdateStatus.Text = Loc.Get("frmMUUpdates.UpdateState.Error", "Something went wrong"); Log.Write(String.Format("frmMUUpdates: Cannot compare the local version with the remote ({0}). Wrong version format probably ({1}/{2})", updateState, this.remoteVersion, this.localVersion)); break; } }
public override void Moved() { Model.MovingEntities[NextLoc] = this; if (!MovedCommon()) { return; } AddUpperEntities(); AddMovingEntity(Loc.X + 1, Loc.Y); AddMovingEntity(Loc.X - 1, Loc.Y); var cell = Loc.Get(Model.Data); var scType = cell.TypeOfScissors; cell.TypeOfScissors = DirectionType.None; Loc = NextLoc; cell = Loc.Get(Model.Data); cell.TypeOfCell = OperatedCell; cell.TypeOfScissors = scType; }
public override void Moved() { if (!MovedCommon()) { return; } if (Pushing) { Pushing = false; } if (rollCell != null) { rollCell.ToBeFilled = false; rollCell = null; } AddUpperEntities(); Loc = NextLoc; Loc.Get(Model.Data).TypeOfCell = OperatedCell; }
//int lastDownloadsCount = 0; private void InitializeLocalization() { this.trayIcon.Text = Loc.Get("frmMain.trayIcon.Text", "Medoc Updates"); this.checkForUpdatesToolStripMenuItem.Text = Loc.Get("frmMain.checkForUpdatesToolStripMenuItem.Text", "Check for updates"); this.delayNotificationsToolStripMenuItem.Text = Loc.Get("frmMain.delayNotificationsToolStripMenuItem.Text", "Delay notifications..."); this.exitToolStripMenuItem.Text = Loc.Get("frmMain.exitToolStripMenuItem.Text", "Exit"); this.fileToolStripMenuItem.Text = Loc.Get("frmMain.fileToolStripMenuItem.Text", "File"); this.labelVersion.Text = Loc.Get("frmMain.labelVersion.Text", "VERSION HERE"); this.menuStrip1.Text = Loc.Get("frmMain.menuStrip1.Text", "menuStrip1"); this.editToolStripMenuItem.Text = Loc.Get("frmMain.editToolStripMenuItem.Text", "Edit"); this.settingsToolStripMenuItem.Text = Loc.Get("frmMain.settingsToolStripMenuItem.Text", "Settings"); this.labelLocalVersion.Text = Loc.Get("frmMain.labelLocalVersion.Text", "LOCAL VERSION HERE"); this.statusStrip1.Text = Loc.Get("frmMain.statusStrip1.Text", "statusStrip1"); this.toolStripStatusLabel1.Text = Loc.Get("frmMain.toolStripStatusLabel1.Text", "toolStripStatusLabel1"); this.Text = Loc.Get("frmMain.Text", "Medoc Updates"); this.helpToolStripMenuItem.Text = Loc.Get("frmMain.helpToolStripMenuItem.Text", "Help"); this.checkForMedocUpdatesNewVersionToolStripMenuItem.Text = Loc.Get("frmMain.checkForMedocUpdatesNewVersionToolStripMenuItem.Text", "MedocUpdates updates..."); }
private void InitializeLocalization() { this.gbLogLevels.Text = Loc.Get("frmSettings.gbLogLevels.Text", "Logs"); this.lblLogLevels.Text = Loc.Get("frmSettings.lblLogLevels.Text", "Level of logs:"); this.cbLogs.Text = Loc.Get("frmSettings.cbLogs.Text", "Enable logging"); this.gbTelegram.Text = Loc.Get("frmSettings.gbTelegram.Text", "Telegram"); this.lblTelegramToken.Text = Loc.Get("frmSettings.lblTelegramToken.Text", "Token:"); this.btnSave.Text = Loc.Get("frmSettings.btnSave.Text", "Save"); this.btnCancel.Text = Loc.Get("frmSettings.btnCancel.Text", "Cancel"); this.gbDownloads.Text = Loc.Get("frmSettings.gbDownloads.Text", "Download settings"); this.btnDownloadsPathBrowse.Text = Loc.Get("frmSettings.btnDownloadsPathBrowse.Text", "Browse..."); this.lblDownloadPath.Text = Loc.Get("frmSettings.lblDownloadPath.Text", "Downloads path:"); this.cbRemoveUpdateFile.Text = Loc.Get("frmSettings.cbRemoveUpdateFile.Text", "Remove .upd files after update installation"); this.Text = Loc.Get("frmSettings.Text", "Medoc Updates - Settings"); this.gbLanguage.Text = Loc.Get("frmSettings.gbLanguage.Text", "Language setup"); this.lblLanguage.Text = Loc.Get("frmSettings.lblLanguage.Text", "Language:"); this.lblLanguageNote.Text = Loc.Get("frmSettings.lblLanguageNote.Text", "Note that the language will change only after the application restart."); }
private void button1_Click(object sender, EventArgs e) { DialogResult result; int updateState = GetUpdateState(); switch (updateState) { case 0: result = MessageBox.Show(Loc.Get("frmMUUpdates.UpdateButton.NoUpdates", "MedocUpdates is already up-to-date.\r\n\r\nDo you really want to forcibly update this application?"), "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ForceUpdate(); } break; case 1: ForceUpdate(); break; case -1: result = MessageBox.Show(Loc.Get("frmMUUpdates.UpdateButton.DevBuild", "You have a development build of MedocUpdates\r\n\r\nDo you really want to forcibly update this application?"), "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ForceUpdate(); } break; default: Log.Write(String.Format("frmMUUpdates: Update state is wrong ({0})", updateState)); break; } }
public string Moving() { Vector bufferDir = Vector.Null; var directs = new List <Vector>(); foreach (var direct in GetDirectionsFromLeft()) { var nextCell = (Loc + direct).Get(Model.Data); if (nextCell != null && (nextCell.TypeOfCell == CellType.None || nextCell.TypeOfCell == CellType.Murphy) && !nextCell.ToBeFilled) { if (!_passedPoints.Contains(direct)) { directs.Add(direct); } else if (bufferDir == Vector.Null) { bufferDir = direct; } } } // rotate scissors var scissorsType = Loc.Get(Model.Data).TypeOfScissors; if (!directs.Contains(MoveDir) && MoveDir != bufferDir) { Vector nextDir; if (directs.Count != 0) { nextDir = directs[0]; _passedPoints.Add(nextDir); } else { if (bufferDir == Vector.Null) { return(""); } nextDir = bufferDir; _passedPoints.Clear(); } scissorsType = (DirectionType)(Array.IndexOf(PathBranch.CommonDirectons, nextDir) + 1); Loc.Get(Model.Data).TypeOfScissors = scissorsType; return(""); } // moove in the direction set NextLoc = Loc + MoveDir; var newCell = NextLoc.Get(Model.Data); newCell.ToBeFilled = true; if (newCell.TypeOfCell == CellType.Murphy) { Model.GameFinishing(false); return(""); } switch (scissorsType) { case DirectionType.Down: return("D"); case DirectionType.Up: return("U"); case DirectionType.Left: return("L"); default: return("R"); } }
public override string Moving(Vector direct, out MyCell cell, MoveType typeOfMoving) { Vector newLoc = Loc + direct; cell = newLoc.Get(Model.Data); MovingEntity targetEnt; var isTargetFalling = Model.MovingEntities.TryGetValue(newLoc, out targetEnt) && targetEnt.IsFalling; if (cell != null && !cell.ToBeFilled && !isTargetFalling) { if (cell.TypeOfCell == CellType.Cookie) //пcounting cookies { Model.ScoresGained++; } switch (cell.TypeOfCell) { case CellType.Exit: if (Model.AllScoresCollected) { Model.GameFinishing(true); } break; case CellType.Ball: case CellType.Cookie: case CellType.None: case CellType.Grass: NextLoc = newLoc; var isBall = cell.TypeOfCell == CellType.Ball; if (direct.Equals(Vector.Left)) { if (isBall) { //if not than create such a ball if (Model.PushedBall == null || !Model.PushedBall.Loc.Equals(newLoc)) { Model.PushedBall = new Ball(Model, newLoc); } //if can not be mooved yet if (!Model.PushedBall.CheckPushing(Vector.Left)) { break; } } Loc.Get(Model.Data).TypeOfMurphy = DirectionType.Left; Model.GridScrollingHorisontal = -1; //field rolling direction set return("L"); } if (direct.Equals(Vector.Right)) { if (isBall) { //if no pushed ball than create if (Model.PushedBall == null || !Model.PushedBall.Loc.Equals(newLoc)) { Model.PushedBall = new Ball(Model, newLoc); } //if can not moove the ball if (!Model.PushedBall.CheckPushing(Vector.Right)) { break; } } Loc.Get(Model.Data).TypeOfMurphy = DirectionType.Right; Model.GridScrollingHorisontal = 1; return("R"); } if (isBall) { break; } if (direct.Equals(Vector.Up)) { Loc.Get(Model.Data).TypeOfMurphy = DirectionType.Up; Model.GridScrollingVertical = -1; return("U"); } if (direct.Equals(Vector.Down)) { Loc.Get(Model.Data).TypeOfMurphy = DirectionType.Down; // change Murphy picture Model.GridScrollingVertical = 1; return("D"); //animation property value changing } break; } } Model.Murphy.Loc.Get(Model.Data).TypeOfMurphy = DirectionType.None; NextLoc = Loc; return(""); }
private void InitializeLocalization() { this.button1.Text = Loc.Get("frmMUUpdates.button1.Text", "Update"); this.lblUpdateStatus.Text = Loc.Get("frmMUUpdates.lblUpdateStatus.Text", "Cannot check for MedocUpdates updates"); this.Text = Loc.Get("frmMUUpdates.Text", "MedocUpdates updates"); }
private void CheckingRoutine() { // Cleaning up a bit //flowDownloads.Controls.Clear(); labelVersion.Text = Loc.Get("frmMain.labelVersion.Text.CheckingRoutine.Checking", "Checking..."); Log.Write("Checking for updates on the medoc.ua server"); bool success = medoc.RefreshDoc(); if (success) { MedocVersion version = medoc.GetLatestVersion(); if (!MedocVersion.IsValid(version)) { Log.Write("Application cannot get the latest remote M.E.Doc version"); return; } //version = "11.01.023"; labelVersion.Text = String.Format(Loc.Get("frmMain.labelVersion.Text.CheckingRoutine.LatestVersion", "Latest version: {0}"), version); //MedocVersion test = new MedocVersion(version); //MedocVersion test2 = "11.01.024"; //MedocVersion test3 = "11.01.023"; MedocVersion localversion = localmedoc.LocalVersion; if (!MedocVersion.IsValid(version)) { Log.Write("Application cannot get a local version of M.E.Doc installation."); MessageBox.Show( Loc.Get("frmMain.MessageBox.CheckingRoutine.NoLocalVersion", "This application must be ran only on systems with M.E.Doc installed."), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //localversion = "11.01.021"; labelLocalVersion.Text = String.Format(Loc.Get("frmMain.labelLocalVersion.Text.CheckingRoutine.LatestLocalVersion", "Latest local version: {0}"), localversion); Log.Write(labelVersion.Text); Log.Write(labelLocalVersion.Text); // Does some updates are performing now? Then don't recreate the buttons // FIXME: Still can be a better solution probably bool isStillUpdating = false; foreach (DownloadButton button in flowDownloads.Controls) { if (button.IsUpdating) { isStillUpdating = true; break; } } if (!isStillUpdating) { MedocDownloadItem[] items; success = medoc.GetItems(out items); if (success) { /* * if (lastDownloadsCount != items.Length) * { * // Initial download items update * //if(lastDownloadsCount == 0) * if(false) // Test * { * flowDownloads.Controls.Clear(); * foreach (MedocDownloadItem item in items) * { * DownloadButton btn = new DownloadButton(item); * btn.IsHighlighted = (item.version > localversion); * btn.FileDownloadedAndRunned += Btn_FileDownloadedAndRunned; * flowDownloads.Controls.Add(btn); * * // Console.WriteLine("Added {0}", item.link); * } * } * else // Update count was changed since the last checking for updates * { * // Determine what count should we add to existing download items * int newItemsCount = items.Length - lastDownloadsCount; * int i = 0; * for (; newItemsCount > 0; newItemsCount--, i++) * { * //MedocDownloadItem item = items[newItemsCount-1]; // Reverse order * MedocDownloadItem item = items[i]; * DownloadButton btn = new DownloadButton(item); * btn.IsHighlighted = (item.version > localversion); * btn.FileDownloadedAndRunned += Btn_FileDownloadedAndRunned; * flowDownloads.Controls.Add(btn); // This whole thing might be working if I could add to the begin of the Controls * } * } * * lastDownloadsCount = items.Length; * } */ flowDownloads.Controls.Clear(); foreach (MedocDownloadItem item in items) { DownloadButton btn = new DownloadButton(item); btn.IsHighlighted = (item.version > localversion); btn.FileDownloadedAndRunned += Btn_FileDownloadedAndRunned; flowDownloads.Controls.Add(btn); // Console.WriteLine("Added {0}", item.link); } } } Status(Loc.Get("frmMain_Done", "Done.")); trayIcon.Text = labelVersion.Text + "\r\n" + labelLocalVersion.Text; if (localversion != version) { trayIcon.ShowBalloonTip(5000, Loc.Get("frmMain.trayIcon.BalloonTipTitle.CheckingRoutine.UpdateReleased", "M.E.Doc update has been released!"), labelVersion.Text + "\r\n" + labelLocalVersion.Text, ToolTipIcon.Info); } else { if (this.WindowState != FormWindowState.Minimized) { trayIcon.ShowBalloonTip(5000, Loc.Get("frmMain.trayIcon.BalloonTipTitle.CheckingRoutine.NoUpdates", "No updates for M.E.Doc"), String.Format(Loc.Get("frmMain.trayIcon.BalloonTipText.CheckingRoutine.NoUpdates", "Minimize the app to deny \"no updates\" notifications\r\n{0}"), labelVersion.Text + "\r\n" + labelLocalVersion.Text), ToolTipIcon.Info); } } if (ParsedArgs.GetToken("telegramforcemsg") || localversion != version) { string versionChangelog = medoc.GetLatestChangelog(); telegram.SendMessageAll(String.Format(Loc.Get("frmMain.telegram.CheckingRoutine.UpdateAvailable", "Update from {0} to [{1}]({2}) is available"), localversion, version, versionChangelog), Telegram.Bot.Types.Enums.ParseMode.Markdown); } } else { labelVersion.Text = Loc.Get("frmMain.labelVersion.Text.CheckingRoutine.Error", "Something went wrong"); Log.Write("Cannot connect to medoc.ua"); Status(Loc.Get("frmMain.Status.CheckingRoutine.CannotConnect", "Cannot connect to medoc.ua")); } }
private void InitializeLocalization() { this.llblDownload.Text = Loc.Get("DownloadButton.llblDownload.Text", "Download"); this.labelVersion.Text = Loc.Get("DownloadButton.labelVersion.Text", "VERSION HERE"); this.llblDownloadRun.Text = Loc.Get("DownloadButton.llblDownloadRun.Text", "Download and run"); }
private void InputUpdate() { switch (state) { case ActionType.none: anim.SetBool("walk", axis != 0); SetDirection(Input.GetAxis("Horizontal")); anim.SetFloat("walkSpeed", Math.Abs(axis) * moveSpeed / 2.75f); if (!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D)) { axis = 0; } if (Input.GetKeyDown(KeyCode.E)) { Use(); } if (Input.GetKeyDown(KeyCode.R)) { GunShot(); } if (Input.GetKeyUp(KeyCode.T)) { SubtitlesController.Instance.Show(Loc.Get("projector_needs_battery_and_lens")); } if (Input.GetKeyDown(KeyCode.C)) { StartClimb(); } break; case ActionType.action: axis = 0; break; case ActionType.climb: if (Input.GetKey(KeyCode.W)) { Climb(ClimbState.climbUp); } if (Input.GetKey(KeyCode.S)) { Climb(ClimbState.climbDown); } if (!Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S)) { Climb(ClimbState.wait); } if (Input.GetKeyDown(KeyCode.C)) { EndClimb(); } break; } }
private void InitializeLocalization() { this.lblHours.Text = Loc.Get("TimeChooser.lblHours.Text", "h."); this.lblMinutes.Text = Loc.Get("TimeChooser.lblMinutes.Text", "m."); this.lblSeconds.Text = Loc.Get("TimeChooser.lblSeconds.Text", "s."); }
private void Info_MouseEnter(object sender, EventArgs e) { lblInfo.Text = Loc.Get(((Control)sender).Tag.ToString()); }