コード例 #1
0
        public void AddItem(RectTransform item, int index)
        {
            item.SetParent(contentsNode, false);

            item.SetSiblingIndex(index);

            if (this.gameObject.activeInHierarchy)
            {
                StartCoroutine(SetPosition(item));
            }
        }
コード例 #2
0
ファイル: ButtleUI.cs プロジェクト: spi8823/Sudenona
 public void Start()
 {
     panel = Instantiate(Resources.Load<GameObject>("Prefabs/UIPrefabs/ButtlePanel")).GetComponent<RectTransform>();
     panel.SetParent(GameObject.Find("/Canvas").transform);
     panel.sizeDelta = new Vector2();
     panel.SetSiblingIndex(0);
     panel.position = new Vector3(panel.rect.width / 2, panel.rect.height / 2, 0);
     player = GameObject.Find("/Player").GetComponent<PlayerController>();
     maxHP = player.MaxHP;
     hpbar = panel.FindChild("HPPanel/HPBar").GetComponent<Slider>();
     hptext = panel.FindChild("HPPanel/HPText").GetComponent<Text>();
     hpbar.maxValue = maxHP;
     enemyPoint = Resources.Load<GameObject>("Prefabs/UIPrefabs/EnemyPoint");
     radarPanel = panel.FindChild("RadarPanel").gameObject;
     playerPoint = panel.FindChild("RadarPanel/PlayerPoint").gameObject;
     prtf = playerPoint.GetComponent<RectTransform>();
     ptf = player.transform;
     rrtf = radarPanel.GetComponent<RectTransform>();
     marker = panel.FindChild("MarkerPanel").GetComponent<MarkerScript>();
     maincamera = GameObject.Find("/Player/Main Camera").GetComponent<Camera>();
     remainingEnemyPanel = panel.FindChild("RemainingEnemyPanel").GetComponent<RectTransform>();
     remainingEnemyNumText = remainingEnemyPanel.FindChild("Text").GetComponent<Text>();
     remainingEnemyPanel.localScale = Vector3.zero;
     timeLimitPanel = panel.FindChild("TimeLimitPanel").GetComponent<RectTransform>();
     timeLimitText = timeLimitPanel.FindChild("Text").GetComponent<Text>();
     timeLimitPanel.localScale = Vector3.zero;
 }