少年修仙传客户端代码仓库
client_Hale
2019-05-25 af76df01ab98e86e7e65d9f9ee7bb3691b26e059
System/Message/RichNormalEvent.cs
@@ -21,6 +21,7 @@
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.TaskFeedback, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.MyFightPoint, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.MyReikiRoot, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.MyDefense, this);
    }
    public override bool Execute(RichTextEventEnum type, RichTextMgr.HrefInfo href)
@@ -262,6 +263,47 @@
                        return label;
                    }
                }
            case RichTextEventEnum.MyDefense:
                {
                    var colorType = 0;
                    if (RichTextMgr.Inst.presentRichText != null)
                    {
                        colorType = RichTextMgr.Inst.presentRichText.colorType == RichText.ColorType.Dark ? 0 : 1;
                    }
                    var treasureModel = ModelCenter.Instance.GetModel<TreasureModel>();
                    var satisfy = false;
                    var targetValue = 0;
                    var point = 0;
                    var treasureId = 0;
                    if (int.TryParse(dic["mydefense"], out treasureId))
                    {
                        TreasureDungeon treasureDungeon;
                        if (treasureModel.TryGetTreasureDungeon(treasureId, out treasureDungeon))
                        {
                            var dungeonInfo = treasureDungeon.Get(treasureDungeon.currentLevel + 1);
                            if (!dungeonInfo.Equals(default(TreasureDungeonInfo)))
                            {
                                targetValue = dungeonInfo.defense;
                            }
                        }
                        point = UIHelper.GetPropertyValue(PropertyType.DEF);
                        satisfy = point >= targetValue;
                    }
                    if (!satisfy)
                    {
                        var label = dic.ContainsKey("replacelabel1") ? dic["replacelabel1"] : string.Empty;
                        return UIHelper.AppendColor(TextColType.Red, StringUtility.Contact(label, point, "/", targetValue), colorType == 1);
                    }
                    else
                    {
                        var label = dic.ContainsKey("replacelabel2") ? dic["replacelabel2"] : string.Empty;
                        return label;
                    }
                }
        }
        return string.Empty;
    }