コード例 #1
0
    ///////////////////////////////////////////////////////////////////////////
    //  非公開関数
    ///////////////////////////////////////////////////////////////////////////
    //初期化===================================================================
    void Awake()
    {
        //キャンバス取得
        m_Cnvs = transform.GetComponent<Canvas>();

        //ゲージ取得・初期化
        m_GaugeParent = transform.FindChild("Gauge").GetComponent<RectTransform>();
        m_GaugeGlider = m_GaugeParent.FindChild("GliderGauge/Bar").GetComponent<Image>();
        m_GaugeHeat   = m_GaugeParent.FindChild("HeatGauge/Bar"  ).GetComponent<Image>();

        //文字
        m_Goal        = transform.FindChild("Goal").GetComponent<Image>();
        m_Goal.enabled = false;
    }
コード例 #2
0
ファイル: HitText.cs プロジェクト: scozirge/AVentureCapital
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     MyGameobject = gameObject;
     MyTransfrom = transform.GetComponent<RectTransform>();
     Go_Motion = MyTransfrom.FindChild("Motion").gameObject;
     MyTransfrom.FindChild("Motion").GetComponent<HitTextMotion>().Init(this);
     CanvasRect = FightSceneUI.Canvas;
     MyText = MyTransfrom.FindChild("Motion").FindChild("text").GetComponent<Text>();
     MyImage = MyTransfrom.FindChild("Motion").FindChild("image").GetComponent<Image>();
     RT_Image = MyImage.GetComponent<RectTransform>();
     Ani = MyTransfrom.FindChild("Motion").GetComponent<Animator>();
     ImagePosUp = new Vector2(0, 40);
     ImagePosCenter = new Vector2(0, 0);
     IsInit = true;
 }
コード例 #3
0
ファイル: HudScript.cs プロジェクト: NotYannis/waterjumpers
	// Use this for initialization
	void Start () {
		//Enemy killed counter initialisation
		text = GetComponentInChildren<Text>();
		text.text = ("Enemies killed : " + enemiesKilled);
		GameObject player = GameObject.FindGameObjectWithTag("Player");
		health = player.GetComponent<HealthScript>();
		playerHealth = health.health;
		totalHealth = playerHealth;
		weapon = player.GetComponent<WeaponController>();
		skill = player.GetComponent<SkillController>();

		GameObject skills = GameObject.Find("Skills");
		//skills.gameObject.
		GameObject bullet = GameObject.Find("Bullet");
		bulletCooldownBar = bullet.GetComponentInChildren<RectTransform>();
		bulletCooldownBar = bulletCooldownBar.FindChild("Cooldown") as RectTransform;
		GameObject secondary = GameObject.Find("Secondary");
		secondaryCooldownBar = secondary.GetComponentInChildren<RectTransform>();
		secondaryCooldownBar = secondaryCooldownBar.FindChild("Cooldown") as RectTransform;
		GameObject dodge = GameObject.Find("Dodge");
		dodgeCooldownBar = dodge.GetComponentInChildren<RectTransform>();
		dodgeCooldownBar = dodgeCooldownBar.Find("Cooldown") as RectTransform;

		Image healthBarImage = GetComponentInChildren<Image>();
		healthBar = healthBarImage.gameObject.GetComponent<RectTransform>();
	}
コード例 #4
0
ファイル: CommonUtils.cs プロジェクト: yantian001/2DShooting
 /// <summary>
 /// 设置子节点是否可见
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="child"></param>
 /// <param name="isActive"></param>
 public static void SetChildActive(RectTransform parent, string child, bool isActive)
 {
     if (parent == null || string.IsNullOrEmpty(child))
         return;
     var childNode = parent.FindChild(child);
     if (childNode != null)
     {
         childNode.gameObject.SetActive(isActive);
     }
 }
コード例 #5
0
ファイル: CommonUtils.cs プロジェクト: yantian001/2DShooting
 /// <summary>
 /// 设置子对象的Slider值
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="child"></param>
 /// <param name="value"></param>
 public static void SetChildSliderValue(RectTransform parent, string child, float value)
 {
     var childTran = parent.FindChild(child);
     if (childTran)
     {
         Slider slider = childTran.GetComponentInChildren<Slider>();
         if (slider)
         {
             slider.value = value;
         }
     }
 }
コード例 #6
0
ファイル: CommonUtils.cs プロジェクト: yantian001/2DShooting
 /// <summary>
 /// 设置子节点的文本值
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="child"></param>
 /// <param name="text"></param>
 public static void SetChildText(RectTransform parent, string child, string text)
 {
     var childNode = parent.FindChild(child);
     if (childNode != null)
     {
         var textNode = childNode.GetComponent<Text>();
         if (textNode)
         {
             textNode.text = text;
         }
     }
 }
コード例 #7
0
 public void Init()
 {
     if (IsInit)
         return;
     Canvas = transform.GetComponent<RectTransform>();
     //腳色介面
     MyCharaDataUI = Canvas.FindChild("CharaData").GetComponent<CharaDataUI>();
     MyCharaDataUI.Init();//初始化
     //跳血文字控制器
     MyHitTextController = Canvas.FindChild("HitTextController").GetComponent<HitTextController>();
     MyHitTextController.Init();
     //標題控制器
     TitleController = Canvas.FindChild("FightTitle").GetComponent<FightTitleController>();
     TitleController.Init();
     //冒險進度
     MyProgress = Canvas.FindChild("Progress").GetComponent<Progress>();
     MyProgress.Init();
     //事件
     MyEventUI = Canvas.FindChild("Event").GetComponent<EventUI>();
     MyEventUI.Init();
     IsInit = true;
 }
コード例 #8
0
ファイル: CommonUtils.cs プロジェクト: yantian001/2DShooting
 /// <summary>
 /// 设置RawImage子节点的Texture2d值
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="child"></param>
 /// <param name="texture"></param>
 public static void SetChildRawImage(RectTransform parent, string child, Texture2D texture)
 {
     if (parent == null || texture == null || string.IsNullOrEmpty(child))
         return;
     var childNode = parent.FindChild(child);
     if (childNode != null)
     {
         var img = childNode.GetComponent<RawImage>();
         if (img != null)
         {
             img.texture = texture;
         }
     }
 }
コード例 #9
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;
 }
コード例 #10
0
ファイル: HomeUI.cs プロジェクト: spi8823/Sudenona
        void Awake()
        {
            InputController.SetForKeyboard();
            InputController.SetGravity(5);
            InputController.SetSensitivity(5);

            InputController.SetGamePads();
            InputController.SetAcceptGravityToAnalogPad(true);

            GameStatus.Initialilze();
            rtfButtonPanel = GameObject.Find("/Canvas/ButtonPanel").GetComponent<RectTransform>();
            rtfButtons = rtfButtonPanel.FindChild("Buttons").GetComponent<RectTransform>();
            rtfExpression = rtfButtonPanel.FindChild("ButtonExpression").GetComponent<RectTransform>();
            txtExpression = rtfExpression.FindChild("Text").GetComponent<Text>();
            rtfStatus = GameObject.Find("/Canvas/StatusPanel/Statuses").GetComponent<RectTransform>();
            expressionAnimator = rtfExpression.GetComponent<Animator>();
            eventSystem = GameObject.Find("/EventSystem").GetComponent<EventSystem>();

            buttonList = new List<Button>();
            buttonList.Add(rtfButtons.FindChild("BattleButton").GetComponent<Button>());
            buttonList.Add(rtfButtons.FindChild("PartsButton").GetComponent<Button>());
            buttonList.Add(rtfButtons.FindChild("AIButton").GetComponent<Button>());
            buttonList.Add(rtfButtons.FindChild("SettingButton").GetComponent<Button>());
            buttonList.Add(rtfButtons.FindChild("RecordButton").GetComponent<Button>());
            buttonList.Add(rtfButtons.FindChild("ExitButton").GetComponent<Button>());

            int x = 1;
            int y = x++ + ++x;
            Debug.Log(y);
        }
コード例 #11
0
ファイル: PrepareForStageUI.cs プロジェクト: spi8823/Sudenona
        public void Awake()
        {
            #region 参照登録

            UICanvas = GameObject.Find("/UICanvas").GetComponent<RectTransform>();
            StageSelectPanel = UICanvas.FindChild("StageSelectPanel").GetComponent<RectTransform>();
            StageDiscriptionPanel = StageSelectPanel.FindChild("StageDiscriptionPanel").GetComponent<RectTransform>();
            StageListPanel = StageSelectPanel.FindChild("StageListPanel").GetComponent<RectTransform>();
            StageButtonsPanel = StageListPanel.FindChild("Stages").GetComponent<RectTransform>();
            DifficultyStarsPanel = StageDiscriptionPanel.FindChild("DifficultyStarsPanel").GetComponent<RectTransform>();

            PartsSelectPanel = UICanvas.FindChild("PartsSelectPanel").GetComponent<RectTransform>();
            PartsDiscriptionPanel = PartsSelectPanel.FindChild("PartsDiscriptionPanel").GetComponent<RectTransform>();
            PartsListPanel = PartsSelectPanel.FindChild("PartsListPanel").GetComponent<RectTransform>();
            PartsButtonsPanel = PartsListPanel.FindChild("PartsButtonsPanel").GetComponent<RectTransform>();
            PartsNameText = PartsDiscriptionPanel.FindChild("PartsNameText").GetComponent<RectTransform>();
            PartsLevelText = PartsDiscriptionPanel.FindChild("LevelText").GetComponent<RectTransform>();
            PartsBulletNumText = PartsDiscriptionPanel.FindChild("BulletNumText").GetComponent<RectTransform>();
            PartsDamageText = PartsDiscriptionPanel.FindChild("DamageText").GetComponent<RectTransform>();
            PartsCoolTimeText = PartsDiscriptionPanel.FindChild("CoolTimeText").GetComponent<RectTransform>();
            PartsDiscriptionField = PartsDiscriptionPanel.FindChild("DiscriptionField").GetComponent<RectTransform>();

            eventData = new PointerEventData(GameObject.Find("EventSystem").GetComponent<EventSystem>());

            DifficultyStarPrefab = Resources.Load<GameObject>("Prefabs/UIPrefabs/DifficultyStar");
            #endregion

            ListUpStage();

            DiscriptStage(UnLockedStageList[0]);
        }
コード例 #12
0
ファイル: StoreUI.cs プロジェクト: ofx360/rpg-project
        public Stock(RectTransform template, string parentName, Itemsss item)
        {
            this.itemPanel = Instantiate<RectTransform>(template);
            itemPanel.SetParent(GameObject.Find(parentName).transform);
            itemPanel.localScale = Vector3.one;

            this.item = item;

            this.iconDisplay = itemPanel.FindChild("Icon").GetComponent<Image>();
            this.nameDisplay = itemPanel.FindChild("Name").GetComponent<Text>();
            this.valueDisplay = itemPanel.FindChild("Value").GetComponent<Text>();

            this.nameDisplay.text = item.obj.name;
            this.valueDisplay.text = item.value.ToString();
        }
コード例 #13
0
ファイル: MenuManager.cs プロジェクト: VCRhythm/hotfrog
    void Awake()
    {
        controller = transform.parent.GetComponentInChildren<Controller>();
        purchaseManager = transform.parent.FindChild("SOOMLA").GetComponent<PurchaseManager>();
        frogPackages = GetComponentInParent<FrogPackages>();
        variableManager = GetComponentInParent<VariableManager>();
        advertisingManager = GetComponentInParent<AdvertisingManager>();
        canvas = GetComponent<RectTransform>();
        titleTransform = canvas.FindChild("Title").GetComponent<RectTransform>();

        mainMenu = canvas.FindChild("MainMenu").GetComponent<CanvasGroup>();
        frogButton = mainMenu.transform.FindChild("FrogButton").GetComponent<RectTransform>();
        settingsButton = mainMenu.transform.FindChild("SettingsButton").GetComponent<RectTransform>();

        settingsMenu = canvas.FindChild("SettingsPanel").GetComponent<CanvasGroup>();
        musicToggle = settingsMenu.transform.GetChild(0).FindChild("MusicToggle").GetComponent<Toggle>();

        hud = transform.FindChild("HUD").GetComponent<HUD>();
        hudCanvas = hud.GetComponent<CanvasGroup>();
        hudRect = hud.GetComponent<RectTransform>();

        qualityCountPanelCG = canvas.FindChild("QualityCountPanel").GetComponent<CanvasGroup>();
        qualityCountPanel = qualityCountPanelCG.GetComponent<RectTransform>();
        perfectCount = qualityCountPanel.FindChild("PerfectCount").GetComponent<TextMeshProUGUI>();
        greatCount = qualityCountPanel.FindChild("GreatCount").GetComponent<TextMeshProUGUI>();;
        okCount = qualityCountPanel.FindChild("OKCount").GetComponent<TextMeshProUGUI>();;

        flyIconPosition = new Vector2(screenWidth, 50);
        flyButton = canvas.FindChild ("FlyPanel").GetComponent<Button>();
        flyPanelCG = flyButton.GetComponent<CanvasGroup>();
        flyTextAnimator = flyButton.transform.FindChild("FlyCount").GetComponent<Animator>();
        flyCount = flyButton.transform.FindChild("FlyCount").GetComponent<TextMeshProUGUI>();
        flyToGoText = flyButton.transform.FindChild("ToGoText").GetComponent<TextMeshProUGUI>();
        tameFlyNet = Instantiate(tameFlyNetPrefab, flyIconPosition, Quaternion.identity) as GameObject;

        arrowPanelCG = canvas.FindChild("ArrowPanel").GetComponent<CanvasGroup>();
        arrowPanel = arrowPanelCG.GetComponent<RectTransform>();
        frogName = arrowPanel.FindChild("FrogName").GetComponent<TextMeshProUGUI>();
        arrowPanelBuyButton = arrowPanel.FindChild("BuyButton").gameObject;

        returnPanel = canvas.FindChild("ReturnPanel").GetComponent<CanvasGroup>();
        returnButton = returnPanel.transform.FindChild("ReturnButton").GetComponent<RectTransform>();

        Transform endGameTransform = canvas.FindChild("EndGamePanel");
        endGamePanel = endGameTransform.GetComponent<CanvasGroup>();
        giftButton = endGameTransform.FindChild("GiftsButton").gameObject;
        adButton = endGameTransform.FindChild("AdsButton").gameObject;

        timeUntilGiftText = endGameTransform.FindChild("TimeUntilGift").GetComponent<TextMeshProUGUI>();

        buyButtonObject = endGameTransform.FindChild("BuyButton").gameObject;
        buyButton = buyButtonObject.GetComponent<Button>();
        buyButtonText = buyButton.transform.FindChild("Text").GetComponent<TextMeshProUGUI>();
        buyButtonImage = buyButton.transform.FindChild("Image").GetComponent<Image>();
    }
コード例 #14
0
ファイル: SideLayout.cs プロジェクト: ideadreamDefy/Defy
        public override void InitView()
        {
            if (isInited)
            {
                return;
            }
            isInited = true;

            Transform MainLayout0 = transform.parent.FindChild("MainLayout");
            mainLayout = MainLayout0 as RectTransform;
            Transform MainContainer00 = MainLayout0.FindChild("MainContainer");
            mainContainer = MainContainer00 as RectTransform;

            sideBarLayout = transform as RectTransform;
            Transform SideBarContainer10 = sideBarLayout.FindChild("SideBarContainer");
            sideBarContainer = SideBarContainer10 as RectTransform;
            Transform SideBarNode100 = SideBarContainer10.FindChild("SideBarNode");
            sideBarNode = SideBarNode100 as RectTransform;
            Transform ButtonLayout101 = SideBarContainer10.FindChild("ButtonLayout");
            Transform PanelButtonLocator1010 = ButtonLayout101.FindChild("Locator");
            Transform _Button_SideBar10100 = PanelButtonLocator1010.FindChild("SideBarButton");
            sideBarButton = _Button_SideBar10100.GetComponent<Button>();
            sideBarButton.onClick.AddListener(OnButtonSideBarClicked);

            var localPosition = sideBarLayout.transform.localPosition;
            localPosition.x = localPosition.x + SideBarWidth;

            sideLayoutFixedRightPos = localPosition;
            sideLayoutFixedLeftPos = sideBarLayout.transform.localPosition;

            var horizontalLayoutElement = mainLayout.gameObject.GetComponent<HorizontalLayoutGroup>();
            if (horizontalLayoutElement == null)
            {
                horizontalLayoutElement = mainLayout.gameObject.AddComponent<HorizontalLayoutGroup>();
            }
            horizontalLayoutElement.childForceExpandWidth = false;
            horizontalLayoutElement.childForceExpandHeight = true;

            mainContainerLayoutElement = mainContainer.gameObject.GetComponent<LayoutElement>();
            if (mainContainerLayoutElement == null)
            {
                mainContainerLayoutElement = mainContainer.gameObject.AddComponent<LayoutElement>();
            }
            mainContainerLayoutElement.preferredWidth = mainLayout.rect.width;
        }
コード例 #15
0
ファイル: CommonUtils.cs プロジェクト: yantian001/2DShooting
    public static void SetChildButtonActive(RectTransform parent, string child, bool b)
    {
        if (parent == null || string.IsNullOrEmpty(child))
            return;

        var childNode = parent.FindChild(child);
        if (childNode)
        {
            var button = childNode.GetComponent<Button>();
            button.interactable = b;
        }

    }
コード例 #16
0
ファイル: CargoManager.cs プロジェクト: Syldarion/DJD-JP
    /// <summary>
    /// Updates a resource list
    /// </summary>
    /// <param name="ship">New ship to use</param>
    /// <param name="resource_list">Resource list to repopulate</param>
    public void UpdateResourceList(Ship ship, RectTransform resource_list)
    {
        foreach(string s in AllResources)
        {
            Type cargo_type = typeof(Cargo);
            FieldInfo field = cargo_type.GetField(s);
            int value = (int)field.GetValue(ship.Cargo);

            resource_list.FindChild(string.Format("{0}/Text", s)).GetComponent<Text>().text = string.Format("{0}\n{1}", s, value);
            resource_list.FindChild(string.Format("{0}/Quantity", s)).GetComponent<NumericUpDown>().UpdateValue(0);
            resource_list.FindChild(string.Format("{0}/Quantity", s)).GetComponent<NumericUpDown>().SetMaxValue(value);
        }
    }
コード例 #17
0
ファイル: Demo.cs プロジェクト: James9074/Unity-Juice-UI
    void Start()
    {
        mMiddlePanel = transform.FindChild("Middle").GetComponent<RectTransform>();

        mTweenPanel = mMiddlePanel.FindChild("TweenTypesPanel").GetComponent<RectTransform>();
        mTweenPanelArrow = mTweenPanel.FindChild("Arrow").GetComponent<RectTransform>();
        mCreditsPanelArrow = mMiddlePanel.FindChild("CreditsPanel/Arrow").GetComponent<RectTransform>();

        mInstructionsPanel = mMiddlePanel.FindChild("Instructions").GetComponent<RectTransform>();
        mMoveDot = mInstructionsPanel.FindChild("MoveDot").GetComponent<RectTransform>();

        mDot = mInstructionsPanel.FindChild("Instructions/Juice/Dot").GetComponent<CanvasGroup>();
        Juice.Instance.PulseGroup(mDot, 2, 0, 1);

        Juice.Instance.Delay(2f, () =>
        {
            for (int i = 0; i < mMoveDot.childCount; i++)
            {
                Transform dot = mMoveDot.GetChild(i).transform;
                Juice.Instance.Delay(i / 10f, () => { MoveDot(dot); });
            }
        });
    }
コード例 #18
0
ファイル: Zone.cs プロジェクト: sylafrs/GGJ2016
	private void SetLetterColor(RectTransform letter, Color c)
	{
		RectTransform txtT = letter.FindChild ("Text") as RectTransform;
		Assert.Check (txtT, "Letter Text child not found or has no RectTransform");

		Text txt = txtT.GetComponent<Text> ();
		Assert.Check (txtT, "Letter Text child's 'Text' component not found");

		txt.color = c;
	}