public void SetHP(float hitPoint) { this.hitPoint = hitPoint; GameObject hp = null; for (int i = 0; i < hitPoint; i++) { hp = Instantiate(hpObj); hpObjects.Add(hp); SizeFitter.FittingContent(hp, gameObject); SizeFitter.FittingSize(hp); } float residualPoint = hitPoint - (float)Math.Truncate(hitPoint); if (residualPoint > 0) { hp = Instantiate(hpObj); hp.GetComponent <Image>().fillAmount = residualPoint; hpObjects.Add(hp); SizeFitter.FittingContent(hp, gameObject); SizeFitter.FittingSize(hp); } }
protected virtual void AddPanel(IListObjectInfo info) { Debug.Log("AddPanel"); GameObject panel = Instantiate(this.listObject); ControlPanel containePanel; containePanel = panel.GetComponent <ControlPanel>(); if (info.GetOption().Title) { Debug.Log(info.GetTitle()); containePanel.SetText(info.GetTitle()); } if (info.GetOption().SubTitle) { Debug.Log(info.GetSubTitle()); containePanel.SetSubText(info.GetSubTitle()); } if (info.GetOption().Sprite) { containePanel.SetSprite(info.GetSprite()); } panel.transform.SetParent(content.transform); SizeFitter.FittingSize(panel); }
public void Start() { diceSlots = new Dictionary <Vector2, GameObject>(); for (int y = 0; y < ySize; y++) { for (int x = 0; x < xSize; x++) { GameObject dice_slot = Instantiate(diceSlot); dice_slot.name = x + "," + y; dice_slot.transform.SetParent(transform); SizeFitter.FittingSize(dice_slot); diceSlots.Add(new Vector2(x, y), dice_slot); dice_slot.transform.Rotate(new Vector3(0, 0, RotateZ)); } } }
public virtual void NotifyChangeList() { Destroy(content); Debug.Log("노티파잉"); content = Instantiate(container); SizeFitter.FittingContent(content, parent); SizeFitter.FittingSize(content); if (this.GetComponentInChildren <ScrollRect>() != null) { this.GetComponentInChildren <ScrollRect>().content = content.GetComponent <RectTransform>(); } foreach (IListObjectInfo info in infos) { AddPanel(info); } }