Ejemplo n.º 1
0
    // Token: 0x06001FE4 RID: 8164 RVA: 0x003CC5CC File Offset: 0x003CA7CC
    public void UpdateBtnStyle()
    {
        TalentTbl recordByKey = DataManager.Instance.TalentData.GetRecordByKey((ushort)this.TalentID);

        this.SetBtnStyle((byte)this.ConfirmBtn.m_BtnID3, recordByKey.LevelMax);
    }
Ejemplo n.º 2
0
    // Token: 0x06001FE5 RID: 8165 RVA: 0x003CC60C File Offset: 0x003CA80C
    private void SetBtnStyle(byte state, byte MaxLevel)
    {
        byte        level    = GUIManager.Instance.BuildingData.GetBuildData(8, 0).Level;
        DataManager instance = DataManager.Instance;

        if ((state & 1) > 0)
        {
            TalentTbl recordByKey = instance.TalentData.GetRecordByKey((ushort)this.TalentID);
            this.ConfirmBtn.m_BtnID1 = 4;
            this.ConfirmBtn.m_BtnID2 = (int)recordByKey.NeedTalentID;
            this.ConfirmBtn.m_BtnID4 = (int)(recordByKey.NeedTalentLv - instance.GetTalentLevel(recordByKey.NeedTalentID, this.SaveSlot));
            this.ConfirmBtn.m_BtnID3 = (int)instance.CheckTalentState(recordByKey.NeedTalentID, this.SaveSlot, (byte)this.ConfirmBtn.m_BtnID4);
            this.ResetBtn.gameObject.SetActive(false);
            this.ConfirmMaxBtn.gameObject.SetActive(false);
            this.ConfirmRect.anchoredPosition = new Vector2(4f, this.ConfirmRect.anchoredPosition.y);
            this.ConfirmRect.sizeDelta        = new Vector2(232f, this.ConfirmRect.sizeDelta.y);
            this.PointIcon.gameObject.SetActive(false);
            this.LockIcon.gameObject.SetActive(true);
            this.LearnText.text     = instance.mStringTable.GetStringByID(10030u);
            this.NeedPointText.text = string.Empty;
        }
        else if (level < 16)
        {
            this.ConfirmBtn.m_BtnID1 = 2;
            this.ConfirmBtn.m_BtnID2 = this.TalentID;
            this.ConfirmBtn.m_BtnID3 = (int)state;
            this.ConfirmBtn.m_BtnID4 = 1;
            this.ConfirmMaxBtn.gameObject.SetActive(false);
            this.ConfirmRect.anchoredPosition = new Vector2(4f, this.ConfirmRect.anchoredPosition.y);
            this.ConfirmRect.sizeDelta        = new Vector2(232f, this.ConfirmRect.sizeDelta.y);
            this.PointIcon.gameObject.SetActive(true);
            this.LockIcon.gameObject.SetActive(false);
            this.LearnText.text = instance.mStringTable.GetStringByID(1506u);
            this.UpdateResetBtnState(instance.GetTalentLevel((ushort)this.TalentID, this.SaveSlot));
        }
        else
        {
            this.ConfirmBtn.m_BtnID1 = 2;
            this.ConfirmBtn.m_BtnID2 = this.TalentID;
            this.ConfirmBtn.m_BtnID3 = (int)state;
            this.ConfirmBtn.m_BtnID4 = 1;
            this.ConfirmMaxBtn.gameObject.SetActive(true);
            this.ConfirmMaxBtn.m_BtnID2 = this.TalentID;
            instance.GetNeedTalentPoint((ushort)this.TalentID, ref MaxLevel, this.SaveSlot);
            this.ConfirmMaxBtn.m_BtnID4 = (int)(MaxLevel - instance.GetTalentLevel((ushort)this.TalentID, this.SaveSlot));
            byte addLevel = (byte)Mathf.Clamp(this.ConfirmMaxBtn.m_BtnID4, 1, (int)MaxLevel);
            this.ConfirmMaxBtn.m_BtnID3 = (int)instance.CheckTalentState((ushort)this.TalentID, this.SaveSlot, addLevel);
            this.MaxNeedPointStr.ClearString();
            this.MaxNeedPointStr.IntToFormat((long)this.ConfirmMaxBtn.m_BtnID4, 1, false);
            this.MaxNeedPointStr.AppendFormat("{0}");
            this.MaxNeedPointText.text = this.MaxNeedPointStr.ToString();
            this.MaxNeedPointText.SetAllDirty();
            this.MaxNeedPointText.cachedTextGenerator.Invalidate();
            if (this.SaveSlot > 0)
            {
                this.ConfirmRect.anchoredPosition = new Vector2(-44f, this.ConfirmRect.anchoredPosition.y);
                this.ConfirmRect.sizeDelta        = new Vector2(165f, this.ConfirmRect.sizeDelta.y);
            }
            else
            {
                this.ConfirmRect.anchoredPosition    = new Vector2(-105f, this.ConfirmRect.anchoredPosition.y);
                this.ConfirmRect.sizeDelta           = new Vector2(180f, this.ConfirmRect.sizeDelta.y);
                this.ConfirmMaxRect.anchoredPosition = new Vector2(110f, this.ConfirmMaxRect.anchoredPosition.y);
            }
            this.UpdateResetBtnState(instance.GetTalentLevel((ushort)this.TalentID, this.SaveSlot));
            this.ConfirmMaxRect.sizeDelta = this.ConfirmRect.sizeDelta;
            this.PointIcon.gameObject.SetActive(true);
            this.LockIcon.gameObject.SetActive(false);
            this.LearnText.text = instance.mStringTable.GetStringByID(1506u);
        }
        ColorBlock colors = this.ConfirmBtn.colors;

        if ((state & 1) > 0)
        {
            this.Black.gameObject.SetActive(true);
            this.Lock.gameObject.SetActive(true);
        }
        else
        {
            this.Black.gameObject.SetActive(false);
            this.Lock.gameObject.SetActive(false);
        }
        colors.highlightedColor = colors.normalColor;
        this.ConfirmBtn.colors  = colors;
    }
Ejemplo n.º 3
0
    // Token: 0x06001FE3 RID: 8163 RVA: 0x003CBFE8 File Offset: 0x003CA1E8
    public void UpdateTalentInfo()
    {
        DataManager instance    = DataManager.Instance;
        TalentTbl   recordByKey = instance.TalentData.GetRecordByKey((ushort)this.TalentID);
        byte        talentLevel = instance.GetTalentLevel(recordByKey.TalentID, this.SaveSlot);

        this.TalentName.text = instance.mStringTable.GetStringByID((uint)recordByKey.NameID);
        float   num       = 163f / (float)recordByKey.LevelMax;
        Vector2 sizeDelta = this.DegreeRect.sizeDelta;

        sizeDelta.x = num * (float)talentLevel;
        this.DegreeRect.sizeDelta = sizeDelta;
        this.LevelStr.ClearString();
        this.LevelStr.IntToFormat((long)talentLevel, 1, false);
        this.LevelStr.IntToFormat((long)recordByKey.LevelMax, 1, false);
        if (GUIManager.Instance.IsArabic)
        {
            this.LevelStr.AppendFormat("{1}/{0}");
        }
        else
        {
            this.LevelStr.AppendFormat("{0}/{1}");
        }
        this.LevelText.text = this.LevelStr.ToString();
        this.LevelText.SetAllDirty();
        this.LevelText.cachedTextGenerator.Invalidate();
        this.GraphicID = recordByKey.Graphic;
        if (GUIManager.Instance.TechMaterial == null)
        {
            this.TalentIcon.enabled = false;
        }
        else
        {
            this.TalentIcon.sprite   = GUIManager.Instance.GetTechSprite(this.GraphicID);
            this.TalentIcon.material = GUIManager.Instance.TechMaterial;
            this.TalentIcon.enabled  = true;
        }
        this.NeedPointStr.ClearString();
        this.EffectStr.ClearString();
        this.EffectNextStr.ClearString();
        this.ContentStr.ClearString();
        uint           num2  = 0u;
        byte           level = Math.Max(1, talentLevel);
        TalentLevelTbl talentLevelTbl;

        if (instance.GetTalentLevelupData(out talentLevelTbl, (ushort)this.TalentID, level))
        {
            if (talentLevel > 0)
            {
                num2 += (uint)talentLevelTbl.EffectVal;
            }
            CString cstring = StringManager.Instance.StaticString1024();
            if (talentLevel == 0 && recordByKey.NeedTalentID > 0)
            {
                this.EffectStr.IntToFormat((long)recordByKey.NeedTalentLv, 1, false);
                this.EffectStr.StringToFormat(instance.mStringTable.GetStringByID((uint)instance.TalentData.GetRecordByKey(recordByKey.NeedTalentID).NameID));
                this.EffectStr.AppendFormat(instance.mStringTable.GetStringByID(1510u));
            }
            else if (talentLevelTbl.Effect <= 1000)
            {
                if (num2 > 0u)
                {
                    GameConstants.GetEffectValue(cstring, talentLevelTbl.Effect, 0u, 6, num2);
                    this.EffectStr.StringToFormat(cstring);
                    this.EffectStr.AppendFormat(instance.mStringTable.GetStringByID(5012u));
                }
            }
            else
            {
                GameConstants.GetEffectValue(cstring, talentLevelTbl.Effect, 0u, 7, num2);
                this.EffectStr.StringToFormat(cstring);
                this.EffectStr.AppendFormat(instance.mStringTable.GetStringByID(5012u));
            }
            this.EffectText.text = this.EffectStr.ToString();
            this.EffectText.SetAllDirty();
            this.EffectText.cachedTextGenerator.Invalidate();
            GameConstants.GetEffectValue(this.ContentStr, talentLevelTbl.Effect, num2, 0, 0f);
            this.ContText.text = this.ContentStr.ToString();
            this.ContText.SetAllDirty();
            this.ContText.cachedTextGenerator.Invalidate();
        }
        if (talentLevel < recordByKey.LevelMax && instance.GetTalentLevelupData(out talentLevelTbl, (ushort)this.TalentID, talentLevel + 1))
        {
            num2 = (uint)((ushort)((uint)talentLevelTbl.EffectVal - num2));
            CString cstring2 = StringManager.Instance.StaticString1024();
            if (talentLevelTbl.Effect <= 1000)
            {
                GameConstants.GetEffectValue(cstring2, talentLevelTbl.Effect, 0u, 6, num2);
            }
            else
            {
                GameConstants.GetEffectValue(cstring2, talentLevelTbl.Effect, 0u, 7, num2);
            }
            GameConstants.GetEffectValue(this.ContentStr, talentLevelTbl.Effect, num2, 0, 0f);
            this.ContText.text = this.ContentStr.ToString();
            this.ContText.SetAllDirty();
            this.ContText.cachedTextGenerator.Invalidate();
            this.EffectNextStr.StringToFormat(cstring2);
            this.EffectNextStr.AppendFormat(instance.mStringTable.GetStringByID(5013u));
            this.EffectNextText.text = this.EffectNextStr.ToString();
            this.EffectNextText.SetAllDirty();
            this.EffectNextText.cachedTextGenerator.Invalidate();
            this.NeedPointStr.IntToFormat((long)talentLevelTbl.NeedPoint, 1, false);
            this.NeedPointStr.AppendFormat("{0}");
            this.NeedPointText.text = this.NeedPointStr.ToString();
            this.NeedPointText.SetAllDirty();
            this.NeedPointText.cachedTextGenerator.Invalidate();
            this.LearnTrans.gameObject.SetActive(true);
            this.ResearchFull.gameObject.SetActive(false);
            this.FullFrame.gameObject.SetActive(false);
            this.Frame.gameObject.SetActive(true);
        }
        else
        {
            this.EffectNextText.text = string.Empty;
            this.LearnTrans.gameObject.SetActive(false);
            this.ResearchFull.gameObject.SetActive(true);
            this.FullFrame.gameObject.SetActive(true);
            this.Frame.gameObject.SetActive(false);
            this.ResetBtn.gameObject.SetActive(true);
            this.ResetStateImg.color = Color.white;
        }
        this.SetBtnStyle(instance.CheckTalentState((ushort)this.TalentID, this.SaveSlot, 1), recordByKey.LevelMax);
    }