コード例 #1
0
ファイル: UI_Getted_Dice.cs プロジェクト: robin1392/robin
        public void Initialize(InfoData pData, int level, int count)
        {
            _data = pData;

            int needDiceCount = int.MaxValue;

            if (_data.isGuardian == false)
            {
                TDataDiceUpgrade dataDiceUpgrade;
                if (TableManager.Get().DiceUpgrade.GetData(x => x.diceLv == level + 1 && x.diceGrade == (int)_data.grade, out dataDiceUpgrade))
                {
                    needDiceCount = dataDiceUpgrade.needCard;
                }
            }

            if (needDiceCount == 0)
            {
                needDiceCount = 1;
            }

            image_Icon.sprite = FileHelper.GetIcon(_data.iconName);
            image_Eye.color   = FileHelper.GetColor(_data.color);

            bool isUpgradePossible = count >= needDiceCount;

            text_DiceLevel.text = $"{Global.g_class} {level}";
            text_DiceCount.text = $"{count}/{needDiceCount}";
            //image_DiceGuage.fillAmount = count / (float)needDiceCount;
            slider_DiceGuage.gameObject.SetActive(!_data.isGuardian);
            slider_DiceGuage.value = count / (float)needDiceCount;
            //image_DiceGuage.color = arrColor[count >= needDiceCount ? 1 : 0];
            image_DiceGuage.sprite = arrSprite_DiceGuage[isUpgradePossible ? 1 : 0];
            //count >= needDiceCount ? arrColor[1] : arrColor[0];//UnityUtil.HexToColor("6AD3E5");

            bool isUpgradeEnable = count >= needDiceCount;

            obj_UpgradeIcon.SetActive(isUpgradeEnable);
            obj_Upgradeable.SetActive(isUpgradeEnable);
            button_LevelUp.gameObject.SetActive(isUpgradeEnable);
            //obj_UpgradeLight.SetActive(obj_UpgradeIcon.activeSelf);

            button_Use.onClick.AddListener(() => { _panelDice.Click_Dice_Use(_data.id); });
            button_Info.onClick.AddListener(() => { _panelDice.Click_Dice_Info(_data.id); });
            button_LevelUp.onClick.AddListener(() => { _panelDice.Click_Dice_Info(_data.id); });

            if (_data.isGuardian)
            {
                image_GradeBG.sprite       = arrSprite_GradeBG[0];
                image_SelectGradeBG.sprite = arrSprite_SelectGradeBG[0];
            }
            else
            {
                image_GradeBG.sprite = arrSprite_GradeBG[(int)_data.grade];
                //image_SelectGradeBG.sprite = arrSprite_SelectGradeBG[isUpgradeEnable ? 4 : (int)_data.grade];
                image_SelectGradeBG.sprite = arrSprite_SelectGradeBG[(int)_data.grade];
            }

            // 장착중인지
            SetEquipedMark();
        }
コード例 #2
0
 public void Initialize(TDataGuardianInfo pData)
 {
     data = new InfoData(pData);
     Initialize();
 }
コード例 #3
0
 //public void Initialize(Data_Dice pData)
 public void Initialize(TDataDiceInfo pData)
 {
     data = new InfoData(pData);
     Initialize();
 }