public ActionResult <CurseReadDto> GetRandomCurse() { Curse curse = repository.GetRandomCurse(); CurseReadDto curseReadDto = mapper.Map <CurseReadDto>(curse); return(Ok(curseReadDto)); }
static void quit() { Log.WriteLine("quit"); Log.StopLog(); Curse.endwin(); Console.WriteLine("bye, 👋"); }
private void InitTree(string html) { try { var mls = Curse.PraseCategory(html); int index = 0; foreach (var m in mls) { TreeNode tn = new TreeNode { Text = m.title, Name = index.ToString() }; dicts.Add(index.ToString(), m); index++; if (m.childs.Count > 0) { foreach (var cm in m.childs) { TreeNode ctn = new TreeNode(); ctn.Text = cm.title; ctn.Name = index.ToString(); tn.Nodes.Add(ctn); dicts.Add(index.ToString(), cm); index++; } } AddTreeNode(tn); } treeInited = true; }catch (Exception e) { Settings.LogException(e); } }
public void Load() { //(saveID, curse_id, curse_id, curse_id) if (GameManager.Instance.playerData.isNewBegin) { Build(); return; } Room room = GetComponent <Room>(); List <string> datas = GameManager.Instance.playerData.curseData; foreach (string data in datas) { string[] values = data.Trim(new char[] { '(', ')' }).Replace(" ", "").Split(','); if (values[0] == room.saveID) { int curseCount = PlayerPrefs.GetInt(room.saveID + "_curseCount"); for (int i = 0; i < curseCount; i++) { Curse curse = Instantiate(DataHandler.Instance.cursePrefab); curse.transform.SetParent(transform); curse.Load(values[i + 1], room.saveID + "_curse_" + i.ToString()); curses.Add(curse); } return; } } //Debug.Log("오류! 룸 정보를 불러오지 못함"); }
/// <summary> /// 解析列表的分页 /// </summary> /// <param name="html"></param> private void InitPage(string html) { try { pages = Curse.PrasePages(html); if (null == pages) { return; } foreach (var pg in pages) { ToolStripButton tb = new ToolStripButton { Name = pg.title, Text = pg.title, DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text, Font = new System.Drawing.Font("Microsoft YaHei UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))) }; if (pg.iscurrent || pg.isdot) { tb.Enabled = false; } else { tb.Click += ListPage_Click; } AddPages(tb); } }catch (Exception ex) { Settings.LogException(ex); } }
public override void Start(string[] args) { if (!File.Exists(args[0])) { ex = "Couldn't find help database!"; } if (ex == null) { r = true; } help_string = File.ReadAllText(args[0]); //get help string. ParseHelp(); if (args[1] != null) { bool show_error = true; for (int i = 0; i < help_keys.Count; i++) { if (help_keys[i].ToLower() == args[1].ToLower()) { viewing = true; show_error = false; help_doc = i; } } if (show_error) { Curse.ShowMessagebox("Help Viewer - Topic not found.", "Help Viewer could not find the topic specified in the command argument."); } } }
private void FillDataFunction() { Settings.dt.Clear(); try { var list = Settings.db.GetAddonList(); if (null != list) { foreach (var li in list) { var row = Settings.dt.NewRow(); row["title"] = li.title; row["local_version"] = Curse.ConvertStringToDateTime(li.local_version).ToShortDateString(); row["update_time"] = li.update_time; row["addon_id"] = li.addon_id; Settings.dt.Rows.Add(row); } } } catch (Exception e) { Settings.LogException(e); ShowTrace("刷新插件列表失败!"); } }
public async Task <IHttpActionResult> PutCurse(int id, Curse curse) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != curse.Id) { return(BadRequest()); } db.Entry(curse).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CurseExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <string> CleanAsync(string content) { Curse curseExtractor = new Curse(); for (int i = 1; i <= 5; ++i) { switch (i) { case 1: curseExtractor.SetLanguage(Language.English); break; case 2: curseExtractor.SetLanguage(Language.French); break; case 3: curseExtractor.SetLanguage(Language.German); break; case 4: curseExtractor.SetLanguage(Language.Italian); break; case 5: curseExtractor.SetLanguage(Language.Spanish); break; } content = await curseExtractor.CleanseAsync(content); } return(content); }
public void Build() { Room room = GetComponent <Room>(); Grade minGrade = UIHandler.Instance.floorBuilder.GetMinimumGrade(HeroSpawner.currentWave); List <CurseForm> preForms = DataHandler.Instance.GetDefaultCurseForms(capacity); List <CurseForm> forms = new List <CurseForm>(); if (minGrade != Grade.E) { foreach (CurseForm mf in preForms) { if ((int)minGrade <= (int)mf.grade) { forms.Add(mf); } } if (forms.Count == 0) { forms = DataHandler.Instance.GetCurseFormsAtGrade(minGrade, capacity); } else if (forms.Count < capacity) { while (forms.Count < capacity) { forms.Add(forms[Random.Range(0, forms.Count)]); } } else if (forms.Count > capacity) { List <CurseForm> newForms = new List <CurseForm>(); for (int i = 0; i < capacity; i++) { int idx = Random.Range(0, forms.Count); newForms.Add(forms[idx]); } forms = newForms; } } else { forms = preForms; } foreach (CurseForm form in forms) { Curse curse = Instantiate(DataHandler.Instance.cursePrefab); curse.transform.SetParent(transform); int space = (curses.Count + 1) / 2; if (curses.Count % 2 == 1) { space *= -1; } Vector3 pos = room.roomCollider.bounds.center + new Vector3(spawnAligin * space, 0, 0); curse.Create(form, pos); curses.Add(curse); } }
/** * create the list of action use in the game * set the logo for each action */ public List <Action> GetActionList() { List <Action> actionList = new List <Action>(); foreach (ACTION_TYPE type in ActionInTimeline) { switch (type) { case ACTION_TYPE.ATTACK: { Attack attack = new Attack(); attack.actionLogo = attackLogo; actionList.Add(attack); } break; case ACTION_TYPE.DEFEND: { Defend defend = new Defend(); defend.actionLogo = defendLogo; actionList.Add(defend); } break; case ACTION_TYPE.CURSE: { Curse curse = new Curse(); curse.actionLogo = curseLogo; actionList.Add(curse); } break; case ACTION_TYPE.MOVE_ENEMY: { MoveEnemy moveEnemy = new MoveEnemy(); moveEnemy.actionLogo = moveEnemyLogo; actionList.Add(moveEnemy); } break; case ACTION_TYPE.SPAWN_ENEMY: { SpawnEnemy spawnEnemy = new SpawnEnemy(); spawnEnemy.actionLogo = spawnEnemyLogo; actionList.Add(spawnEnemy); } break; case ACTION_TYPE.SPAWN_FOW: { SpawnFOW spawnFOW = new SpawnFOW(); spawnFOW.actionLogo = spawnFOWLogo; actionList.Add(spawnFOW); } break; } } return(actionList); }
public object Clone() { Curse curse = new Curse(); curse.unlocked = this.unlocked; curse.unlockedAt = this.unlockedAt; return(curse); }
void Start() { var dagger = new Dagger(); var curse = new Curse(); DebugPrint.PrintAnyDamageSubject(dagger); // dagger damage info DebugPrint.PrintAnyDamageSubject(curse); // curse damage info }
static void getUserInput() { int ch; do { ch = Curse.getch(); } while (ch != 'q'); Logger.Log.WriteLine("user whant to quit"); }
public async Task <IHttpActionResult> GetCurse(int id) { Curse curse = await db.Curses.FindAsync(id); if (curse == null) { return(NotFound()); } return(Ok(curse)); }
public void ShouldAddNewWordToDictionary() { // Arrange var word = "OkieDokie"; var curse = new Curse(); // Act curse.AddNewWord(word); // Assert Assert.IsTrue(curse.GetCurrentDictionary().ToList().Contains(word)); }
public void ShouldNotCleanseTextFromCursed() { // Arrange var textToBeCleaned = "The quick brown fox jumps over thefuck dog"; var curse = new Curse(); // Act var cleansed = curse.Cleanse(textToBeCleaned); // Assert Assert.AreEqual(textToBeCleaned, cleansed); }
public async Task <IHttpActionResult> PostCurse(Curse curse) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Curses.Add(curse); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = curse.Id }, curse)); }
public void ShouldRemoveWordFromDictionary() { // Arrange var word = "shit"; var curse = new Curse(); // Act curse.RemoveWord(word); // Assert Assert.IsFalse(curse.GetCurrentDictionary().Contains(word)); }
public void SpanishDictionaryWithNoEmptyLines() { // Arrange var curse = new Curse(); curse.SetLanguage(Language.Spanish); // Act var hasEmpty = curse.GetCurrentDictionary().Contains(string.Empty); // Assert Assert.IsFalse(hasEmpty); }
public ActionResult <CurseReadDto> GetCurse(int id) { Curse curse = repository.GetCurseById(id); if (curse == null) { return(NotFound()); } CurseReadDto curseReadDto = mapper.Map <CurseReadDto>(curse); return(Ok(curseReadDto)); }
public async Task <IHttpActionResult> DeleteCurse(int id) { Curse curse = await db.Curses.FindAsync(id); if (curse == null) { return(NotFound()); } db.Curses.Remove(curse); await db.SaveChangesAsync(); return(Ok(curse)); }
public void ShouldCountCleanedWords() { // Arrange var curse = new Curse(); var textToBeCleansed = "The f**k brown fox jumps over the f**k dog"; IDictionary <string, int> cleanedWords; // Act curse.Cleanse(textToBeCleansed, out cleanedWords); // Assert Assert.AreEqual(2, cleanedWords["f**k"]); }
public void ShouldAddNewCurseChar() { // Arrange var textToBeCleansed = "The f**k brown fox jumps over the f**k dog"; var expectedText = "The ???? brown fox jumps over the ???? dog"; var curse = new Curse(); // Act curse.SetCurseChar('?'); var cleansed = curse.Cleanse(textToBeCleansed); // Assert Assert.AreEqual(expectedText, cleansed); }
static void waitUserInput() { int ch; displayWelcomeScreen(); do { ch = Curse.getch(); if (ch == 410) { Window.Standar.Clear(); displayWelcomeScreen(); } } while (ch != '\n'); }
static void initNcurse() { Log.WriteLine("initNCurse"); Curse.initscr(); Curse.start_color(); Curse.curs_set(CursorMode.INVISIBLE); Curse.init_pair(1, ColorCode.RED, ColorCode.DARK_GREY); Curse.init_pair(2, ColorCode.BLUE_1, ColorCode.DARK_GREY); Curse.init_pair(3, ColorCode.GREEN, ColorCode.DARK_GREY); Curse.init_pair(4, ColorCode.YELLOW, ColorCode.DARK_GREY); Curse.init_pair(5, ColorCode.DARK_GREY_1, ColorCode.DARK_GREY); Curse.init_pair(6, ColorCode.WHITE, ColorCode.DARK_GREY); Curse.noecho(); Window.Standar.SetColor(5); }
public override void Start(string[] args) { in_menu = true; Running = true; //clear console Console.Clear(); if (!string.IsNullOrEmpty(args[0])) { if (File.Exists(args[0])) { file_path = args[0]; LoadFromFile(); } } Curse.ShowMessagebox("SharpPad", "Welcome to SharpPad! SharpPad is a text editor that allows you to edit text of any text file. In this current version, there are some bugs, so beware!"); }
public void ShouldRemoveWordsFromDictionary() { // Arrange var curse = new Curse(); var words = new List <string>() { "f**k", "wanky" }; // Act curse.RemoveWords(words); var notRemoved = curse.GetCurrentDictionary().Any(e => words.Contains(e)); // Assert Assert.IsFalse(notRemoved); }
private void PraseList() { SetProgress(1); SetStatus("Working..."); string html = Curl.GetHtmlAsync(currentUrl); if (null == html) { SetProgress(100); SetStatus(null); MessageBox.Show("获取远程内容失败,请重试!"); return; } SetProgress(50); InitPage(html); SetProgress(60); if (!treeInited) { InitTree(html); } SetProgress(70); try { var lis = Curse.PraseList(html); if (null == lis) { SetStatus("No Result!"); } else { int i = 0; foreach (var li in lis) { ListItem ad = new ListItem(li, i); ad.SetOnClickListener(onListItemClickListener); AddListItem(ad); i++; } } }catch (Exception e) { Settings.LogException(e); } SetStatus(null); SetProgress(100); }
//This method is used is various places to ask if a particular curse is active at the moment. As one might predict, it returns true if so and false if not. public bool IsCurseActive(Curse curse) { if (PersistantVars.pVars.goal == ModeGoal.SURVIVE) //Curses are only relevant in the actual cursed mode. All curses are off in other modes. { return(activeCurses[0][0] >= 0 && (activeCurses[0][(int)curse] > 0 || PersistantVars.pVars.forcedCurses[(int)curse])); //If notSerenity and (curseActive or curseForcedActive) } return(false); /*if (activeCurses[0][0] >= 0 && activeCurses[0][(int)curse] > 0) //If serenity is not active AND if the specified curse has a duration of 1 or more... * { * return true; * } * if (PersistantVars.pVars.forcedCurses[(int)curse]) //If the curse is forced via debug... * { * return true; * } * return false;*/ }
void Start () { position = transform.position; Debug.Log("PLayer 2"); anim = GetComponent<Animator>(); audioPlayer = GetComponent<AudioSource>(); //Get a component reference to this object's BoxCollider2D boxCollider = GetComponent<BoxCollider2D>(); inputs = GetComponent<Inputs>(); //Get a component reference to this object's Rigidbody2D rb2D = GetComponent<Rigidbody2D>(); //By storing the reciprocal of the move time we can use it by multiplying instead of dividing, this is more efficient. inverseMoveTime = 1f / moveTime; curses = new Hashtable (); Curse curseInvisible = new Curse (); curseInvisible.type = Curse.Type.Invisible; curses.Add(Curse.Type.Invisible, curseInvisible); Curse curseConfused = new Curse (); curseConfused.type = Curse.Type.Confused; curses.Add(Curse.Type.Confused, curseConfused); }
public void setCurse(Curse curse) { this.curse = curse; }
public void Vote(Curse curse) { _curseVotes[curse] += 1; }
/// <summary> /// Creates a new card based on how many cards have already been made. /// </summary> /// <param name="card"> /// The name of the card to be created. /// </param> /// <returns> /// The new created card. /// </returns> public static Card CreateCard(CardName card) { Contract.Requires(card != CardName.Backside & card != CardName.Empty); Contract.Ensures(Contract.Result<Card>().Name == card); Card c; switch (card) { case CardName.Copper: c = new Copper(); break; case CardName.Silver: c = new Silver(); break; case CardName.Gold: c = new Gold(); break; case CardName.Curse: c = new Curse(); break; case CardName.Estate: c = new Estate(); break; case CardName.Duchy: c = new Duchy(); break; case CardName.Province: c = new Province(); break; case CardName.Gardens: c = new Gardens(); break; case CardName.Cellar: c = new Cellar(); break; case CardName.Chapel: c = new Chapel(); break; case CardName.Chancellor: c = new Chancellor(); break; case CardName.Village: c = new Village(); break; case CardName.Woodcutter: c = new Woodcutter(); break; case CardName.Workshop: c = new Workshop(); break; case CardName.Feast: c = new Feast(); break; case CardName.Moneylender: c = new Moneylender(); break; case CardName.Remodel: c = new Remodel(); break; case CardName.Smithy: c = new Smithy(); break; case CardName.ThroneRoom: c = new ThroneRoom(); break; case CardName.CouncilRoom: c = new CouncilRoom(); break; case CardName.Festival: c = new Festival(); break; case CardName.Laboratory: c = new Laboratory(); break; case CardName.Library: c = new Library(); break; case CardName.Market: c = new Market(); break; case CardName.Mine: c = new Mine(); break; case CardName.Adventurer: c = new Adventurer(); break; case CardName.Bureaucrat: c = new Bureaucrat(); break; case CardName.Militia: c = new Militia(); break; case CardName.Spy: c = new Spy(); break; case CardName.Thief: c = new Thief(); break; case CardName.Witch: c = new Witch(); break; case CardName.Moat: c = new Moat(); break; default: throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated."); } c.Initialize(card, CardsMade[card]); CardsMade[card] += 1; createdCards.Add(c, true); return c; }
public Event InstantiateCurse (Curse cursePrefab) { AudioManager.Instance.PlayCurse (); return InstantiateEvent (cursePrefab); }
public void PrepareCurse(Curse curse, int gameSeconds) { if (curse == Curse.Quake) { _timeToStartCurse = DateTime.UtcNow.AddMilliseconds(3000); _curseAction = () => FindObjectOfType<CameraShake>().StartShaking(gameSeconds); } if (curse == Curse.Blood) { _timeToStartCurse = DateTime.UtcNow.AddMilliseconds(3000); _curseAction = () => FindObjectOfType<FogGenerator>().GenerateFogFor(gameSeconds / 15 + 5); } if (curse == Curse.Flip) { _timeToStartCurse = DateTime.UtcNow; _curseAction = () => { var camera = FindObjectOfType<CameraFlip>(); camera.Flip(); camera.TimeToNormality = DateTime.UtcNow.AddSeconds(gameSeconds/15 + 5); }; } }