private void cloneDialogButton_Click(object sender, EventArgs e) { if (mCallback != null) { CloneObjectParameters parameters = new CloneObjectParameters(); for (int row = 0; row < parametersTable.RowCount; row++) { TextBox original = parametersTable.GetControlFromPosition(0, row) as TextBox; TextBox replacement = parametersTable.GetControlFromPosition(1, row) as TextBox; if ((original != null) && (replacement != null) && (!string.IsNullOrWhiteSpace(original.Text)) && (!string.IsNullOrWhiteSpace(replacement.Text))) { parameters.AddStringReplacement(original.Text, replacement.Text); } } bool isSuccess = mCallback.OnAccept(parameters); if (isSuccess) { mCallback = null; Close(); } } }
private void cancelButton_Click(object sender, EventArgs e) { if (mCallback != null) { mCallback.OnCancelled(GetUnwantedItems()); mCallback = null; } }
public CustomDialog(IDialogCallback dialogCallback, String title, String content, String primaryButtonText, String secondaryButtonText) { this.dialogCallback = dialogCallback; this.title = title; this.content = content; this.primaryButtonText = primaryButtonText; this.secondaryButtonText = secondaryButtonText; }
private void PreviewCloneDialog_FormClosed(object sender, FormClosedEventArgs e) { if (mCallback != null) { mCallback.OnCancelled(GetUnwantedItems()); mCallback = null; } }
private void InputDialog_FormClosed(object sender, FormClosedEventArgs e) { if (mCallback != null) { mCallback.OnCancelled(); mCallback = null; } }
private void AliasSelectionDialog_FormClosed(object sender, FormClosedEventArgs e) { if (mCallback != null) { mCallback.OnCancelled(); mCallback = null; } }
private void inputDialogOkayButton_Click(object sender, EventArgs e) { if (mCallback != null) { bool isSuccess = mCallback.OnAccept(inputDialogTextBox.Text); if (isSuccess) { mCallback = null; Close(); } } }
private void acceptButton_Click(object sender, EventArgs e) { if (mCallback != null) { bool isSuccess = mCallback.OnAccept(GetUnwantedItems()); if (isSuccess) { mCallback = null; DialogResult = DialogResult.OK; Close(); } } }
private void applyButton_Click(object sender, EventArgs e) { if (mCallback != null) { bool isSuccess = mCallback.OnAccept(baseModsPathTextbox.Text, steamUploadsPathTextbox.Text); if (isSuccess) { mCallback = null; this.DialogResult = DialogResult.OK; Close(); } } }
public void OnCloseDialog() { Transform t = transform.Find("PopupDialog"); t.gameObject.SetActive(false); mDialogOpen = false; if (mDialogCallback != null) { mDialogCallback.OnDialogClosed(); mDialogCallback = null; } }
private void acceptButton_Click(object sender, EventArgs e) { if (mCallback != null) { // Casts the listbox items to strings (throws an exception should anything be uncastable), // then selects only unique (distinct) elements and passes that to OnAccept as IEnumerable<string> bool isSuccess = mCallback.OnAccept(listBox.SelectedItems.Cast<string>().Distinct()); if (isSuccess) { mCallback = null; Close(); } } }
public AliasSelectionDialog(IDialogCallback callback) { InitializeComponent(); mCallback = callback; foreach (Module mod in ModuleDataManager.GetInstance().GetAllModules()) { foreach (ModuleFile alias in mod.GetAliases()) { mAllAliases.Add(alias.FullAlias); } } SetFilter(null); }
private void acceptButton_Click(object sender, EventArgs e) { if (mCallback != null) { // Casts the listbox items to strings (throws an exception should anything be uncastable), // then selects only unique (distinct) elements and passes that to OnAccept as IEnumerable<string> bool isSuccess = mCallback.OnAccept(listBox.SelectedItems.Cast <string>().Distinct()); if (isSuccess) { mCallback = null; Close(); } } }
public PreviewCloneDialog(string title, HashSet<string> set, IDialogCallback callback) { InitializeComponent(); Text = title; dependenciesListBox.Items.Clear(); mSet = set; HashSet<string> unwantedItems = callback.GetSavedUnwantedItems(); foreach (string item in mSet) { bool isChecked = unwantedItems != null ? !unwantedItems.Contains(item) : true; dependenciesListBox.Items.Add(item, isChecked); } mCallback = callback; }
public PreviewCloneDialog(string title, HashSet <string> set, IDialogCallback callback) { InitializeComponent(); Text = title; dependenciesListBox.Items.Clear(); mSet = set; HashSet <string> unwantedItems = callback.GetSavedUnwantedItems(); foreach (string item in mSet) { bool isChecked = unwantedItems != null ? !unwantedItems.Contains(item) : true; dependenciesListBox.Items.Add(item, isChecked); } mCallback = callback; }
private void acceptButton_Click(object sender, EventArgs e) { if (mCallback != null) { HashSet <string> selected = new HashSet <string>(); foreach (object obj in listBox.SelectedItems) { string alias = (string)obj; selected.Add(alias); } bool isSuccess = mCallback.OnAccept(selected); if (isSuccess) { mCallback = null; Close(); } } }
public OptionsViewModel(IDialogCallback callback) { this.callback = callback; }
public void SetCallback(IDialogCallback callback) { mCallback = callback; }
void Update() { List <Person> people = mPersonManager.People; UpdateRenderables(people, uiPersonObject, mUiPeoplePool, mUiPeopleMap, null, InitializeUIPerson); // Update the god and demands if (mGod != null) { // TODO: show the god name somewhere //transform.Find("Left/Demands/Name").GetComponent<Text>().text = mGod.Name; UpdateRenderables(mGod.Demands, uiDemandObject, mUiDemandPool, mUiDemandMap, null, InitializeUIDemand); } // TODO: define a class to represent a notification message, and have it implement IRenderable // Update notification objects // UPDATE: this now only shows and updates the timer of the first (oldest) notification Transform notificationContainer = transform.Find("BRCorner"); Transform godContainer = transform.Find("BLCorner"); for (int i = 0; i < Mathf.Max(mNotificationMessages.Count, mUiNotificationPool.Count); i++) { GameObject uiNotification; // Spawn new UI demand if (i >= mUiNotificationPool.Count) { uiNotification = Instantiate(uiNotificationObject); mUiNotificationPool.Add(uiNotification); uiNotification.transform.SetParent(notificationContainer, false); } else { uiNotification = mUiNotificationPool[i]; } if (i < mNotificationMessages.Count) { if (mNotificationIsGod[i]) { uiNotification.transform.SetParent(godContainer, false); uiNotification.GetComponent <Image>().color = Color.gray; } else { uiNotification.transform.SetParent(notificationContainer, false); uiNotification.GetComponent <Image>().color = new Color(1f, 1f, 1f, 0.8f); } } // Update position RectTransform rt = uiNotification.GetComponent <RectTransform>(); // TODO: slide down if others have faded rt.anchoredPosition = new Vector2(0f, 100f * i); // Update visibility uiNotification.transform.gameObject.SetActive(i == 0 && i < mNotificationMessages.Count); // Update text and alpha if (i < mNotificationMessages.Count) { uiNotification.transform.Find("Text").GetComponent <Text>().text = mNotificationMessages[i]; // Fade out over the last 0.25s uiNotification.GetComponent <CanvasGroup>().alpha = Mathf.Min(1f, mNotificationDurations[i] * 4f); } } if (mNotificationMessages.Count > 0) { mNotificationDurations[0] -= Time.deltaTime; if (mNotificationDurations[0] <= 0f) { mNotificationIsGod.RemoveAt(0); mNotificationMessages.RemoveAt(0); mNotificationDurations.RemoveAt(0); } } // Update ongoing objects Transform ongoingContainer = transform.Find("TRCorner/OngoingGroup"); UpdateRenderables(GameState.Ongoings, uiOngoingObject, mUiOngoingPool, mUiOngoingMap, ongoingContainer); // Update the top UI bar string foodString = string.Format("Food: {0:0.#} / {1}", GameState.FoodSupply, people.Count); transform.Find("Top/Left/Item1/Text").GetComponent <Text>().text = Utilities.ColorString(foodString, "red", people.Count > GameState.FoodSupply); string armyString = GameState.InvaderSize == 0 ? string.Format("Army: {0:0.#}", GameState.ArmyStrength) : Utilities.ColorString(string.Format("Army: {0:0.#} / {1}", GameState.ArmyStrength, GameState.InvaderSize), "red", GameState.InvaderSize > GameState.ArmyStrength); transform.Find("Top/Left/Item2/Text").GetComponent <Text>().text = armyString; string birthString1 = float.IsInfinity(GameState.TimeBetweenBirths) ? "Birth rate is 0" : string.Format("Birth every {0:0.#}s", GameState.TimeBetweenBirths); string birthString2 = mPersonManager.People.Count == PersonManager.MAX_POPULATION ? "(max population)" : (float.IsInfinity(GameState.TimeUntilBirth) ? "(need civilians)" : string.Format("Next in {0:0.0}s", GameState.TimeUntilBirth)); transform.Find("Top/Left/Item3/Text").GetComponent <Text>().text = birthString1 + "\r\n" + birthString2; // Population transform.Find("Top/Right/Item1/Text").GetComponent <Text>().text = "Population: " + people.Count + "/" + PersonManager.MAX_POPULATION; if (mPendingDialogMessages.Count > 0 && !mDialogOpen) { // messages pause the game by default. could make this optional if we need to. Utilities.SetGamePaused(true); // TODO: disable pause button too mDialogOpen = true; DialogMessage dm = mPendingDialogMessages[0]; mDialogCallback = dm.c; Transform popDialog = transform.Find("PopupDialog"); popDialog.gameObject.SetActive(true); popDialog.Find("DialogText").GetComponent <Text>().text = dm.msg; mPendingDialogMessages.RemoveAt(0); } }
public DialogMessage(string message, IDialogCallback callback) { msg = message; c = callback; }
public void ShowMessage(string s, IDialogCallback callback) { mPendingDialogMessages.Add(new DialogMessage(s, callback)); }