public void OpenLottery() { if (manager.gameMode != Main_Manager.GameMode.Normal || manager.setting.working) { return; } SoundManager.Ins.PlaySound(SoundManager.Ins._Select); Player p = SaveSystem.A_LoadSaveGame(); DateTime oldTime; if (p.lastTimeLotteyry != null && p.lastTimeLotteyry.Length > 0) { oldTime = DateTime.Parse(p.lastTimeLotteyry); if (oldTime.Day == DateTime.Now.Day) { Popup.Ins.PopupOne("You have already recieved the lucky draw for today. Please come again tomorrow.", "OK", null); return; } } //p.lastTimeLotteyry = DateTime.Now.ToString(); //SaveSystem.A_SaveGame(p); gameObject.SetActive(true); working = true; }
private void Awake() { web = GameObject.FindObjectOfType <API_Web>(); player = SaveSystem.A_LoadSaveGame(); LoadPet(); playerNameTxt.text = PlayerPrefs.GetString("slug"); playerCoin.text = player.coin.ToString(); StartCoroutine(GetTexture(web.m_ViewProfile.user.profile.pic, profileImage)); }
void GotoMainScene() { SoundManager.Ins.PlaySound(SoundManager.Ins._Select); Player player = SaveSystem.A_LoadSaveGame(); for (int i = 0; i < player.pets.Count; i++) { if (player.pets[i].selected && player.pets[i].status >= 0) { SceneManager.LoadScene("Main"); return; } } Popup.Ins.PopupOne("Please select at least one pet.", "OK", null); }
public void CallbackDelete(bool bo) { if (!bo) { return; } Player p = SaveSystem.A_LoadSaveGame(); for (int i = 0; i < p.pets.Count; i++) { if (petID == p.pets[i].id) { p.pets[i].status = -1; PetData petData = new PetData(); petData.CloneData(p.pets[i]); SaveSystem.A_EditPet(petData, true, LoadItem); popupEdit.SetActive(false); } } }
// Start is called before the first frame update void Start() { numColor = 4; Player player = SaveSystem.A_LoadSaveGame(); for (int i = 0; i < player.pets.Count; i++) { if (player.pets[i].id == PlayerPrefs.GetInt("idPet")) { namePet.text = player.pets[i].namePet; if (player.pets[i].color < 0) { return; } color = player.pets[i].color; head.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.head.color[color])[player.pets[i].head]; ear.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.ear.color[color])[player.pets[i].ear]; pattern.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.pattern.color[color])[player.pets[i].pattern]; eye.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.eye)[player.pets[i].eye]; eyebrow.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.eyebrow)[player.pets[i].eyebrow]; nose.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.nose)[player.pets[i].nose]; mouth.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.mouth)[player.pets[i].mouth]; body.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.body)[color]; armLeft.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.armLeft)[color]; armRight.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.armRight)[color]; legLeft.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.legLeft)[color]; legRight.sprite = Atlas.Ins.GetSprites(Atlas.Ins.cha.legRight)[color]; numColor = player.pets[i].color; numHead = player.pets[i].head; numEar = player.pets[i].ear; numPattern = player.pets[i].pattern; numEye = player.pets[i].eye; numEyebrow = player.pets[i].eyebrow; numNose = player.pets[i].nose; numMouth = player.pets[i].mouth; } } }
public void CloneItem(GameObject obj) { FurnitureData f = obj.GetComponent <FurnitureData>(); Player p = SaveSystem.A_LoadSaveGame(); GameObject clone = Instantiate(furniturePrefab, roomParent); FurnitureData c = clone.AddComponent <FurnitureData>(); foreach (Furniture fur in p.inventory.furniture) { if (fur.id == f.id && fur.type == f.type && fur.furnitureIsUsing == false && !idFurInstall.Contains(fur.realId)) { c.realId = fur.realId; fur.furnitureIsUsing = true; idFurInstall.Add(fur.realId); break; } } SaveSystem.A_SaveGame(p); c.id = f.id; c.type = f.type; c.furnitureIsUsing = true; clone.SetActive(false); clone.GetComponent <SpriteRenderer>().sprite = GetFurnitureSprites(f); clone.name = ((FurnitureType)f.type).ToString(); PolygonCollider2D polygonCollider2D = clone.AddComponent <PolygonCollider2D>(); polygonCollider2D.isTrigger = true; clone.transform.position = new Vector3(clone.transform.position.x, clone.transform.position.y, 0); clone.GetComponent <Rigidbody2D>().gravityScale = 0; Text t = obj.GetComponentInChildren <Text>(); t.text = (int.Parse(t.text) - 1).ToString(); target = clone; }
public void Finish() { Player player = SaveSystem.A_LoadSaveGame(); if (player.pets != null && player.pets.Count > 0) { for (int i = 0; i < player.pets.Count; i++) { if (player.pets[i].selected && player.pets[i].status >= 0) { StartCoroutine(LoadYourAsyncScene("Main")); return; } } } if (player.coin == 0 && (player.pets == null || player.pets.Count <= 0)) { SaveSystem.A_AddCoin(2500); } StartCoroutine(LoadYourAsyncScene("Edit")); }
// Start is called before the first frame update void Start() { player = SaveSystem.A_LoadSaveGame(); LoadItem(); }
public void Calculator() { p = SaveSystem.A_LoadSaveGame(); StartCoroutine(StatusAndRewardCalculator()); }
public void PreFinish() { Player player = SaveSystem.A_LoadSaveGame(); Finish(); }
public void LoadItem() { itemList = new List <Sprite>(); switch (pathLoad) { case "Ac": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.clothesPre.ac)); break; case "Shirt": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.clothesPre.shirt)); break; case "Pant": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.clothesPre.pant)); break; case "Shoe": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.clothesPre.shoe)); break; case "Bed": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.bed)); break; case "Decoration": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.decoration)); break; case "Floor": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.floor)); break; case "Furniture": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.furniture)); break; case "Other": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.other)); break; case "Wallpaper": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.furPre.wallpaper)); break; case "Food": itemList.AddRange(Atlas.Ins.GetSprites(Atlas.Ins.food.food)); break; } for (int i = 0; i < itemList.Count; i++) { ClothesData c = new ClothesData(); FurnitureData f = new FurnitureData(); FoodData fo = new FoodData(); Player player = SaveSystem.A_LoadSaveGame(); item.GetComponent <Image>().sprite = itemList[i]; GameObject clone = Instantiate(item, parent); clone.name = i.ToString(); if (clothesType != ClothesType.None) { c = clone.AddComponent <ClothesData>(); c.id = i; } else if (furnitureType != FurnitureType.None) { f = clone.AddComponent <FurnitureData>(); f.id = i; } else if (foodType != FoodType.None) { fo = clone.AddComponent <FoodData>(); fo.id = i; } switch (furnitureType) { case FurnitureType.Decoration: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Decoration) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; case FurnitureType.Bed: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Bed) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; case FurnitureType.Windows: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Windows) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; case FurnitureType.Floor: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Floor) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; case FurnitureType.Wallpaper: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Wallpaper) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; case FurnitureType.Toy: for (int y = 0; y < player.inventory.furniture.Count; y++) { if (player.inventory.furniture[y].type == (int)FurnitureType.Toy) { if (player.inventory.furniture[y].id == i) { clone.SetActive(true); f.CloneData(player.inventory.furniture[y]); } } } break; } if (furnitureType != FurnitureType.None) { int t = (from tt in player.inventory.furniture where f.id == tt.id && f.type == tt.type && !tt.furnitureIsUsing select tt).Count(); Text txt = clone.GetComponentInChildren <Text>(); if (t > 0) { txt.text = t.ToString(); } else { txt.text = "0"; } } switch (clothesType) { case ClothesType.Accessories: for (int y = 0; y < player.inventory.clothes.Count; y++) { if (player.inventory.clothes[y].type == (int)ClothesType.Accessories) { if (player.inventory.clothes[y].id == i) { clone.SetActive(true); c.CloneData(player.inventory.clothes[y]); } } } break; case ClothesType.Shirts: for (int y = 0; y < player.inventory.clothes.Count; y++) { if (player.inventory.clothes[y].type == (int)ClothesType.Shirts) { if (player.inventory.clothes[y].id == i) { clone.SetActive(true); c.CloneData(player.inventory.clothes[y]); } } } break; case ClothesType.Pants: for (int y = 0; y < player.inventory.clothes.Count; y++) { if (player.inventory.clothes[y].type == (int)ClothesType.Pants) { if (player.inventory.clothes[y].id == i) { clone.SetActive(true); c.CloneData(player.inventory.clothes[y]); } } } break; case ClothesType.Shoes: for (int y = 0; y < player.inventory.clothes.Count; y++) { if (player.inventory.clothes[y].type == (int)ClothesType.Shoes) { if (player.inventory.clothes[y].id == i) { clone.SetActive(true); c.CloneData(player.inventory.clothes[y]); } } } break; } if (clothesType != ClothesType.None) { try { Clothes t = (from tt in player.inventory.clothes where c.id == tt.id && c.type == tt.type select tt).First(); Text txt = clone.GetComponentInChildren <Text>(); if (t.count > 0) { txt.text = t.count.ToString(); foreach (Pet p in player.pets) { if (clothesType == ClothesType.Shirts && p.shirtWearing == c.id) { txt.text = (int.Parse(txt.text) - 1).ToString(); } else if (clothesType == ClothesType.Pants && p.pantWearing == c.id) { txt.text = (int.Parse(txt.text) - 1).ToString(); } else if (clothesType == ClothesType.Shoes && p.shoeWearing == c.id) { txt.text = (int.Parse(txt.text) - 1).ToString(); } else if (clothesType == ClothesType.Accessories && p.accessoriesWearing == c.id) { txt.text = (int.Parse(txt.text) - 1).ToString(); } } } else { txt.text = "0"; } } catch { } } switch (foodType) { case FoodType.Food: for (int y = 0; y < player.inventory.foods.Count; y++) { if (player.inventory.foods[y].id == i && player.inventory.foods[y].count > 0) { clone.SetActive(true); fo.CloneData(player.inventory.foods[y]); } } break; } if (foodType != FoodType.None) { try { Food t = (from tt in player.inventory.foods where fo.id == tt.id select tt).First(); Text txt = clone.GetComponentInChildren <Text>(); if (t.count > 0) { txt.text = t.count.ToString(); } else { txt.text = "0"; } } catch { } } } }