Ejemplo n.º 1
0
    private void Init()
    {
        stakesHint = transform.Find("txtStakesHint").GetComponent <StakesHint>();

        goStakesSum  = transform.Find("StakesSum").gameObject;
        txtStakesSum = transform.Find("StakesSum/txtStakesSum").GetComponent <Text>();
        goCoin       = transform.Find("Coin").gameObject;
        lookCardHint = transform.Find("LookCardHint").gameObject;
        txtCoin      = transform.Find("Coin/txtCoin").GetComponent <Text>();
        goCountDown  = transform.Find("goCountDown").gameObject;
        txtCountDown = transform.Find("goCountDown/txtCountDown").GetComponent <Text>();
        txtHint      = transform.Find("txtHint").GetComponent <Text>();
        imgBanker    = transform.Find("imgBanker").GetComponent <Image>();
        imgHead      = transform.Find("imgHead").GetComponent <Image>();
        txtName      = transform.Find("txtName").GetComponent <Text>();
        cardPoint    = transform.Find("cardPoint");

        txtStakesSum.text = "0";

        HintObj();
    }
Ejemplo n.º 2
0
    private void Init()
    {
        audio          = GetComponent <AudioSource>();
        gameManager    = GetComponentInParent <GameManagerOnline>();
        goCompareBtns  = transform.Find("goCompareBtns").gameObject;
        btnCompareLeft = goCompareBtns.transform.Find("btnCompareLeft").GetComponent <Button>();
        btnCompareLeft.onClick.AddListener(OnCompareLeftButtonClick);
        btnCompareRight = goCompareBtns.transform.Find("btnCompareRight").GetComponent <Button>();
        btnCompareRight.onClick.AddListener(OnCompareRightButtonClick);
        goBottomButton = transform.Find("goBottomButton").gameObject;
        goCountDown    = transform.Find("goCountDown").gameObject;
        txtHint        = transform.Find("txtHint").GetComponent <Text>();
        imgHead        = transform.Find("imgHead").GetComponent <Image>();
        imgBanker      = transform.Find("imgBanker").GetComponent <Image>();
        txtName        = transform.Find("txtName").GetComponent <Text>();
        txtCoin        = transform.Find("Coin/txtCoin").GetComponent <Text>();
        txtCountDown   = transform.Find("goCountDown/txtCountDown").GetComponent <Text>();
        txtStakesSum   = transform.Find("StakesSum/txtStakesSum").GetComponent <Text>();
        txtCoin        = transform.Find("Coin/txtCoin").GetComponent <Text>();
        stakesHint     = transform.Find("txtStakesHint").GetComponent <StakesHint>();
        cardPoint      = transform.Find("cardPoint");
        tog2           = transform.Find("goBottomButton/tog2").GetComponent <Toggle>();
        tog5           = transform.Find("goBottomButton/tog5").GetComponent <Toggle>();
        tog10          = transform.Find("goBottomButton/tog10").GetComponent <Toggle>();
        btnReady       = transform.Find("btnReady").GetComponent <Button>();
        btnReady.onClick.AddListener(OnReadyButtonClick);
        btnUnReady = transform.Find("btnUnReady").GetComponent <Button>();
        btnUnReady.onClick.AddListener(OnUnReadyButtonClick);
        btnLookCard = transform.Find("goBottomButton/btnLookCard").GetComponent <Button>();
        btnLookCard.onClick.AddListener(OnLookCardBtnClick);
        btnFollowStakes = transform.Find("goBottomButton/btnFollowStakes").GetComponent <Button>();
        btnFollowStakes.onClick.AddListener(OnFollowBtnClick);
        btnGiveUp = transform.Find("goBottomButton/btnGiveUp").GetComponent <Button>();
        btnGiveUp.onClick.AddListener(OnGiveUpButtonClick);
        btnCompareCard = transform.Find("goBottomButton/btnCompareCard").GetComponent <Button>();
        btnCompareCard.onClick.AddListener(OnCompareBtnClick);
        btnAddStakes = transform.Find("goBottomButton/btnAddStakes").GetComponent <Button>();
        btnAddStakes.onClick.AddListener(OnAddStakesButtonClick);

        // 规则图片,不规则按钮
        btnLookCard.GetComponent <Image>().alphaHitTestMinimumThreshold     = 0.5f; // 忽略透明区域
        btnFollowStakes.GetComponent <Image>().alphaHitTestMinimumThreshold = 0.5f;
        btnGiveUp.GetComponent <Image>().alphaHitTestMinimumThreshold       = 0.5f;
        btnAddStakes.GetComponent <Image>().alphaHitTestMinimumThreshold    = 0.5f;
        btnCompareCard.GetComponent <Image>().alphaHitTestMinimumThreshold  = 0.5f;
        tog2.GetComponent <Image>().alphaHitTestMinimumThreshold            = 0.5f;
        tog5.GetComponent <Image>().alphaHitTestMinimumThreshold            = 0.5f;
        tog10.GetComponent <Image>().alphaHitTestMinimumThreshold           = 0.5f;

        goBottomButton.SetActive(false);
        imgBanker.gameObject.SetActive(false);
        txtHint.gameObject.SetActive(false);
        goCountDown.SetActive(false);
        goCompareBtns.SetActive(false);
        btnUnReady.gameObject.SetActive(false);

        txtStakesSum.text = "0";
        if (Models.GameModel.userDto != null)
        {
            imgHead.sprite = ResourcesManager.GetSprite(Models.GameModel.userDto.iconName);
            txtName.text   = Models.GameModel.userDto.name;
            txtCoin.text   = Models.GameModel.userDto.coin.ToString();
        }
    }