public void UpdateBatchesData() { try { foreach (var c in m_Batches) { ListExtras.Resize <ScreenshotBatch.ActiveItem>(c.m_ActiveResolutions, m_Resolutions.Count); for (int i = 0; i < m_Resolutions.Count && i < c.m_ActiveResolutions.Count; ++i) { c.m_ActiveResolutions[i].m_Name = m_Resolutions[i].ToString(); c.m_ActiveResolutions[i].m_Id = i; // c.m_ActiveResolutions[i].m_Resolution = m_Resolutions[i]; } ListExtras.Resize <ScreenshotBatch.ActiveItem>(c.m_ActiveCompositions, m_Compositions.Count); for (int i = 0; i < m_Compositions.Count && i < c.m_ActiveCompositions.Count; ++i) { c.m_ActiveCompositions[i].m_Name = m_Compositions[i].m_Name; c.m_ActiveCompositions[i].m_Id = i; // c.m_ActiveCompositions[i].m_Composition = m_Compositions[i]; } } } catch { } }
public void AddRow(Dictionary <string, object> rows, string tableName) { var unique = rows.Keys.Where(s => HeaderRows.Contains(s) == false).ToList(); if (HeaderRows.Any() == false) { HeaderRows.Add(""); } HeaderRows.AddRange(unique); var data = ListExtras.Initialise(HeaderRows.Count, ""); foreach (var row in rows) { var i = HeaderRows.IndexOf(row.Key); if (i != -1) { data[i] = row.Value.ToString(); } } data[0] = tableName; //add data currentPage.Add(data); }
private static bool SwitchControls(PanelReplacement control, bool up) { var U2 = ((PanelReplacement)control.Parent); var F = ((FormulaEditor)U2.Parent); if (F == null) { return(false); } //get index of this item var index = getI(U2, control.Name); if ((index == 0 && up) || (index == U2.Controls.Count - 1 && up == false)) { return(false); } var newindex = index; if (up) { newindex--; } else { newindex++; } ListExtras.Swap(ref F.formulas, index, newindex); U2.SwitchControlLocations(index, newindex); return(true); }
public Dictionary <string, int> GetTopPhrases(int count, List <String> excludedPhrases, List <string> requiredPhrases, bool min3words, bool cull) { var phrases = new Dictionary <string, int>(); int reqspace = 1; if (min3words) { reqspace = 3; } var parents = new HashSet <String>(); foreach (var s in sentences) { //get all combos var xx = ListExtras.GetAllCombinations(s, 2, -1).OrderByDescending(pair => pair.Count).ToList(); if (xx.Count == 0) { continue; } String fullsentence = null; foreach (var sl in xx) { var sentence = String.Join(" ", sl.ToArray()); if (fullsentence == null) { //empty value=no further parent parents.Add(sentence); fullsentence = sentence; } OKPhrase(ref phrases, sentence, excludedPhrases, requiredPhrases, reqspace); } } var ret = new Dictionary <string, int>(); foreach (var kvp in phrases.OrderByDescending(pair => pair.Value).Take(count)) { if (cull && kvp.Value == 1 && parents.Contains(kvp.Key)) { continue; } ret.Add(kvp.Key, kvp.Value); } return(ret); }
/// <summary> /// Switches the control locations. /// </summary> /// <param name="indexone">The indexone.</param> /// <param name="indextwo">The indextwo.</param> public void SwitchControlLocations(int indexone, int indextwo) { var one = Controls[indexone]; var two = Controls[indextwo]; ListExtras.Swap(ref ControlStack, indexone, indextwo); //switch the control locs var x = one.Location.X; var y = one.Location.Y; one.Location = new Point(two.Location.X, two.Location.Y); two.Location = new Point(x, y); //switch the item locs SwapControls(one, two); }
public void Refresh() { this.RefreshItems(); if (!Object.op_Inequality((Object)this.ScrollRect, (Object)null)) { return; } ListExtras component = (ListExtras)((Component)this.ScrollRect).GetComponent <ListExtras>(); if (Object.op_Inequality((Object)component, (Object)null)) { component.SetScrollPos(1f); } else { this.ScrollRect.set_normalizedPosition(Vector2.get_one()); } }
public void Refresh(bool isEvent, bool isSelect = false) { GlobalVars.SelectedMultiPlayQuestIsEvent = isEvent; this.RefreshItems(isSelect); if (!Object.op_Inequality((Object)this.ScrollRect, (Object)null)) { return; } ListExtras component = (ListExtras)((Component)this.ScrollRect).GetComponent <ListExtras>(); if (Object.op_Inequality((Object)component, (Object)null)) { component.SetScrollPos(1f); } else { this.ScrollRect.set_normalizedPosition(Vector2.get_one()); } }
private void Refresh(bool isEvent, QuestListV2_MultiPlayCategory.DISPLAY_QUEST_TYPE type = QuestListV2_MultiPlayCategory.DISPLAY_QUEST_TYPE.Normal) { GlobalVars.SelectedMultiPlayQuestIsEvent = isEvent; this.RefreshItems(type); if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ScrollRect, (UnityEngine.Object)null)) { return; } ListExtras component = (ListExtras)((Component)this.ScrollRect).GetComponent <ListExtras>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { component.SetScrollPos(1f); } else { this.ScrollRect.set_normalizedPosition(Vector2.get_one()); } }
//default constructor public ProbabilisticGate(List <int> inputsAddress, List <int> outputsAddress, List <List <double> > rawTable, int id) { _id = id; int i, j; inputs = inputsAddress; outputs = outputsAddress; int numInputs = inputs.Count(); int numOutputs = outputs.Count(); ListExtras.Resize(table, 2 ^ numInputs); //normalize each row for (i = 0; i < (2 ^ numInputs); i++) { //for each row (each possible input bit string) ListExtras.Resize(table[i], (2 ^ numOutputs)); // first sum the row double S = 0; for (j = 0; j < (2 ^ numOutputs); j++) { S += rawTable[i][j]; } // now normalize the row if (S == 0.0) { //if all the inputs on this row are 0, then give them all a probability of 1/(2^(number of outputs)) for (j = 0; j < (2 ^ numOutputs); j++) { table[i][j] = 1.0 / (2 ^ numOutputs); } } else { //otherwise divide all values in a row by the sum of the row for (j = 0; j < (2 ^ numOutputs); j++) { table[i][j] = rawTable[i][j] / S; } } } }