|
- foreach (GameObject obj in GameObject.FindGameObjectsWithTag("CardTop"))
- {
- //public string[,] strArray = { { "8", "0", "0" }, { "7", "1", "1" }, { "8", "2", "2" }, { "5", "3", "3" }, { "4", "4", "2" } };
- for (int i = 0; i < 5;i++ )
- {
- if (obj.gameObject.name == "A"+(i+1).ToString())
- {
- foreach (UISprite sp in obj.GetComponentsInChildren<UISprite>())
- {
- //改变头像
- if (sp.gameObject.name == "A"+(i+1).ToString())
- {
- sp.spriteName = strArray[i, 1];
- }
- //改变背景框
- if (sp.gameObject.name == "A"+(i+1).ToString()+"BG")
- {
- sp.spriteName = strArray[i, 2];
- }
- //改变名字
- if (sp.gameObject.name == "A" + (i + 1).ToString() + "Name")
- {
- sp.spriteName = strArray[i, 3];
- }
- //改变星级
- if (sp.spriteName == "icon_sc_star1")
- {
- if (int.Parse(sp.name.Substring(4, 1)) > int.Parse(strArray[i, 0]))
- {
- sp.spriteName = "icon_sc_star2";
- }
- }
- }
- }
- }
- }
复制代码 |
|