예제 #1
0
    private void MultLanguage()
    {
        Util.SetText(m_redName, Module_FactionBattle.FactionName(Module_FactionBattle.Faction.Red));
        Util.SetText(m_blueName, Module_FactionBattle.FactionName(Module_FactionBattle.Faction.Blue));
        Util.SetText(GetComponent <Text>("factionbattle/title/count_down/over/over_txt"), ConfigText.GetDefalutString(TextForMatType.FactionBattleUI, 6));
        Util.SetText(GetComponent <Text>("factionbattle/bottom_panel/rule_btn/Text"), ConfigText.GetDefalutString(TextForMatType.FactionBattleUI, 7));
        Util.SetText(GetComponent <Text>("factionbattle/bottom_panel/reward_btn/Text"), ConfigText.GetDefalutString(TextForMatType.FactionBattleUI, 8));

        Util.SetText(GetComponent <Text>("rule_panel/right/time_txt"), moduleFactionBattle.ActiveTime);
        Util.SetText(GetComponent <Text>("rule_panel/right/rule_txt"), ConfigText.GetDefalutString(TextForMatType.FactionSignUI, 3));

        var ct = ConfigManager.Get <ConfigText>((int)TextForMatType.FactionSignUI);

        if (null == ct)
        {
            return;
        }
        Util.SetText(GetComponent <Text>("rule_panel/right/titile01/Text"), ct[5]);
        Util.SetText(GetComponent <Text>("rule_panel/right/titile01/Text"), ct[6]);
    }
예제 #2
0
    private void OnClick(PMail data)
    {
        if (data.type == 201)
        {
            var info = ConfigManager.Get <ConfigText>(data.type);
            if (info != null)
            {
                mailTitle.text  = info.text[1];
                mailSender.text = info.text[0];
                //显示内容
                if (data.type == (byte)TextForMatType.LabyrinthMailText)
                {
                    string[] strs    = data.content.Split('-');//0:迷宫ID 1:在迷宫的几层  2:晋级情况(1:晋级 2:保级 3:降级) 3:小组排名
                    var      labInfo = ConfigManager.Get <LabyrinthInfo>(Util.Parse <int>(strs[0]));
                    if (labInfo == null)
                    {
                        Logger.LogError("LabyrinthInfo config id=={0} is null", strs[0]);
                        return;
                    }

                    var    allLabInfo = ConfigManager.GetAll <LabyrinthInfo>();
                    int    maxId      = allLabInfo?[allLabInfo.Count - 1].ID ?? 0;
                    string maxStr     = string.Empty;
                    if (strs[0].Equals(maxId.ToString()))
                    {
                        maxStr = info.text[10];
                    }
                    else
                    {
                        var nextLabInfo = ConfigManager.Get <LabyrinthInfo>(Util.Parse <int>(strs[0]) + 1);
                        if (nextLabInfo != null)
                        {
                            maxStr = Util.Format(info.text[7], nextLabInfo.labyrinthName);
                        }
                    }

                    int    minId  = allLabInfo?[0].ID ?? 0;
                    string minStr = string.Empty;
                    if (strs[0].Equals(minId.ToString()))
                    {
                        minStr = Util.Format(info.text[9], labInfo.labyrinthName);
                    }
                    else
                    {
                        var lastLabyInfo = ConfigManager.Get <LabyrinthInfo>(Util.Parse <int>(strs[0]) - 1);
                        if (lastLabyInfo != null)
                        {
                            minStr = Util.Format(info.text[9], lastLabyInfo.labyrinthName);
                        }
                    }

                    string str = strs[2] == null ? "" : strs[2] == "1" ? maxStr : strs[2] == "2" ? info.text[8] : minStr;

                    mailContent.text = Util.Format(info.text[5].Replace("\\n", "\n").Replace("\\t", "\t"), labInfo.labyrinthName, strs[1], strs[3], str);
                }
            }
        }
        else if (data.type >= 204 && data.type <= 207)
        {
            var info = ConfigManager.Get <ConfigText>(data.type - 204 + 33); //映射多语言文本
            if (info != null)
            {
                Util.SetText(mailTitle, info.text[0]);
                Util.SetText(mailSender, info.text[1]);
                switch (data.type)
                {
                case 204:
                    Util.SetText(mailContent, Util.Format(info.text[2], data.content));
                    break;

                case 205:
                case 206:
                    Util.SetText(mailContent, Util.Format(info.text[2], Module_FactionBattle.FactionName((Module_FactionBattle.Faction)Util.Parse <int>(data.content))));
                    break;

                case 207:
                    Util.SetText(mailContent, Util.Format(info.text[2], Module_FactionBattle.GetKillString(Util.Parse <int>(data.content))));
                    break;
                }
            }
        }
        else
        {
            mailTitle.text   = data.title;
            mailContent.text = data.content;
            string text = ConfigText.GetDefalutString(TextForMatType.PublicUIText, 32);
            if (!string.IsNullOrEmpty(text))
            {
                string str = Util.Format(text, data.name);
                mailSender.text = str;
            }
        }
        DateTime localdt = Util.GetDateTime(data.time);

        Util.SetText(mailTitleTime, (int)TextForMatType.LabyrinthMailText, 4, localdt.Year, localdt.Month, localdt.Day);

        if (data.isGet == 0 && data.attachment != null && data.attachment.Length > 0)//有附件并且未领取的情况
        {
            getBtn.SafeSetActive(true);
            awardGoods.SafeSetActive(true);
            if (awardGoods.childCount > 0)
            {
                for (int i = 0; i < awardGoods.childCount; i++)
                {
                    awardGoods.GetChild(i).SafeSetActive(false);
                }
            }

            for (int i = 0; i < data.attachment.Length; i++)
            {
                var prop = ConfigManager.Get <PropItemInfo>(data.attachment[i].itemTypeId);
                if (!prop || !prop.IsValidVocation(modulePlayer.proto))
                {
                    continue;
                }

                Transform tran = awardGoods.childCount > i?awardGoods.GetChild(i) : null;

                if (tran == null)
                {
                    tran = awardGoods.AddNewChild(itemObj);
                }

                tran.SafeSetActive(true);


                Util.SetItemInfo(tran, prop, 0, (int)data.attachment[i].num, false);
                var btn = tran?.GetComponentDefault <Button>();
                btn.onClick.RemoveAllListeners();
                btn.onClick.AddListener(() => moduleGlobal.UpdateGlobalTip((ushort)prop.ID, true, false));
            }

            getBtn.onClick.RemoveAllListeners();
            getBtn.onClick.AddListener(() => { OnGetGoods(moduleMailbox.currentMail); });
        }
        else //没有附件的情况
        {
            awardGoods.SafeSetActive(false);
            getBtn.SafeSetActive(false);
        }

        if (moduleMailbox.alreadySendRead != null && !moduleMailbox.alreadySendRead.ContainsKey(data.mailId))
        {
            moduleMailbox.AddAlreadySendDic(data.mailId);
            moduleMailbox.SendReadMail(data.mailId);
        }

        SetButtonEnable();
    }