示例#1
0
        public override void mouse_click(object sender, MouseEventArgs e)
        {
            cursor = new Rectangle(e.X, e.Y, 10, 10);
            Rectangle back = new Rectangle(1230, 10, 50, 50);

            if (cursor.IntersectsWith(back))
            {
                gsm.stage = Stage.mainMenu;
                gsm.loadState(gsm.stage);
            }

            if (!selected)
            {
                for (int i = 0; i < rosterField.Count; i++)
                {
                    if (rosterField[i].IntersectsWith(cursor))
                    {
                        index     = i;
                        indexHero = i;
                        selected  = true;
                        break;
                    }
                }
            }

            if (selected)
            {
                for (int i = 0; i < karacters.Count; i++)
                {
                    if (cursor.IntersectsWith(karacters[i].getSelect()))
                    {
                        selected = false;
                        karacters[i].setKaracter(player.myCharacter[index]);
                        if (player.currentCharacters.Count > i)
                        {
                            player.currentCharacters[i] = karacters[i].GetKarakter();
                            indexsimp = i;
                        }
                        else
                        {
                            player.currentCharacters.Add(karacters[i].GetKarakter());
                            indexsimp = player.currentCharacters.Count - 1;
                        }

                        index = -1;
                        break;
                    }
                }
            }
            bool close = false;

            if (cursor.IntersectsWith(yes))
            {
                if (simp < 2)
                {
                    if (player.currentCharacters[indexsimp].hero_stress.stress_point == 0)
                    {
                        MessageBox.Show("Hero ini tidak stress");
                        close = true;
                    }
                    else
                    {
                        player.currentCharacters[indexsimp].hero_stress.stress_point -= 10;
                        if (player.currentCharacters[indexsimp].hero_stress.stress_point < 0)
                        {
                            player.currentCharacters[indexsimp].hero_stress.stress_point = 0;
                        }
                        close = true;
                    }
                }
                else if (simp >= 2 && simp < 4)
                {
                    if (player.currentCharacters[indexsimp].hero_stress.stress_point == 0)
                    {
                        MessageBox.Show("Hero ini tidak stress");
                        close = true;
                    }
                    else
                    {
                        player.currentCharacters[indexsimp].hero_stress.stress_point -= 50;
                        if (player.currentCharacters[indexsimp].hero_stress.stress_point < 0)
                        {
                            player.currentCharacters[indexsimp].hero_stress.stress_point = 0;
                        }
                        close = true;
                    }
                }
                else
                {
                    if (player.currentCharacters[indexsimp].hero_stress.stress_point == 0)
                    {
                        MessageBox.Show("Hero ini tidak stress");
                        close = true;
                    }
                    else
                    {
                        player.currentCharacters[indexsimp].hero_stress.stress_point = 0;
                        close = true;
                    }
                }
                Config.form1.Invalidate();
            }
            else if (cursor.IntersectsWith(no))
            {
                close = true;
            }
            if (close == true)
            {
                int tmpx    = karacters[simp].x;
                int tmpy    = karacters[simp].y;
                int tmindex = karacters[simp].index;
                karacters[simp] = new Selected_karacter(tmpx, tmpy, tmindex);
                simp            = -1;
                Config.form1.Invalidate();
            }
        }
示例#2
0
        public override void mouse_click(object sender, MouseEventArgs e)
        {
            Rectangle cursor = new Rectangle(e.X, e.Y, 10, 10);
            Rectangle back   = new Rectangle(1230, 10, 50, 50);

            if (cursor.IntersectsWith(back))
            {
                //gsm.player.currentCharacters[0] = this.player;
                gsm.unloadState(gsm.stage);
                gsm.stage = Stage.mainMenu;
                gsm.loadState(gsm.stage);
            }
            if (!selected)
            {
                for (int i = 0; i < rosterField.Count; i++)
                {
                    if (rosterField[i].IntersectsWith(cursor))
                    {
                        index     = i;
                        indexHero = i;
                        selected  = true;
                        break;
                    }
                }
            }

            if (selected)
            {
                for (int i = 0; i < karacters.Count; i++)
                {
                    if (cursor.IntersectsWith(karacters[i].getSelect()))
                    {
                        selected = false;
                        karacters[i].setKaracter(player.myCharacter[index]);
                        if (player.currentCharacters.Count > i)
                        {
                            player.currentCharacters[i] = karacters[i].GetKarakter();
                            indexsimp = i;
                        }
                        else
                        {
                            player.currentCharacters.Add(karacters[i].GetKarakter());
                            indexsimp = player.currentCharacters.Count - 1;
                        }
                        index = -1;
                        break;
                    }
                }
            }

            bool close = false;

            if (cursor.IntersectsWith(yes))
            {
                if (simp < 2)
                {
                    if (tmp == 1)
                    {
                        pay = 250;
                    }
                    if (tmp2 == 1)
                    {
                        pay2 = 250;
                    }
                    player.currentCharacters[indexsimp].hero_equip[0].def     += 2;;
                    player.currentCharacters[indexsimp].hero_equip[1].max_dmg += 5;;
                    player.gold -= (pay + pay2);
                    tmp          = -1;
                    pay          = 0;
                    tmp2         = -1;
                    pay2         = 0;
                    close        = true;
                }

                Config.form1.Invalidate();
            }
            else if (cursor.IntersectsWith(no))
            {
                close = true;
            }
            if (close == true)
            {
                int tmpx    = karacters[simp].x;
                int tmpy    = karacters[simp].y;
                int tmindex = karacters[simp].index;
                karacters[simp] = new Selected_karacter(tmpx, tmpy, tmindex);
                tmp             = -1;
                pay             = 0;
                tmp2            = -1;
                pay2            = 0;
                simp            = -1;
                Config.form1.Invalidate();
            }
        }
示例#3
0
        public override void mouse_click(object sender, MouseEventArgs e)
        {
            Rectangle cursor = new Rectangle(e.X, e.Y, 10, 10);

            if (cursor.IntersectsWith(back))
            {
                //gsm.player.currentCharacters[0] = this.player;
                gsm.unloadState(gsm.stage);
                gsm.stage = Stage.mainMenu;
                gsm.loadState(gsm.stage);
            }
            if (!selected)
            {
                for (int i = 0; i < rosterField.Count; i++)
                {
                    if (rosterField[i].IntersectsWith(cursor))
                    {
                        index     = i;
                        indexHero = i;
                        selected  = true;
                        break;
                    }
                }
            }

            if (selected)
            {
                for (int i = 0; i < karacters.Count; i++)
                {
                    if (cursor.IntersectsWith(karacters[i].getSelect()))
                    {
                        selected = false;
                        karacters[i].setKaracter(player.myCharacter[index]);
                        if (player.currentCharacters.Count > i)
                        {
                            player.currentCharacters[i] = karacters[i].GetKarakter();
                            indexsimp = i;
                        }
                        else
                        {
                            player.currentCharacters.Add(karacters[i].GetKarakter());
                            indexsimp = player.currentCharacters.Count - 1;
                        }
                        index = -1;
                        break;
                    }
                }
            }
            bool close = false;

            if (cursor.IntersectsWith(yes))
            {
                if (simp < 2)
                {
                    if (player.currentCharacters[indexsimp].hero_buff == efek.none)
                    {
                        MessageBox.Show("Tidak ada buff musuh yang menempel!");
                        close = true;
                    }
                    else
                    {
                        player.currentCharacters[indexsimp].hero_buff = efek.none;
                        player.gold -= 100;
                        close        = true;
                    }
                }
                else if (simp >= 2 && simp < 4)
                {
                    int tmp = player.currentCharacters[indexsimp].maxHp;
                    if (player.currentCharacters[indexsimp].hp == tmp)
                    {
                        MessageBox.Show("HP hero ini penuh");
                        close = true;
                    }
                    else
                    {
                        player.currentCharacters[indexsimp].hp = tmp;
                        player.gold -= 100;
                        close        = true;
                    }
                }
                Config.form1.Invalidate();
            }
            else if (cursor.IntersectsWith(no))
            {
                close = true;
            }
            if (close == true)
            {
                int tmpx    = karacters[simp].x;
                int tmpy    = karacters[simp].y;
                int tmindex = karacters[simp].index;
                karacters[simp] = new Selected_karacter(tmpx, tmpy, tmindex);
                simp            = -1;
                Config.form1.Invalidate();
            }
        }