public void Init(string btnName) { Transform panel = transform.FindChild("Panel").transform; mBtnCancel = panel.FindChild("Btns").FindChild("BtnCancel").GetComponent <UIButton> (); mBtnConfirm = panel.FindChild("Btns").FindChild("BtnConfirm").GetComponent <UIButton> (); mBtnConfirm2 = panel.FindChild("Btns").FindChild("BtnConfirm2").GetComponent <UIButton> (); mLblGot = mLblGold1.GetComponent <UILabel> (); mLblUse = mLblGold2.GetComponent <UILabel> (); mLblExpect = mLblGold3.GetComponent <UILabel> (); mLblSelectedBase = mLblReward1_1.GetComponent <UILabel> (); mLblSelectedRatio = mLblReward1_2.GetComponent <UILabel> (); mLblCardName = mLblReward2_1.GetComponent <UILabel> (); mLblCardRatio = mLblReward2_2.GetComponent <UILabel> (); mLblTotalRatio = mLblReward3_2.GetComponent <UILabel> (); mNameSelectedBtn = btnName; mSbi = GetBettingItem(); if (mSbi.IsSelected) { mBtnCancel.gameObject.SetActive(true); mBtnConfirm.gameObject.SetActive(true); mBtnConfirm2.gameObject.SetActive(false); } else { mBtnCancel.gameObject.SetActive(false); mBtnConfirm.gameObject.SetActive(false); mBtnConfirm2.gameObject.SetActive(true); } mLblGot.text = UtilMgr.AddsThousandsSeparator(UserMgr.UserInfo.userGoldenBall); mLblUse.text = UtilMgr.AddsThousandsSeparator(mAmountUse); mLblExpect.text = UtilMgr.AddsThousandsSeparator(mAmountUse * float.Parse(QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].ratio)); mLblSelectedBase.text = QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].description; mLblSelectedRatio.text = QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].ratio + "x"; mLblCardName.text = "-"; mLblCardRatio.text = "1x"; float total = float.Parse(QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].ratio) * 1f; mLblTotalRatio.text = total + "x"; }
bool Init(string btnName) { BtnName = btnName; // if(double.Parse(UserMgr.UserInfo.userGoldenBall) < 1){ // DialogueMgr.ShowDialogue(mNoMoreGoldTitle, mNoMoreGoldBody, // DialogueMgr.DIALOGUE_TYPE.Alert, // DialogueHandler); // return true; // } mNameSelectedBtn = btnName; mSbi = GetBettingItem(); // // Transform panel = transform.FindChild ("Panel").transform; // mBtnCancel = panel.FindChild ("Btns").FindChild ("BtnCancel").GetComponent<UIButton> (); // mBtnConfirm = panel.FindChild ("Btns").FindChild ("BtnConfirm").GetComponent<UIButton> (); // mBtnConfirm2 = panel.FindChild ("Btns").FindChild ("BtnConfirm2").GetComponent<UIButton> (); // mLblGot = mLblGold1.GetComponent<UILabel> (); // mLblUse = mLblGold2.GetComponent<UILabel> (); // mLblExpect = mLblGold3.GetComponent<UILabel> (); // mLblSelectedBase = mLblReward1_1.GetComponent<UILabel> (); // mLblSelectedRatio = mLblReward1_2.GetComponent<UILabel> (); // mLblCardName = mLblReward2_1.GetComponent<UILabel> (); // mLblCardRatio = mLblReward2_2.GetComponent<UILabel> (); // mLblTotalRatio = mLblReward3_2.GetComponent<UILabel> (); // // if (mSbi.IsSelected) // { // mBtnCancel.gameObject.SetActive(true); // mBtnConfirm.gameObject.SetActive(true); // mBtnConfirm2.gameObject.SetActive(false); // } // else // { // mBtnCancel.gameObject.SetActive(false); // mBtnConfirm.gameObject.SetActive(false); // mBtnConfirm2.gameObject.SetActive(true); // } // // // mLblGot.text = UtilMgr.AddsThousandsSeparator (UserMgr.UserInfo.userGoldenBall); // mLblUse.text = UtilMgr.AddsThousandsSeparator (mAmountUse); // mLblExpect.text = UtilMgr.AddsThousandsSeparator (GetExpectGold()); // // mLblSelectedBase.text = QuizMgr.QuizInfo.order [GetIndex (mNameSelectedBtn)].description; // mLblSelectedRatio.text = QuizMgr.QuizInfo.order [GetIndex (mNameSelectedBtn)].ratio+"x"; // // float total = 0; // if(mCardInfo != null){ // mSbi.SetCardInfo(mCardInfo); // mLblCardName.text = mCardInfo.cardName; // mLblCardRatio.text = "+"+mCardInfo.rewardRate+"x"; // total = float.Parse(QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].ratio) // + mCardInfo.rewardRate; // } else if(mStrategyInfo != null){ // mSbi.SetStrategyInfo(mStrategyInfo); // mLblCardName.text = mStrategyInfo.itemName; // mLblCardRatio.text = "*"+mStrategyInfo.multipleRatio+"x"; // total = float.Parse(QuizMgr.QuizInfo.order [GetIndex(mNameSelectedBtn)].ratio) // * mStrategyInfo.multipleRatio; // } else{ // mLblCardName.text = mStrNoCard; // mLblCardRatio.text = "-"; // total = float.Parse (QuizMgr.QuizInfo.order [GetIndex (mNameSelectedBtn)].ratio) * 1f; // } // // mLblTotalRatio.text = total+"x"; // // InitAmountUse(); transform.root.GetComponent <AudioSource>().PlayOneShot(mAudioOpenBet); return(false); }