public NewNameForm(string newName, FisheryObjectNameType objectNameType) { InitializeComponent(); _newName = newName; _objectNameType = objectNameType; _newObjectName = new NewFisheryObjectName(_newName, _objectNameType); switch (_objectNameType) { case FisheryObjectNameType.CatchLocalName: Text = "New catch local name"; _similarNames = Names.GetSimilarSoundingLocalNames(_newObjectName); break; case FisheryObjectNameType.GearLocalName: Text = "New gear local name"; _similarNames = Gears.GetSimilarSoundingLocalNames(_newObjectName); break; } txtLocalName.Text = newName; listBoxSimilar.ValueMember = "key"; listBoxSimilar.DisplayMember = "value"; foreach (var item in _similarNames) { listBoxSimilar.Items.Add(item); } }
public void UpdatePowerTrainPacket(double speed, int rpm, Gears position, DriveGear driveGear) { this.Velocity = speed; this.RPM = rpm; this.GearShifterPostion = position; this.DriveGear = driveGear; }
private void CalculateInfo() { string[] infoArr = { "MOT", MOT.ToString(), "Sat Nav", SatNav.ToString(), "Locked", Locked.ToString(), "Manufacturer", Manufacturer, "Model", Model, "Wheels", Wheels.ToString(), "Gears", Gears.ToString(), "Fuel Level", FuelLevel.ToString(), "Fuel Type", FuelType.ToString(), "EngineCC", Engine.EngineCC.ToString(), "Mileage", Engine.Mileage.ToString(), "Service Needed", Engine.ServiceNeeded.ToString() }; for (int i = 0; i < infoArr.Length; i++) { Info = Info + infoArr[i] + ": "; i++; Info = Info + infoArr[i] + "\n"; } }
public override void Blacken(Gears vm) { foreach (GearsObjUpvalue upvalue in Upvalues) { vm.MarkObject(upvalue); } }
protected virtual void Initialize(Vector2?_acc = null, Vector2?_vel = null, float _mass = 1.0f, bool _friction = true) { // Set default values. this.direction = new Vector2(0, 1); // Right. this.acceleration = new Vector2(0, 1); // Not moving. this.velocity = new Vector2(0, 1); // Not moving. this.debugLine = new List <DebugLine>(); // Debug Lines. // Assign values. this.mass = Math.Abs(_mass); this.friction = _friction; this.gears = new Gears(); if (_acc != null && ((Vector2)_acc) != Vector2.Zero) { this.acceleration = (Vector2)_acc; } if (_vel != null && ((Vector2)_vel) != Vector2.Zero) { this.velocity = (Vector2)_vel; } CreateControlScheme(); }
public Cycle(string brand, string model, Gears gear, int price) { this.Brand = brand; this.Model = model; this.Gear = gear; this.Price = price; }
public void OnTargetGears(Mobile from, object targ) { Gears g = targ as Gears; if (g == null || !g.IsChildOf(from.Backpack)) { from.SendMessage("Those are not gears."); // Apparently gears that aren't in your backpack aren't really gears at all. :-( } else if (IsModified) { from.SendMessage("That has already been modified."); } else if (!IsChildOf(from.Backpack)) { from.SendMessage("This must be in your backpack to modify it."); } else if (from.Skills[SkillName.Fletching].Base < 100.0) { from.SendMessage("Only a grandmaster bowcrafter can modify this weapon."); } else { g.Consume(); Hue = 0x453; Slayer = (SlayerName)Utility.Random(2, 25); from.SendMessage("You modify it."); } }
private void OnGearClassChanged(object sender, EventArgs e) { int n = 0; string selectVariation = ""; cboGearVariation.Items.Clear(); foreach (var item in Gears.GearVariationsUsage(((KeyValuePair <string, string>)cboGearClasses.SelectedItem).Key)) { cboGearVariation.Items.Add(item); if (_parsedVariationName != item.Value.ToLower() && _parsedVariationName.Contains(item.Value.ToLower())) { if (n == 0) { selectVariation = item.Value; } else if (item.Value.Length > selectVariation.Length) { selectVariation = item.Value; } n++; } } cboGearVariation.DisplayMember = "value"; cboGearVariation.ValueMember = "key"; cboGearVariation.Text = selectVariation; if (cboGearVariation.Text == "") { cboGearVariation.Text = _variationName.Substring(_variationName.IndexOf('-') + 1).Trim(); } }
protected override void Initialize(Vector2?_acc = default(Vector2?), Vector2?_vel = default(Vector2?), float _mass = 1, bool _friction = true) { base.Initialize(_acc, _vel, _mass, _friction); exAcc = new Extents(8f, 0.07f, false, 0.04f); exSpeed = new Extents(1000.0f, 3f, false, 0.31f); gears = new Gears(10, 0, 1000f); }
public AbstractWidget(int size, bool isSmall) { this._size = size; this._isSmall = isSmall; _gears = new Gears(); _springs = new Springs(); _levers = new Levers(); }
public static Gears GetInstance() { if (!_instance) { _instance = (Gears)GameObject.FindObjectOfType(typeof(Gears)); } return(_instance); }
public Widget2(float price) { _Price = price; _Gears = new Gears(); _Springs = new Springs(); _Levers = new Levers(); _painted = new Painted(); }
private void Onbutton_Click(object sender, EventArgs e) { switch (((Button)sender).Name) { case "buttonCancel": DialogResult = DialogResult.Cancel; Close(); break; case "buttonOk": switch (_action) { case fad3GearEditAction.addGearVariation: _parentForm.UsageGearVariation(textBox.Text); break; case fad3GearEditAction.addGearCode: _parentForm.UsageGearCode($"{labelCode.Text}{textBox.Text}", checkBox.Checked); break; case fad3GearEditAction.addAOI: var AOIGuid = ((KeyValuePair <string, string>)comboBox.SelectedItem).Key; _parentForm.UsageTargetArea(AOIGuid, comboBox.Text); break; case fad3GearEditAction.addLocalName: var localNameGuid = ((KeyValuePair <string, string>)comboBox.SelectedItem).Key; _parentForm.UsageLocalName(localNameGuid, comboBox.Text); break; case fad3GearEditAction.editGearVariation: if (Gears.EditGearVariationName(textBox.Text, GearVariationName)) { GearVariationName = textBox.Text; DialogResult = DialogResult.OK; } else { MessageBox.Show("Editing gear variation name was not successful", "Editing not successful", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case fad3GearEditAction.editLocalName: if (Gears.EditGearLocalName(textBox.Text, GearLocalName)) { GearLocalName = textBox.Text; DialogResult = DialogResult.OK; } break; } Close(); break; } }
public AbstractWidget(int size, WidgetColor color) { this._size = size; this._color1 = color; _springs = new Springs(); _levers = new Levers(); _gears = new Gears(); }
/// <summary> /// Attempt to load a file and compile it. /// firstrun must be true to initialize classes and declare all globals. /// </summary> internal static bool TryLoadFromFile(string path, bool firstrun, out Gears gears, out string status) { gears = null; if (!LoxCompiler.TryCompileFromPath(path, out GearsChunk chunk, out status)) { return(false); } return(TryLoad(path, chunk, firstrun, ref gears, ref status)); }
private void FillList() { switch (_action) { case fad3GearEditAction.addGearVariation: _List = Gears.AllGearVariationNames(); foreach (var item in _List) { listBox.Items.Add(item); } break; case fad3GearEditAction.addGearCode: foreach (var item in Gears.GearCodesByClass(_GearClassGuid)) { listBox.Items.Add(item); } labelCode.Text = Gears.GearLetterFromGearClass(_GearClassGuid); break; case fad3GearEditAction.addAOI: case fad3GearEditAction.addLocalName: TargetArea targetArea = new TargetArea(); ((ComboBox)comboBox).With(o => { if (_action == fad3GearEditAction.addAOI) { foreach (var item in targetArea.TargetAreas) { comboBox.Items.Add(item); } } else { foreach (var item in Gears.GearLocalNames) { comboBox.Items.Add(item); } } o.DisplayMember = "Value"; o.ValueMember = "Key"; o.AutoCompleteMode = AutoCompleteMode.SuggestAppend; o.AutoCompleteSource = AutoCompleteSource.ListItems; }); for (int i = 0; i < comboBox.Items.Count; i++) { comboList.Add(((KeyValuePair <string, string>)comboBox.Items[i]).Value); } break; } }
// Konstruktor, a driveGearLabels es driveGearRatios alapjan feltolti a DriveGears tombot - ezek lesznek a Drive belso fokozatai public GearShifter() { this.Position = Gears.N; this.DriveGears = new Gear[7]; for (int i = 0; i < this.DriveGears.Length; i++) { this.DriveGears[i] = new Gear(this.driveGearRatios[i], this.driveGearLabels[i], i); } this.CurrentDriveGear = this.DriveGears[0]; }
public void SetGear(Gears gear) { if (Status != TransmissonStatus.Manual) { _writter.WriteLine(String.Format("You Cant change you gear, becouse Transmission is {0}", Status)); return; } Gear = gear; _writter.WriteLine(String.Format("Set gear - {0}", gear)); }
public virtual IQueryable <TEntity> Set <TEntity>() where TEntity : class { if (typeof(TEntity) == typeof(City)) { return((IQueryable <TEntity>)Cities.AsQueryable()); } if (typeof(TEntity) == typeof(CogTag)) { return((IQueryable <TEntity>)Tags.AsQueryable()); } if (typeof(TEntity) == typeof(Faction)) { return((IQueryable <TEntity>)Factions.AsQueryable()); } if (typeof(TEntity) == typeof(Gear)) { return((IQueryable <TEntity>)Gears.AsQueryable()); } if (typeof(TEntity) == typeof(Mission)) { return((IQueryable <TEntity>)Missions.AsQueryable()); } if (typeof(TEntity) == typeof(Squad)) { return((IQueryable <TEntity>)Squads.AsQueryable()); } if (typeof(TEntity) == typeof(SquadMission)) { return((IQueryable <TEntity>)SquadMissions.AsQueryable()); } if (typeof(TEntity) == typeof(Weapon)) { return((IQueryable <TEntity>)Weapons.AsQueryable()); } if (typeof(TEntity) == typeof(LocustLeader)) { return((IQueryable <TEntity>)LocustLeaders.AsQueryable()); } if (typeof(TEntity) == typeof(LocustHighCommand)) { return((IQueryable <TEntity>)LocustHighCommands.AsQueryable()); } throw new InvalidOperationException("Invalid entity type: " + typeof(TEntity)); }
public void SetGear(String name, int value) { if (Gears.ContainsKey(name)) { Gears[name] = value; } else { Gears.Add(name, value); } }
private void OnFieldValidating(object sender, CancelEventArgs e) { var s = ((Control)sender).Text; var name = ((Control)sender).Name; if (s.Length > 0) { switch (name) { case "txtCost": const string costMsg = "Expected value must be a number greater than zero"; if (!double.TryParse(s, out double v)) { e.Cancel = true; } else { e.Cancel = v <= 0; } if (e.Cancel) { MessageBox.Show(costMsg, "Validation error", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "cboExpenseItem": case "cboSource": var cbo = (ComboBox)sender; if (!cbo.Items.Contains(s)) { var msg = $"The list does not contain '{s}' \r\nDo you want to add a new item?"; if (MessageBox.Show(msg, "Item not found", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { switch (name) { case "cboExpenseItem": Gears.AddExpense(s); break; case "cboSource": Gears.AddPaymentSource(s); break; } cbo.Items.Add(s); } else { e.Cancel = true; } } break; } } }
private void AddNewGearLocalName(string newLocalName) { NewFisheryObjectName nfo = new NewFisheryObjectName(newLocalName, FisheryObjectNameType.GearLocalName); var result = Gears.SaveNewLocalName(nfo); if (result.success) { KeyValuePair <string, string> kv = new KeyValuePair <string, string>(result.newGuid, newLocalName); comboBox.Items.Add(kv); comboBox.SelectedItem = kv; } }
private void OnFormLoad(object sender, EventArgs e) { lblTitle.Text = $"Editing the gear:\r\n{_variationName}"; cboGearClasses.DisplayMember = "Value"; cboGearClasses.ValueMember = "Key"; foreach (var item in Gears.GetGearClassDictionary()) { KeyValuePair <string, string> gearClass = new KeyValuePair <string, string>(item.Key, item.Value.gearClassName); cboGearClasses.Items.Add(gearClass); } _parsedVariationName = _variationName.Substring(_variationName.IndexOf('-') + 1).Trim().ToLower(); cboGearClasses.Text = _variationName.Split('-')[0].Trim(); }
map.LAYER_HEIGHT_TILES = 35; map.TILE_DATA = "453tgfd,346tw,4e5trfr5,34tegdr,45tr"; } } }
public NewNameForm(NewFisheryObjectName newObjectName, string gearClassGuid = "") { InitializeComponent(); _newObjectName = newObjectName; switch (_newObjectName.NameType) { case FisheryObjectNameType.CatchLocalName: Text = "New catch local name"; _similarNames = Names.GetSimilarSoundingLocalNames(_newObjectName); lblNewType.Text = "New catch local name"; lblTitle.Text = " Add new catch local name"; break; case FisheryObjectNameType.GearLocalName: Text = "New gear local name"; _similarNames = Gears.GetSimilarSoundingLocalNames(_newObjectName); lblNewType.Text = "New gear local name"; lblTitle.Text = "Add new fishing gear local name"; break; case FisheryObjectNameType.GearVariationName: Text = "New gear variation name"; lblNewType.Text = "New gear variation name"; lblTitle.Text = "Add new gear variation name"; _gearClassGuid = gearClassGuid; break; case FisheryObjectNameType.FishingAccessory: Text = "New fishing accessory"; lblNewType.Text = "New accessory name"; lblTitle.Text = "Add new fishing accessory"; break; case FisheryObjectNameType.FishingExpense: Text = "New fishing expense"; lblNewType.Text = "New expense category"; lblTitle.Text = "Add new fishing expense"; break; } //DoLevenstein(); txtLocalName.Text = _newObjectName.NewName; listBoxSimilar.ValueMember = "key"; listBoxSimilar.DisplayMember = "value"; foreach (var item in _similarNames) { listBoxSimilar.Items.Add(item); } }
public AircraftStatusModel(AircraftStatusStruct status) { Latitude = status.Latitude; Longitude = status.Longitude; Altitude = status.Altitude; TotalFuel = status.TotalFuel; CurrentFuel = status.CurrentFuel; TrueHeading = status.TrueHeading; AirspeedIndicated = status.AirspeedIndicated; AirspeedTrue = status.AirspeedTrue; NavHasSignal = status.NavHasSignal; NavHasDME = status.NavHasDME; DMEDistance = status.DMEDistance; Autopilot = new AutoPilot() { Available = status.AutopilotAvailable, Master = status.AutopilotMaster, FlightDirector = status.AutopilotFlightDirector, AirspeedHold = status.AutopilotAirspeedHold, Airspeed = status.AutopilotAirspeed, AltitudeHold = status.AutopilotAltitudeHold, Altitude = status.AutopilotAltitude, Approach = status.AutopilotApproach, Autothrottle = status.AutopilotAutothrottle, Backcourse = status.AutopilotBackcourse, HeadingHold = status.AutopilotHeadingHold, HeadingDir = status.AutopilotHeadingDir, Level = status.AutopilotWingLevel, Mach = status.AutopilotMach, Nav1 = status.AutopilotNav1Hold, VerticalSpeedHold = status.AutopilotVerticalSpeedHold, VerticalSpeed = status.AutopilotVerticalSpeed, YawDamper = status.AutopilotYawDamper }; Gear = new Gears() { HandlePosition = status.GearHandlePosition, CenterPosition = status.GearCenterPosition, LeftPosition = status.GearLeftPosition, RightPosition = status.GearRightPosition, IsRetractable = status.GearIsRetractable, TotalPctExtended = status.GearTotalPctExtended, ParkingBrakePosition = status.ParkingBrakePosition }; }
/// <summary> /// Underlying - sets up a gears machine for this chunk. /// </summary> private static bool TryLoad(string path, GearsChunk chunk, bool firstrun, ref Gears gears, ref string status) { if (DebugTestSerialization && !TestSerializeDeserialize(chunk, path)) { status = $"Error serializing GearsChunk in LoxHandler.TryLoad: Could not serialize or deserialize '{path}'."; return(false); } try { gears = new Gears().Reset(chunk, firstrun); return(true); } catch (Exception e) { status = $"Error initializing Gears in {e.TargetSite.DeclaringType.Name}.{e.TargetSite.Name}: {path} {e}"; return(false); } }
void CalculateInfo() { string[] infoArr = { "Wheels", Wheels.ToString(), "Top Speed", TopSpeed.ToString(), "Gears", Gears.ToString(), "Fuel Level", FuelLevel.ToString() }; for (int i = 0; i < infoArr.Length; i++) { Info = Info + infoArr[i] + ": "; i++; Info = Info + infoArr[i] + "\n"; } }
//Called when the user click on any invnetory button public void ClickOnCategoryButton(string CategroyName) { CurrentClicedOnCategory_string = CategroyName; if (CategroyName == "Weapon") { CurrentClickedOnCategory = JobsAndWeapons[MyJob]; } else if (CategroyName == "OffHand") { CurrentClickedOnCategory = JobsAndOffhands[MyJob]; } else { CurrentClickedOnCategory = (Gears)Enum.Parse(typeof(Gears), CategroyName); } ListGears(CurrentClickedOnCategory); }
private static void Run(string source) { TokenList tokens = new Tokenizer(source).ScanTokens(); if (Compiler.TryCompile(tokens, out GearsChunk chunk, out string status)) { using (BinaryFileWriter writer = new BinaryFileWriter("compiled.lxx")) { chunk.Serialize(writer); writer.Close(); } Gears gears = new Gears(); gears.Reset(chunk); gears.AddNativeObject("TestObj", new TestNativeObject()); gears.Disassemble(chunk); Console.WriteLine("Press enter to run."); Console.ReadKey(); gears.Run(); } }
//A function that is responsible for listing all the gear icons and buttons in the character editor void ListGears(Gears TheGear) { //Clear the content of GearButtonsParent foreach (Transform child in GearButtonsParent) { Destroy(child.gameObject); } //Generate new buttons for (int i = 0; i < GearsAndSprites[TheGear].Count; i++) { GameObject newButton = Instantiate(GearButtonPrefab, GearButtonsParent); newButton.GetComponent <GearButtonClicker>().TakeInfo(TheGear, GearsAndSprites[TheGear][i], i); } //Change the side of the ScrollContent float NewScrollContentHeight = 30 + (Mathf.CeilToInt((float)GearsAndSprites[TheGear].Count / 5)) * 140; ScrollContent.sizeDelta = new Vector2(ScrollContent.sizeDelta.x, NewScrollContentHeight); }
public virtual IEnumerable <IniValueObject> ExportParameters() { List <IniValueObject> obj = new List <IniValueObject>(); obj.Add(new IniValueObject(new string[] { "Engine" }, "Idle", StallRpm.ToString())); obj.Add(new IniValueObject(new string[] { "Engine" }, "Max", MaximumRpm.ToString())); foreach (var frame in Engine) { obj.Add(new IniValueObject(new string[] { "Engine" }, "Power", string.Format("({0},{1},{2})", frame.Key, frame.Value.N, frame.Value.P))); } obj.Add(new IniValueObject(new string[] { "Gearbox" }, "Gears", Gears.ToString())); obj.Add(new IniValueObject(new string[] { "Gearbox" }, "GearR", GearReverse.ToString())); for (int g = 0; g < Gears; g++) { obj.Add(new IniValueObject(new string[] { "Gearbox" }, "Gear", string.Format("({0},{1})", g, GearRatios[g]))); } return(obj); }