static void init_part(part part, string textureName)//Material material) { if (part == null) { return; } }
public AddpartViewModel(process process ) { this.process = process; this.num = process.parts.Count+1; types = new List<TypePart>(); types.Add(new TypePart(1)); types.Add(new TypePart(2)); types.Add(new TypePart(3)); types.Add(new TypePart(4)); types.Add(new TypePart(5)); types.Add(new TypePart(6)); types.Add(new TypePart(7)); types.Add(new TypePart(8)); types.Add(new TypePart(9)); types.Add(new TypePart(10)); save = new Command(()=> { if (Name.ToString().Length == 0) { erour.Add("الرجاء كتابة إسم العملية "); } if (Code.ToString().Length != 15) { erour.Add(" كود العملية يجب أن يحتوي على 15 حرف" + Code.ToString().Length); } if (Num.ToString().Length == 0) { erour.Add("الرجاء كتابة رقم الثابت للعملية "); } if (erour.Count == 0) { var part = new part() { Name=name, Cost=cost, Id_Pro=process.Id, num_type= numtype.numType, num=num, alpart= alhcost }; Ico.getValue<db>().GetUnivdb().parts.Add(part); Ico.getValue<db>().GetUnivdb().SaveChanges(); Ico.getValue<ContentApp>().back(); }); back = new Command(()=> { Ico.getValue<ContentApp>().back(); }); }
public Adddafa3VewModel(part part) { this.part = part; this.namepro = part.process.Name; this.cost = cost; this.namepart = part.Name; var client = part.card_kanoni.ToList().FirstOrDefault().client; this.nameclient = client.Name; this.codebankclient = client.num_account; this.bankclient = client.bank; savecommand = new Command(() => {; if ((part.mcost - part.nowcost) >= Cost) { acc(); var card = Ico.getValue <db>().GetUnivdb().card_dafa3.ToList().Where(c => c.id_part == part.Id).OrderByDescending(c => c.num).ToList().FirstOrDefault(); var num = 1; if (card != null) { num = card.num + 1; } var card_dafa3 = new card_dafa3() { date = DateTime.Now, num = num, id_part = part.Id, Cost = Cost, alcost = AlCost, location = " ", id_year = Ico.getValue <Date>().GetNowDate().Id , tswiya = null }; Ico.getValue <db>().GetUnivdb().parts.ToList().Where(c => c.Id == part.Id).SingleOrDefault().nowcost += Cost; // Ico.getValue<db>().GetUnivdb().processes.ToList().Where(p => p.Id == card_kanoni.part.Id_Pro).ToList().First().parts.ToList().Where(p => p.Id == card_kanoni.id_part).ToList().First().nowcost += Cost; Ico.getValue <db>().GetUnivdb().card_dafa3.Add(card_dafa3); Ico.getValue <db>().savedb(); saveElement(); con(); } else { MessageBox.Show("المبلغ أكبر من الرصيد المتاح"); } // var cardm = Ico.getValue<db>().GetUnivdb().card_mo7sabi.ToList().Where(c => c.Id == card_mo7sabi.Id).SingleOrDefault(); // Ico.gtValue<ContentApp>().SetPage(new Viewdafa3(cardm)); }); Cancelcommand = new Command(() => { con(); }); }
public void inTilData(part part) { this.process = part.process; this.part = new Part(part); ItemDafa3S = CreateItem(); this.newcost = (part.nowcost); this.old_cost = (part.mcost - part.nowcost); }
public Adddafa3(part part, Action addItem) { InitializeComponent(); this.DataContext = new Adddafa3VewModel(part) { saveElement = addItem , THIS = this }; }
public Adddafa3(part part, Action accept, Action Cancel, Action addItem) { InitializeComponent(); this.DataContext = new Adddafa3VewModel(part) { acc = accept, con = Cancel, saveElement = addItem }; }
public AddpartCardViewModel(part part, Action accept, Action Cancel) { this.namepart = part.Name; this.cost = part.Cost; this.nameprocess = part.process.Name; this.part = part; clients = Ico.getValue <db>().GetUnivdb().clients.ToList(); savecommand = new Command(() => { accept(); Task.Run(() => { var cardn = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == part.Id_Pro && c.year == Ico.getValue <Date>().GetNowDate().Id).OrderByDescending(c => c.num).ToList().FirstOrDefault(); var num = 1; if (cardn != null) { num = cardn.num + 1; } var d = DateTime.Now; var name = "بطاقة إلتزام قانوني رقم " + num + " سنة " + d.Year; var card = new card() { id_prosess = part.process.Id, year = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id, num = num, location = Ico.getValue <IO>().CREATE_F_kanoni(part.process.location) + "\\" + name, date = DateTime.Now, }; var kanoni = new card_kanoni() { card = card, id_client = client.Id, id_part = part.Id, cost = part.Cost, visa = null }; Ico.getValue <db>().GetUnivdb().cards.Add(card); Ico.getValue <db>().GetUnivdb().card_kanoni.Add(kanoni); Ico.getValue <db>().savedb(); Card_kanoniExecl card_Kanoni = new Card_kanoniExecl(Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == part.Id).ToList().FirstOrDefault()); card_Kanoni.CreateCard(); Cancel(); }); }); Cancelcommand = new Command(() => { Cancel(); }); addclient = new Command(() => { Ico.getValue <ContentApp>().page = new AddClient(); }); }
private static void serializeObject(string filename, part newpart) { // Create a datetime format object DateTimeFormatInfo dateFormat = new CultureInfo("en-US").DateTimeFormat; try { //create an eConnect schema object IVItemMasterType iv = new IVItemMasterType(); taUpdateCreateItemRcd newItem = new taUpdateCreateItemRcd(); newItem.ITEMNMBR = newpart.itemNumber; //Item number newItem.ITEMDESC = newpart.description; //Item description newItem.ITMSHNAM = "temp"; //short desc newItem.ITMGEDSC = "temp"; //general desc newItem.UseItemClass = 1; newItem.ITMCLSCD = newpart.category; //Part or Assembly newItem.ITEMTYPESpecified = true; //Say custom itemtype is being used newItem.ITEMTYPE = 1; //Sales item newItem.UOMSCHDL = newpart.units; newItem.DECPLCURSpecified = true; //Say a custom decplcur is being used newItem.DECPLCUR = 3; //Needed to make item in IVR10015 newItem.NOTETEXT = newpart.purchasing; newItem.UpdateIfExists = 0; //Populate schema object with newItem info iv.taUpdateCreateItemRcd = newItem; // Create an array that holds ItemMasterType objects // Populate the array with the ItemMasterType schema object IVItemMasterType[] myItemType = { iv }; // Create an eConnect XML document object and populate it // with the ItemMasterType schema object eConnectType eConnect = new eConnectType(); eConnect.IVItemMasterType = myItemType; // Create a file to hold the serialized eConnect XML document FileStream fs = new FileStream(filename, FileMode.Create); XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding()); // Serialize the eConnect document object to the file using the XmlTextWriter. XmlSerializer serializer = new XmlSerializer(eConnect.GetType()); serializer.Serialize(writer, eConnect); writer.Close(); } //If an eConnect exception occurs, notify the user catch (eConnectException ex) { Console.Write(ex.ToString()); } }
public Adddafa3(part part, Viewdafa3VewModel Sample4Contentviw, Action accept, Action Cancel, Action addItem) { InitializeComponent(); this.DataContext = new Adddafa3VewModel(part) { acc = accept, con = Cancel, saveElement = addItem, Sample4Contentviw = Sample4Contentviw, THIS = this }; }
public Adddafa3(part part, Action accept, Action Cancel, Action addItem) { MessageBox.Show(Sample4Contentviw + ""); InitializeComponent(); this.DataContext = new Adddafa3VewModel(part) { acc = accept, con = Cancel, saveElement = addItem, Sample4Contentviw = Sample4Contentviw }; }
private void fillPartDetails() { if (!string.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); OnlinePurchase choosePart = new OnlinePurchase(); productdb product = choosePart.chooseProduct(id); LegacyPartsDB l = new LegacyPartsDB(); part pt = l.chooseParts(id); lblPrice.Text = "Price per Unit : $ " + pt.price; lblTitle.Text = pt.description; if (product == null) { imgProduct.ImageUrl = "~/Images/Products/NoImageFound.jpg"; //int q = Convert.ToInt32(product.qty); //if (q == null) Quantity.Visible = false; //int[] qty = Enumerable.Range(0, 0).ToArray(); //Quantity.DataSource = qty; //Quantity.AppendDataBoundItems = true; //Quantity.DataBind(); Availability.Text = "Not available"; btnAddCart.Visible = false; } else { imgProduct.ImageUrl = "~/Images/Products/" + product.image; int q = Convert.ToInt32(product.qty); if (q == 0) { Quantity.Visible = false; Availability.Text = "Not available"; btnAddCart.Visible = false; } else { int[] qty = Enumerable.Range(1, q).ToArray(); Quantity.DataSource = qty; Quantity.AppendDataBoundItems = true; Quantity.DataBind(); Availability.Text = "Available"; } } } }
// Called by a floating part when you pick it up public void pickup_part(part partType, int p) { my_parts[playerID].val[(int)partType]++; if (partType == part.horn) { my_parts[playerID].horns.Add(p); } SoundManager.instance.PlayOnce(pick_up_sound); pickup_player_ids[playerID].val[(int)partType] = p; //Debug.Log("Car now has " + (my_parts[playerID].val[(int)partType]) + " " + partType + "(s)"); }
public static void part_draw(part part, float[] M, float[] p, float r, float rz, float s) { Video.MODELVIEW_PushMatrix(); { Video.MODELVIEW_Translate(r * p[0], p[1], r * p[2]); Video.MODELVIEW_MultMatrix(M); Video.MODELVIEW_Rotate(rz, 0, 0, 1); Video.MODELVIEW_Scale(s, s, 1.0f); //Video.CallList(part_list); part_list_draw(); } Video.MODELVIEW_PopMatrix(); }
public virtual void Injury(int dmg, part bodyPart) { //wsadz to w formule TODO float dmgMultiplier = 1f; float armorDecreaser = 1f; int armorFlat = 0; string stringPart = ""; if (bodyPart == part.head) { stringPart = "head"; dmgMultiplier = Formulas.HEAD_DMG_MULTIPLIER; if (helmet) { armorDecreaser = Formulas.DefenseFormula(helmet.defense, dmg); armorFlat = helmet.flatDefense; } } else if (bodyPart == part.chest) { stringPart = "chest"; if (armor) { armorDecreaser = Formulas.DefenseFormula(armor.defense, dmg); armorFlat = armor.flatDefense; } } else if (bodyPart == part.legs) { stringPart = "legs"; dmgMultiplier = Formulas.LEG_DMG_MULTIPLIER; if (armor) { if (armor.protectLegs) { armorDecreaser = Formulas.DefenseFormula(armor.defense, dmg); armorFlat = armor.flatDefense; } } } dmg = Formulas.DamageFormula(dmg, dmgMultiplier, armorDecreaser, armorFlat); hp -= dmg; log.Send(nickname + " was hit in the " + stringPart + " for " + dmg + " HP"); if (hp < 1) { Death(); } }
public void inTilData(part part) { this.process = part.process; this.part = new Part(part); ItemDafa3S = CreateItem(); double d = 0; foreach (var m in part.card_mo7sabi.ToList().Where(c => c.card.date.Year < Ico.getValue <Date>().GetNowDate().year1.Year + 1)) { d += m.cost; } this.newcost = (part.nowcost); this.old_cost = (d - part.nowcost); }
public void inTilData(part part) { this.process = part.process; this.part = new Part(part); ItemDafa3S = CreateItem(); double d = 0; foreach (var m in part.card_mo7sabi.ToList()) { d += m.cost; } this.newcost = (part.nowcost); this.old_cost = (d - part.nowcost); }
public part chooseParts(int id) { try { using (csci467Entities db = new csci467Entities()) { part p = db.parts.Find(id); return(p); } } catch (Exception e) { throw e; } }
public string partName(int id) { try { using (csci467Entities db = new csci467Entities()) { part p = db.parts.Find(id); string name = p.description; return(name); } } catch (Exception) { return(null); } }
public Viewdafa3VewModel(part part) { this.inTilData(part); this.client = part.card_kanoni.ToList().FirstOrDefault().client.Name; visa = "لم يتحصل على فيزا إلى حد الان .."; back = new Command(() => { Ico.getValue <ContentApp>().back(); }); AddDafa3 = new Command(() => { Sample4Content = new Adddafa3(part, AcceptSample4Dialog, CancelSample4Dialog, () => { this.inTilData(Ico.getValue <db>().GetUnivdb().parts.ToList().Where(p => p.Id == part.Id).ToList().SingleOrDefault()); }); OpenSample4Dialog(); }); }
public static float ChanceToHit(Stats attacker, Transform defenderPart) { float distance = Distance(attacker.shootPoint.transform, defenderPart); ItemWeapon weapon = attacker.weapon; part bodyPart = defenderPart.GetComponent <BodyPart>().bodyPart; Stats defender = defenderPart.GetComponent <BodyPart>().owner; float modeP = attacker.accuracyModePenalty; float stateB = attacker.accuracyStateBonus; float stateP = defender.defenseStateBonus; //STEP 1: out of range if ((weapon.effectiveRange / RANGE_SCALER) * 10 < distance) { return(0); } //STEP 2: formula float chanceToHit; chanceToHit = (attacker.accuracy * 4 * ((float)weapon.accuracy / 100 + 1) / (distance / 7)) * modeP * stateB * stateP; //STEP 3: 1/2 cth if out of effectiveRange if (weapon.effectiveRange / RANGE_SCALER < distance) { chanceToHit /= 2; } //STEP 4: 1/2 cth if head if (bodyPart == part.head) { chanceToHit /= 2; } //STEP 5: minor window for miss if cth < 200 if (chanceToHit > 200) { chanceToHit = 100; } else if (chanceToHit > 95) { chanceToHit = 95; } return(chanceToHit); }
public void createNewItem(part newpart) { using (eConnectMethods eConCall = new eConnectMethods()) { try { // Create the eConnect document and store it in a file serializeObject("C:\\newItem.xml", newpart); // Load the eConnect XML document from the file into // and XML document object XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("C:\\newItem.xml"); // Create an XML string from the document object string salesOrderDocument = xmldoc.OuterXml; // Create a connection string // Integrated Security is required. Integrated security=SSPI // Update the data source and initial catalog to use the names of // data server and company database string sConnectionString = "data source=Sandbox-PC\\DTIGP;initial catalog=DTI;integrated security=SSPI;persist security info=False;packet size=4096"; // Use the CreateTransactionEntity method to create the sales document in Microsoft Dynamics GP // The method returns a string that contains the doc ID number of the new sales document string salesOrder = eConCall.CreateTransactionEntity(sConnectionString, salesOrderDocument); } // The eConnectException class will catch any business logic related errors from eConnect_EntryPoint. catch (eConnectException exp) { Console.Write(exp.ToString()); } // Catch any system error that might occurr. Display the error to the user catch (Exception ex) { Console.Write(ex.ToString()); } finally { // Use the Dipose method to release resources associated with the // eConnectMethods objects eConCall.Dispose(); } } }
// Send a specific part flying off public void lose_part(part partType, Vector3 collisionImpulse) { lostPartDelay = partConfig.delayBetweenLosingParts; Vector3 partImpulse = collisionImpulse + Vector3.up * collisionImpulse.magnitude * partConfig.flyingPartImpulseUpBoost; // TODO - make this go up partImpulse = partImpulse.normalized * collisionImpulse.magnitude; partImpulse *= partConfig.flyingPartImpulseMult; partImpulse = new Vector3(partImpulse.x, Mathf.Abs(partImpulse.y), partImpulse.z); if (my_parts[playerID].val[(int)partType] <= 0) { Debug.LogError("Trying to lose part that you're already out of: " + partType); } Sum <int, Unit> hornID = Sum <int, Unit> .Inr(new Unit()); if (partType == part.horn && my_parts[playerID].horns.Count > 0) { hornID = Sum <int, Unit> .Inl(my_parts[playerID].horns[0]); my_parts[playerID].horns.RemoveAt(0); } my_parts[playerID].val[(int)partType]--; foreach (part_prefab pp in partConfig.partPrefabs) { if (pp.Part == partType) { if (!pp.Prefab) { Debug.LogError("No floating part prefab available for part: " + pp.Part + ". Please make one and add it to partConfig"); return; } GameObject floatingPart = Instantiate(pp.Prefab); floatingPart.transform.position = transform.position + Vector3.up * partConfig.flyingPartYOffset * Random.Range(1f, 3f); floatingPart.GetComponent <Rigidbody>().AddForce(partImpulse, ForceMode.Impulse); floatingPart.GetComponent <playerID>().p = hornID.Match(i => i, u => playerID); return; } } Debug.LogError("No part prefab found for part: " + partType); }
public ViewpartViewModel(part part) { this.cost = part.Cost; this.name = part.Name; this.process = part.process; this.Code = process.Code; this.Name = process.Name; this.alhcost = part.alpart; foreach (part p in process.parts.ToList()) { nowcost += p.Cost; } type = new TypePart(part.num_type); back = new Command(() => { Ico.getValue <ContentApp>().back(); }); }
public void addBoMHeaderTemp(part headerPart) { openGPSQL(); try { SqlCommand myCommand = new SqlCommand("Insert_BoMHeaderTemp", gpsql); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@ItemNumber", headerPart.itemNumber); myCommand.Parameters.AddWithValue("@Revision", headerPart.revision); myCommand.Parameters.AddWithValue("@EffectiveDate", headerPart.effectiveDate); int reader = myCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error performing SQL command AddTempBoMHeader. Contact database Administrator: " + ex.ToString()); } closeSQL(); }
public AddpartCardViewModel(part part, Action accept, Action Cancel) { this.namepart = part.Name; this.cost = part.Cost; this.nameprocess = part.process.Name; this.part = part; clients = Ico.getValue <db>().GetUnivdb().clients.ToList(); savecommand = new Command(() => { accept(); }); Cancelcommand = new Command(() => { Cancel(); }); addclient = new Command(() => { Ico.getValue <ContentApp>().page = new AddClient(); }); }
public async Task Creat_card(part part) { await Task.Run(() => { var cardn = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == part.Id_Pro && c.year == Ico.getValue <Date>().GetNowDate().Id).OrderByDescending(c => c.num).ToList().FirstOrDefault(); var num = 1; if (cardn != null) { num = cardn.num + 1; } var d = DateTime.Now; var name = "بطاقة إلتزام قانوني رقم " + num + " سنة " + d.Year; var card = new card() { id_prosess = part.process.Id, year = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id, num = num, location = Ico.getValue <IO>().CREATE_F_kanoni(part.process.location) + "\\" + name, date = DateTime.Now, }; var kanoni = new card_kanoni() { card = card, id_client = client.Id, id_part = part.Id, cost = part.Cost, visa = null }; Ico.getValue <db>().GetUnivdb().cards.Add(card); Ico.getValue <db>().GetUnivdb().card_kanoni.Add(kanoni); Ico.getValue <db>().savedb(); Card_kanoniExecl card_Kanoni = new Card_kanoniExecl(Ico.getValue <db>().GetUnivdb().card_kanoni.ToList().Where(c => c.id_part == part.Id).ToList().FirstOrDefault()); card_Kanoni.CreateCard(); Cancel(); }); }
public void addBoMLineTemp(part linePart) { openGPSQL(); int subCat = 0; if (linePart.category.Equals("Part")) { subCat = 1; } if (linePart.position != "") { try { SqlCommand myCommand = new SqlCommand("Insert_BoMLineTemp", gpsql); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@ParentNumber", linePart.parent); myCommand.Parameters.AddWithValue("@ChildNumber", linePart.itemNumber); myCommand.Parameters.AddWithValue("@SubCat", subCat); myCommand.Parameters.AddWithValue("@BoMSeq", linePart.position); myCommand.Parameters.AddWithValue("@Position", Int32.Parse(linePart.position)); myCommand.Parameters.AddWithValue("@Quantity", float.Parse(linePart.quantity)); myCommand.Parameters.AddWithValue("@EffectiveDate", linePart.effectiveDate); myCommand.Parameters.AddWithValue("@Units", linePart.units); int reader = myCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error performing SQL command AddBoMTempLinevarchar . Contact database Administrator: " + ex.ToString()); } } else { MessageBox.Show("Part number: " + linePart.itemNumber + " will not be added because no position value was given."); } closeSQL(); }
public AddpartCardViewModel(part part, Action accept, Action Cancel) { this.namepart = part.Name; this.cost = part.Cost; this.nameprocess = part.process.Name; this.part = part; clients = Ico.getValue <db>().GetUnivdb().clients.ToList(); savecommand = new Command(() => { accept(); var card = new card() { id_prosess = part.process.Id, year = Ico.getValue <db>().GetUnivdb().years.ToList().LastOrDefault().Id, num = Ico.getValue <db>().GetUnivdb().cards.ToList().Where(c => c.id_prosess == part.process.Id).ToList().Count + 1, location = "", date = DateTime.Now, }; var kanoni = new card_kanoni() { card = card, id_client = client.Id, id_part = part.Id, cost = part.Cost, visa = null }; Ico.getValue <db>().GetUnivdb().cards.Add(card); Ico.getValue <db>().GetUnivdb().card_kanoni.Add(kanoni); Ico.getValue <db>().savedb(); Cancel(); }); Cancelcommand = new Command(() => { Cancel(); }); addclient = new Command(() => { Ico.getValue <ContentApp>().page = new AddClient(); }); }
// Token: 0x06000BA8 RID: 2984 RVA: 0x00096738 File Offset: 0x00094B38 public Equipment(part partType, int boss, float curAtk, float capAtk, float curDef, float capDef, specType type1, float cur1, float cap1, specType type2, float cur2, float cap2, specType type3, float cur3, float cap3, string source, int pid) { this.id = pid; this.path = source; this.type = partType; this.curAttack = curAtk; this.capAttack = capAtk; this.curDefense = curDef; this.capDefense = capDef; this.spec1Type = type1; this.spec1Cur = cur1; this.spec1Cap = cap1; this.spec2Type = type2; this.spec2Cur = cur2; this.spec2Cap = cap2; this.spec3Type = type3; this.spec3Cur = cur3; this.spec3Cap = cap3; this.removable = true; this.bossRequired = boss; this.level = 0; }
private static parts_layout_template from_string(string s) { settings_as_string sett = new settings_as_string(s); string rows = sett.get("rows"), parts = sett.get("parts"); parts_layout_template layout = new parts_layout_template(); foreach (var row_data in rows.Split(';')) { var cur_row = row_data.Split(','); Debug.Assert(cur_row.Length == 3); row r = new row(); r.label_width_ = int.Parse(cur_row[0]); r.row_width_ = int.Parse(cur_row[1]); int count = int.Parse(cur_row[2]); layout.rows_.Add(r); } foreach (var part_data in parts.Split(';')) { if (part_data == "") { continue; } var cur_part = part_data.Split(','); Debug.Assert(cur_part.Length == 6); row r = layout.rows_[int.Parse(cur_part[0])]; part p = new part(); p.type = (info_type)int.Parse(cur_part[1]); p.visible = cur_part[2] == "1"; p.multi_line = cur_part[3] == "1"; p.auto_resize = cur_part[4] == "1"; p.line_count = int.Parse(cur_part[5]); r.parts_.Add(p); } layout.name_ = sett.get("name"); return(layout); }
private static parts_layout_template from_string(string s) { settings_as_string sett = new settings_as_string(s); string rows = sett.get("rows"), parts = sett.get("parts"); parts_layout_template layout = new parts_layout_template(); foreach (var row_data in rows.Split(';')) { var cur_row = row_data.Split(','); Debug.Assert(cur_row.Length == 3); row r = new row(); r.label_width_ = int.Parse(cur_row[0]); r.row_width_ = int.Parse(cur_row[1]); int count = int.Parse(cur_row[2]); layout.rows_.Add(r); } foreach (var part_data in parts.Split(';')) { if (part_data == "") continue; var cur_part = part_data.Split(','); Debug.Assert(cur_part.Length == 6); row r = layout.rows_[int.Parse(cur_part[0]) ]; part p = new part(); p.type = (info_type) int.Parse(cur_part[1]); p.visible = cur_part[2] == "1"; p.multi_line = cur_part[3] == "1"; p.auto_resize = cur_part[4] == "1"; p.line_count = int.Parse(cur_part[5]); r.parts_.Add(p); } layout.name_ = sett.get("name"); return layout; }
public question(XmlNode x) { text = getText(x); parts = new List<part>(); XmlElement qs = x["parts"]; if (qs == null) return; foreach (XmlNode n in qs.ChildNodes) { part p = new part(n); parts.Add(p); } shuffle = getshuffle((XmlNode)(qs), parts.Count); }
// <a link> ... </a> // <b> ... </b> // <i> ... </i> // <fg #col>.... </fg> // <bg #col>.... </bg> // <font name>... </font> public void set_text(string text) { print_info cur_print = new print_info(); string cur_link = ""; parts_.Clear(); while (text != "") { int delimeter = text.IndexOf("<"); if (delimeter > 0) { var new_ = new part { text = text.Substring(0, delimeter), link = cur_link }; cur_link = ""; new_.print.copy_from(cur_print); if ( new_.link != "") new_.print.fg = Color.DodgerBlue; parts_.Add(new_); int end_delimeter = text.IndexOf(">", delimeter); string format = text.Substring(delimeter + 1, end_delimeter - delimeter - 1); parse_format(format, ref cur_print, ref cur_link); text = text.Substring(end_delimeter + 1); } else { // it was the last part var last = new part { text = text }; last.print.copy_from(cur_print); parts_.Add(last); text = ""; } } // also, it must allow for multiline (if so, print one line, and scroll at a give time) for (int i = 0; i < parts_.Count; ++i) { int enter = parts_[i].text.IndexOf("\r\n"); if (enter >= 0) { string before = parts_[i].text.Substring(0, enter); string after = parts_[i].text.Substring(enter + 2); parts_[i].text = before; parts_[i].ends_line = true; if (after != "") { var new_ = new part() {text = after, link = parts_[i].link}; new_.print.copy_from(parts_[i].print); parts_.Insert(i + 1, new_); } } } cur_line_idx_ = 0; Invalidate(); Update(); update_tip(); }
/// <summary> /// Keyboard actions for Part Two of the assignment /// </summary> private void PartTwoKeyboardActions() { KeyboardState curretKeyboardState = Keyboard.GetState(); Keys[] keys = curretKeyboardState.GetPressedKeys(); foreach (Keys key in keys) { if (CheckPressedKeys(key)) { switch (key) { case Keys.R: if (piecewise) { InitializePieceWise(); } else if (interpolation) { InitializeInterpolation(); } else if (approximation) { } break; case Keys.D1: // Piecewise linear motion pathing piecewise = true; interpolation = false; approximation = false; InitializePieceWise(); break; case Keys.D2: // Polynomial interpolation pathing piecewise = false; interpolation = true; approximation = false; InitializeInterpolation(); break; case Keys.D3: // Polynomial approximation pathing - Does nothing break; case Keys.S: moveOn = !moveOn; break; case Keys.F1: currentState = part.ONE; PartOneInitialize(); break; case Keys.Escape: this.Exit(); break; } } } lastKeyboardState = curretKeyboardState; }
/// <summary> /// Keyboard actions for Part One of the assignment /// </summary> private void PartOneKeyboardActions() { KeyboardState currentKeyboardState = Keyboard.GetState(); Keys[] keys = currentKeyboardState.GetPressedKeys(); foreach (Keys key in keys) { if (CheckPressedKeys(key)) { switch (key) { case Keys.R: moveOn = true; gravityOn = false; dragOn = false; kinecticOn = false; ball.velocity = new Vector3((float)randomNums.NextDouble(), (float)randomNums.NextDouble(), (float)randomNums.NextDouble()); ball.position = new Vector3((float)randomNums.Next(-5, 5), (float)randomNums.Next(-5, 5), (float)randomNums.Next(-5, 5)); break; case Keys.D1: // Turn Gravity on gravityOn = !gravityOn; break; case Keys.D2: // Turn Drag on dragOn = !dragOn; break; case Keys.D3: // Turn Loss of Kinect Energy kinecticOn = !kinecticOn; break; case Keys.D4: // Turn Everything On gravityOn = true; dragOn = true; kinecticOn = true; break; case Keys.S: moveOn = !moveOn; break; case Keys.F2: currentState = part.TWO; PartTwoInitialize(); break; case Keys.Escape: this.Exit(); break; } } } lastKeyboardState = currentKeyboardState; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); currentState = part.ONE; switch (currentState) { case part.ONE: PartOneInitialize(); break; case part.TWO: PartTwoInitialize(); break; } }