void FixedUpdate() { if (itemType == TYPE_SPEED) { TimeSpan t = curPetData.getLeftTime(); if (t.TotalSeconds <= 0) { setPetData(curPetData); } else { timePartText.text = curPetData.getLeftTime().ToString(); } } }
void setPetData(PetEggData data) { fishIcon = transform.Find("SkinImage").Find("FishPart").Find("Icon").GetComponent <Image>(); LeftBut = transform.Find("SkinImage").Find("LButton").gameObject; RightBut = transform.Find("SkinImage").Find("RButton").gameObject; ConfirmBut = transform.Find("SkinImage").Find("ConfirmButton").gameObject; timePartText = transform.Find("SkinImage").Find("TimePart").Find("Text").GetComponent <Text>(); GameObject steppart = transform.Find("SkinImage").Find("StepPart").gameObject; if (data.item_id == "20001") { steppart.SetActive(false); } else { steppart.SetActive(true); steppart.transform.Find("text").GetComponent <Text> ().text = (curIndex + 1).ToString(); } spec = SpecController.getItemById(data.item_id); fishIcon.sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); curPetData = data; if (spec is FishItemSpec) { TimeSpan leftTime = data.getLeftTime(); if (leftTime.TotalSeconds <= 0) { itemType = TYPE_OUT; ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("setout").ToUpper(); timePartText.text = LanController.getString("PetOutMes").ToUpper(); } else { itemType = TYPE_SPEED; timePartText.text = leftTime.ToString(); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("speedup").ToUpper(); } } else { OwnedItem item = PlayerData.getOwnedItem(spec.item_id); if (item.count > 0) { itemType = TYPE_USE; timePartText.text = LanController.getString("randomPetEgg"); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("open").ToUpper(); } else { itemType = TYPE_BUY; timePartText.text = LanController.getString("buyEggCase"); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("buy").ToUpper(); } } }