Exemplo n.º 1
0
        public void SellItemAllByPos(int pos)
        {
            var pickItem = Items[pos];

            if (pickItem.Type > 0 && pickItem.Value > 0)
            {
                var  config    = ConfigData.GetHItemConfig(pickItem.Type);
                uint sellPrice = GameResourceBook.InGoldSellItem(config.Rare, config.ValueFactor);
                uint money     = (uint)(sellPrice * pickItem.Value);
                AddResource(GameResourceType.Gold, money);
            }
            ClearItemAllByPos(pos);
        }
Exemplo n.º 2
0
        public static Image GetPreview(int id)
        {
            HItemConfig hItemConfig = ConfigData.GetHItemConfig(id);

            if (hItemConfig.Id <= 0)
            {
                return(DrawTool.GetImageByString("unknown", 100));
            }

            ControlPlus.TipImage tipData = new ControlPlus.TipImage(PaintTool.GetTalkColor);
            tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20);
            if (hItemConfig.IsUsable)
            {
                if (hItemConfig.SubType == (int)HItemTypes.Fight)
                {
                    tipData.AddTextNewLine("       战斗中双击使用", "Red");
                }
                else if (hItemConfig.SubType == (int)HItemTypes.Seed)
                {
                    tipData.AddTextNewLine("       农场中双击使用", "Red");
                }
                else
                {
                    tipData.AddTextNewLine("       双击使用", "Green");
                }
            }
            if (hItemConfig.Type == (int)HItemTypes.Task)
            {
                tipData.AddTextNewLine("       任务物品", "DarkBlue");
            }
            else if (hItemConfig.Type == (int)HItemTypes.Material)
            {
                tipData.AddTextNewLine(string.Format("       材料(稀有度:{0})", hItemConfig.Rare), "White");
            }
            if (hItemConfig.Attributes != null && hItemConfig.Attributes.Length > 0)
            {
                tipData.AddTextNewLine(string.Format("       特性:{0}", string.Join(",", hItemConfig.Attributes)), "Lime");
            }

            tipData.AddTextNewLine(string.Format("       等级:{0}", hItemConfig.Level), "White");
            tipData.AddTextNewLine("", "White", 8);
            if (!string.IsNullOrEmpty(hItemConfig.Descript))
            {
                tipData.AddTextLines(hItemConfig.Descript, "White", 20, true);
            }
            tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow");
            tipData.AddImage(HSIcons.GetIconsByEName("res1"));
            tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32);

            return(tipData.Image);
        }
Exemplo n.º 3
0
        public static Image GetPreview(int id)
        {
            HItemConfig hItemConfig = ConfigData.GetHItemConfig(id);

            if (hItemConfig.Id <= 0)
            {
                return(DrawTool.GetImageByString("unknown", 100));
            }

            ControlPlus.TipImage tipData = new ControlPlus.TipImage();
            tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20);
            if (hItemConfig.IsUsable)
            {
                if (hItemConfig.SubType == HItemTypes.Fight)
                {
                    tipData.AddTextNewLine("       战斗中双击使用", "Red");
                }
                else if (hItemConfig.SubType == HItemTypes.Seed)
                {
                    tipData.AddTextNewLine("       农场中双击使用", "Red");
                }
                else
                {
                    tipData.AddTextNewLine("       双击使用", "Green");
                }
            }
            else if (hItemConfig.SubType == HItemTypes.Task)
            {
                tipData.AddTextNewLine("       任务物品", "DarkBlue");
            }
            else if (hItemConfig.SubType == HItemTypes.Material)
            {
                tipData.AddTextNewLine(string.Format("       材料(稀有度:{0})", hItemConfig.Rare), "White");
            }
            else
            {
                tipData.AddTextNewLine("", "White");
            }
            tipData.AddTextNewLine(string.Format("       等级:{0}", hItemConfig.Level), "White");
            tipData.AddTextNewLine("", "White");
            tipData.AddTextLines(hItemConfig.Descript, "White", 20, true);
            if (hItemConfig.SubType == HItemTypes.RandomCard)
            {
                var consumerConfig = ConfigData.GetItemConsumerConfig(hItemConfig.Id);
                int totalRate      = 0;
                foreach (var rate in consumerConfig.RandomCardRate)
                {
                    totalRate += rate;
                }
                tipData.AddLine();
                tipData.AddTextNewLine("抽卡概率", "White");
                tipData.AddTextNewLine("", "White");
                tipData.AddImage(HSIcons.GetIconsByEName("gem5"));
                tipData.AddText(string.Format("{0:0}%  ", (float)consumerConfig.RandomCardRate[3] * 100 / totalRate), "White");
                tipData.AddImage(HSIcons.GetIconsByEName("gem4"));
                tipData.AddText(string.Format("{0:0}%  ", (float)consumerConfig.RandomCardRate[2] * 100 / totalRate), "White");
                tipData.AddLine();
            }
            tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow");
            tipData.AddImage(HSIcons.GetIconsByEName("res1"));
            tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32);

            return(tipData.Image);
        }