void ChangeBindSet(int setIndex) { if (setIndex == 1) { keybinding = new Bind1(); } }
public void Pickup(float serverTime, int playerAID, int playerEID) { // only recognize the latest if (serverTime < lastServerTime) { return; } var player = GameInitializer.Instance.Entity <PlayerEntity>(playerAID, playerEID); if (player == null) { return; } DoubleDictionary <PlayerEntity, ItemEntity> .Remove(this); rb.isKinematic = true; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; DoubleDictionary <PlayerEntity, ItemEntity> .Set(player, this); DoubleDictionary <Cabient, ItemEntity> .Remove(this); lastServerTime = serverTime; }
public GlobalGestureRecognizer(GRConfiguration configuration) : base(configuration) { m_handlerTable = new DoubleDictionary<EventInfo, object, List<GestureEventHandler>>(); m_temporaryHandlerTable = new DoubleDictionary<TargetList, EventInfo, List<GestureEventHandler>>(); m_temporaryTargetSingletonList = new List<IGestureListener>(1); }
public static Sheet Create(DoubleDictionary <string, string, string> languageKeyTextDictionary) { var result = new Sheet(); foreach (var(language, key, text) in languageKeyTextDictionary) { var item = result.items.FirstOrDefault(_ => _.key == key); if (item == null) { item = new Item { key = key }; result.items.Add(item); } var pair = new Item.Pair { language = language, text = text }; item.pairs.Add(pair); } return(result); }
protected override void ClearMyObjects() { base.ClearMyObjects(); this.DisposeIfNeeds(this._MicronBEAssyProcess); this._MicronBEAssyProcess = null; this.DisposeIfNeeds(this._MicronBEAssyWipInfo); this._MicronBEAssyWipInfo = null; this.DisposeIfNeeds(this._ProductDetail); this._ProductDetail = null; this.DisposeIfNeeds(this._MicronBEAssyBEMoMaster); this._MicronBEAssyBEMoMaster = null; this.DisposeIfNeeds(this._MicronBEAssyPlanWip); this._MicronBEAssyPlanWip = null; this.DisposeIfNeeds(this._MicronBEAssyEqp); this._MicronBEAssyEqp = null; this.DisposeIfNeeds(this._MicronBEAssyBatch); this._MicronBEAssyBatch = null; this.DisposeIfNeeds(this._MicronBEAssyActPlanWips); this._MicronBEAssyActPlanWips = null; this.DisposeIfNeeds(this._MatchingLotList); this._MatchingLotList = null; this.DisposeIfNeeds(this._MicronBEAssyRemainStepPlans); this._MicronBEAssyRemainStepPlans = null; this.DisposeIfNeeds(this._FindAssyInPartCache); this._FindAssyInPartCache = null; this.DisposeIfNeeds(this._ArrivalTime); this._ArrivalTime = null; this.DisposeIfNeeds(this._EqpPlans); this._EqpPlans = null; this.DisposeIfNeeds(this._TactTimeCache); this._TactTimeCache = null; this.DisposeIfNeeds(this._MicronBEProducts); this._MicronBEProducts = null; }
public void Cook() { if (cookCurrent == 0) { cookCurrent = -2; this.description.GetComponent <Food>().burnt(); //Tsq } else if (cookCurrent > 0) { cookCurrent -= 1; } // get cabient that this item belongs to var cab = DoubleDictionary <Cabient, ItemEntity> .Get(this); if (cab) { // You have access to the cabient class // Perhaps tell the cabient to play a cutting animation //Debug.LogWarning("Insert code to have cooking animation IF ANYTHING"); if (cookCurrent == 0) { this.description.GetComponent <Food>().cooked(); } } }
public override void DestroyEntity() { base.DestroyEntity(); DoubleDictionary <PlayerEntity, ItemEntity> .Remove(this); DoubleDictionary <Cabient, ItemEntity> .Remove(this); }
public static int CalculateProperEqpCount(AssignEqp assignEqp) { WorkStep workStep = assignEqp.WorkStep; int loadedEqpCount = workStep.LoadedEqpCount; DoubleDictionary <Step, object, StepPlan> stepPlans = StepPlanManager.Current.RunPlans; DateTime nowDt = FindHelper.GetNowDT(); foreach (var stepPlan in stepPlans) { if (stepPlan.Step.StepID != workStep.Key.ToString()) { continue; } if (stepPlan.StepTargetList.Count == 0) { continue; } Mozart.SeePlan.DataModel.StepTarget target = stepPlan.StepTargetList.First(); Tuple <string, string, string> key = target.Key as Tuple <string, string, string>; string lineID = key.Item1; string stepID = key.Item2; string prodID = key.Item3; double remainTargetQty = target.CurrentQty; #if DEBUG if (stepID == "S0100" && prodID == "ASSY_A01") { Console.WriteLine(); } #endif TimeSpan remainTime = target.DueDate - nowDt; double remainSec = remainTime.TotalSeconds; int eqpCount = 0; double currAvailableQty = 0d; var loadedEqps = workStep.LoadedEqps; foreach (var loadedEqp in loadedEqps) { if (currAvailableQty >= remainTargetQty) { break; } MicronBEAssyEqp eqp = FindHelper.FindEquipment(loadedEqp.Target.EqpID); double tactTime = GetTactTime(lineID, stepID, prodID, eqp); currAvailableQty += remainSec / tactTime; eqpCount++; } return(eqpCount); } return(0); }
void HandleVariables() { // Get all values. DoubleDictionary <string> variables = new DoubleDictionary <string>(); foreach (Element elem in elementList) { if (!variables.ContainsKey(elem.File)) { variables.Add(elem.File, new Dictionary <string, string>()); } if (elem.CommandType == CommandType.Variable) { if (elem.Parameters.Length != 2) // VAR varName varValue { AddSkinFileException(elem.LineNumber, elem.File, "VAR must have one parameter."); continue; } else { variables[elem.File].Add(elem.Parameters[0], elem.Parameters[1]); } } } // Remove the variable declarations. foreach (Element elem in new List <Element>(elementList)) { if (elem.CommandType == CommandType.Variable) { elementList.Remove(elem); } } // Set all variable-references. foreach (Element elem in elementList) { for (int i = 0; i < elem.Parameters.Length; i++) { if (elem.Parameters[i].Length != 0 && elem.Parameters[i][0] == '$') { string key = elem.Parameters[i].Substring(1); if (!variables[elem.File].ContainsKey(key)) { AddSkinFileException(elem.LineNumber, elem.File, "Can't find variable \"" + key + "\""); continue; } else { elem.Parameters[i] = variables[elem.File][key]; } } } } }
public void GetKeysAndValuesTest() { var d = new DoubleDictionary <int, string> { { 1, "Hello" }, { 2, "World" } }; CollectionAssert.AreEquivalent(new int[] { 1, 2 }, d.Keys.ToArray()); CollectionAssert.AreEquivalent(new string[] { "Hello", "World" }, d.Values.ToArray()); }
public void CopyTo(DoubleDictionary <TKey1, TKey2, TValue> target) { if (target == null) { return; } for (int i = 0; i < Count; i++) { target[keys[i]] = values[i]; } }
private void InitializeData() { var modelContext = this._result.GetCtx <ModelDataContext>(); // ALL Step정보 _stepInfoDic = new Dictionary <string, SwvData.StepInfo>(); var stdStep = modelContext.StdStep.Where(x => x.STEP_SEQ > 0) .OrderBy(x => x.SHOP_ID).OrderByDescending(x => x.STEP_SEQ); foreach (var step in stdStep) { if (_stepInfoDic.ContainsKey(step.SHOP_ID + step.STEP_ID) == false) { _stepInfoDic.Add(step.SHOP_ID + step.STEP_ID, new SwvData.StepInfo(step.SHOP_ID, step.STEP_ID, step.STEP_DESC, step.STEP_TYPE, (int)step.STEP_SEQ, step.LAYER_ID)); } } // StepWip 정보 _stepWipAllDic = new Dictionary <string, SwvData.StepWipInf>(); _stepWipChartAllDDic = new DoubleDictionary <DateTime, string, List <SwvData.StepWipChartInf> >(); // Result / StepWip 재공정보 DataTable dtStepWip = _result.LoadOutput(SimResultData.OutputName.StepWip); foreach (DataRow drow in dtStepWip.Rows) { SimResultData.StepWip row = new SimResultData.StepWip(drow); SwvData.StepInfo stepInfo; _stepInfoDic.TryGetValue(row.ShopID + row.StepID, out stepInfo); string stepDesc = stepInfo == null ? Consts.NULL_ID : stepInfo.StepDesc; int stepSeq = stepInfo == null ? int.MaxValue : stepInfo.StepSeq; string layer = stepInfo == null ? Consts.NULL_ID : stepInfo.Layer; Dictionary <string, List <SwvData.StepWipChartInf> > dic; if (_stepWipChartAllDDic.TryGetValue(row.TargetDate, out dic) == false) { _stepWipChartAllDDic.Add(row.TargetDate, dic = new Dictionary <string, List <SwvData.StepWipChartInf> >()); } List <SwvData.StepWipChartInf> list; if (dic.TryGetValue(row.ShopID, out list) == false) { dic.Add(row.ShopID, list = new List <SwvData.StepWipChartInf>()); } SwvData.StepWipChartInf inf = new SwvData.StepWipChartInf(row.TargetDate, row.ShopID, row.StepID, stepDesc, stepSeq, layer); list.Add(inf); } }
public void TestInitializer() { instance = new DoubleDictionary <string, string, string>() { { "fkey1", "skey1", "value1" }, { "fkey2", "skey2", "value2" }, }; Assert.Equal(true, instance.ContainsKeys("fkey1")); Assert.Equal(true, instance.ContainsKey("fkey1", "skey1")); Assert.Equal(false, instance.ContainsKeys("fkey3")); Assert.Equal(false, instance.ContainsKey("fkey1", "skey2")); }
public void SimpleDictionaryTest() { var d = new DoubleDictionary <int, string> { { 1, "Hello" }, { 2, "World" } }; Assert.AreEqual(2, d.Count); Assert.AreEqual("World", d[2]); Assert.ThrowsException <KeyNotFoundException>(() => d[42]); }
/// <summary> /// Callback called after deserialization of the object occurs. The now deserialized lists of dictionary values are transferred back into the disctionary /// </summary> public void OnAfterDeserialize() { //Unity has just written new data into the serialized fields. //let's populate our actual runtime data with those new values. internalLookup = new DoubleDictionary <HumidityVariables, TemperatureVariables, WeatherTypes>(); for (int i = 0; i < primaryKeys.Count; i++) { internalLookup.Add(primaryKeys[i], secondaryKeys[i], values[i]); } //primaryKeys.Clear(); //secondaryKeys.Clear(); //values.Clear(); }
public void ContainsTest() { var d = new DoubleDictionary <int, string> { { 1, "Hello" }, { 2, "World" } }; Assert.IsTrue(d.ContainsKey(1)); Assert.IsFalse(d.ContainsKey(10)); Assert.IsTrue(d.ContainsValue("Hello")); Assert.IsFalse(d.ContainsValue("Goodbye")); }
public void EnumerationTest() { var d = new DoubleDictionary <int, string> { { 1, "one" }, { 2, "two" }, { 3, "three" }, { 10, "ten" } }; var de = (IEnumerable <KeyValuePair <int, string> >)d; Assert.AreEqual(4, de.Count()); CollectionAssert.AreEquivalent(new int[] { 1, 2, 3, 10 }, d.Select(e => e.Key).ToArray()); }
public void AddTest() { var d = new DoubleDictionary <int, string> { { 1, "Hello" }, { 2, "World" } }; Assert.AreEqual(2, d.Count); d.Add(3, "Goodbye"); Assert.AreEqual(3, d.Count); Assert.ThrowsException <InvalidOperationException>(() => d.Add(1, "foo")); Assert.ThrowsException <InvalidOperationException>(() => d.Add(4, "World")); }
public void Cut() { cutCurrent = Mathf.Max(0, cutCurrent - 1); // get cabient that this item belongs to var cab = DoubleDictionary <Cabient, ItemEntity> .Get(this); if (cab) { // You have access to the cabient class // Perhaps tell the cabient to play a cutting animation //Debug.LogWarning("Insert code to have cabient play knife cutting animation"); this.description.GetComponent <Food>().slicing(); } }
public void InitDict(List <string> shifts) { QtyDict = new DoubleDictionary <string, string, float>(); GenerateDict(TFT_DONE, shifts); GenerateDict(CF_DONE, shifts); GenerateDict(TFT_WIP, shifts); GenerateDict(CF_WIP, shifts); GenerateDict(CELL_IN_TARGET, shifts); GenerateDict(CELL_IN_PLAN, shifts); GenerateDict(CELL_IN_BALANCE, shifts); GenerateDict(CELL_OUT_TARGET, shifts); GenerateDict(CELL_OUT_PLAN, shifts); GenerateDict(CELL_OUT_BALANCE, shifts); }
public TabbedDocumentControl() { InitializeComponent(); _renderer = new TabbedDocumentControlRenderer(this, _menuStrip.Renderer); _menuStrip.Renderer = _renderer; _controlButtonMap = new DoubleDictionary <Control, ToolStripButton>(); _initialMenuStripItemCount = _menuStrip.Items.Count; _menuStrip.Padding = new Padding(8, 2, 8, 2); _documents = new TabbedDocumentCollection(this); _activeFilesContextMenuHandler = new TabbedDocumentControlActiveFilesContextMenuHandler(this); this.TabStop = true; _titles = new TabbedDocumentTitlesCollection(this); SetStyle(ControlStyles.Selectable, true); }
public MemoryStream Save(GffRootStruct root) { _bw = new LatinBinaryWriter(new MemoryStream()); _rt = root; _ext = root.Extention; DfaF = new DoubleDictionary <GffFieldFrame, GffComponent>(); DsaS = new DoubleDictionary <GffStructFrame, GffStruct>(); CreateFrames(_rt); FillFrames(); WriteData(); var res = _bw.BaseStream; _bw.Close(); return((MemoryStream)res); }
public void Place(float serverTime, int cabientID) { var cab = Cabient.cabients[cabientID]; // only recognize the latest if (serverTime < lastServerTime) { // a late message, still place near station rb.isKinematic = false; rb.position = cab.placeTransform.position; rb.rotation = Quaternion.identity; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; transform.position = cab.placeTransform.position; transform.rotation = Quaternion.identity; return; } // pop any item on the cabient var item = DoubleDictionary <Cabient, ItemEntity> .Get(cab); if (item) { var itemrb = item.rb; itemrb.isKinematic = false; itemrb.velocity = Vector3.zero; itemrb.angularVelocity = Vector3.zero; } DoubleDictionary <Cabient, ItemEntity> .Remove(cab); rb.isKinematic = true; rb.position = cab.placeTransform.position; rb.rotation = Quaternion.identity; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; transform.position = cab.placeTransform.position; transform.rotation = Quaternion.identity; DoubleDictionary <PlayerEntity, ItemEntity> .Remove(this); DoubleDictionary <Cabient, ItemEntity> .Set(cab, this); lastServerTime = serverTime; }
public void Drop(float serverTime) { // only recognize the latest if (serverTime < lastServerTime) { return; } rb.isKinematic = false; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; DoubleDictionary <PlayerEntity, ItemEntity> .Remove(this); DoubleDictionary <Cabient, ItemEntity> .Remove(this); lastServerTime = serverTime; }
public void Throw(float serverTime) { // only recognize the latest if (serverTime < lastServerTime) { return; } rb.isKinematic = false; rb.velocity = transform.forward * 10f; // i find setting the velocity to work a lot better than force rb.angularVelocity = Vector3.zero; DoubleDictionary <PlayerEntity, ItemEntity> .Remove(this); DoubleDictionary <Cabient, ItemEntity> .Remove(this); lastServerTime = serverTime; }
/// <summary> /// </summary> /// <param name="da"/> /// <param name="aeqp"/> /// <param name="wips"/> /// <param name="handled"/> public void ON_DISPATCHED0(DispatchingAgent da, AoEquipment aeqp, IHandlingBatch[] wips, ref bool handled) { if (wips != null) { DoubleDictionary <Step, object, StepPlan> stepPlans = StepPlanManager.Current.RunPlans; foreach (var wip in wips) { foreach (var stepPlan in stepPlans) { if (stepPlan.Step.StepID != wip.CurrentStep.StepID) { continue; } Tuple <string, string, string> key = stepPlan.Key as Tuple <string, string, string>; string lineID = key.Item1; string stepID = key.Item2; string prodID = key.Item3; var lot = wip.Sample as MicronBEAssyBELot; if (lineID != lot.LineID) { continue; } if (prodID != lot.Product.ProductID) { continue; } var target = stepPlan.StepTargetList.FirstOrDefault(); if (target == null) { continue; } target.Peg(lot, lot.UnitQty); } } } }
/// <summary> /// Creates a DoubleDictionary. /// </summary> /// <typeparam name="TSource">The element type of the source collection.</typeparam> /// <typeparam name="TKey1">The type of key 1.</typeparam> /// <typeparam name="TKey2">The type of key 2.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> /// <param name="source">The source collection.</param> /// <param name="key1Selector">The key 1 selector.</param> /// <param name="key2Selector">The key 2 selector.</param> /// <param name="valueSelector">The value selector.</param> /// <returns></returns> public static DoubleDictionary <TKey1, TKey2, TValue> ToDoubleDictionary <TSource, TKey1, TKey2, TValue>( this IEnumerable <TSource> source, Func <TSource, TKey1> key1Selector, Func <TSource, TKey2> key2Selector, Func <TSource, TValue> valueSelector) { var result = new DoubleDictionary <TKey1, TKey2, TValue>(); foreach (var element in source) { var key1 = key1Selector(element); var key2 = key2Selector(element); var value = valueSelector(element); result[key1][key2] = value; } return(result); }
public static void SavePrims(DoubleDictionary <uint, UUID, Primitive> prims, string path, ImportSettings options) { // Delete all of the old linkset files try { Directory.Delete(path, true); Directory.CreateDirectory(path); } catch (Exception ex) { Logger.Log("Failed saving prims: " + ex.Message, Helpers.LogLevel.Error); return; } // Copy the double dictionary to a temporary list for iterating List <Primitive> primList = new List <Primitive>(); prims.ForEach(delegate(Primitive prim) { primList.Add(prim); }); foreach (Primitive p in primList) { if (p.ParentID == 0) { Linkset linkset = new Linkset(); linkset.Parent = ImportCommand.Importing.APrimToCreate(p); prims.ForEach(delegate(Primitive q) { if (q.ParentID == p.LocalID) { linkset.Children.Add(ImportCommand.Importing.APrimToCreate(q)); } }); OarFile.SaveLinkset(linkset, path + "/Primitive_" + linkset.Parent.NewID.ToString() + ".xml", false, options); } } }
public void SetByIndexerTest() { var d = new DoubleDictionary <int, string>(); d[1] = "one"; d[10] = "ten"; d[100] = "hundred"; Assert.AreEqual(3, d.Count); Assert.AreEqual("ten", d[10]); d[100] = "one hundred"; Assert.AreEqual("one hundred", d[100]); Assert.ThrowsException <InvalidOperationException>(() => d[2] = "one"); Assert.ThrowsException <InvalidOperationException>(() => d[10] = "one"); Assert.AreEqual(3, d.Count); Assert.AreEqual("ten", d[10]); }
public MergeInfo(SymGraph <TFunc, TADomain> result, SymGraph <TFunc, TADomain> g1, SymGraph <TFunc, TADomain> g2, bool widen) { this.mappings = DoubleImmutableMap <SymValue, SymValue, SymValue> .Empty(SymValue.GetUniqueKey); this.visited_key1 = ImmutableSet <SymValue> .Empty(SymValue.GetUniqueKey); this.visited_multi_edges = new HashSet <Tuple <SymValue, SymValue, MultiEdge <TFunc, TADomain> > > (); this.pending_counts = new DoubleDictionary <SymValue, SymValue, int> (); this.manifested = new HashSet <SymValue> (); this.LastCommonVariable = result.IdGenerator; this.Widen = widen; this.Result = result; this.Graph1 = g1; this.Graph2 = g2; this.Changed = false; }
DoubleDictionary <SystemLanguage, string, string> CreateLanguageKeyTextDictionary(params SystemLanguage[] languages) { Debug.Assert(languages.Length > 0, "使う言語が何もしていされていません"); var languageKeyWords = new DoubleDictionary <SystemLanguage, string, string>(); foreach (var item in items) { foreach (var pair in item.pairs) { if (System.Enum.TryParse <SystemLanguage>(pair.language, out var lang)) { if (System.Array.IndexOf(languages, lang) < 0) { continue; } languageKeyWords.Add(lang, item.key, pair.text); } } } return(languageKeyWords); }
public static void SavePrims(DoubleDictionary<uint, UUID, Primitive> prims, string path) { // Delete all of the old linkset files try { Directory.Delete(path, true); Directory.CreateDirectory(path); } catch (Exception ex) { Logger.Log("Failed saving prims: " + ex.Message, Helpers.LogLevel.Error); return; } // Copy the double dictionary to a temporary list for iterating List<Primitive> primList = new List<Primitive>(); prims.ForEach(delegate(Primitive prim) { primList.Add(prim); }); foreach (Primitive p in primList) { if (p.ParentID == 0) { Linkset linkset = new Linkset(); linkset.Parent = p; prims.ForEach(delegate(Primitive q) { if (q.ParentID == p.LocalID) linkset.Children.Add(q); }); SaveLinkset(linkset, path + "/Primitive_" + linkset.Parent.ID.ToString() + ".xml"); } } }
void LazyInitialize() { if (items == null) items = new DoubleDictionary<UUID, string, InventoryTaskItem>(); }
internal GroupGRManager(Group group) { m_group = group; m_ggrInstanceTable = new DoubleDictionary<Type, object, GlobalGestureRecognizer>(); m_lgrInstanceTable = new DoubleDictionary<Type, IGestureListener, Dictionary<object, LocalGestureRecognizer>>(); m_targetLgrInstancesTable = new Dictionary<IGestureListener, List<GestureRecognizer>>(); m_currentPN = 0; m_pns = new List<int>(); m_processing = true; m_armedGRs = new List<GestureRecognizer>(); m_unarmedLGRs = new Dictionary<int, List<LocalGestureRecognizer>>(); m_unarmedGGRs = new Dictionary<int, List<GlobalGestureRecognizer>>(); GestureEventRegistry.Subscribe(this); }
public SceneManager() { m_instance = this; m_localScenes = new DoubleDictionary<UUID, string, Scene>(); }