Exemple #1
0
    public void UpdateArenaRankGrid(UIGridItem item)
    {
        if (item == null || item.mScripts == null || item.oData == null)
        {
            return;
        }
        ArenaInfo info         = item.oData as ArenaInfo;
        UILabel   ranking      = item.mScripts[0] as UILabel;
        UITexture head         = item.mScripts[1] as UITexture;
        UILabel   name         = item.mScripts[2] as UILabel;
        UILabel   formation    = item.mScripts[3] as UILabel;
        UILabel   fight        = item.mScripts[4] as UILabel;
        UISprite  select       = item.mScripts[5] as UISprite;
        UITexture clubHead     = item.mScripts[6] as UITexture;
        UILabel   clubName     = item.mScripts[7] as UILabel;
        UILabel   dimaondLabel = item.mScripts[8] as UILabel;
        UILabel   blackLabel   = item.mScripts[9] as UILabel;
        UISprite  rankSprite   = item.mScripts[10] as UISprite;

        item.onClick = OnClickArenaItem;
        LoadSprite.LoaderHead(head, "jueshetouxiang1", false);
        LoadSprite.LoaderHead(clubHead, "jueshetouxiang1", false);
        select.gameObject.SetActive(info.dbid == PlayerMediator.playerInfo.roleId && info.playerName == PlayerMediator.playerInfo.name);
        if (select.gameObject.activeSelf)
        {
            arenaInfo = info;
        }
        clubName.text = info.club;
        rankSprite.gameObject.SetActive(info.ranking <= 3);
        ranking.gameObject.SetActive(info.ranking > 3);
        if (info.ranking <= 3)
        {
            rankSprite.spriteName = info.ranking.ToString();
        }
        else
        {
            ranking.text = info.ranking.ToString();
        }
        name.text      = info.playerName;
        formation.text = info.formation.ToString();
        fight.text     = info.fightValue.ToString();
        ArenaReward reward = ArenaConfig.GetArenaRewardByRank(info.ranking);

        if (reward == null)
        {
            dimaondLabel.text = "0";
            blackLabel.text   = "0";
        }
        else
        {
            dimaondLabel.text = reward.arenaReward.Split(';')[1].ToString();
            blackLabel.text   = reward.arenaReward.Split(';')[0].ToString();
        }
    }
Exemple #2
0
    // Token: 0x060010AE RID: 4270 RVA: 0x001D9024 File Offset: 0x001D7224
    public ushort GetNowCrystal()
    {
        ushort result = 0;

        for (int i = DataManager.Instance.ArenaRewardData.TableCount; i > 0; i--)
        {
            ArenaReward recordByIndex = DataManager.Instance.ArenaRewardData.GetRecordByIndex(i - 1);
            if (this.m_ArenaPlace >= (uint)recordByIndex.Value1 && this.m_ArenaPlace <= (uint)recordByIndex.Value2)
            {
                result = recordByIndex.Crystal;
                break;
            }
        }
        return(result);
    }
Exemple #3
0
        public Deck(string name, string className, IEnumerable <Card> cards, IEnumerable <string> tags, string note, string url,
                    DateTime lastEdited, bool archived, List <Card> missingCards, SerializableVersion version, IEnumerable <Deck> versions,
                    bool?syncWithHearthStats, string hearthStatsId, Guid deckId, string hearthStatsDeckVersionId, long hsId = 0,
                    string hearthStatsIdClone = null, SerializableVersion selectedVersion = null, bool?isArenaDeck = null,
                    ArenaReward reward        = null)

        {
            Name         = name;
            Class        = className;
            Cards        = new ObservableCollection <Card>();
            MissingCards = missingCards;
            foreach (var card in cards.ToSortedCardList())
            {
                Cards.Add((Card)card.Clone());
            }
            Tags                = new List <string>(tags);
            Note                = note;
            Url                 = url;
            LastEdited          = lastEdited;
            Archived            = archived;
            Version             = version;
            SyncWithHearthStats = syncWithHearthStats;
            HearthStatsId       = hearthStatsId;
            SelectedVersion     = selectedVersion ?? version;
            Versions            = new List <Deck>();
            DeckId              = deckId;
            if (hearthStatsIdClone != null)
            {
                HearthStatsIdForUploading = hearthStatsIdClone;
            }
            if (isArenaDeck.HasValue)
            {
                IsArenaDeck = isArenaDeck.Value;
            }
            HearthStatsDeckVersionId = hearthStatsDeckVersionId;
            if (versions != null)
            {
                foreach (var d in versions)
                {
                    Versions.Add(d.CloneWithNewId(true) as Deck);
                }
            }
            if (reward != null)
            {
                _arenaReward = reward;
            }
            HsId = hsId;
        }
Exemple #4
0
    public static ArenaReward GetArenaRewardByRank(int rank)
    {
        if (configList.ContainsKey(rank))
        {
            return(configList[rank]);
        }
        ArenaReward info = new ArenaReward();

        foreach (ArenaReward item in configList.Values)
        {
            if (rank < item.id)
            {
                return(info);
            }
            info = item;
        }
        return(null);
    }
Exemple #5
0
    static void LoadArenaConfig(AssetBundles.NormalRes data)
    {
        byte[] asset = (data as AssetBundles.BytesRes).m_bytes;
        if (asset == null)
        {
            return;
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return;
        }
        List <TbXmlNode> xmlNodeList = docNode.GetNodes("Object/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return;
        }
        ArenaReward info;

        for (int i = 0; i < xmlNodeList.Count; ++i)
        {
            TbXmlNode node = xmlNodeList[i] as TbXmlNode;
            info             = new ArenaReward();
            info.id          = node.GetIntValue("ID");
            info.arenaReward = node.GetStringValue("reward");
            if (configList.ContainsKey(info.id))
            {
                configList[info.id] = info;
            }
            else
            {
                configList.Add(info.id, info);
            }
        }
        asset = null;
    }
Exemple #6
0
    // Token: 0x060010C8 RID: 4296 RVA: 0x001DE0D0 File Offset: 0x001DC2D0
    public override void OnOpen(int arg1, int arg2)
    {
        this.DM     = DataManager.Instance;
        this.GUIM   = GUIManager.Instance;
        this.GameT  = base.gameObject.transform;
        this.TTFont = this.GUIM.GetTTFFont();
        this.SArray = this.GameT.GetComponent <UISpritesArray>();
        this.door   = (this.GUIM.FindMenu(EGUIWindow.Door) as Door);
        Material material = this.door.LoadMaterial();
        float    num      = 0f;

        this.Cstr_CDTime   = StringManager.Instance.SpawnString(100);
        this.tmpItemNum    = this.DM.ArenaRewardData.TableCount;
        this.Cstr_P2       = new CString[this.tmpItemNum];
        this.Cstr_P2Reward = new CString[this.tmpItemNum];
        this.text_P2       = new UIText[this.tmpItemNum * 2];
        for (int i = 0; i < this.tmpItemNum; i++)
        {
            this.Cstr_P2[i]       = StringManager.Instance.SpawnString(30);
            this.Cstr_P2Reward[i] = StringManager.Instance.SpawnString(30);
        }
        Transform child  = this.GameT.GetChild(0);
        Transform child2 = child.GetChild(0).GetChild(0);

        this.text_Title      = child2.GetComponent <UIText>();
        this.text_Title.font = this.TTFont;
        this.text_Title.text = this.DM.mStringTable.GetStringByID(9128u);
        child           = this.GameT.GetChild(1);
        child2          = child.GetChild(0);
        this.Content_RT = child2.GetComponent <RectTransform>();
        child2          = child.GetChild(0).GetChild(0);
        this.P1_RT      = child2.GetComponent <RectTransform>();
        Transform child3 = child2.GetChild(0);

        this.text_TitleP1[0]      = child3.GetComponent <UIText>();
        this.text_TitleP1[0].font = this.TTFont;
        this.text_TitleP1[0].text = this.DM.mStringTable.GetStringByID(9129u);
        num += this.text_TitleP1[0].rectTransform.sizeDelta.y;
        for (int j = 0; j < 5; j++)
        {
            child3               = child2.GetChild(1 + j);
            this.text_P1[j]      = child3.GetComponent <UIText>();
            this.text_P1[j].font = this.TTFont;
            this.text_P1[j].text = this.DM.mStringTable.GetStringByID((uint)(9130 + j));
            this.text_P1[j].SetAllDirty();
            this.text_P1[j].cachedTextGenerator.Invalidate();
            this.text_P1[j].cachedTextGeneratorForLayout.Invalidate();
            if (this.text_P1[j].rectTransform.sizeDelta.y < this.text_P1[j].preferredHeight)
            {
                this.text_P1[j].rectTransform.sizeDelta = new Vector2(this.text_P1[j].rectTransform.sizeDelta.x, this.text_P1[j].preferredHeight + 1f);
            }
            if (j == 0)
            {
                this.text_P1[0].rectTransform.anchoredPosition = new Vector2(this.text_P1[0].rectTransform.anchoredPosition.x, -(12f + num));
            }
            else
            {
                this.text_P1[j].rectTransform.anchoredPosition = new Vector2(this.text_P1[j].rectTransform.anchoredPosition.x, this.text_P1[j - 1].rectTransform.anchoredPosition.y - this.text_P1[j - 1].rectTransform.sizeDelta.y - 2f);
            }
            num += this.text_P1[j].rectTransform.sizeDelta.y;
        }
        CString cstring = StringManager.Instance.StaticString1024();

        cstring.ClearString();
        this.Cstr_CDTime.ClearString();
        cstring.IntToFormat((long)GameConstants.GetDateTime(this.DM.RoleAttr.FirstTimer).Hour, 2, false);
        cstring.IntToFormat((long)GameConstants.GetDateTime(this.DM.RoleAttr.FirstTimer).Minute, 2, false);
        cstring.AppendFormat("{0}:{1}");
        this.Cstr_CDTime.StringToFormat(cstring);
        this.Cstr_CDTime.AppendFormat(this.DM.mStringTable.GetStringByID(9134u));
        this.text_P1[4].text = this.Cstr_CDTime.ToString();
        child3               = child2.GetChild(6);
        this.text_P1[5]      = child3.GetComponent <UIText>();
        this.text_P1[5].font = this.TTFont;
        this.text_P1[5].text = this.DM.mStringTable.GetStringByID(9135u);
        if (this.text_P1[5].rectTransform.sizeDelta.y < this.text_P1[5].preferredHeight)
        {
            this.text_P1[5].rectTransform.sizeDelta = new Vector2(this.text_P1[5].rectTransform.sizeDelta.x, this.text_P1[5].preferredHeight + 1f);
        }
        this.text_P1[5].rectTransform.anchoredPosition = new Vector2(this.text_P1[5].rectTransform.anchoredPosition.x, this.text_P1[4].rectTransform.anchoredPosition.y - this.text_P1[4].rectTransform.sizeDelta.y - 2f);
        num   += this.text_P1[5].rectTransform.sizeDelta.y;
        child3 = child2.GetChild(7);
        this.text_TitleP1[1]      = child3.GetComponent <UIText>();
        this.text_TitleP1[1].font = this.TTFont;
        this.text_TitleP1[1].text = this.DM.mStringTable.GetStringByID(9151u);
        this.text_TitleP1[1].rectTransform.anchoredPosition = new Vector2(this.text_TitleP1[1].rectTransform.anchoredPosition.x, this.text_P1[5].rectTransform.anchoredPosition.y - this.text_P1[5].rectTransform.sizeDelta.y - 20f);
        num                 += this.text_TitleP1[1].rectTransform.sizeDelta.y;
        child3               = child2.GetChild(8);
        this.text_P1[6]      = child3.GetComponent <UIText>();
        this.text_P1[6].font = this.TTFont;
        this.text_P1[6].text = this.DM.mStringTable.GetStringByID(9136u);
        this.text_P1[6].SetAllDirty();
        this.text_P1[6].cachedTextGenerator.Invalidate();
        this.text_P1[6].cachedTextGeneratorForLayout.Invalidate();
        if (this.text_P1[6].rectTransform.sizeDelta.y < this.text_P1[6].preferredHeight)
        {
            this.text_P1[6].rectTransform.sizeDelta = new Vector2(this.text_P1[6].rectTransform.sizeDelta.x, this.text_P1[6].preferredHeight + 1f);
        }
        this.text_P1[6].rectTransform.anchoredPosition = new Vector2(this.text_P1[6].rectTransform.anchoredPosition.x, this.text_TitleP1[1].rectTransform.anchoredPosition.y - this.text_TitleP1[1].rectTransform.sizeDelta.y + 2f);
        num += this.text_P1[6].rectTransform.sizeDelta.y;
        num += 60f;
        this.P1_RT.sizeDelta      = new Vector2(this.P1_RT.sizeDelta.x, num);
        this.Content_RT.sizeDelta = new Vector2(this.Content_RT.sizeDelta.x, num);
        child2     = child.GetChild(0).GetChild(1);
        this.P2_RT = child2.GetComponent <RectTransform>();
        this.P2_RT.anchoredPosition = new Vector2(this.P2_RT.anchoredPosition.x, -num);
        num    = 0f;
        child3 = child2.GetChild(0);
        num   += child3.GetComponent <RectTransform>().sizeDelta.y;
        child3 = child2.GetChild(0).GetChild(0);
        this.text_TitleP2[0]      = child3.GetComponent <UIText>();
        this.text_TitleP2[0].font = this.TTFont;
        this.text_TitleP2[0].text = this.DM.mStringTable.GetStringByID(9137u);
        child3 = child2.GetChild(1).GetChild(0);
        this.text_TitleP2[1]      = child3.GetComponent <UIText>();
        this.text_TitleP2[1].font = this.TTFont;
        this.text_TitleP2[1].text = this.DM.mStringTable.GetStringByID(9140u);
        child3 = child2.GetChild(2);
        Image component = child3.GetComponent <Image>();
        Image component3;

        for (int k = 0; k < this.tmpItemNum; k++)
        {
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(component.gameObject);
            gameObject.transform.SetParent(this.P2_RT.transform, false);
            RectTransform component2 = gameObject.GetComponent <RectTransform>();
            component2.anchoredPosition = new Vector2(component.rectTransform.anchoredPosition.x, -num);
            gameObject.SetActive(true);
            num += component.rectTransform.sizeDelta.y;
            if (k % 2 == 1)
            {
                component3        = gameObject.transform.GetComponent <Image>();
                component3.sprite = this.SArray.m_Sprites[0];
                component3        = gameObject.transform.GetChild(0).GetComponent <Image>();
                component3.sprite = this.SArray.m_Sprites[1];
            }
            for (int l = 0; l < 2; l++)
            {
                child3 = gameObject.transform.GetChild(2 + l);
                this.text_P2[k * 2 + l]      = child3.GetComponent <UIText>();
                this.text_P2[k * 2 + l].font = this.TTFont;
            }
        }
        this.P2_RT.sizeDelta      = new Vector2(this.P2_RT.sizeDelta.x, num);
        this.Content_RT.sizeDelta = new Vector2(this.Content_RT.sizeDelta.x, this.Content_RT.sizeDelta.y + num);
        ArenaReward recordByIndex = this.DM.ArenaRewardData.GetRecordByIndex(0);

        for (int m = 0; m < this.tmpItemNum; m++)
        {
            this.Cstr_P2[m].ClearString();
            recordByIndex = this.DM.ArenaRewardData.GetRecordByIndex((int)((ushort)m));
            if (recordByIndex.Value1 == recordByIndex.Value2)
            {
                this.Cstr_P2[m].IntToFormat((long)recordByIndex.Value1, 1, true);
                this.Cstr_P2[m].AppendFormat(this.DM.mStringTable.GetStringByID(9138u));
            }
            else
            {
                this.Cstr_P2[m].IntToFormat((long)recordByIndex.Value1, 1, true);
                this.Cstr_P2[m].IntToFormat((long)recordByIndex.Value2, 1, true);
                this.Cstr_P2[m].AppendFormat(this.DM.mStringTable.GetStringByID(9139u));
            }
            this.text_P2[m * 2].text = this.Cstr_P2[m].ToString();
            this.Cstr_P2Reward[m].ClearString();
            this.Cstr_P2Reward[m].IntToFormat((long)recordByIndex.Crystal, 1, true);
            this.Cstr_P2Reward[m].AppendFormat("{0}");
            this.text_P2[m * 2 + 1].text = this.Cstr_P2Reward[m].ToString();
        }
        child               = this.GameT.GetChild(2);
        component3          = child.GetComponent <Image>();
        component3.sprite   = this.door.LoadSprite("UI_main_close_base");
        component3.material = material;
        if (this.GUIM.bOpenOnIPhoneX)
        {
            component3.enabled = false;
        }
        child         = this.GameT.GetChild(2).GetChild(0);
        this.btn_EXIT = child.GetComponent <UIButton>();
        this.btn_EXIT.image.sprite   = this.door.LoadSprite("UI_main_close");
        this.btn_EXIT.image.material = material;
        this.btn_EXIT.m_Handler      = this;
        this.btn_EXIT.m_BtnID1       = 0;
        this.btn_EXIT.m_EffectType   = e_EffectType.e_Scale;
        this.btn_EXIT.transition     = Selectable.Transition.None;
        this.GUIM.UpdateUI(EGUIWindow.Door, 1, 2);
    }