private void SetInfo(int index) { nameText.text = HouseKeeperSystem.GetNameByIndex(index); ImageUtils.FittingImg(keeperImgRT, keeperImg, HouseKeeperSystem.GetSpriteByIndex(index), keeperImgDefaultSize); skillText.text = HouseKeeperSystem.GetSkillStrByIndex(index); descText.text = HouseKeeperSystem.GetDescByIndex(index); }
private void ChangeHouseKeeperRoutine() { bool got = HouseKeeperSystem.GetGotByIndex(chosenIndex); ChosenHouseKeeper.sprite = (got) ? HouseKeeperSystem.GetSpriteByIndex(chosenIndex) : unknownHK; ChosenHouseKeeperName.text = (got) ? HouseKeeperSystem.GetNameByIndex(chosenIndex) : "???"; HouseKeeperSkill sk = HouseKeeperSystem.GetSkillByIndex(chosenIndex); ChosenHouseKeeperSkill.text = (got) ? (sk.skill.ToString() + ((sk.percentage > 0) ? "+" : "") + sk.percentage.ToString() + "%") : ""; GoButton.interactable = got; }
void Update() { if (down) { if (!open && Time.time - startTime >= longPressLimitation) { open = true; hintImage.sprite = HouseKeeperSystem.GetHintByIndex(SystemVariables.currentHKindex); hintAni.SetTrigger("OpenHint"); } } }
private void SetPanel() { //Set RabbitPanel Transform Content = RabbitPanel.transform.GetChild(0).GetChild(0); for (int i = 0; i < RabbitSystem.GetRabbitListCount(); i++) { GameObject g = Instantiate(elementPrefab, Content); Transform img = g.transform.GetChild(0); bool got = RabbitSystem.GetRabbitGotById(i); img.GetComponent <RectTransform>().sizeDelta = got ? new Vector2(80, 80) : new Vector2(未知兔子.texture.width, 未知兔子.texture.height); img.GetComponent <Image>().sprite = got ? RabbitSystem.GetRabbitSpriteById(i) : 未知兔子; if (!got) { continue; } int tmpIndex = i; g.GetComponent <Button>().onClick.AddListener(delegate() { ClickRabbit(tmpIndex); }); } //Set KeeperPanel Content = KeeperPanel.transform.GetChild(0).GetChild(0); for (int i = 0; i < HouseKeeperSystem.GetKeeperCount(); i++) { GameObject g = Instantiate(elementPrefab, Content); Transform img = g.transform.GetChild(0); bool got = HouseKeeperSystem.GetGotByIndex(i); img.GetComponent <RectTransform>().sizeDelta = got ? new Vector2(80, 80) : new Vector2(未知管家.texture.width, 未知管家.texture.height); img.GetComponent <Image>().sprite = got ? HouseKeeperSystem.GetSpriteByIndex(i) : 未知管家; if (!got) { continue; } int tmpIndex = i; g.GetComponent <Button>().onClick.AddListener(delegate() { ClickKeeper(tmpIndex); }); } }
public void RightChangeHouseKeeper() { chosenIndex = (chosenIndex == HouseKeeperSystem.GetKeeperCount() - 1) ? 0 : chosenIndex + 1; ChangeHouseKeeperRoutine(); }
public void LeftChangeHouseKeeper() { chosenIndex = (chosenIndex == 0) ? HouseKeeperSystem.GetKeeperCount() - 1 : chosenIndex - 1; ChangeHouseKeeperRoutine(); }