Example #1
0
 private void tyyMainFrame_LocationChanged(object sender, EventArgs e)
 {
     TYYCoreGUI.tyyRPGDlgProcess(this, ObjAnimation.tyyDlg);
 }
Example #2
0
        //键盘响应事件
        private void MainFrame_KeyDown(object sender, KeyEventArgs e)
        {
            //esc窗口弹出
            if (e.KeyCode == Keys.Escape)
            {
                String mapName;
                if (curMapName == null)
                {
                    mapName = ObjDataSav.tyyMapName;
                }
                else
                {
                    mapName = curMapName;
                }
                tyyEscDlg tyyEDlg = new tyyEscDlg(_mainMap.Location, mapName);
                tyyEDlg.Owner = this;
                tyyEDlg.ShowDialog();
                return;
            }
            //rpg窗口弹出
            if (e.KeyCode == Keys.Space)
            {
                bool isEnd = false;

                if ((recentHit != null || ObjAnimation.tyyHitObjName != null))
                {
                    TYYCoreGUI.tyyRPGDlgProcess(this, ObjAnimation.tyyDlg);
                    List <String> info = new List <String>();
                    if (ObjAnimation.tyyHitObjName == TYYObjectName.tyyTree || recentHit == TYYObjectName.tyyTree)
                    {
                        info = TYYDlgInfo.tyyStaticInfo(TYYObjectName.tyyTree);
                        this.tyyDlgShow(info[0], info[1]);
                    }
                    if (ObjAnimation.tyyHitObjName == TYYObjectName.tyyWater || recentHit == TYYObjectName.tyyWater)
                    {
                        info = TYYDlgInfo.tyyStaticInfo(TYYObjectName.tyyWater);
                        this.tyyDlgShow(info[0], info[1]);
                    }
                    if (ObjAnimation.tyyHitObjName == TYYObjectName.tyyNpc || recentHit == TYYObjectName.tyyNpc)
                    {
                        if (ObjAnimation.LEVEL_INDEX == 99)
                        {
                            recentHit = ObjAnimation.tyyHitObjName;
                            ObjAnimation.tyyDlg.tyySetList(ObjAnimation.tyyNpcNames, ObjAnimation.tyyNpcDlgs, false, 0);
                            ObjAnimation.tyyDlg.Visible = false;
                            ObjAnimation.tyyDlg.ShowDialog();
                            return;
                        }
                        if (ObjAnimation.LEVEL_INDEX != ObjLevel.I_LEVEL)
                        {
                            this.tyyDlgShow("……", "请先完成当前任务");
                        }

                        else
                        {
                            recentHit = ObjAnimation.tyyHitObjName;
                            ObjAnimation.tyyDlg.tyySetList(ObjAnimation.tyyNpcNames, ObjAnimation.tyyNpcDlgs, false, 0);
                            ObjAnimation.tyyDlg.Visible = false;
                            ObjAnimation.tyyDlg.ShowDialog();
                            //level up
                            isEnd = this.ObjLevel.tyyLevelUp();
                            //set level name
                            this.tyyFreshTask();
                        }
                    }
                    //
                    if (ObjAnimation.tyyHitObjName == TYYObjectName.tyyGen || recentHit == TYYObjectName.tyyGen)
                    {
                        recentHit = ObjAnimation.tyyHitObjName;
                        this.tyyLevelUp("老王的桌子");

                        ObjAnimation.tyyDlg.tyySetList(ObjAnimation.tyyGenNames, ObjAnimation.tyyGenDlgs[ObjAnimation.tyyIndexInt], true, ObjAnimation.tyyIndexInt);
                        ObjAnimation.tyyDlg.Visible = false;
                        ObjAnimation.tyyDlg.ShowDialog();
                    }

                    ObjAnimation.tyyHitObjName = null;
                    this.tyyImStop();
                    if (isEnd)
                    {
                        this.Dispose();         /*Extend*/
                    }
                    else
                    {
                        return;
                    }
                }
            }
            recentHit = null;
            //人物移动
            if (e.KeyCode == Keys.S || e.KeyCode == Keys.Down)
            {
                if (!isEcho)
                {
                    ObjAnimation.tyyCharacterImEcho(0); isEcho = true;
                }
                ObjAnimation.tyyCharacterMove[0].Start();
                ObjAnimation.tyyFlag = 0;
                recentKey            = "S";
                ObjAnimation.tyyKeys = e.KeyCode;
            }
            else if (e.KeyCode == Keys.W || e.KeyCode == Keys.Up)
            {
                if (!isEcho)
                {
                    ObjAnimation.tyyCharacterImEcho(1); isEcho = true;
                }
                ObjAnimation.tyyCharacterMove[1].Start();
                ObjAnimation.tyyFlag = 1;
                recentKey            = "W";
                ObjAnimation.tyyKeys = e.KeyCode;
            }
            else if (e.KeyCode == Keys.D || e.KeyCode == Keys.Right)
            {
                if (!isEcho)
                {
                    ObjAnimation.tyyCharacterImEcho(2); isEcho = true;
                }
                ObjAnimation.tyyCharacterMove[2].Start();
                ObjAnimation.tyyFlag = 2;
                recentKey            = "D";
                ObjAnimation.tyyKeys = e.KeyCode;
            }
            else if (e.KeyCode == Keys.A || e.KeyCode == Keys.Left)
            {
                if (!isEcho)
                {
                    ObjAnimation.tyyCharacterImEcho(3); isEcho = true;
                }
                ObjAnimation.tyyCharacterMove[3].Start();
                ObjAnimation.tyyFlag = 3;
                recentKey            = "A";
                ObjAnimation.tyyKeys = e.KeyCode;
            }
            else
            {
                return;
            }

            //坐标移动
            ObjAnimation.tyyMapMove1.Enabled = true;
            ObjAnimation.tyyMapMove1.Start();
            if (ObjAnimation.tyyDlg.isVisiable == true)
            {
                ObjAnimation.tyyDlg.Visible = false;
            }

            //地图转化
            if (ObjAnimation.tyyNeedTr == true)
            {
                curMapName = ObjMapCharger.tyyMapTrName[ObjAnimation.tyyMapIndex];
                this.tyyInitMapFrame(curMapName);
                ObjAnimation.tyyNeedTr = false;
                return;
            }

            //Bgm Play
            if (e.KeyCode == Keys.S || e.KeyCode == Keys.Down || e.KeyCode == Keys.W || e.KeyCode == Keys.Up || e.KeyCode == Keys.D || e.KeyCode == Keys.Right || e.KeyCode == Keys.A || e.KeyCode == Keys.Left)
            {
                if (this.Count == 30)
                {
                    try
                    {
                        axWalkPlayer.Ctlcontrols.stop();
                        axWalkPlayer.Ctlcontrols.play();
                        Count = 0;
                    }
                    catch
                    {
                        return;
                    }
                }
                else
                {
                    Count++;
                }
            }
        }
Example #3
0
 private void rPGDlgToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ObjAnimation.tyyDlg.Owner = this;
     //启动rpg对话框
     TYYCoreGUI.tyyRPGDlgProcess(this, ObjAnimation.tyyDlg);
 }