Exemple #1
0
    public static string GetShopItemTitle(ShopTemplate shopT)
    {
        if (shopT == null)
        {
            LogManager.LogError("");
            return("");
        }

        StringBuilder sb = new StringBuilder();

        switch (shopT.getTagtype())
        {
        case -1:
            return("");

        case 1:
            TimeSpan ts = GetTimeSpanToOffShelve(shopT);
            if (ts.Days >= 365)
            {
                return("");
            }

            sb.Append(GameUtils.getString(shopT.getTagtext1()));
            sb.Append(FillWith2Char(ts.Hours + ts.Days * 24));
            sb.Append(":");
            sb.Append(FillWith2Char(ts.Minutes));
            sb.Append(":");
            sb.Append(FillWith2Char(ts.Seconds));
            return(sb.ToString());

        case 2:
            TimeSpan ts1 = GetTimeSpanToDiscountOff(shopT);
            if (ts1.Days >= 365)
            {
                return("");
            }
            sb.Append(GameUtils.getString(shopT.getTagtext1()));
            sb.Append(FillWith2Char(ts1.Hours + ts1.Days * 24));
            sb.Append(":");
            sb.Append(FillWith2Char(ts1.Minutes));
            sb.Append(":");
            sb.Append(FillWith2Char(ts1.Seconds));
            return(sb.ToString());

        case 3:
            sb.Append(GameUtils.getString(shopT.getTagtext1()));
            return(sb.ToString());

        case 4:
            if (IsShopItemInSaling(shopT))
            {
                if (IsShopItemInDiscount(shopT))
                {
                    TimeSpan ts2 = GetTimeSpanToDiscountOff(shopT);
                    if (ts2.Days >= 365)
                    {
                        return("");
                    }
                    sb.Append(GameUtils.getString(shopT.getTagtext1()));
                    sb.Append(FillWith2Char(ts2.Hours + ts2.Days * 24));
                    sb.Append(":");
                    sb.Append(FillWith2Char(ts2.Minutes));
                    sb.Append(":");
                    sb.Append(FillWith2Char(ts2.Seconds));
                }
                else
                {
                    TimeSpan ts3 = GetTimeSpanToOffShelve(shopT);
                    if (ts3.Days >= 365)
                    {
                        return("");
                    }
                    sb.Append(GameUtils.getString(shopT.getTagtext2()));
                    sb.Append(FillWith2Char(ts3.Hours + ts3.Days * 24));
                    sb.Append(":");
                    sb.Append(FillWith2Char(ts3.Minutes));
                    sb.Append(":");
                    sb.Append(FillWith2Char(ts3.Seconds));
                }
                return(sb.ToString());
            }
            return("");
        }

        return("");
    }