/// <summary> /// 猫的下落效果 /// </summary> private void StartCatsDrop() { catsDic.Clear(); catsList.Clear(); CatManager.Instance.RemoveWriteCat(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { CatType type = (CatType)Random.Range((int)CatType.Red, (int)CatType.Purple + 1); GameObject cat = CatManager.Instance.GetCat(type); cat.transform.parent = CatLayer.Instance.transform; cat.GetComponent <Cat>().point = new Point(i, j); catsList.Add(cat); catsDic.Add(cat.GetComponent <Cat>().point, cat); } } for (int x = 0; x < 10; x++) { float t = 0;//下一个掉落的时间 for (int y = 0; y < 10; y++) { GameObject cat = catsDic[new Point(x, y)]; //AudioManager.Instance.PlayAudioDrop(); float time = cat.GetComponent <Cat>().StartDrop(t); t += time; } } }
//根据对象获加载物体 public GameObject GetCat(CatType catType) { GameObject cat; for (int i = 0; i < catPoolList.Count; i++) { var ccCat = catPoolList[i].GetComponent <Cat>(); if (ccCat.catType == catType) { cat = catPoolList[i]; catPoolList.Remove(cat); cat.SetActive(true); ccCat.ResetWriteCat(); //catPoolList[i].GetComponent<Cat>().ResetWriteCat(); return(cat); } } //如果这个物体在对象池里,就直接返回,如果不在就创建 cat = new GameObject("Cat_" + catType.ToString()); //GameObject obj = Resources.Load<GameObject>("Cat/Cat"); //cat = GameObject.Instantiate(obj) as GameObject; //cat.name = "Cat_" + catType.ToString(); cat.AddComponent <Cat>().catType = catType; SpriteRenderer render = cat.AddComponent <SpriteRenderer>(); render.sprite = defaultSpriteList[(int)catType]; render.sortingLayerName = "actor"; return(cat); }
private void setRewardPrompt(ExploreController controller, bool wonByAction, ushort rating, bool hasWon) { GameControl.control.getSoundManager().playExploreButton(); if (controller.stage.rewardPrompt.rewards.Length == 1) { GameControl.control.YesNoPrompt("<font=\"pixelfont\">" + controller.stage.rewardPrompt.prompt, transform.root, () => { controller.stage.rewardCat = controller.stage.rewardPrompt.rewards[0]; setExploreUI(true, controller, wonByAction, true, rating, hasWon); }, () => { setExploreUI(true, controller, wonByAction, false, rating, hasWon); }); } else { UnityAction[] listeners = new UnityAction[controller.stage.rewardPrompt.rewards.Length]; string[] labels = new string[controller.stage.rewardPrompt.rewards.Length]; for (int i = 0; i < controller.stage.rewardPrompt.rewards.Length; i++) { CatType rewardCat = controller.stage.rewardPrompt.rewards[i]; listeners[i] = () => { controller.stage.rewardCat = rewardCat; setExploreUI(true, controller, wonByAction, true, rating, hasWon); }; labels[i] = new Cat(rewardCat).Name; } GameControl.control.MultiplePrompt("<font=\"pixelfont\">" + controller.stage.rewardPrompt.prompt, transform.root, listeners, labels, () => { setExploreUI(true, controller, wonByAction, false, rating, hasWon); Debug.Log("ADDD"); }); } }
public virtual void ChangeType(CatType newType) { type = newType; if (isCoin) { image.sprite = type.spriteFish; } else if (isHeart) { image.sprite = type.spriteHeart; } else if (isBat) { image.sprite = type.spriteBat; } else if (isMultiplier) { image.sprite = type.spriteMultiplier; } else { image.sprite = type.spriteNormal; } onClickSound.clip = type.onFreeFXSound; }
public override void ChangeType(CatType newType) { type = newType; typeRiki = type as CatTypeRiki; SetupType(typeRiki); if (isCoin) { rikiImage.candy.SetActive(true); } else if (isHeart) { // TODO } else if (isBat) { // TODO } else if (isMultiplier) { rikiImage.multiplier.SetActive(true); rikiImage.multiplierText.text = "x" + (gameplay.multiplier + 1); } else { rikiImage.idle.SetActive(true); } }
public Ocelot(Level level) : base(EntityType.Ocelot, level) { Width = Length = 0.6; Height = 0.8; CatType = CatType.WildOcelot; HealthManager.MaxHealth = 100; HealthManager.ResetHealth(); }
/// <inheritdoc /> protected override void HandleJavaMeta(MetaDataEntry entry) { base.HandleJavaMeta(entry); if (entry.Index == 18 && entry is MetadataVarInt varInt) { Variant = (CatType)varInt.Value; } }
public override void Init() { bigCatSlot.catItem = null; foreach (var catView in catViews) { var catItem = user.GetItem(catView.catType); if (catItem != null) { catView.Init(catItem, catItemView => { ShowBig(catItemView.catItem); }); catView.cat.SetActive(true); catView.catEmpty.SetActive(false); catView.footer.SetActive(true); if (catView.particleController != null) { catView.particleController.OFF(); } if (bigCatSlot.catItem == null) { ShowBig(catItem); if (bigCatSlot.itemView.particleController != null) { bigCatSlot.itemView.particleController.OFF(); } } } else { catView.cat.SetActive(false); catView.catEmpty.SetActive(true); catView.footer.SetActive(false); if (catView.catType == CatType.GetCatType(Cats.Santa)) { catView.ActivateButton(item => { ui.tutorial.Show(Tutorial.Part.CollectionSanta, new Transform[] { item.catEmpty.transform }); }); } else if (catView.catType == CatType.GetCatType(Cats.Lady)) { catView.ActivateButton(item => { ui.tutorial.Show(Tutorial.Part.CollectionLady, new Transform[] { item.catEmpty.transform }); }); } else if (catView.catType == CatType.GetCatType(Cats.Jack)) { catView.ActivateButton(item => { ui.tutorial.Show(Tutorial.Part.CollectionJack, new Transform[] { item.catEmpty.transform }); }); } else if (catView.catType == CatType.GetCatType(Cats.Mix)) { catView.ActivateButton(item => { ui.tutorial.Show(Tutorial.Part.CollectionMix, new Transform[] { item.catEmpty.transform }); }); } } } buyCatboxButton.SetActive(!build.premium && user.isCanGetPremiumBox); }
public void YieldCat() { // assumes player has enough gold CatType result = Yield(); Cat newCat = new Cat(result); newCat.catLvl = new CatLevel(MathUtils.FairEnemyCatLevel(DataUtils.getTotalLevels(), MathUtils.progressThroughWorld(), UnityEngine.Random.Range(0.4f, 0.6f))); lastDC = GameControl.control.AddToDeck(newCat); }
public int GetScore(CatType type) { for (int i = 0; i < scoreProfiles.Length; ++i) { if (scoreProfiles[i].type == type) { return(scoreProfiles[i].score); } } return(0); }
public void SetColor(CatType catType) { if (catType.id > colors.Length - 1) { return; } StopCoroutine("ChangeColor"); image.color = colors[catType.id]; }
/// <summary> /// Initializes a new instance of the <see cref="PlaylistCreator" /> class. /// </summary> /// <param name="mapCount"> The amount of beatmaps that are going to be queued. </param> /// <param name="playlistSize"> The amount of beatmaps in each beatmap playlist. </param> /// <param name="type"> The category type of beatmap playlist. </param> public static async Task CreateAllLists(int mapCount, int playlistSize, CatType type) { string categoryType = $"&cat={(int)type}"; string limit = $"&limit={mapCount}"; const string isUnique = "&unique=1"; const string isRanked = "&ranked=1"; (IEnumerable <string> allIds, IEnumerable <string> allNames) = await GetAllIdsAndNames(categoryType, limit, isUnique, isRanked); LogAllNames(allNames); await CreateLists(mapCount, playlistSize, allIds, type); }
private int GetTvShowSubcats(Category parentCategory, CatType newCatType, Regex regEx) { regEx_dynamicSubCategories = regEx; int res = base.ParseSubCategories(parentCategory, parentCategory.Other as string); foreach (Category cat in parentCategory.SubCategories) { cat.HasSubCategories = true; cat.Other = newCatType; } return(res); }
public override void OnInspectorGUI() { DrawDefaultInspector(); MainMenuCat cat = (MainMenuCat)target; type = (CatType)EditorGUILayout.EnumPopup(type); if (GUILayout.Button("SET CAT")) { Cat newCat = new Cat(type); newCat.SetCat(cat.transform.GetChild(0)); } }
public CatItem(string data) { var splited = data.Split(new char[] { ':' }); if (splited.Length != 3) { return; } this.type = CatType.GetCatType(splited[0]); this.level = int.Parse(splited[1]); this.exp = int.Parse(splited[2]); }
public override void OnInspectorGUI() { DrawDefaultInspector(); DetailCard card = (DetailCard)target; type = (CatType)EditorGUILayout.EnumPopup(type); if (GUILayout.Button("SET DETAIL CARD")) { Cat cat = new Cat(type); card.setDetailCard(cat); card.transform.Find("about").localScale = Vector3.one; } }
public void GetCat() { if (user.halloweenBats < balance.events.batsForGift) { iTween.PunchScale(batImage.gameObject, new Vector3(0.5f, 0.5f, 0), 1); } else { user.halloweenBats -= balance.events.batsForGift; user.GetCat(CatType.GetCatType(Cats.Jack)); ui.getCatbox.Setup(ui.getCatbox.catboxHW); ui.PopupShow(ui.getCatbox); } }
public void GetCat() { if (user.newYearHats < balance.events.hatsForGift) { iTween.PunchScale(hatsImage.gameObject, new Vector3(0.5f, 0.5f, 0), 1); } else { user.newYearHats -= balance.events.hatsForGift; user.GetCat(CatType.GetCatType(Cats.Santa)); ui.getCatbox.Setup(ui.getCatbox.catboxNY); ui.PopupShow(ui.getCatbox); } }
public void GetCat() { if (user.stValentinHearts < balance.events.heartsForGift) { iTween.PunchScale(heartImage.gameObject, new Vector3(0.5f, 0.5f, 0), 1); } else { user.stValentinHearts -= balance.events.heartsForGift; user.GetCat(CatType.GetCatType(Cats.Lady)); ui.getCatbox.Setup(ui.getCatbox.catboxSV); ui.PopupShow(ui.getCatbox); } }
private ExploreCat getExploreCat(CatType cat) { if (cat == CatType.none) { return(userCatRef); } ExploreCat cat2 = enemyCatRefs.FirstOrDefault(x => x.cat.catType == cat); if (cat2 == null) { return(userCatRef); } return(cat2); }
void LoadRentCats() { var rentCatsDict = Json.Deserialize(ObscuredPrefs.GetString("rentCatsDict", "{}")) as Dictionary <string, object>; if (rentCatsDict.Count == 0) { foreach (var cat in balance.rentCat.cats) { rentCatsDict.Add(cat.ToString(), 0); } } rentCats = new Dictionary <CatType, int>(); foreach (var pair in rentCatsDict) { rentCats.Add(CatType.GetCatType(pair.Key), System.Convert.ToInt32(pair.Value)); } }
private DataTable GetTableData(string aTitle, CatType aCategory) { var selectCommand = CommandBuilder(aTitle, aCategory); using (var dbConnection = _sqliteConnection) { dbConnection.Open(); selectCommand.Connection = dbConnection; using (var r = selectCommand.ExecuteReader()) { var res = new DataTable(); res.Load(r); return(res); } } }
public void AddParticlePool(Vector3 pos, CatType type) { GameObject particleobj = null; if (particlePoolObj.Count > 0) { particleobj = particlePoolObj.Dequeue(); particleobj.SetActive(true); } else { particleobj = GameObject.Instantiate(particlePrefab) as GameObject; } particleobj.transform.position = pos; ParticleSystem parsy = particleobj.GetComponent <ParticleSystem>(); parsy.GetComponent <Renderer>().material.mainTexture = CatManager.Instance.defaultSpriteList[(int)type].texture; parsy.Play(); StartCoroutine(SetAction(particleobj)); }
public static void InsertArticle2Category(int articleId, CatType catType, List <int> ids) { //首先根据文章ID和类型删除对应的数据 StringBuilder sbSQL = new StringBuilder(); sbSQL.AppendFormat("DELETE Article2Category WHERE ArticleId = {0} AND [Type] = '{1}'", articleId, catType.ToString().ToLower()); SQLPlus.ExecuteNonQuery(CommandType.Text, sbSQL.ToString()); if (ids.Count > 0) { sbSQL = new StringBuilder(); //在插入 sbSQL.Append("INSERT INTO Article2Category(ArticleId,CategoryId,[Type]) VALUES"); foreach (int id in ids) { sbSQL.AppendFormat("({0},{1},'{2}'),", articleId, id, catType.ToString().ToLower()); } string strSQL = Regex.Replace(sbSQL.ToString(), @",$", "", RegexOptions.IgnoreCase); SQLPlus.ExecuteNonQuery(CommandType.Text, strSQL); } }
static void Main() { // Наследование первого типа (generic базовый класс, non-generic наследник) CatType animalsT1_01 = new CatType(Sex.Male); AnimalsType <Sex> animalsT1_02 = new CatType(Sex.Male); AnimalsType <Sex> animalsT1_03 = new AnimalsType <Sex>(Sex.Male); // Наследование первого типа (generic базовый класс, generic наследник того же типа) AnimalsType <string> animalsT2_01 = new AnimalsType <string>("Male"); AnimalsType <bool> animalsT2_02 = new AnimalsType <bool>(true); // Наследование первого типа (generic базовый класс, generic наследник иного типа) CatType01 <int> animalsT3_01 = new CatType01 <int>(Sex.Male); AnimalsType <Sex> animalsT3_02 = new CatType01 <int>(Sex.Male); AnimalsType <Sex> animalsT3_03 = new AnimalsType <Sex>(Sex.Male); // Наследование первого типа (generic базовый класс, generic наследник сочетание параметра базового класса и своих типов) CatType02 <int, Sex, object> animalsT4_01 = new CatType02 <int, Sex, object>(Sex.Male); AnimalsType <Sex> animalsT4_02 = new CatType02 <long, Sex, long>(Sex.Male); AnimalsType <Sex> animalsT4_03 = new AnimalsType <Sex>(Sex.Male); }
public bool AddCat() { if (rentCats == null) { LoadRentCats(); } CatType catType = null; int min = int.MaxValue; foreach (var rentCat in rentCats) { if (!user.isOwned(rentCat.Key) && min > rentCat.Value) { catType = rentCat.Key; min = rentCat.Value; } } if (catType == null) { return(false); } catItem = new CatItem(catType, Random.Range(5, 8), 0); // TODO Кажется можно просто вызвать ui.prepare.freeCatSlot for (int i = 0; i < ui.prepare.catSlots.Length; i++) { if (ui.prepare.catSlots[i].gameObject.activeSelf && ui.prepare.catSlots[i].catItem == null) { catItem.isInstalled = i; ui.prepare.catSlots[i].Init(catItem); return(true); } } return(false); }
public void initcat(CatType catType) { Cat cat = new Cat(catType); GetComponent <TextMeshProUGUI>().text = ""; Debug.Log("init cat reward!"); GameControl.control.checkDeckAvailability(transform.root, ((bool deckAvailable) => { if (deckAvailable) { init(); cat.catLvl = new CatLevel(MathUtils.FairEnemyCatLevel(DataUtils.getTotalLevels(), MathUtils.progressThroughWorld(), UnityEngine.Random.Range(0.5f, 0.7f))); GameControl.control.AddToDeck(cat); DeckCard card = GameObject.Instantiate(deckCard, transform, false).GetComponent <DeckCard>(); card.setDeckCard(cat, GameControl.GetTextBox(card.gameObject, "rarity")); card.transform.localScale = Vector3.one * 0.55f; deckCard.gameObject.SetActive(true); GameControl.control.SavePlayerData(); } }), cat.Name + " wants to join! "); }
public void CreateCatBasic(CatType catType, bool isMultiplier) { CatBasic cat; if (POOL_CATS.Count > 0 && POOL_CATS[0] != null) { cat = POOL_CATS[0]; POOL_CATS.Remove(cat); LIVE_STUFF.Add(cat); cat.gameObject.SetActive(true); } else { cat = Instantiate(catBasicPrefab, randomPosition, Quaternion.identity) as CatBasic; cat.t.SetParent(ui.game.stuffBack, true); cat.t.Rotate(0f, 0f, Random.Range(0f, 360f)); } cat.type = catType; cat.name = "Cat " + cat.type.name + " " + ++LAST_ID; cat.Setup(isMultiplier); }
public void CreateCatSuper(CatItem catItem) { Stuff cat; if (catItem.type == CatType.GetCatType(Cats.Joker)) { cat = Instantiate(catItem.type.gamePrefab, randomPosition, Quaternion.identity) as CatJoker; (cat as CatJoker).item = catItem; (cat as CatJoker).type = catItem.type; } else { cat = Instantiate(catItem.type.gamePrefab, randomPosition, Quaternion.identity) as CatSuper; (cat as CatSuper).item = catItem; (cat as CatSuper).type = catItem.type; } cat.t.SetParent(ui.game.stuffFront, true); cat.t.Rotate(0, 0, Random.Range(0, 360)); cat.name = "Cat " + catItem.type.name + " " + ++LAST_ID; cat.Setup(); }
private SQLiteCommand CommandBuilder(string aTitle, CatType aCategory) { var selectCommand = new SQLiteCommand(); if (aCategory.GetType() == typeof(Category)) { selectCommand.CommandText = searchCatQuery; selectCommand.Parameters.AddWithValue("@cat", (int)((Category)aCategory).CatType); } else if (aCategory.GetType() == typeof(SubCategory)) { selectCommand.CommandText = searchSubCatQuery; selectCommand.Parameters.AddWithValue("@subcat", (int)((SubCategory)aCategory).SubCatType); } else { selectCommand.CommandText = searchQuery; } selectCommand.Parameters.AddWithValue("@animeTitle", aTitle); return(selectCommand); }
/// <summary> /// 获取分类图书排行 /// </summary> /// <returns></returns> public static IList<BookInfo> GetTopBook(int year, int month, int catID, CatType type) { return books.GetTopBook(year, month,catID,type); }
private int GetTvShowSubcats(Category parentCategory, CatType newCatType, Regex regEx) { regEx_dynamicSubCategories = regEx; int res = base.ParseSubCategories(parentCategory, parentCategory.Other as string); foreach (Category cat in parentCategory.SubCategories) { cat.HasSubCategories = true; cat.Other = newCatType; } return res; }
public static void InsertArticle2Category(int articleId, CatType catType, List<int> ids) { ArticleManage.InsertArticle2Category(articleId,catType,ids); }
public static List<int> Article2CategoryListByArticleIdAndType(int articleId, CatType catType) { string strSQL = string.Format("SELECT CategoryId FROM Article2Category WITH(NOLOCK) WHERE ArticleId = {0} AND [Type] = '{1}'",articleId,catType.ToString().ToLower()); List<int> ids = new List<int>(); if (articleId == 0) { return ids; } DataTable dt = SQLPlus.ExecuteDataTable(CommandType.Text,strSQL); if(dt != null && dt.Rows.Count>0){ foreach(DataRow dr in dt.Rows){ ids.Add(dr.Field<int>("CategoryId")); } } return ids; }
public static List<int> Article2CategoryListByArticleIdAndType(int articleId,CatType catType) { return ArticleManage.Article2CategoryListByArticleIdAndType(articleId, catType); }
public static void InsertArticle2Category(int articleId,CatType catType,List<int> ids) { //首先根据文章ID和类型删除对应的数据 StringBuilder sbSQL = new StringBuilder(); sbSQL.AppendFormat("DELETE Article2Category WHERE ArticleId = {0} AND [Type] = '{1}'", articleId, catType.ToString().ToLower()); SQLPlus.ExecuteNonQuery(CommandType.Text,sbSQL.ToString()); if (ids.Count > 0) { sbSQL = new StringBuilder(); //在插入 sbSQL.Append("INSERT INTO Article2Category(ArticleId,CategoryId,[Type]) VALUES"); foreach(int id in ids){ sbSQL.AppendFormat("({0},{1},'{2}'),",articleId,id,catType.ToString().ToLower()); } string strSQL = Regex.Replace(sbSQL.ToString(),@",$","",RegexOptions.IgnoreCase); SQLPlus.ExecuteNonQuery(CommandType.Text,strSQL); } }
/// <summary> /// 获取分类图书排行 /// </summary> /// <returns></returns> public IList<BookInfo> GetTopBook(int year, int month, int catID, CatType type) { SqlHelper objSqlHelper = new SqlHelper(); List<BookInfo> books = new List<BookInfo>(); SqlParameter[] objParams = new SqlParameter[4]; objParams[0] = new SqlParameter("@year", SqlDbType.Int, 4); objParams[1] = new SqlParameter("@month", SqlDbType.Int, 4); objParams[2] = new SqlParameter("@catID", SqlDbType.Int, 4); objParams[3] = new SqlParameter("@type", SqlDbType.Int, 4); objParams[0].Value = year; objParams[1].Value = month; objParams[2].Value = catID; objParams[3].Value = (int)type; SqlDataReader reader = objSqlHelper.ExecuteReader("je_Book_GetTopBookBycat", objParams); ; while (reader.Read()) { BookInfo item = new BookInfo(); item = GetBookByID(reader.GetInt32(reader.GetOrdinal("BookID"))); books.Add(item); } reader.Close(); return books; }