private void LoseOperation() { #if FULLLOG MoreDebug.Log("qaa go: " + gameObject.name); #endif if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } if (InfoPriority > CampaignManager.campaign.OperationTerseness) { MessageBoxParams parms = new MessageBoxParams(); parms.Message = FailureInfo; parms.MessageBoxTitle = oname; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); } OnLoseOperation.Invoke(); level.LoseAnOperation(); // Remember winning the operation does not win the level or (necessarily) end the operation if (ForceLevelLose) { EndOperation(); level.LoseLevel(); } }
private IEnumerator ShowOperationStatus() { #if FULLLOG MoreDebug.Log("."); #endif yield return(new WaitForSeconds(2)); if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } string sceneresult = "There are " + Missions.Length + "(" + missioncount.MaximumCount + ") missions " + newline + "Actual wins: " + missioncount.GroupCount[1] + newline + "Actual losses: " + missioncount.GroupCount[0]; MessageBoxParams parms = new MessageBoxParams(); parms.Message = sceneresult; parms.MessageBoxTitle = "Operation is Ended"; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); }
public void BeginMission() { // must be called after pausegame.beginplay() #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } if (InfoPriority >= operation.MissionTerseness) { MessageBoxParams parms = new MessageBoxParams(); parms.Message = StartingInfo; parms.MessageBoxTitle = MissionTitle; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); } // reset the goal state currentState = initialState; isActive = true; CurrentLevel = Registry.only.GetObject <LevelManager> ().MapOverlayName; operation.StartMission(); // set flags BeginEvent.Invoke(); }
void SucceedMission() { #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif if (!isActive) { return; } #if FULLLOG MoreDebug.Log("real."); #endif if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } if (InfoPriority > operation.MissionTerseness) { MessageBoxParams parms = new MessageBoxParams(); parms.Message = SuccessInfo; parms.MessageBoxTitle = MissionTitle; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); } currentState = GoalManager.GoalState.realwin; SuccessEvent.Invoke(); operation.WinMission(); isActive = false; //Reset (); }
public void OnButton_RateUs() { EasyMessageBox.Show("Like the game? Please consider rating us!", button1Text: "Rate Now", button2Text: "Maybe Later", button3Text: "Neve Show Again", inAnimation: InAnimationTypes.Spin, templateId: 4); }
public void OnButtonClick_MultiCallNewInstance() { for (int i = 0; i < 3; i++) { EasyMessageBox.Show("This is message box #" + (i + 1).ToString(), dragType: DragTypes.TitleAndMessage); } }
public void OnButtonClick_ShowIcons() { EasyMessageBox.Show("Buy more ammo?", button1Icon: yesIcon, button1Text: "$0.99", button2Icon: noIcon, button2Text: "Cancel", messageIcon: mainIcon); }
private void StartCampaign() { // Called when enabled // todo: can we just put this in OnEnable() ? #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif // announce the start of the campaign PauseGame.only.beginPlay(); OnBeginCampaign.Invoke(); // show the campaign start screen if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } MessageBoxParams parms = new MessageBoxParams(); parms.Message = StartingInfo; parms.MessageBoxTitle = CampaignName; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); // load the first level currentLevel = 0; LoadLevel(currentLevel); }
public void OnButtonClick_MultiCallQueue() { for (int i = 0; i < 3; i++) { EasyMessageBox.Show("This is message box #" + (i + 1).ToString(), multipleCallBehaviour: MultipleCallBehaviours.Queue); } }
public void OnButtonClick_Inputfield() { EasyMessageBox.Show("", button2Text: "Cancel", inputField1Label: "User Name", inputField2Label: "Password", inputFieldAction: (x1, x2) => { EasyMessageBox.Show("User name: " + x1 + " Password: "******"Remember Me", messageBoxTitle: "Login"); }
public void OnButton_Achievement() { EasyMessageBox.Show("You have reached level 5! Please claim your reward.", messageTitle: "Novice", messageIcon: flowerIcon, button1Icon: cashIcon, button1Text: "10", templateId: 2, inAnimation: InAnimationTypes.Stamp, button1Action: () => { Debug.Log("You got 10 diamonds."); }, multipleCallBehaviour: MultipleCallBehaviours.Queue); EasyMessageBox.Show("You have reached level 100! Please claim your reward.", messageTitle: "Expert", messageIcon: lanternIcon, button1Icon: cashIcon, button1Text: "1000", templateId: 2, inAnimation: InAnimationTypes.Stamp, button1Action: () => { Debug.Log("You got 1000 diamonds."); }, multipleCallBehaviour: MultipleCallBehaviours.Queue); }
public void OnButton_GetItem() { EasyMessageBox.Show("A magical lantern.", messageTitle: "Lantern", layout: MessageLayout.Vertical, messageBoxTitle: "You got a new item", messageIcon: lanternIcon, button1Text: "Keep", button2Text: "Discard", templateId: 3, multipleCallBehaviour: MultipleCallBehaviours.Queue); EasyMessageBox.Show("A lovely flower.", messageTitle: "Flower", layout: MessageLayout.Vertical, messageBoxTitle: "You got a new item", messageIcon: flowerIcon, button1Text: "Keep", button2Text: "Discard", templateId: 3, multipleCallBehaviour: MultipleCallBehaviours.Queue); }
void OnToggleSet(bool isOn) { if (isOn) { EasyMessageBox.Show("Checked!"); } else { EasyMessageBox.Show("Unchecked!"); } }
void Start() { #if FULLLOG MoreDebug.Log(MoreDebug.splatRow); #endif RegisterSelf(); InitialScene = SceneManager.GetActiveScene().name; EasyMessageBox.Show(StartingInfo, messageBoxTitle: DefaultHeader, button1Action: () => { BeginMenus(); }, multipleCallBehaviour: MultipleCallBehaviours.Queue); }
public void quitlevel() { // quit the level after confirming hideall(); MessageBoxParams param = new MessageBoxParams(); param.Message = "Do you really want to end this level?"; param.Button1Text = "Yes"; param.Button1Action = QuitClean.only.FailScene; param.Button2Text = "No"; param.Button2Action = showpause; EasyMessageBox.Show(param); }
public void quit() { // quit the game after confirming hideall(); MessageBoxParams param = new MessageBoxParams(); param.Message = "Do you really want to stop the game now?"; param.Button1Text = "Yes"; param.Button1Action = QuitClean.QuitGame; param.Button2Text = "No"; param.Button2Action = showmain; EasyMessageBox.Show(param); }
public void OnButtonClick_Toggle() { EasyMessageBox.Show("Click the toggle.", toggleText: "Don't show next time", toggleAction: (x) => { if (x) { EasyMessageBox.Show("Checked."); } else { EasyMessageBox.Show("Unchecked."); } }); }
private void MainForm_Load(object sender, EventArgs e) { if (Settings.Default.MainWindowWidth >= 100 && Settings.Default.MainWindowHeight > 100) { Width = Settings.Default.MainWindowWidth; Height = Settings.Default.MainWindowHeight; } InitObjectsList(); txtSearchQuery.Focus(); if (Settings.Default.Server != "" && Settings.Default.Database != "") { var connRes = DataProvider.AddMSSqlManager("default", new MSSQLConnectionParams() { Server = Settings.Default.Server, Database = Settings.Default.Database, Username = Settings.Default.Username, Password = Settings.Default.Password, SetIntegratedSecurity = Settings.Default.IntegratedSecurity }); //connRes = DataProvider.AddMySqlManager("mysql", new MySqlConnectionParams() //{ // Server = "127.0.0.1", // Database = "skype", // Username = "******", // Password = null //}); DataProvider.SetActiveManager("default"); if (connRes.Success && DataProvider.ActiveManager.IsConnected) { lblStatus.Text = $"Connected {DataProvider.ActiveManager.ConnectionString}"; SearchInBackground(); return; } else { EasyMessageBox.Error(connRes.Exception.Message); } } lblStatus.Text = "Not Connected!"; lblLoading.Visible = false; }
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { var results = e.Result as SearchResults; if (results == null) { return; } if (results.Error) { EasyMessageBox.Error(results.ErrorMessage); lblLoading.Visible = false; return; } foreach (var obj in results.FoundDbObjects) { var item = new ListViewItem(); item.Text = obj.ToString(); item.Tag = obj; if (DataProvider.ActiveManager.IsTable(obj)) { item.ImageIndex = 0; } if (DataProvider.ActiveManager.IsView(obj)) { item.ImageIndex = 1; } if (DataProvider.ActiveManager.IsStoredProcedure(obj)) { item.ImageIndex = 2; } listDbObjects.Items.Add(item); } lblObjectsCount.Text = results.FoundDbObjects != null ? results.FoundDbObjects.Count + " Objects" : ""; lblLoading.Visible = bw.IsBusy; txtSearchQuery.Focus(); }
private void SetConnection() { using (var connDialog = new ConnectionDialog()) { connDialog.Server = Settings.Default.Server; connDialog.Database = Settings.Default.Database; connDialog.Username = Settings.Default.Username; connDialog.IntegratedSecurity = Settings.Default.IntegratedSecurity; if (connDialog.ShowDialog() == DialogResult.OK) { var connRes = DataProvider.AddMSSqlManager("default", new MSSQLConnectionParams() { Server = connDialog.Server, Database = connDialog.Database, Username = connDialog.Username, Password = connDialog.Password, SetIntegratedSecurity = connDialog.IntegratedSecurity }); DataProvider.SetActiveManager("default"); if (connRes.Success && DataProvider.ActiveManager.IsConnected) { Settings.Default.Server = connDialog.Server; Settings.Default.Database = connDialog.Database; Settings.Default.Username = connDialog.Username; Settings.Default.Password = connDialog.Password; Settings.Default.IntegratedSecurity = connDialog.IntegratedSecurity; Settings.Default.Save(); lblStatus.Text = $"Connected {DataProvider.ActiveManager.ConnectionString}"; SearchInBackground(); } else { EasyMessageBox.Error(connRes.Exception.Message); lblStatus.Text = "Not Connected!"; } } } }
public void OnButton_LevelComplete() { MessageBoxParams param = new MessageBoxParams() { TemplateId = 1, MessageLayout = MessageLayout.Vertical, MessageTitle = "Level Complete!", MessageIcon = dashboardIcon, Button1Text = "Restart", Button1Icon = restartIcon, Button2Text = "Home", Button2Icon = homeIcon, Button3Text = "Share", Button3Icon = shareIcon, InAnimation = InAnimationTypes.VerticalExpand, OutAnimation = OutAnimationTypes.Shrink }; EasyMessageBox.Show(param); }
// Local methods public override void show() { MessageBoxParams boxDef = new MessageBoxParams(); boxDef.MessageBoxTitle = Title; boxDef.MessageTitle = Header; boxDef.Message = Message; boxDef.TemplateId = TemplateID; if (ClickAction != null) { boxDef.Button1Action = ClickAction; } else { string actionname = onClick.GetPersistentMethodName(0); object actionobject = onClick.GetPersistentTarget(0); boxDef.Button1Action = (UnityAction)Delegate.CreateDelegate(typeof(UnityAction), actionobject, actionname); } EasyMessageBox.Show(boxDef); }
private void LoseCampaign() { #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } MessageBoxParams parms = new MessageBoxParams(); parms.Message = FailureInfo; parms.MessageBoxTitle = CampaignName; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); OnLoseCampaign.Invoke(); CampaignManager.EndCampaign(); }
private void BackupSelectedScript() { if (listDbObjects.FocusedItem?.Tag != null) { var dbObject = listDbObjects.FocusedItem.Tag as IDbObject; if (DataProvider.ActiveManager.IsView(dbObject)) { dbObject = DataProvider.ActiveManager.View(dbObject); } else if (DataProvider.ActiveManager.IsStoredProcedure(dbObject)) { dbObject = DataProvider.ActiveManager.StoredProcedure(dbObject); } else { return; } Tuple <string, string> output; if (FileHelper.BackupScript(dbObject.Name, dbObject.Script, out output)) { EasyMessageBox.MessageWithActions( "Script saved", $"Script saved successfully.\r\n{output.Item1}", "OK", new ActionButton(() => Process.Start(output.Item1), "Open File"), new ActionButton(() => Process.Start(output.Item2), "Open Dir") ); } else { EasyMessageBox.Error($"Error occured while saving file.\n{output.Item1}"); } } }
public void OnButtonClick_Animation2() { EasyMessageBox.Show("In animation: Spin. Out animation: Spin.", inAnimation: InAnimationTypes.Spin, outAnimation: OutAnimationTypes.Spin); }
public void OnButtonClick_Animation3() { EasyMessageBox.Show("In animation: Stamp. Out animation: Fade.", inAnimation: InAnimationTypes.Stamp, outAnimation: OutAnimationTypes.Fade); }
//List<BoxController> activeBoxes; void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); return; } if (settings == null) { settings = Resources.Load <GlobalSettings>("Global Settings"); if (settings == null) { settings = ScriptableObject.CreateInstance <GlobalSettings>(); Debug.LogWarning("Easy Message Box cannot load global settings. Using default settings."); } } if (settings.DefaultPrefab == null) { var loaded = Resources.Load <GameObject>("Default Message Box"); if (loaded == null) { Debug.LogError("Cannot find the Default Message Box prefab."); } else { settings.DefaultPrefab = loaded; } } currentCanvas = gameObject.GetComponent <Canvas>(); BoxQueue = new Queue <MessageBoxParams>(); boxPool = new List <List <BoxController> >(); //activeBoxes = new List<BoxController>(); if (Templates == null) { Templates = new List <BoxController>(); } else { Templates.RemoveAll(t => t == null); } for (int i = 0; i < Templates.Count; i++) { boxPool.Add(new List <BoxController>()); Templates[i].gameObject.SetActive(false); boxPool[i].Add(Templates[i]); } if (FindObjectOfType <EventSystem>() == null) { var evt = new GameObject("EventSystem"); evt.AddComponent <EventSystem>(); evt.AddComponent <StandaloneInputModule>(); } var canvasesInTheScene = FindObjectsOfType <Canvas>(); for (int i = 0; i < canvasesInTheScene.Length; i++) { if (canvasesInTheScene[i].sortingOrder > maxCanvasOrderInTheScene) { maxCanvasOrderInTheScene = canvasesInTheScene[i].sortingOrder; } } currentCanvas.sortingOrder = maxCanvasOrderInTheScene + 1; }
/// <summary> /// Show the message box using specified param. /// </summary> /// <returns>The show.</returns> /// <param name="param">Parameter.</param> public static void Show(MessageBoxParams param) { if (Instance == null) { GameObject canvasObject = new GameObject(); canvasObject.name = "Easy Message Box Canvas"; canvasObject.AddComponent <Canvas>(); canvasObject.GetComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; canvasObject.AddComponent <CanvasScaler>(); canvasObject.AddComponent <GraphicRaycaster>(); canvasObject.AddComponent <EasyMessageBox>(); Instance = canvasObject.GetComponent <EasyMessageBox>(); var messageBoxObject = (GameObject)Instantiate(settings.DefaultPrefab); var messageBox = messageBoxObject.GetComponent <BoxController>(); messageBoxObject.transform.SetParent(Instance.transform); Instance.Templates.Add(messageBox); Instance.boxPool.Add(new List <BoxController>()); Instance.boxPool[0].Add(Instance.Templates[0]); (messageBoxObject.transform as RectTransform).anchoredPosition = Vector2.zero; (messageBoxObject.transform as RectTransform).sizeDelta = Vector2.zero; messageBoxObject.SetActive(false); Debug.Log("No template found in the scene, using default message box template."); } else if (Instance.Templates == null || /*Instance.Templates.Count - 1 < param.TemplateId*/ Instance.Templates.Count == 0) { Debug.LogWarning("Cannot find template id " + param.TemplateId.ToString() + ", using default message box. Make sure to add corresponding template in the Inspector of EasyMessageBox object before you call its ID."); var messageBoxObject = (GameObject)Instantiate(settings.DefaultPrefab); var messageBox = messageBoxObject.GetComponent <BoxController>(); messageBoxObject.transform.SetParent(Instance.transform); Instance.Templates.Add(messageBox); param.TemplateId = 0; Instance.boxPool.Add(new List <BoxController>()); Instance.boxPool[0].Add(Instance.Templates[0]); (messageBoxObject.transform as RectTransform).anchoredPosition = Vector2.zero; (messageBoxObject.transform as RectTransform).sizeDelta = Vector2.zero; messageBoxObject.SetActive(false); } if (param.TemplateId > Instance.Templates.Count - 1) { Debug.Log(string.Format("Cannot find template id {0}, using the first template 0.", param.TemplateId.ToString())); param.TemplateId = 0; } switch (param.MultipleCallBehaviour) { case MultipleCallBehaviours.ShowNewInstance: Instance.ActualShowDialogBox(param); break; case MultipleCallBehaviours.Queue: if (!Instance.hasQueuedBox) { Instance.ActualShowDialogBox(param); } else { BoxQueue.Enqueue(param); } break; default: break; } }
public void OnButton_MessageBox() { EasyMessageBox.Show("This is a regular message box. My template ID is 0", toggleText: "Do not show again.", toggleAction: OnToggleSet); }
void Start() { #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif RegisterSelf(); // Warn if there's no mission if (Missions.Length == 0) { Debug.LogWarning("OperationManager: No missions set."); } // Set up each mission foreach (MissionManager mi in Missions) { if (mi == null) { continue; } mi.SetOperation(this); if (mi.StartOnLoad) { OnBeginOperation.AddListener(mi.BeginMission); } } // Set up end managers foreach (EndManager em in OperationEndConditions) { em.OnEnd.AddListener(EndOperation); em.isActive = true; } // let the level know you're here level.IncrementOperations(); // load overlays if (OperationOverlayNames != null) { foreach (string scenename in OperationOverlayNames) { SceneManager.LoadScene(scenename, LoadSceneMode.Additive); // todo: what if its not there? } } // Warn if there's no end criteria (level won't end) if (OperationEndConditions.Length == 0) { Debug.LogWarning("OperationManager: No criteria set to end the level."); } // Place the items StartCoroutine(PlaceItems()); // show the op start screen if (!PauseGame.exists) { #if FULLLOG MoreDebug.Log("No PauseGame -----"); #endif } if (CampaignManager.campaign.ForceMissionTerseness) { MissionTerseness = CampaignManager.campaign.OperationTerseness; } if (InfoPriority >= CampaignManager.campaign.OperationTerseness) { MessageBoxParams parms = new MessageBoxParams(); parms.Message = StartingInfo; parms.MessageBoxTitle = OperationName; parms.Button1Action = PauseGame.only.queueResume; parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue; EasyMessageBox.Show(parms); PauseGame.only.queuePause(); } // announce the start of the op // _opIsStarted = true; OnBeginOperation.Invoke(); }