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 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 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); } }
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); } }
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)); } }
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(); }
public override void ActivatePower() { var types = new CatType[] { CatType.GetCatType(Cats.Snow), CatType.GetCatType(Cats.Loki), CatType.GetCatType(Cats.Orion), CatType.GetCatType(Cats.Zen), CatType.GetCatType(Cats.Disco), CatType.GetCatType(Cats.Boom), CatType.GetCatType(Cats.Cap), CatType.GetCatType(Cats.King), CatType.GetCatType(Cats.Flint) }; type = types[Random.Range(0, types.Length)]; item = new CatItem(type, item.level, 0); if (type == CatType.GetCatType(Cats.Zen)) { shape.enabled = false; StartCoroutine(FlyingTimers((int)item.power)); iTween.PunchScale(ui.game.timeText.gameObject, new Vector3(0.6f, 0.6f, 0), 1); if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Snow)) { shape.enabled = false; gameplay.FreezeSeconds(item.power); if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Disco)) { shape.enabled = false; gameplay.StartFever(item.power); if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Boom)) { shape.enabled = false; Bomb((type.levelPower[0] + (type.levelPower[item.level - 1] - type.levelPower[0]) * 0.4f)); if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Cap)) { Destroy(rb); shape.enabled = false; float scale = type.scale.x * (smallScreen ? 1.1f : 1f) * 0.6f * (type.levelPower[item.level - 1] / type.levelPower[0]); iTween.ScaleTo(gameObject, iTween.Hash("x", scale, "y", scale, "easeType", "easeOutBack", "time", 0.6f)); StartCoroutine(Fly()); StartCoroutine(PushOutCatsOnPath()); } else if (type == CatType.GetCatType(Cats.King)) { shape.enabled = false; SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF); int goldfishs = (int)item.power; foreach (Stuff stuff in Factory.LIVE_STUFF) { if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCanHoldCoin) { Mover.CreateCoinForCat(t.position, stuff as CatBasic); goldfishs--; } if (goldfishs < 1) { break; } } if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Flint)) { shape.enabled = false; SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF); int goldfishs = (int)item.power; foreach (Stuff stuff in Factory.LIVE_STUFF) { if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCoin) { stuff.Punch(); (stuff as CatBasic).FreeCoin(); if (--goldfishs <= 0) { break; } } } if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Loki)) { shape.enabled = false; for (byte i = 0; i < CatLoki.bomb[item.level - 1, 0]; i++) { factory.CreateFirework(factory.fireworkPrefabs.boomSmall, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0)); } for (byte i = 0; i < CatLoki.bomb[item.level - 1, 1]; i++) { factory.CreateFirework(factory.fireworkPrefabs.rocket, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0)); } for (byte i = 0; i < CatLoki.bomb[item.level - 1, 2]; i++) { factory.CreateFirework(factory.fireworkPrefabs.boomBig, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0)); } for (byte i = 0; i < CatLoki.bomb[item.level - 1, 3]; i++) { factory.CreateFirework(factory.fireworkPrefabs.color, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0)); } if (!isRiki) { ShakeAndDestroy(); } } else if (type == CatType.GetCatType(Cats.Orion)) { shape.enabled = false; BlackHole.Create(t.position, item.power); if (!isRiki) { ShakeAndDestroy(); } } }