コード例 #1
0
ファイル: MazeItem.cs プロジェクト: jayrulez/TOMClassic
        public void Effect(Forms.BasePanel panel, HsActionCallback success, HsActionCallback fail)
        {
            if (type == "item")
            {
                UserProfile.InfoBag.AddItem(infos[0], 1);
                HItemConfig itemConfig = ConfigData.GetHItemConfig(infos[0]);
                panel.AddFlowCenter(string.Format("获得{0}x1", itemConfig.Name), HSTypes.I2RareColor(itemConfig.Rare));
            }
            else if (type == "mon")
            {
                PeopleBook.Fight(infos[0], "oneline", mlevel + infos[1], new PeopleFightParm(), success, fail, null);
                return;
            }
            else if (type == "gold")
            {
                UserProfile.InfoBag.AddResource(GameResourceType.Gold, (uint)infos[0]);
                panel.AddFlowCenter(string.Format("获得黄金x{0}", infos[0]), HSTypes.I2ResourceColor(0));
            }
            else if (type == "resource")
            {
                UserProfile.InfoBag.AddResource((GameResourceType)(infos[0] - 1), 1);
                panel.AddFlowCenter(string.Format("获得{1}x{0}", 1, HSTypes.I2Resource(infos[0] - 1)), HSTypes.I2ResourceColor(infos[0] - 1));
            }
            string word = MazeItemConfig.Word;

            if (word != "")
            {
                panel.AddFlowCenter(word, "White");
            }
            success();
        }
コード例 #2
0
ファイル: MazeItem.cs プロジェクト: narlon/TOMClassic
 public void Effect(Forms.BasePanel panel, string tile, HsActionCallback success, HsActionCallback fail)
 {
     if (type == "item")
     {
         UserProfile.InfoBag.AddItem(infos[0], 1);
         HItemConfig itemConfig = ConfigData.GetHItemConfig(infos[0]);
         panel.AddFlowCenter(string.Format("获得{0}x1", itemConfig.Name), HSTypes.I2RareColor(itemConfig.Rare));
     }
     else if (type == "task")
     {
         UserProfile.InfoTask.SetTaskStateById(infos[0], 2);
         panel.AddFlowCenter(string.Format("任务{0}达成", ConfigData.GetTaskConfig(infos[0]).Name), "White");
     }
     else if (type == "mon")
     {
         PeopleBook.Fight(infos[0], tile, -1, mlevel + infos[1], success, fail);
         return;
     }
     else if (type == "gold")
     {
         UserProfile.InfoBag.AddResource(GameResourceType.Gold, (uint)infos[0]);
         panel.AddFlowCenter(string.Format("获得黄金x{0}", infos[0]), HSTypes.I2ResourceColor(0));
     }
     else if (type == "resource")
     {
         UserProfile.InfoBag.AddResource((GameResourceType)(infos[0] - 1), 1);
         panel.AddFlowCenter(string.Format("获得{1}x{0}", 1, HSTypes.I2Resource(infos[0] - 1)), HSTypes.I2ResourceColor(infos[0] - 1));
     }
     string word = MazeItemConfig.Word;
     if (word != "")
     {
         panel.AddFlowCenter(word, "White");
     }
     success();
 }
コード例 #3
0
ファイル: Maze.cs プロジェクト: narlon/TOMClassic
 public void CheckEvent(Forms.BasePanel panel, int x, int y, HsActionCallback success, HsActionCallback fail)
 {
     int idex;
     if ((idex = GetItemIndex(x, y)) >= 0)
     {
         items[idex].Effect(panel, MazeConfig.Map, success, fail);
     }
 }
コード例 #4
0
        public void CheckEvent(Forms.BasePanel panel, int x, int y, HsActionCallback success, HsActionCallback fail)
        {
            int idex;

            if ((idex = GetItemIndex(x, y)) >= 0)
            {
                items[idex].Effect(panel, success, fail);
            }
        }
コード例 #5
0
        public TalkEventItemFight(int evtId, int level, Rectangle r, SceneQuestEvent e)
            : base(evtId, level, r, e)
        {
            int enemyId = config.EnemyId;
            HsActionCallback winCallback  = OnWin;
            HsActionCallback failCallback = OnFail;
            var parm = new PeopleFightParm();

            parm.Reason = PeopleFightReason.SceneQuest;
            if (evt.ParamList.Count > 1)
            {
                parm.RuleAddon = (PeopleFightRuleAddon)Enum.Parse(typeof(PeopleFightRuleAddon), evt.ParamList[0]);
                parm.RuleLevel = int.Parse(evt.ParamList[1]);
            }
            if (enemyId == 1)//特殊处理标记
            {
                enemyId = UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.SceneQuestRandPeopleId);
            }
            int fightLevel = Math.Max(1, level + BlessManager.FightLevelChange);

            PeopleBook.Fight(enemyId, config.BattleMap, fightLevel, parm, winCallback, failCallback, failCallback);
        }
コード例 #6
0
ファイル: PictureRegion.cs プロジェクト: jayrulez/TOMClassic
        public override void Draw(Graphics g)
        {
            if (nid > 0)
            {
                Image            img    = null;
                HsActionCallback action = null;
                if (type == PictureRegionCellType.Npc)
                {
                    img = SceneBook.GetSceneNpcImage(nid);
                }
                else if (type == PictureRegionCellType.Item)
                {
                    img    = DataType.Items.HItemBook.GetHItemImage(nid);
                    action = () =>
                    {
                        var itemConfig = ConfigData.GetHItemConfig(nid);
                        var pen        = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2);
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Equip)
                {
                    img    = DataType.Equips.EquipBook.GetEquipImage(nid);
                    action = () =>
                    {
                        var equipConfig = ConfigData.GetEquipConfig(nid);
                        var pen         = new Pen(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality)), 2);
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Card)
                {
                    img    = DataType.Cards.CardAssistant.GetCardImage(nid, 60, 60);
                    action = () =>
                    {
                        var    cardData   = CardConfigManager.GetCardConfig(nid);
                        string cardBorder = DataType.Cards.CardAssistant.GetCardBorder(cardData);
                        g.DrawImage(PicLoader.Read("Border", cardBorder), X, Y, Width, Height);
                    };
                }
                else if (type == PictureRegionCellType.SkillAttr)
                {
                    img = DataType.HeroSkills.HeroSkillAttrBook.GetHeroSkillAttrImage(nid);
                }
                else if (type == PictureRegionCellType.Achieve)
                {
                    img = DataType.Achieves.AchieveBook.GetAchieveImage(nid);
                }
                else if (type == PictureRegionCellType.People)
                {
                    img = DataType.Peoples.PeopleBook.GetPersonImage(nid);
                }
                else if (type == PictureRegionCellType.HeroSkill)
                {
                    img = DataType.HeroSkills.HeroPowerBook.GetImage(nid);
                }
                else if (type == PictureRegionCellType.CardQual)
                {
                    img = HSIcons.GetIconsByEName("gem" + nid);
                }
                else if (type == PictureRegionCellType.Job)
                {
                    img    = HSIcons.GetIconsByEName("job" + nid);
                    action = () =>
                    {
                        var jobConfig = ConfigData.GetJobConfig(nid + JobConfig.Indexer.NewBie);
                        Pen pen       = new Pen(Color.FromName(jobConfig.Color));
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Bless)
                {
                    img = DataType.Blesses.BlessBook.GetBlessImage(nid);
                }
                else if (type == PictureRegionCellType.SceneQuest)
                {
                    img = SceneBook.GetSceneQuestImage(nid);
                }
                if (img != null)
                {
                    if (Scale == 1)
                    {
                        g.DrawImage(img, X, Y, Width, Height);
                    }
                    else
                    {
                        int realWidth  = (int)(Width * Scale);
                        int realHeight = (int)(Height * Scale);
                        g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight);
                    }
                }
                if (action != null)
                {
                    action();
                }
            }

            foreach (IRegionDecorator decorator in decorators)
            {
                decorator.Draw(g, X, Y, Width, Height);
            }
        }
コード例 #7
0
ファイル: PeopleBook.cs プロジェクト: narlon/TOMClassic
        public static void Fight(int pid, string map, int tile, int rlevel, HsActionCallback winEvent, HsActionCallback lossEvent)
        {
            if (UserProfile.InfoBasic.Ap < GameConstants.FightAPCost)
            {
                MainForm.Instance.AddTip(HSErrorTypes.GetDescript(HSErrorTypes.SceneAPNotEnough), "Red");
                return;
            }

            bool rt = PopDeckChoose.Show(map, tile, UserProfile.InfoCard.GetDeckNames());
            if (!rt)
            {
                return;
            }

            UserProfile.InfoBasic.Ap -= GameConstants.FightAPCost;
            BattleForm bf = new BattleForm();
            bf.BattleWin = winEvent;
            bf.BattleLose = lossEvent;
            bf.Init(0, pid, map, tile, rlevel);
            MainForm.Instance.DealPanel(bf);
        }
コード例 #8
0
ファイル: PictureRegion.cs プロジェクト: realeternia/FEWin
        public override void Draw(Graphics g)
        {
            if (nid > 0)
            {
                Image            img       = null;
                HsActionCallback preAction = null;
                HsActionCallback action    = null;
                if (type == PictureRegionCellType.Item)
                {
                    img    = HItemBook.GetHItemImage(nid);
                    action = () =>
                    {
                        var itemConfig = ConfigData.GetHItemConfig(nid);
                        var pen        = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2);
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Gismo)
                {
                    img = DungeonBook.GetGismoImage(nid);
                }
                else if (type == PictureRegionCellType.People)
                {
                    img       = HSIcons.GetImage("Samurai", nid);
                    preAction = () =>
                    {
                        var peopleConfig = ConfigData.GetSamuraiConfig(nid);
                        var brush        = new SolidBrush(Color.FromName(HSTypes.I2QualityColorD(peopleConfig.Quality)));
                        g.FillRectangle(brush, X + 3, Y + 3, Width - 6, Height - 6);
                        brush.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.SceneQuest)
                {
                    img = SceneQuestBook.GetSceneQuestImageScene(nid);
                }
                else if (type == PictureRegionCellType.DungeonItem)
                {
                    img = DungeonBook.GetDungeonItemImage(nid);
                }

                if (preAction != null)
                {
                    preAction();
                }
                if (img != null)
                {
                    if (Scale == 1)
                    {
                        if (Enabled)
                        {
                            g.DrawImage(img, X, Y, Width, Height);
                        }
                        else
                        {
                            g.DrawImage(img, new Rectangle(X, Y, Width, Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
                        }
                    }
                    else
                    {
                        int realWidth  = (int)(Width * Scale);
                        int realHeight = (int)(Height * Scale);
                        g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight);
                    }
                }
                if (action != null)
                {
                    action();
                }
            }

            foreach (IRegionDecorator decorator in decorators)
            {
                decorator.Draw(g, X, Y, Width, Height);
            }
        }
コード例 #9
0
ファイル: PeopleBook.cs プロジェクト: jayrulez/TOMClassic
        public static void Fight(int pid, string map, int rlevel, PeopleFightParm reason, HsActionCallback winEvent, HsActionCallback lossEvent, HsActionCallback cancelEvent)
        {
            bool rt = PopDeckChoose.Show(map, UserProfile.InfoCard.GetDeckNames());

            if (!rt)
            {
                if (cancelEvent != null)
                {
                    cancelEvent();
                }
                return;
            }

            BattleForm bf = new BattleForm();

            bf.BattleWin  = winEvent;
            bf.BattleLose = lossEvent;
            bf.Init(0, pid, map, rlevel, reason);
            PanelManager.DealPanel(bf);
        }