public static void CreateShop(string shops, string cuts, string owner, string post) { Shopping = new List <ItemSystem.GameItemInfo>(); NowShop = 0; Owner = owner; Post = post; string[] cut = cuts.Split(';'), shop = shops.Split(';'); for (int i = 0; i < shop.Length; i++) { ItemSystem.GameItemInfo gmi = ItemSystem.GItems.Find(m => m.Name == shop[i]); gmi.Cut = float.Parse(cut[i]); Shopping.Add(gmi); } GameObject fab = (GameObject)Resources.Load("Prefabs\\PayCanvas"); GameObject box = Instantiate(fab, new Vector3(0, 0, 0), Quaternion.identity); box.SetActive(true); SoundPlayer.Play("Decide_2"); }
public void UpdateUI() { Debug.Log(this.name); if (!this.name.StartsWith("PayCanvas")) { return; } this.transform.Find("PrevBtn").gameObject.SetActive(NowShop > 0 && Shopping.Count > 1); this.transform.Find("NextBtn").gameObject.SetActive(NowShop < Shopping.Count - 1 && Shopping.Count > 1); ItemSystem.GameItemInfo gmi = Shopping[NowShop]; this.transform.Find("Icon").GetComponent <Image>().sprite = Resources.Load <Sprite>("Items/" + gmi.Icon); this.transform.Find("CutOff").gameObject.SetActive(gmi.Cut != 1); this.transform.Find("Cuts").gameObject.SetActive(gmi.Cut != 1); string Cut = gmi.Cut.ToString().Replace("0.", ""); string[] Num1 = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; string[] Num2 = { "一", "二", "三", "四", "五", "六", "七", "八", "九" }; for (int i = 0; i < Num1.Length; i++) { Cut = Cut.Replace(Num1[i], Num2[i]); } Cut += "折优惠"; this.transform.Find("Cuts").GetComponent <Text>().text = Cut; this.transform.Find("Exchange").GetComponent <Text>().text = $"<b>{Owner}</b>想要和你交易“<b>{gmi.Name}x1</b>”"; this.transform.Find("Tips").GetComponent <Text>().text = $"{gmi.Describe}"; this.transform.Find("Say").GetComponent <Text>().text = $"{Post}"; this.transform.Find("PayTips").GetComponent <Text>().text = $"G{(int)(gmi.Cost * gmi.Cut * 10) / 10}"; /** TODO * this.transform.Find("Coins").GetComponent<Text>().text = * $"余额 G{Coins}"; **/ string LovePerson = ""; /** TODO * 查找道具的喜爱者然后从队伍中筛选出 **/ if (gmi.Love.IndexOf("世原·安诺;") >= 0) { LovePerson = "世原·安诺"; } this.transform.Find("LikeBar").gameObject.SetActive(LovePerson != ""); this.transform.Find("Role").gameObject.SetActive(LovePerson != ""); this.transform.Find("DislikeBar").gameObject.SetActive(LovePerson == ""); this.transform.Find("Role").GetComponent <WalkingAnimate>().character = LovePerson; this.transform.Find("People").GetComponent <Text>().text = LovePerson != "" ? $"队伍里的{LovePerson}表示很想要!" : $"队伍里没有人特别想要。"; }