public static CUIPlayerChan Create(PlayerControllerChan p, Transform parentTransform) { if (listNoSlot.ContainsKey(p.slotServer)) { GameObject.Destroy(listNoSlot[p.slotServer]); } GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/PlayerInfoPrefab")); obj.name = "Player " + (int)p.mSide; obj.transform.parent = parentTransform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = scaleAvatar; CUIPlayerChan cui = obj.GetComponent <CUIPlayerChan>(); cui.player = p; p.cuiPlayer = cui; p.AvatarTexture(delegate(Texture _texture) { if (cui != null && cui.avatar != null) { //if(cui.avatar.GetComponentInChildren<UITexture>() !=null) cui.avatar.GetComponentInChildren <UITexture>().mainTexture = _texture; } }); if (p.mSide == ESide.Slot_0 && GameModelChan.YourController != null) { cui.avatar.GetComponentInChildren <UITexture>().enabled = false; for (int i = 0; i < cui.avatar.childCount; i++) { GameObject.Destroy(cui.avatar.GetChild(i).gameObject); } GameObject.Destroy(cui.GetComponentInChildren <UISprite>().gameObject); cui.timerCountDown.FindChild("Background").GetComponent <UISprite>().spriteName = "bgYourTimer"; cui.timerCountDown.FindChild("Background").GetComponent <UISprite>().MakePixelPerfect(); cui.timerCountDown.FindChild("Foreground").GetComponent <UISprite>().spriteName = "bgYourTimer-1"; cui.timerCountDown.FindChild("Foreground").GetComponent <UISprite>().MakePixelPerfect(); Transform iconWarning = cui.gameObject.transform.FindChild("IconWarning"); Transform iconMaster = cui.gameObject.transform.FindChild("IconMaster"); iconWarning.parent = GameModelChan.game.mPlaymat.locationHand.parent.parent; iconMaster.parent = GameModelChan.game.mPlaymat.locationHand.parent.parent; iconWarning.localPosition = new Vector3(40f, 10f, -5f); iconMaster.localPosition = new Vector3(-50f, 10f, -5f); iconWarning.GetComponent <UISprite>().depth = 22; iconWarning.parent = cui.transform; iconMaster.parent = cui.transform; cui.ChangePositionYouLevelBar(); } else { cui.labelUserName.text = p.username; } cui.UpdateInfo(); return(cui); }
public void SetData(PlayerControllerChan player) { this.player = player; player.AvatarTexture(delegate(Texture texture) { avatar.mainTexture = texture; }); lbUserName.text = player.username; if (GameManager.PlayGoldOrChip == "chip") { lbChip.text = Utility.Convert.ChipToK(player.chip) + " chip"; } else if (GameManager.PlayGoldOrChip == "gold") { lbChip.text = Utility.Convert.ChipToK(player.gold) + " gold"; } lbUserName.transform.parent.GetComponent <UITable>().Reposition(); GetComponent <UIToggle>().value = player.isPriority; }