static void Main(string[] args) { IPrinterWindows printer; Console.WriteLine("Pilih Printer!!!"); Console.WriteLine("1. Epson"); Console.WriteLine("2. Canon"); Console.WriteLine("3. LaserJet/\n"); Console.Write("Nomor Printer [1..3] : "); int nomorPrinter = Convert.ToInt32(Console.ReadLine()); if (nomorPrinter == 1) { printer = new Epson(); } else if (nomorPrinter == 2) { printer = new Canon(); } else { printer = new LaserJet(); } printer.show(); printer.print(); Console.ReadKey(); }
public void ControlCanon(Canon canon) { bool enabled = player.enabled; player.enabled = canon.enabled; canon.enabled = enabled; }
public async Task <List <Chapter> > SyncBookUsxAsync(TextInfo text, TextType textType, string paratextId, string fileName, bool isReadOnly, ISet <int> chaptersToInclude) { if (text.Chapters.Count < 1) { // The SF DB is corrupt. Also, the project doc in the SF DB has no record of any chapters that // we could synchronize. SortedList <int, IDocument <TextData> > allTextDocsForBook = await PessimisticallyFetchTextDocsAsync(text, textType); if (allTextDocsForBook.Count < 1) { // We don't have any chapter text docs for the book in the SF DB. _logger.LogWarning("SyncBookUsxAsync() detected a corrupt SF DB for project with paratext id " + $"{paratextId}, for book {text.BookNum}, TextType {textType}, because the TextInfo has an " + $"invalid chapter count of {text.Chapters.Count}. There aren't any chapter text docs for " + $"this book in the DB anyway though. Returning null to skip fetching or syncing this book."); return(null); } else { // We have chapter text docs for the book in the SF DB that the project doc did not know were there. // Throw an error and there may need to be a manual investigation to know how to sync this project. throw new Exception("SyncBookUsxAsync() stopped because there are chapter text docs for a " + $"project's book that are not known about by the project doc. And the project doc has an " + $"invalid description of book chapters. TextInfo booknum is {text.BookNum}. " + $"Text type is {textType}. Paratext project id is {paratextId}. The project TextInfo knows " + $"about {text.Chapters.Count} chapters, but in the DB there are {allTextDocsForBook.Count} " + "chapters for the book."); } } SortedList <int, IDocument <TextData> > dbChapterDocs = await FetchTextDocsAsync(text, textType); string bookId = Canon.BookNumberToId(text.BookNum); string ptBookText = await FetchFromAndUpdateParatextAsync(text, paratextId, fileName, isReadOnly, bookId, dbChapterDocs); if (ptBookText == null) { return(null); } await UpdateProgress(); XElement bookTextElem = ParseText(ptBookText); var usxDoc = new XDocument(bookTextElem.Element("usx")); Dictionary <int, ChapterDelta> incomingChapters = _deltaUsxMapper.ToChapterDeltas(usxDoc) .ToDictionary(cd => cd.Number); // Set SF DB to snapshot from Paratext. List <Chapter> chapters = await ChangeDbToNewSnapshotAsync(text, textType, chaptersToInclude, dbChapterDocs, incomingChapters); // Save to disk await SaveXmlFileAsync(bookTextElem, fileName); await UpdateProgress(); return(chapters); }
/// <summary> /// Fill untranslated resource. /// </summary> /// <param name="defaultResource"></param> /// <param name="localeResources"></param> /// <param name="locale"></param> protected static void FillResource(Canon.Data.Localization defaultResource, List<Canon.Data.Localization> localeResources, string locale) { var localeResource = from lr in localeResources where lr.ResourceSet == defaultResource.ResourceSet && lr.ResourceId == defaultResource.ResourceId select lr; if (localeResource.Count() == 0) { Canon.Data.Localization localization = new Canon.Data.Localization(); localization.ResourceId = defaultResource.ResourceId; localization.Value = defaultResource.Value; localization.LocaleId = locale; localization.ResourceSet = defaultResource.ResourceSet; localization.Type = defaultResource.Type; localization.BinFile = defaultResource.BinFile; localization.TextFile = defaultResource.TextFile; localization.Filename = defaultResource.Filename; InsertLocalization(localization); } else { Canon.Data.Localization localization = localeResource.First(); if (localization.Value != String.Empty) { return; } localization.Value = defaultResource.Value; UpdateLocalization(localization); } }
// Use this for initialization void Start() { canon = GameObject.Find("Canon").GetComponent <Canon>(); tank = GameObject.Find("Tank"); GetComponent <Rigidbody2D>().velocity = transform.up.normalized * speed * canon.power / 100; Destroy(gameObject, lifetime); }
public static void LoadPanel(GameObject caller = null) { instance.m_panelCanon.SetActive(true); if (PlayerInstance.playerStats.canons[btn_select] != null) { Canon selectedCanon = PlayerInstance.playerStats.canons[btn_select]; instance.ddl_canonType.value = (int)selectedCanon.canonType; instance.levelCanon.text = "Niveau : " + PlayerInstance.playerStats.canons[btn_select].level; } else { //Lors de l'achat d'un canon if (shop_moneyControl.Transaction(-price.COUT_CANON_BASE)) { //Créé un canon de base PlayerInstance.playerStats.canons[btn_select] = new Canon(); GameObject btn = Instantiate(instance.btnPrefab, instance.boat.GetComponent <Player_Stat>().CanonsSpots[btn_select].transform); btn.transform.localScale = new Vector3(0.014f, 0.004f, 0.02f); btn.transform.localPosition = new Vector3(0, 0, -1); btn.transform.Rotate(Vector3.forward, 90); btn.GetComponent <shop_btnClick>().id = btn_select; btn.GetComponent <Image>().color = Color.red; instance.levelCanon.text = "Niveau : 1"; Destroy(caller); } else { instance.m_panelCanon.SetActive(false); } } }
void OnMouseDown() { if (!active && isPlaced) { // Stworz nowy canon Transform boo = Instantiate(canon, new Vector3(0, 0, 0), Quaternion.identity); Canon newTowerScript = boo.GetComponent <Canon> (); newTowerScript.active = false; newTowerScript.isPlaced = false; newTowerScript.grid = grid; //newTowerScript.loadSpeed = loadSpeed; newTowerScript.range = range; } if (!active && !isPlaced) { if (legalPlace()) { if (guiScript.dollars - this.pointsValue >= 0) { guiScript.dollars -= this.pointsValue; active = true; isPlaced = true; } } } }
private async Task <List <Chapter> > CloneBookUsxAsync(TextInfo text, TextType textType, string paratextId, string fileName, ISet <int> chaptersToInclude) { // Remove any stale text_data records that may be in the way. await DeleteAllTextDocsForBookAsync(text, textType); string bookText = await _paratextService.GetBookTextAsync(_userSecret, paratextId, Canon.BookNumberToId(text.BookNum)); var bookTextElem = ParseText(bookText); await UpdateProgress(); var usxDoc = new XDocument(bookTextElem.Element("usx")); Dictionary <int, ChapterDelta> deltas = _deltaUsxMapper.ToChapterDeltas(usxDoc) .ToDictionary(cd => cd.Number); var tasks = new List <Task>(); var chapters = new List <Chapter>(); foreach (KeyValuePair <int, ChapterDelta> kvp in deltas) { if (chaptersToInclude != null && !chaptersToInclude.Contains(kvp.Key)) { continue; } async Task createText(int chapterNum, Delta delta) { IDocument <TextData> textDataDoc = GetTextDoc(text, chapterNum, textType); await textDataDoc.FetchAsync(); if (textDataDoc.IsLoaded) { Console.WriteLine($"CloneBookUsxAsync: Going to delete text doc before re-creating it. " + $"FYI that it and its contents are: textinfo booknum {text.BookNum}, " + $"chapter count {text.Chapters.Count}, has source {text.HasSource}, " + $"int chapterNum: {chapterNum}, text type: {textType}, paratext project id {paratextId}. " + $"Contents: {textDataDoc.Data.ToString()} END_CONTENTS."); await textDataDoc.DeleteAsync(); } await textDataDoc.CreateAsync(new TextData(delta)); } tasks.Add(createText(kvp.Key, kvp.Value.Delta)); chapters.Add(new Chapter { Number = kvp.Key, LastVerse = kvp.Value.LastVerse, IsValid = kvp.Value.IsValid }); } await Task.WhenAll(tasks); await SaveXmlFileAsync(bookTextElem, fileName); await UpdateProgress(); return(chapters); }
public void EquipCanon(Canon defaultCanon) { if (equippedCanon != null) { Destroy(equippedCanon.gameObject); } equippedCanon = Instantiate (defaultCanon, canonHolder.position, canonHolder.rotation) as Canon; equippedCanon.transform.parent = canonHolder; }
void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.tag == "Player") { Canon canon = canons.GetComponent <Canon>(); canon.StartLaunch(); } }
// Start is called before the first frame update void Start() { gameManager = GameManager.GetInstance(); orderManager = gameManager.orderManager; soundManager = gameManager.soundManager; theCanon = gameManager.cookingManager.theCanon; }
// Use this for initialization void Start() { barrel = this.transform.GetChild(1); target = GameObject.Find("Player").transform; barrelDefaultPosition = barrel.transform.position; canonScript = GetComponentInChildren <Canon>(); sr = this.gameObject.transform.GetChild(0).GetChild(0).gameObject.GetComponent <SpriteRenderer>(); }
private static void VerifyBook(string book) { if (!Canon.IsBookIdValid(book)) { Console.WriteLine("Error: invalid book name"); Environment.Exit(-1); } }
public ActionResult DeleteConfirmed(int id) { Canon canon = db.Canones.Find(id); db.Canones.Remove(canon); db.SaveChanges(); return(RedirectToAction("Index")); }
public void UsePost(GameObject player) { if (!postPlayer) { postPlayer = player; audioData.PlayOneShot(enter, 1); PV.RPC("OccupyPost", RpcTarget.Others); PhotonView playerPV = postPlayer.GetComponentInChildren <PhotonView> (); PhotonView postPV = post.GetComponent <PhotonView> (); // PhotonView[] photonViews = post.GetComponents<PhotonView>(); // foreach (PhotonView view in photonViews) // { // print(view.ViewID); // } if (postPV) { postPV.RequestOwnership(); } switch (type) { case postType.Canon: Canon tmpCanon = post.GetComponent <Canon> (); tmpCanon.enabled = true; break; case postType.Thruster: ThrusterControls tmp = post.GetComponent <ThrusterControls> (); tmp.enabled = true; break; case postType.Turret: Turret turret = post.GetComponent <Turret> (); turret.enabled = true; break; case postType.Rotate: RotateShip rotate = post.GetComponent <RotateShip> (); rotate.enabled = true; break; case postType.Shield: Shield shield = post.GetComponent <Shield> (); shield.enabled = true; break; case postType.MiniShip: postPlayer.transform.GetChild(1).gameObject.SetActive(false); MiniShip ship = post.GetComponent <MiniShip> (); ship.enabled = true; ship.ActivateShip(); break; default: break; } } }
public void EquipCanon(Canon defaultCanon) { if (equippedCanon != null) { Destroy(equippedCanon.gameObject); } equippedCanon = Instantiate(defaultCanon, canonHolder.position, canonHolder.rotation) as Canon; equippedCanon.transform.parent = canonHolder; }
// Use this for initialization void Start() { theCanon = transform.parent.GetComponent<Canon>(); pointLight = transform.FindChild("Light").light; lensFlare = transform.GetComponentInChildren<LensFlare>(); ps = transform.FindChild("PS").particleSystem; time = 0f; if(!Application.loadedLevelName.Contains("Editor") && !Application.loadedLevelName.Contains("MainMenu") ) gameplay = GameObject.Find("Engine").GetComponent<Gameplay>(); }
/// <summary> /// Load canons from playerinstance /// </summary> private void LoadCanons() { LoadCanonsSpots(); for (int i = 0; i < enemyStats.canons.Count; i++) { Canon canon = enemyStats.canons[i]; if (canon == null) { continue; } //Instantiate canon prefab GameObject canonObj = null; switch (canon.canonType) { case CanonType.TirTriple: case CanonType.Normal: if (canon.canonType == CanonType.Normal) { canonObj = Instantiate(Static_Resources.defaultCanon); } else { canonObj = Instantiate(Static_Resources.tripleCanon); } canonObj.name = "Canon" + i; canonObj.transform.SetParent(CanonsSpots[i]); canonObj.transform.position = new Vector3(0, 0, -1); canonObj.transform.localPosition = new Vector3(0, 0, -1); canonObj.transform.rotation = CanonsSpots[i].rotation; Canon_Controller canonCtrl = canonObj.AddComponent <Canon_Controller>(); canonCtrl.canonInfo = canon; canonCtrl.canonInfo.shootPoint = CanonsSpots[i]; break; case CanonType.LanceFlammes: canonObj = Instantiate(Static_Resources.flameThrower); canonObj.name = "CanonFlame" + i; canonObj.transform.SetParent(CanonsSpots[i]); canonObj.transform.position = new Vector3(0, 0, -1); canonObj.transform.localPosition = new Vector3(0, 0, -1); canonObj.transform.rotation = CanonsSpots[i].rotation; Flame_Controller flameCtrl = canonObj.AddComponent <Flame_Controller>(); flameCtrl.canonInfo = canon; flameCtrl.canonInfo.shootPoint = CanonsSpots[i]; break; } } }
static void Main(string[] args) { Printer dev = new Canon("Canon"); Document house2 = dev.Print(); dev = new HP("HP"); Document house = dev.Print(); Console.ReadLine(); }
public ActionResult Edit([Bind(Include = "ID,Nombre,PotenciaFuego,Precio,Valor")] Canon canon) { if (ModelState.IsValid) { db.Entry(canon).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(canon)); }
void InstantiateCanon() { Vector3 pos = transform.position; pos.y = transform.position.y + 0.75f; GameObject CanonGo = GameObject.Instantiate(canonPrefab, pos, Quaternion.Euler(0, angle, 0)) as GameObject; canon = CanonGo.GetComponent <Canon>(); canon.transform.parent = transform; }
public ActionResult Create([Bind(Include = "ID,Nombre,PotenciaFuego,Precio,Valor")] Canon canon) { if (ModelState.IsValid) { db.Canones.Add(canon); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(canon)); }
/// <summary> /// Gets all books that need to be deleted. /// </summary> private IEnumerable <int> GetBooksToDelete(TextType textType, IEnumerable <int> existingBooks) { string projectPath = GetProjectPath(textType); var booksToDelete = new HashSet <int>(_fileSystemService.DirectoryExists(projectPath) ? _fileSystemService.EnumerateFiles(projectPath) .Select(p => Canon.BookIdToNumber(Path.GetFileNameWithoutExtension(p))) : Enumerable.Empty <int>()); booksToDelete.ExceptWith(existingBooks); return(booksToDelete); }
internal void CheckSymmetry() { if (!checkSymmetry) { checkSymmetry = true; numStereoElements = CreateElements(); int[] symmetry = ToIntArray(Canon.Symmetry(container, g)); LabelTrueCenters(symmetry); LabelIsolatedPara(symmetry); } }
// Use this for initialization void Start() { theCanon = transform.parent.GetComponent <Canon>(); pointLight = transform.FindChild("Light").light; lensFlare = transform.GetComponentInChildren <LensFlare>(); ps = transform.FindChild("PS").particleSystem; time = 0f; if (!Application.loadedLevelName.Contains("Editor") && !Application.loadedLevelName.Contains("MainMenu")) { gameplay = GameObject.Find("Engine").GetComponent <Gameplay>(); } }
public Druid(string name, int level, int healthpoints) { this.Name = name; this.Level = level; this.HealthPoints = healthpoints; this.ManaPoints = DEFAULT_ABILITY_POINTS; this.Faction = DEFAULT_FACTION; this.CrimsonGuard = DEFAULT_ARMOR; this.Canon = DEFAULT_WEAPON; this.IsAlive = true; this.Score = 0; }
/// <summary> /// Callback for when a ping notification is received. /// Updates connection status, resets failure count. /// </summary> void PingReceived(string source, string scope, Flake input) { if (source == Canon.Origin()) { Connected = true; LastRoundTripLatency = ((int)System.Diagnostics.Stopwatch.GetTimestamp() - input.ints[0]) * 1000 / (float)System.Diagnostics.Stopwatch.Frequency; failures = 0; awaitingResponse = false; } }
private void Start() { rb = GetComponent <Rigidbody2D>(); shipCanon = GetComponent <Canon>(); activeSkillButtons = new Dictionary <KeyCode, int> { { KeyCode.Q, 0 }, { KeyCode.LeftShift, 0 }, { KeyCode.F, 0 }, { KeyCode.Space, 0 } }; passitiveSkillsON = new List <int>(); shipHPcurrent = shipHP; shootTimer = shootColdTime; }
// GET: Canon/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Canon canon = db.Canones.Find(id); if (canon == null) { return(HttpNotFound()); } return(View(canon)); }
/// <summary> /// Given a molecule (possibly disconnected) compute the labels which /// would order the atoms by increasing canonical labelling. If the SMILES /// are isomeric (i.e. stereo and isotope specific) the InChI numbers are /// used. These numbers are loaded via reflection and the 'cdk-inchi' module /// should be present on the path. /// </summary> /// <param name="molecule">the molecule to</param> /// <returns>the permutation</returns> /// <seealso cref="Canon"/> private static int[] Labels(SmiFlavors flavour, IAtomContainer molecule) { // FIXME: use SmiOpt.InChiLabelling var labels = SmiFlavorTool.IsSet(flavour, SmiFlavors.Isomeric) ? InChINumbers(molecule) : Canon.Label(molecule, GraphUtil.ToAdjList(molecule), CreateComparator(molecule, flavour)); var cpy = new int[labels.Length]; for (int i = 0; i < labels.Length; i++) { cpy[i] = (int)labels[i] - 1; } return(cpy); }
public void GoInsideCanon(Canon canon) { this.canon = canon; if (isHoldingItem) { isHoldingItem = false; Destroy(pickedObject.gameObject); GameManager.managerGame.SpawnObject(); pickedObject = null; canThrow = false; canPick = false; } isInsideCanon = true; }
void Canon_weaponChanged(Canon obj) { if (soundActive) { casetera.Play(obj.changeWeapon); } if (netcm != null) { //netcm.sendData(new NetInformation(GameStatus.ready, GameCommands.playSound, -1, null, null, obj.changeWeapon)); netcm.sendSound(obj.changeWeapon); } }
public void Initialize(Canon gun, float _speed, float chargePercent, bool fullCharged) { speed = (_speed * chargePercent > _speed) ? _speed * chargePercent : _speed; transform.localScale *= (fullCharged) ? chargePercent / 2 : 1; body = GetComponent<Rigidbody>(); transform.rotation = gun.transform.parent.rotation; if (fullCharged) { TrailRenderer trail = GetComponent<TrailRenderer>(); trail.startWidth *= 2f; trail.endWidth *= 2f; } }
public void GetUpdatedBookInfo() { CheckingStatuses checkingStatusData; try { checkingStatusData = CheckingStatuses.Get(UnderlyingScrText); checkingStatusData.CancelChanges(); // This forces it to reload from disk. } catch (Exception e) { throw new ApplicationException($"Unexpected error retrieving the checking status data for {kParatextProgramName} project: {ProjectId}", e); } foreach (var bookNum in CanonicalBookNumbersInProject) { var code = Canon.BookNumberToId(bookNum); if (!Canon.IsBookOTNT(bookNum)) { m_bookInfo.Add(bookNum, code, ParatextProjectBookInfo.BookState.ExcludedNonCanonical); continue; } var failedChecks = new List <String>(m_requiredChecks.Count); foreach (var check in m_requiredChecks) { CheckingStatus status; try { status = checkingStatusData.GetCheckingStatus(code, check); } catch (Exception e) { throw new ApplicationException($"Unexpected error retrieving the {check} check status for {code} in {kParatextProgramName} project: {ProjectId}", e); } if (status == null || !status.Successful) { failedChecks.Add(check); } } if (failedChecks.Any()) { m_bookInfo.Add(bookNum, code, ParatextProjectBookInfo.BookState.FailedCheck, failedChecks); } else { m_bookInfo.Add(bookNum, code, ParatextProjectBookInfo.BookState.NoProblem); } } }
void camera_PictureTaken(object sender, Canon.Eos.Framework.Eventing.EosImageEventArgs e) { var camera = sender as EosCamera; if (camera == null) return; if (FListeningTo.ContainsValue(camera)) { foreach (var key in FListeningTo.Keys) { if (FListeningTo[key] == camera) { FPictureTaken.Add(key); FOutImage[key].Send(e.GetBitmap()); } } } }
internal static IEnumerable<String> FillList(Canon.Eos.Framework.Internal.SDK.Edsdk.EdsPropertyDesc myPropertyDescription, Type myType) { var _List = new List<String>(); for (int i = 0; i < myPropertyDescription.NumElements; i++) { var enumName = Enum.GetName(myType, myPropertyDescription.PropDesc[i]); if (enumName != null) { var _Enum = (Enum) Enum.Parse(myType, enumName); _List.Add(EnumHelper.GetDescriptionAttribute(_Enum)); } } return _List; }
internal static IEnumerable<KeyValuePair<String, String>> FillMap(Canon.Eos.Framework.Internal.SDK.Edsdk.EdsPropertyDesc myPropertyDescription, Type myType) { var _Map = new List<KeyValuePair<String, String>>(); for (int i = 0; i < myPropertyDescription.NumElements; i++) { var enumName = Enum.GetName(myType, myPropertyDescription.PropDesc[i]); if (enumName != null) { Enum en = (Enum) Enum.Parse(myType, enumName); _Map.Add(new KeyValuePair<String, String>(en.ToString(), EnumHelper.GetDescriptionAttribute(en))); } } return _Map; }
/* * NOTE: * * getBitmap() is not available in EosLiveImageEventArgs. ssems we need aproper c# wrapper that exposes something like: * * err = EDSDK.EdsCreateEvfImageRef(stream, out EvfImageRef); * if (err == EDSDK.EDS_ERR_OK) err = EDSDK.EdsDownloadEvfImage(MainCamera.Ref, EvfImageRef); * if (err == EDSDK.EDS_ERR_OBJECT_NOTREADY) continue; * else Error = err; * */ //void FCamera_LiveViewUpdate(object sender, Canon.Eos.Framework.Eventing.EosImageEventArgs e) void FCamera_LiveViewUpdate(object sender, Canon.Eos.Framework.Eventing.EosLiveImageEventArgs e) { var camera = sender as EosCamera; if (camera == null) return; if (FListeningTo.ContainsValue(camera)) { foreach (var key in FListeningTo.Keys) { if (FListeningTo[key] == camera) { FPictureTaken.Add(key); var bitmap = e.GetBitmap(); // not available >> exception in Canon.Eos.framework.dll FOutImage[key].Send(bitmap); bitmap.Dispose(); } } } }
/// <summary> /// Insert new User. /// </summary> /// <param name="user"></param> public static int InsertUser(Canon.Data.User user) { int result = ((CanonMembershipProvider)Membership.Provider).CreateUser(user); CleanUsersCache(); return result; }
/// <summary> /// Update user. /// </summary> /// <param name="user"></param> /// <param name="previousLogin"></param> public static void UpdateUser(Canon.Data.User user, string previousLogin) { ((CanonMembershipProvider)Membership.Provider).UpdateUser(user, previousLogin); CleanUsersCache(); }
/// <summary> /// Insert new localization. /// </summary> /// <param name="localization"></param> protected static void InsertLocalization(Canon.Data.Localization localization) { CanonDataContext db = Cdb.Instance; db.Localizations.InsertOnSubmit(localization); db.SubmitChanges(); }
/// <summary> /// Update localization. /// </summary> /// <param name="localization"></param> protected static void UpdateLocalization(Canon.Data.Localization localization) { CanonDataContext db = Cdb.Instance; if (db.Localizations.GetOriginalEntityState(localization) == null) { db.Localizations.Attach(localization, false); db.Refresh(RefreshMode.KeepCurrentValues, localization); } db.SubmitChanges(); }
void FCamera_LiveViewUpdate(object sender, Canon.Eos.Framework.Eventing.EosLiveImageEventArgs e) { }