Exemplo n.º 1
0
    // Token: 0x06002B20 RID: 11040 RVA: 0x00471494 File Offset: 0x0046F694
    public void CheckMessage(ushort ItemID)
    {
        DataManager instance      = DataManager.Instance;
        GUIManager  instance2     = GUIManager.Instance;
        uint        num           = 0u;
        uint        num2          = 0u;
        bool        flag          = false;
        bool        flag2         = false;
        bool        flag3         = false;
        Equip       recordByKey   = instance.EquipTable.GetRecordByKey(ItemID);
        ushort      equipKind     = (ushort)recordByKey.EquipKind;
        ushort      propertieskey = recordByKey.PropertiesInfo[0].Propertieskey;

        for (int i = 0; i < instance.MaxBuffTableCount; i++)
        {
            ItemBuff recordByKey2 = instance.ItemBuffTable.GetRecordByKey(instance.m_RecvItemBuffData[i].ID);
            recordByKey = instance.EquipTable.GetRecordByKey(recordByKey2.BuffItemID);
            if ((byte)(equipKind - 1) == 13 && propertieskey == 1)
            {
                if (DataManager.Instance.bHaveWarBuff)
                {
                    GUIManager.Instance.AddHUDMessage(instance.mStringTable.GetStringByID(9943u), 255, true);
                    return;
                }
                for (int j = 0; j < (int)instance.MaxMarchEventNum; j++)
                {
                    EMarchEventType type = instance.MarchEventData[j].Type;
                    if ((instance.MarchEventData[j].IsAmbushCamp() || instance.MarchEventData[j].IsAmbushCampMarching() || instance.MarchEventData[j].IsAmbushCampReturn() || type == EMarchEventType.EMET_AttackMarching || type == EMarchEventType.EMET_ScoutMarching || type == EMarchEventType.EMET_InforceStanby || type == EMarchEventType.EMET_RallyStanby || (type >= EMarchEventType.EMET_InforceMarching && type <= EMarchEventType.EMET_RallyAttack) || (type == EMarchEventType.EMET_AttackReturn || type == EMarchEventType.EMET_RallyReturn || type == EMarchEventType.EMET_ScoutReturn || type == EMarchEventType.EMET_InfroceReturn || type == EMarchEventType.EMET_AttackRetreat || type == EMarchEventType.EMET_RallyRetreat) || ((type == EMarchEventType.EMET_Camp || type == EMarchEventType.EMET_CampMarching || type == EMarchEventType.EMET_CampReturn) && DataManager.MapDataController.getYolkIDbyPointCode(instance.MarchEventData[j].Point.zoneID, instance.MarchEventData[j].Point.pointID, 0) < 40)) && instance.MarchEventData[j].bRallyHost != 3 && instance.MarchEventData[j].bRallyHost != 4)
                    {
                        GUIManager.Instance.OpenMessageBox(instance.mStringTable.GetStringByID(614u), instance.mStringTable.GetStringByID(7647u), null, null, 0, 0, false, false, false, false, false);
                        return;
                    }
                }
                if (instance.TotalSoldier_Embassy > 0u || instance.PrisonerNum > 0 || AmbushManager.Instance.GetMaxTroop() > 0u)
                {
                    instance2.OpenOKCancelBox(instance2.FindMenu(EGUIWindow.UI_BagFilter), instance.mStringTable.GetStringByID(614u), instance.mStringTable.GetStringByID(8240u), (int)ItemID, 0, instance.mStringTable.GetStringByID(3u), instance.mStringTable.GetStringByID(617u));
                    return;
                }
            }
            if (instance.m_RecvItemBuffData[i].bEnable && recordByKey2.BuffKind == 3)
            {
                num = (uint)recordByKey2.BuffID;
            }
            if (!flag2 && (ushort)recordByKey.EquipKind == equipKind && recordByKey.PropertiesInfo[0].Propertieskey == propertieskey)
            {
                flag = (recordByKey2.BuffKind == 3);
                switch ((byte)(equipKind - 1))
                {
                case 9:
                {
                    ECaseByCaseType ecaseByCaseType = (ECaseByCaseType)propertieskey;
                    if (ecaseByCaseType == ECaseByCaseType.ECBCT_ExpPercent || ecaseByCaseType == ECaseByCaseType.ECBCT_Monster)
                    {
                        num2 = (uint)recordByKey2.BuffNameID;
                    }
                    break;
                }

                case 11:
                {
                    ESpeedUpPercent espeedUpPercent = (ESpeedUpPercent)propertieskey;
                    if (espeedUpPercent == ESpeedUpPercent.EUP_MARCH_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_BUILD_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_RESEARCH_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_TRAINING_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_RESOURCE_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_TRAP_SPEED || espeedUpPercent == ESpeedUpPercent.EUP_PET_FUSION_SPEED)
                    {
                        num2 = (uint)recordByKey2.BuffNameID;
                    }
                    break;
                }

                case 13:
                {
                    EShieldType eshieldType = (EShieldType)propertieskey;
                    if ((eshieldType == EShieldType.EST_Shield && ShieldLogManager.Instance.HasShieldState()) || eshieldType == EShieldType.EST_Investigate)
                    {
                        num2 = (uint)recordByKey2.BuffNameID;
                    }
                    break;
                }

                case 14:
                {
                    EDefenseType edefenseType = (EDefenseType)propertieskey;
                    if (edefenseType == EDefenseType.EDT_Crafty || edefenseType == EDefenseType.EDT_Salaries || edefenseType == EDefenseType.EDT_TroopScale || edefenseType == EDefenseType.EDT_TroopAtk || edefenseType == EDefenseType.EDT_TorrpDef || edefenseType == EDefenseType.EDT_TroopAtk_Reduce || edefenseType == EDefenseType.EDT_TroopDef_Reduce)
                    {
                        num2 = (uint)recordByKey2.BuffNameID;
                    }
                    break;
                }

                case 15:
                    num2 = (uint)recordByKey2.BuffNameID;
                    break;
                }
                flag3 = instance.m_RecvItemBuffData[i].bEnable;
                flag2 = true;
            }
        }
        if (num2 > 0u)
        {
            this.MessageStr.ClearString();
            if (flag && num > 0u)
            {
                ItemBuff recordByKey2 = instance.ItemBuffTable.GetRecordByKey((ushort)num);
                recordByKey = instance.EquipTable.GetRecordByKey(recordByKey2.BuffItemID);
                num         = (uint)recordByKey2.BuffNameID;
                this.MessageStr.StringToFormat(instance.mStringTable.GetStringByID(num2));
                this.MessageStr.StringToFormat(instance.mStringTable.GetStringByID(num));
                this.MessageStr.AppendFormat(instance.mStringTable.GetStringByID(7247u));
            }
            else
            {
                if (!flag3)
                {
                    this.OnOKCancelBoxClick(true, (int)ItemID, 0);
                    return;
                }
                this.MessageStr.StringToFormat(instance.mStringTable.GetStringByID(num2));
                this.MessageStr.StringToFormat(instance.mStringTable.GetStringByID(num2));
                this.MessageStr.AppendFormat(instance.mStringTable.GetStringByID(7247u));
            }
            instance2.OpenOKCancelBox(instance2.FindMenu(EGUIWindow.UI_BagFilter), instance.mStringTable.GetStringByID(614u), this.MessageStr.ToString(), (int)ItemID, 0, instance.mStringTable.GetStringByID(3u), instance.mStringTable.GetStringByID(617u));
        }
        else
        {
            this.OnOKCancelBoxClick(true, (int)ItemID, 0);
        }
    }
Exemplo n.º 2
0
    // Token: 0x06001BBB RID: 7099 RVA: 0x00313DB0 File Offset: 0x00311FB0
    public void Show(UIButtonHint hint, ushort ItemID, int Num = -1, UIButtonHint.ePosition position = UIButtonHint.ePosition.Original, Vector3?upsetPoint = null)
    {
        if (hint == null)
        {
            return;
        }
        if (GUIManager.Instance.m_LordInfo.m_ButtonHint != null)
        {
            GUIManager.Instance.m_LordInfo.Hide(GUIManager.Instance.m_LordInfo.m_ButtonHint);
        }
        DataManager   instance    = DataManager.Instance;
        RectTransform x           = hint.transform as RectTransform;
        Equip         recordByKey = instance.EquipTable.GetRecordByKey(ItemID);

        if (x == null || recordByKey.EquipKey != ItemID)
        {
            return;
        }
        if (recordByKey.EquipKind - 1 == 4 && GUIManager.Instance.FindMenu(EGUIWindow.Door) != null)
        {
            this.HeroID = recordByKey.SyntheticParts[0].SyntheticItem;
            this.ItemBtnRayCast.blocksRaycasts = true;
            this.InfoIcon.gameObject.SetActive(true);
        }
        else
        {
            this.ItemBtnRayCast.blocksRaycasts = false;
            this.InfoIcon.gameObject.SetActive(false);
        }
        if (this.m_HeroBtn.gameObject.activeSelf)
        {
            this.ItemGo.SetActive(true);
            this.ItemPanel.gameObject.SetActive(true);
            this.HeroPanel.gameObject.SetActive(false);
        }
        ushort num;

        if (Num == -1)
        {
            num = instance.GetCurItemQuantity(ItemID, 0);
        }
        else
        {
            num = (ushort)Num;
        }
        this.m_RectTransform.gameObject.SetActive(true);
        this.m_RectTransform.SetAsLastSibling();
        GUIManager.Instance.ChangeHeroItemImg(this.m_ItemBtn.transform, eHeroOrItem.Item, ItemID, 0, 0, 0);
        UIItemInfo.SetNameProperties(this.m_Name, this.m_Properties, this.NameStr, this.PropertiesStr, ref recordByKey, this.AddionalStr);
        if (this.AddionalStr.Length > 0)
        {
            this.PropertiesStr.Append(this.AddionalStr);
            this.m_Properties.text = this.PropertiesStr.ToString();
            this.m_Properties.SetAllDirty();
            this.m_Properties.cachedTextGenerator.Invalidate();
        }
        Vector2 sizeDelta = this.rectProperties.sizeDelta;
        float   num2      = this.m_Properties.preferredHeight - this.OriTextHeight;

        sizeDelta.y = this.m_Properties.preferredHeight;
        this.rectProperties.sizeDelta = sizeDelta;
        sizeDelta   = this.m_BackRect.sizeDelta;
        sizeDelta.y = Mathf.Max(this.OriHeight, this.OriHeight + num2);
        this.m_BackRect.sizeDelta = sizeDelta;
        this.HeroNameStr.ClearString();
        EItemType eitemType = (EItemType)(recordByKey.EquipKind - 1);

        switch (eitemType)
        {
        case EItemType.EIT_SingleNumSynEquip:
        case EItemType.EIT_MultiNumSynEquip:
            this.HeroNameStr.IntToFormat((long)recordByKey.NeedLv, 1, false);
            this.HeroNameStr.AppendFormat(instance.mStringTable.GetStringByID(148u));
            this.m_ItemLvText.text = this.HeroNameStr.ToString();
            this.m_ItemLvText.SetAllDirty();
            this.m_ItemLvText.cachedTextGenerator.Invalidate();
            this.m_ItemLvText.color  = new Color(0.46f, 1f, 1f);
            this.m_ItemKindText.text = instance.mStringTable.GetStringByID(886u);
            break;

        case EItemType.EIT_SynBook:
            this.m_ItemKindText.text = instance.mStringTable.GetStringByID(255u);
            break;

        case EItemType.EIT_SynBaseEquip:
            this.m_ItemKindText.text = instance.mStringTable.GetStringByID(254u);
            break;

        case EItemType.EIT_HeroStone:
            this.m_ItemKindText.text = instance.mStringTable.GetStringByID(256u);
            break;

        case EItemType.EIT_Consumables:
            this.m_ItemKindText.text = instance.mStringTable.GetStringByID(253u);
            break;

        default:
            if (eitemType != EItemType.EIT_EnhanceStone)
            {
                this.m_ItemKindText.text = string.Empty;
            }
            else
            {
                this.m_ItemKindText.text = instance.mStringTable.GetStringByID(16050u);
            }
            break;

        case EItemType.EIT_CaseByCase:
        {
            ECaseByCaseType ecaseByCaseType = (ECaseByCaseType)recordByKey.PropertiesInfo[0].Propertieskey;
            if (ecaseByCaseType == ECaseByCaseType.ECBCT_PetCore)
            {
                this.m_ItemKindText.text = instance.mStringTable.GetStringByID(14654u);
            }
            else if (ecaseByCaseType == ECaseByCaseType.ECBCT_PetMaterial)
            {
                this.m_ItemKindText.text = instance.mStringTable.GetStringByID(879u);
            }
            else
            {
                this.m_ItemKindText.text = string.Empty;
            }
            break;
        }
        }
        if ((recordByKey.EquipKind != 18 || recordByKey.PropertiesInfo[2].Propertieskey < 1 || recordByKey.PropertiesInfo[2].Propertieskey > 2) && (recordByKey.EquipKind != 11 || recordByKey.PropertiesInfo[0].Propertieskey < 6 || recordByKey.PropertiesInfo[0].Propertieskey > 7))
        {
            if (recordByKey.EquipKind == 19 && recordByKey.PropertiesInfo[3].Propertieskey == 1)
            {
                this.m_OwnedText.text = string.Empty;
            }
            else
            {
                this.OwnedStr.ClearString();
                this.OwnedStr.Append("(");
                this.OwnedStr.IntToFormat((long)num, 1, true);
                this.OwnedStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(79u));
                this.OwnedStr.Append(")");
                this.m_OwnedText.color = Color.white;
                this.m_OwnedText.text  = this.OwnedStr.ToString();
                this.m_OwnedText.SetAllDirty();
                this.m_OwnedText.cachedTextGenerator.Invalidate();
            }
        }
        else
        {
            this.m_OwnedText.text = string.Empty;
        }
        if (recordByKey.RecoverPrice > 0u)
        {
            this.PriceStr.ClearString();
            this.PriceStr.IntToFormat((long)((ulong)recordByKey.RecoverPrice), 1, true);
            this.PriceStr.AppendFormat("{0}");
            this.m_Price.text = this.PriceStr.ToString();
            this.m_Price.SetAllDirty();
            this.m_Price.cachedTextGenerator.Invalidate();
            this.m_Coin.enabled = true;
        }
        else
        {
            this.m_Coin.enabled = false;
            this.m_Price.text   = string.Empty;
        }
        hint.GetTipPosition(this.m_BackRect, position, upsetPoint);
        this.m_ItemRect.anchoredPosition = this.m_BackRect.anchoredPosition + this.ItemPosUpset;
        float num3 = -this.m_BackRect.anchoredPosition3D.y + this.m_BackRect.sizeDelta.y;

        if (num3 > GUIManager.Instance.m_MessageBoxLayer.rect.size.y)
        {
            this.m_Properties.fontSize = 18 - Convert.ToInt32((num3 - GUIManager.Instance.m_MessageBoxLayer.rect.size.y) * 0.038f);
            Vector2 sizeDelta2 = this.m_Properties.rectTransform.sizeDelta;
            sizeDelta2.y = Mathf.Max(66f, this.m_Properties.preferredHeight);
            this.m_Properties.rectTransform.sizeDelta = sizeDelta2;
            sizeDelta2   = this.m_BackRect.sizeDelta;
            sizeDelta2.y = Mathf.Max(186f, 123.6f + this.m_Properties.preferredHeight + 14.4f);
            this.m_BackRect.sizeDelta = sizeDelta2;
        }
        this.m_ButtonHint      = hint;
        this.Canvasgroup.alpha = 1f;
    }
Exemplo n.º 3
0
    // Token: 0x06000E62 RID: 3682 RVA: 0x0017B2F4 File Offset: 0x001794F4
    public override void OnOpen(int arg1, int arg2)
    {
        if (GUIManager.Instance.bOpenOnIPhoneX)
        {
            ((RectTransform)base.transform).offsetMin = new Vector2(-GUIManager.Instance.IPhoneX_DeltaX, 0f);
            ((RectTransform)base.transform).offsetMax = new Vector2(GUIManager.Instance.IPhoneX_DeltaX, 0f);
        }
        this.Transformer = base.transform.GetChild(0);
        this.Transformer.GetChild(4).GetComponent <CustomImage>().hander    = this;
        this.Transformer.GetChild(4).GetComponent <UIButton>().m_Handler    = this;
        this.Transformer.GetChild(11).GetComponent <UIButton>().m_Handler   = this;
        this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().font = GUIManager.Instance.GetTTFFont();
        this.m_InputBoxText[0] = this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>();
        this.Transformer.GetChild(8).GetComponent <Text>().font = GUIManager.Instance.GetTTFFont();
        this.m_InputBoxText[1] = this.Transformer.GetChild(8).GetComponent <Text>();
        this.Transformer.GetChild(5).GetChild(0).GetComponent <Text>().font = GUIManager.Instance.GetTTFFont();
        this.m_InputBoxText[2] = this.Transformer.GetChild(5).GetChild(0).GetComponent <Text>();
        this.m_character       = this.Transformer.GetChild(12).GetComponent <Text>();
        this.m_character.font  = GUIManager.Instance.GetTTFFont();
        this.m_content         = this.Transformer.GetChild(5).GetChild(1).GetComponent <Text>();
        this.m_content.font    = GUIManager.Instance.GetTTFFont();
        this.m_content.text    = this.DM.mStringTable.GetStringByID(4613u);
        this.m_descript        = this.Transformer.GetChild(13).GetComponent <Text>();
        this.m_descript.font   = GUIManager.Instance.GetTTFFont();
        this.m_error           = this.Transformer.GetChild(9).GetChild(0).GetComponent <Text>();
        this.m_error.font      = GUIManager.Instance.GetTTFFont();
        this.m_input           = this.Transformer.GetChild(5).GetChild(0).GetComponent <UIEmojiInput>();
        this.m_input.onValueChange.AddListener(delegate(string input)
        {
            this.ValueChange(input);
        });
        this.m_input.onValidateInput = new UIEmojiInput.OnValidateInput(this.OnValidateInput);
        this.m_butt       = this.Transformer.GetChild(4).GetChild(0).GetComponent <Text>();
        this.m_butt.font  = GUIManager.Instance.GetTTFFont();
        this.m_butt.text  = this.DM.mStringTable.GetStringByID(4715u);
        this.m_butt.color = (((this.Type = (ECaseByCaseType)arg1) >= ECaseByCaseType.ECBCT_ReNickName) ? Color.white : this.m_error.color);
        this.Transformer.GetChild(10).gameObject.AddComponent <ArabicItemTextureRot>();
        UnityEngine.Object.Destroy(base.transform.GetChild(0).GetChild(0).GetComponent <IgnoreRaycast>());
        HelperUIButton helperUIButton = base.gameObject.AddComponent <HelperUIButton>();

        helperUIButton.m_Handler = this;
        helperUIButton.m_BtnID1  = 22;
        ECaseByCaseType type = this.Type;

        switch (type)
        {
        case ECaseByCaseType.ECBCT_ReNickName:
        {
            this.m_descript.text = this.DM.mStringTable.GetStringByID(9069u);
            Text   component  = this.Transformer.GetChild(8).GetComponent <Text>();
            string stringByID = this.DM.mStringTable.GetStringByID(9099u);
            this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
            component.text = stringByID;
            break;
        }

        case ECaseByCaseType.ECBCT_SaveTalent:
        {
            this.m_descript.text = this.DM.mStringTable.GetStringByID(9069u);
            Text   component2 = this.Transformer.GetChild(8).GetComponent <Text>();
            string stringByID = this.DM.mStringTable.GetStringByID(931u);
            this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
            component2.text = stringByID;
            break;
        }

        case ECaseByCaseType.ECBCT_EquipMemorySetup:
        {
            this.m_descript.text = this.DM.mStringTable.GetStringByID(9069u);
            Text   component3 = this.Transformer.GetChild(8).GetComponent <Text>();
            string stringByID = this.DM.mStringTable.GetStringByID(9704u);
            this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
            component3.text = stringByID;
            break;
        }

        default:
            if (type != ECaseByCaseType.ECBCT_AllianceRename)
            {
                if (type != ECaseByCaseType.ECBCT_AllianceTag)
                {
                    this.Sending         = Protocol._MSG_REQUEST_ROLE_RENAME;
                    this.Checking        = Protocol._MSG_REQUEST_ROLE_NAME_CHECK;
                    this.m_content.text  = this.DM.mStringTable.GetStringByID(4718u);
                    this.m_descript.text = this.DM.mStringTable.GetStringByID(4615u);
                    this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = this.DM.mStringTable.GetStringByID(4717u);
                    this.Transformer.GetChild(8).GetComponent <Text>().text             = this.DM.mStringTable.GetStringByID(4716u);
                }
                else
                {
                    this.Checking        = Protocol._MSG_REQUEST_ALLIANCE_TAGCHECK;
                    this.Sending         = Protocol._MSG_REQUEST_ALLIANCE_MODIFY_TAG;
                    this.m_content.text  = this.DM.mStringTable.GetStringByID(4617u);
                    this.m_descript.text = this.DM.mStringTable.GetStringByID(4618u);
                    Text   component4 = this.Transformer.GetChild(8).GetComponent <Text>();
                    string stringByID = this.DM.mStringTable.GetStringByID(4616u);
                    this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
                    component4.text = stringByID;
                }
            }
            else
            {
                this.Checking        = Protocol._MSG_REQUEST_ALLIANCE_NAMECHACK;
                this.Sending         = Protocol._MSG_REQUEST_ALLIANCE_MODIFY_NAME;
                this.m_content.text  = this.DM.mStringTable.GetStringByID(4613u);
                this.m_descript.text = this.DM.mStringTable.GetStringByID(4615u);
                Text   component5 = this.Transformer.GetChild(8).GetComponent <Text>();
                string stringByID = this.DM.mStringTable.GetStringByID(4612u);
                this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
                component5.text = stringByID;
            }
            break;

        case ECaseByCaseType.ECBCT_Preselectedteam:
        {
            this.m_descript.text = this.DM.mStringTable.GetStringByID(9069u);
            Text   component6 = this.Transformer.GetChild(8).GetComponent <Text>();
            string stringByID = this.DM.mStringTable.GetStringByID(992u);
            this.Transformer.GetChild(7).GetChild(0).GetComponent <Text>().text = stringByID;
            component6.text     = stringByID;
            this.m_content.text = this.DM.mStringTable.GetStringByID(4617u);
            break;
        }
        }
        this.Invalid = this.Transformer.GetChild(9).gameObject;
        this.Tick    = this.Transformer.GetChild(10).gameObject;
        this.door    = (GUIManager.Instance.FindMenu(EGUIWindow.Door) as Door);
    }