Beispiel #1
0
    // Token: 0x06001E86 RID: 7814 RVA: 0x003A5DD4 File Offset: 0x003A3FD4
    public void OpenRefresh()
    {
        DataManager       instance              = DataManager.Instance;
        GUIManager        instance2             = GUIManager.Instance;
        byte              level                 = instance2.BuildingData.AllBuildsData[this.BuildIndex].Level;
        BuildLevelRequest buildLevelRequestData = instance2.BuildingData.GetBuildLevelRequestData(17, level);

        this.MiddleStr1.Length = 0;
        float f             = 0f;
        uint  effectBaseVal = instance.AttribVal.GetEffectBaseVal(GATTR_ENUM.EGA_RESOURCE_TRADE_TAX_REDUCTION);

        if (buildLevelRequestData.Value2 >= effectBaseVal)
        {
            f = (buildLevelRequestData.Value2 - effectBaseVal) / 100f;
        }
        this.MiddleStr1.FloatToFormat(f, 1, false);
        this.MiddleStr1.AppendFormat(instance.mStringTable.GetStringByID(3949u));
        this.MiddleText1.text = this.MiddleStr1.ToString();
        this.MiddleText1.SetAllDirty();
        this.MiddleText1.cachedTextGenerator.Invalidate();
        uint effectBaseVal2 = instance.AttribVal.GetEffectBaseVal(GATTR_ENUM.EGA_RESOURCE_TRADE_CAPACITY);
        uint effectBaseVal3 = instance.AttribVal.GetEffectBaseVal(GATTR_ENUM.EGA_RESOURCE_TRADE_CAPACITY_PERCENT);

        this.MiddleStr2.Length = 0;
        this.MiddleStr2.IntToFormat((long)(effectBaseVal2 * ((10000u + effectBaseVal3) / 10000.0)), 1, true);
        this.MiddleStr2.AppendFormat(instance.mStringTable.GetStringByID(3950u));
        this.MiddleText2.text = this.MiddleStr2.ToString();
        this.MiddleText2.SetAllDirty();
        this.MiddleText2.cachedTextGenerator.Invalidate();
    }
Beispiel #2
0
    // Token: 0x06001CF0 RID: 7408 RVA: 0x0033CF84 File Offset: 0x0033B184
    private bool CheckResource()
    {
        bool              result                = false;
        DataManager       instance              = DataManager.Instance;
        uint              effectBaseVal         = instance.AttribVal.GetEffectBaseVal(GATTR_ENUM.EGA_RESOURCE_PROTCTION);
        RoleBuildingData  buildData             = GUIManager.Instance.BuildingData.GetBuildData(9, 0);
        BuildLevelRequest buildLevelRequestData = GUIManager.Instance.BuildingData.GetBuildLevelRequestData(9, buildData.Level);
        float             num  = (10000u + effectBaseVal) / 10000f;
        uint              num2 = GameConstants.appCeil(buildLevelRequestData.Value1 * num);

        this.ResMax = num2;
        for (int i = 0; i < 5; i++)
        {
            this.ResIcon[i].enabled = false;
        }
        int num3 = 0;
        int num4 = 0;

        while (num4 < instance.Resource.Length && num4 < 5)
        {
            if (instance.Resource[num4].Stock > num2)
            {
                this.ResIcon[num4].enabled = true;
                this.ResIcon[num4].rectTransform.anchoredPosition = UIImmigration.ResStart + new Vector2(64f * (float)num3, 0f);
                num3++;
            }
            num4++;
        }
        if (num3 == 0)
        {
            this.ResContent.color = UIImmigration.ResContentNormal;
            this.ResContent.text  = DataManager.Instance.mStringTable.GetStringByID(10022u);
            this.ResContent.rectTransform.anchoredPosition = UIImmigration.ResContentPos;
            this.AnimIcon2[0].enabled = false;
            this.AnimIcon2[1].enabled = false;
            this.ResIconV.enabled     = true;
            result = true;
        }
        else
        {
            this.ResContent.color = UIImmigration.ResContentRed;
            this.ResContent.text  = DataManager.Instance.mStringTable.GetStringByID(10021u);
            this.ResContent.rectTransform.anchoredPosition = UIImmigration.ResContentPos + new Vector2((float)(64 * num3), 0f);
            this.AnimIcon2[0].enabled = true;
            this.AnimIcon2[1].enabled = true;
            this.ResIconV.enabled     = false;
        }
        this.ResTitleStr.ClearString();
        this.ResTitleStr.uLongToFormat((ulong)num2, 1, true);
        this.ResTitleStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10020u));
        this.ResTitle.text = this.ResTitleStr.ToString();
        this.ResTitle.SetAllDirty();
        this.ResTitle.cachedTextGenerator.Invalidate();
        return(result);
    }
Beispiel #3
0
    // Token: 0x060018CE RID: 6350 RVA: 0x00299358 File Offset: 0x00297558
    private void SetValue(Color color)
    {
        byte b = 0;

        if ((int)this.m_ManorID < this.GM.BuildingData.AllBuildsData.Length && this.m_ManorID >= 0)
        {
            b = this.GM.BuildingData.AllBuildsData[(int)this.m_ManorID].Level;
        }
        if (b <= 0)
        {
            b = 1;
        }
        BuildLevelRequest buildLevelRequestData = this.GM.BuildingData.GetBuildLevelRequestData(19, b);

        this.m_EffectTemp[0].Effect = buildLevelRequestData.Effect1;
        this.m_EffectTemp[1].Effect = buildLevelRequestData.Effect2;
        this.m_EffectTemp[2].Effect = buildLevelRequestData.Effect3;
        this.m_EffectTemp[3].Effect = buildLevelRequestData.Effect4;
        this.m_EffectTemp[0].Value  = (ushort)buildLevelRequestData.Value1;
        this.m_EffectTemp[1].Value  = (ushort)buildLevelRequestData.Value2;
        this.m_EffectTemp[2].Value  = buildLevelRequestData.Value3;
        this.m_EffectTemp[3].Value  = buildLevelRequestData.Value4;
        for (int i = 0; i < this.m_EffectTemp.Length; i++)
        {
            this.SetValueIcon(i, this.m_EffectTemp[i].Effect);
            GameConstants.GetEffectValue(this.m_ValueText[i].TitleStr, this.m_EffectTemp[i].Effect, 0u, 0, 0f);
            this.m_ValueText[i].TitleText.text = this.m_ValueText[i].TitleStr.ToString();
            this.m_ValueText[i].TitleText.SetAllDirty();
            this.m_ValueText[i].TitleText.cachedTextGenerator.Invalidate();
            GameConstants.GetEffectValue(this.m_ValueText[i].ValueStr, this.m_EffectTemp[i].Effect, (uint)this.m_EffectTemp[i].Value, 3, 0f);
            this.m_ValueText[i].TempStr.ClearString();
            if (this.GM.IsArabic)
            {
                this.m_ValueText[i].TempStr.Append(this.m_ValueText[i].ValueStr);
                this.m_ValueText[i].TempStr.Append(this.DM.mStringTable.GetStringByID(5805u));
            }
            else
            {
                this.m_ValueText[i].TempStr.Append(this.DM.mStringTable.GetStringByID(5805u));
                this.m_ValueText[i].TempStr.Append(this.m_ValueText[i].ValueStr);
            }
            this.m_ValueText[i].ValueText.text  = this.m_ValueText[i].TempStr.ToString();
            this.m_ValueText[i].ValueText.color = color;
            this.m_ValueText[i].ValueText.SetAllDirty();
            this.m_ValueText[i].ValueText.cachedTextGenerator.Invalidate();
        }
    }
Beispiel #4
0
    // Token: 0x06001816 RID: 6166 RVA: 0x0028B1CC File Offset: 0x002893CC
    private void UpdateInfo()
    {
        BuildLevelRequest buildLevelRequestData = GUIManager.Instance.BuildingData.GetBuildLevelRequestData(21, GUIManager.Instance.BuildingData.AllBuildsData[(int)this.Manor_ID].Level);
        long num = 0L;

        if (buildLevelRequestData.Effect1 == 358)
        {
            num = (long)((ulong)buildLevelRequestData.Value1);
        }
        else if (buildLevelRequestData.Effect2 == 358)
        {
            num = (long)((ulong)buildLevelRequestData.Value2);
        }
        else if (buildLevelRequestData.Effect3 == 358)
        {
            num = (long)buildLevelRequestData.Value3;
        }
        num = num * (long)((ulong)DataManager.Instance.AttribVal.GetEffectBaseVal(GATTR_ENUM.EGE_PETRSS_PRODUCTION_PERCENT) + 10000UL) / 10000L;
        this.values[1].ClearString();
        this.values[1].IntToFormat(num, 1, true);
        this.values[1].AppendFormat("{0}");
        UIText component = this.AGS_Form.GetChild(1).GetChild(1).GetChild(2).GetComponent <UIText>();

        component.text = this.values[1].ToString();
        component.cachedTextGenerator.Invalidate();
        component.SetAllDirty();
        this.values[2].ClearString();
        this.values[2].IntToFormat((long)((ulong)DataManager.Instance.PetResource.Capacity), 1, true);
        this.values[2].AppendFormat("{0}");
        component      = this.AGS_Form.GetChild(1).GetChild(2).GetChild(2).GetComponent <UIText>();
        component.text = this.values[2].ToString();
        component.cachedTextGenerator.Invalidate();
        component.SetAllDirty();
        this.values[3].ClearString();
        this.values[3].IntToFormat(DataManager.Instance.PetResource.GetSpeed(), 1, true);
        this.values[3].AppendFormat("{0}");
        component      = this.AGS_Form.GetChild(1).GetChild(3).GetChild(2).GetComponent <UIText>();
        component.text = this.values[3].ToString();
        component.cachedTextGenerator.Invalidate();
        component.SetAllDirty();
    }
Beispiel #5
0
    // Token: 0x06001AA0 RID: 6816 RVA: 0x002D42FC File Offset: 0x002D24FC
    private void LoadInfo()
    {
        switch (this.OpenDigType)
        {
        case 1:
        {
            UIText component = this.AGS_Form.GetChild(6).GetChild(8).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(3990u);
            component      = this.AGS_Form.GetChild(6).GetChild(9).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(4058u);
            break;
        }

        case 2:
        {
            UIText component = this.AGS_Form.GetChild(6).GetChild(8).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(3991u);
            component      = this.AGS_Form.GetChild(6).GetChild(9).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(4059u);
            break;
        }

        case 3:
        {
            UIText component = this.AGS_Form.GetChild(6).GetChild(8).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(3992u);
            component      = this.AGS_Form.GetChild(6).GetChild(9).GetComponent <UIText>();
            component.text = this.DM.mStringTable.GetStringByID(4060u);
            break;
        }
        }
        if (this.DM.m_CryptData.money == 0)
        {
            this.interest = 1.0 + GameConstants.cryptInterest[(int)this.OpenDigType] + this.DM.AttribVal.GetEffectBaseValByEffectID(277) / 10000.0;
            if (this.funds < 10000)
            {
                this.funds = 10000;
            }
            this.profit   = (uint)Math.Floor((double)this.funds * this.interest);
            this.MaxFunds = (ushort)this.DM.AttribVal.GetEffectBaseValByEffectID(278);
            UIText component = this.AGS_Form.GetChild(6).GetChild(10).GetComponent <UIText>();
            this.interestText.ClearString();
            this.interestText.FloatToFormat(this.DM.AttribVal.GetEffectBaseValByEffectID(277) / 100u, 2, false);
            if (!GUIManager.Instance.IsArabic)
            {
                this.interestText.AppendFormat("+{0}%");
            }
            else
            {
                this.interestText.AppendFormat("%{0}+");
            }
            component.text = this.interestText.ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            RectTransform rectTransform;
            if (this.slider == null)
            {
                GameObject gameObject = new GameObject("Slider");
                rectTransform = gameObject.AddComponent <RectTransform>();
                rectTransform.anchoredPosition = new Vector2(-110f, -215f);
                gameObject.transform.SetParent(this.AGS_Form.GetChild(9), false);
                this.slider = gameObject.AddComponent <UnitResourcesSlider>();
                GUIManager.Instance.InitUnitResourcesSlider(gameObject.transform, eUnitSlider.Crypt, 10000u, (uint)this.MaxFunds, 1f);
                this.slider.m_Handler = this;
                this.slider.m_ID      = 1;
                this.slider.BtnInputText.m_Handler = this;
                this.slider.BtnInputText.m_BtnID1  = 4;
            }
            this.slider.MaxValue          = (long)this.MaxFunds;
            this.slider.m_slider.maxValue = (double)this.MaxFunds;
            this.MaxFundText.ClearString();
            this.MaxFundText.IntToFormat((long)this.MaxFunds, 1, true);
            this.MaxFundText.AppendFormat("{0}");
            this.slider.m_TotalText.text = this.MaxFundText.ToString();
            this.slider.m_TotalText.SetAllDirty();
            this.slider.m_TotalText.cachedTextGenerator.Invalidate();
            StringManager.IntToStr(this.fundsText, (long)this.funds, 1, true);
            this.slider.m_inputText.text = this.fundsText.ToString();
            this.slider.m_inputText.SetAllDirty();
            this.slider.m_inputText.cachedTextGenerator.Invalidate();
            rectTransform = this.AGS_Form.GetChild(9).GetChild(1).GetComponent <RectTransform>();
            rectTransform.anchoredPosition = new Vector2(-110f, -281f);
            rectTransform = this.AGS_Form.GetChild(9).GetChild(0).GetComponent <RectTransform>();
            rectTransform.anchoredPosition = new Vector2(-170f, -213f);
            rectTransform = this.AGS_Form.GetChild(9).GetChild(2).GetComponent <RectTransform>();
            rectTransform.anchoredPosition = new Vector2(54f, -223f);
            this.AGS_SuperBtn_SA.SetSpriteIndex(0);
            this.AGS_Form.GetChild(10).GetChild(0).gameObject.SetActive(false);
            this.AGS_Form.GetChild(10).GetChild(2).gameObject.SetActive(false);
            this.AGS_Form.GetChild(10).GetChild(1).GetComponent <UIText>().text = this.DM.mStringTable.GetStringByID(4089u);
            this.AGS_Form.GetChild(10).GetComponent <UIButton>().m_BtnID1       = 1;
            component       = this.AGS_Form.GetChild(6).GetChild(12).GetComponent <UIText>();
            component.color = new Color32(0, byte.MaxValue, 0, byte.MaxValue);
            this.AGS_Form.GetChild(9).gameObject.SetActive(true);
            this.AGS_Form.GetChild(10).gameObject.SetActive(true);
            this.AGS_Form.GetChild(9).GetChild(1).gameObject.SetActive(true);
            this.AGS_Form.GetChild(9).GetChild(2).gameObject.SetActive(true);
        }
        else
        {
            if (this.DM.m_CryptData.kind == this.OpenDigType)
            {
                BuildLevelRequest buildLevelRequestData = GUIManager.Instance.BuildingData.GetBuildLevelRequestData(16, this.DM.m_CryptData.level);
                this.interest = 1.0 + GameConstants.cryptInterest[(int)this.DM.m_CryptData.kind] + buildLevelRequestData.Value2 / 10000.0;
                this.funds    = this.DM.m_CryptData.money;
                this.profit   = (uint)Math.Floor((double)this.funds * this.interest);
                UIText component = this.AGS_Form.GetChild(6).GetChild(10).GetComponent <UIText>();
                this.interestText.ClearString();
                this.interestText.FloatToFormat(buildLevelRequestData.Value2 / 100u, 2, false);
                if (!GUIManager.Instance.IsArabic)
                {
                    this.interestText.AppendFormat("+{0}%");
                }
                else
                {
                    this.interestText.AppendFormat("%{0}+");
                }
                component.text = this.interestText.ToString();
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component       = this.AGS_Form.GetChild(6).GetChild(12).GetComponent <UIText>();
                component.color = Color.yellow;
                this.AGS_Form.GetChild(8).gameObject.SetActive(true);
                this.AGS_Form.GetChild(10).gameObject.SetActive(true);
                component = this.AGS_Form.GetChild(8).GetChild(3).GetComponent <UIText>();
                this.profitText.ClearString();
                this.profitText.IntToFormat((long)((ulong)this.profit), 1, true);
                this.profitText.AppendFormat("{0}");
                component.text = this.profitText.ToString();
                this.updateTimeBar();
            }
            else
            {
                this.interest = 1.0 + GameConstants.cryptInterest[(int)this.OpenDigType] + this.DM.AttribVal.GetEffectBaseValByEffectID(277) / 10000.0;
                this.funds    = 0;
                this.profit   = 0u;
                UIText component = this.AGS_Form.GetChild(6).GetChild(10).GetComponent <UIText>();
                this.interestText.ClearString();
                this.interestText.FloatToFormat(this.DM.AttribVal.GetEffectBaseValByEffectID(277) / 100u, 2, false);
                if (!GUIManager.Instance.IsArabic)
                {
                    this.interestText.AppendFormat("+{0}%");
                }
                else
                {
                    this.interestText.AppendFormat("%{0}+");
                }
                component.text = this.interestText.ToString();
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component       = this.AGS_Form.GetChild(6).GetChild(12).GetComponent <UIText>();
                component.color = Color.yellow;
                component       = this.AGS_Form.GetChild(7).GetChild(0).GetComponent <UIText>();
                component.text  = this.DM.mStringTable.GetStringByID(4092u);
                component.transform.parent.gameObject.SetActive(true);
                component.gameObject.SetActive(true);
            }
            this.AGS_Form.GetChild(9).GetChild(1).gameObject.SetActive(false);
            this.AGS_Form.GetChild(9).GetChild(2).gameObject.SetActive(false);
        }
        this.SetNumbers();
    }