Example #1
0
        private void dg1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            ToolsHelper     tl = new ToolsHelper();
            DataGridViewRow dv = dg1.CurrentRow;

            label3.Text = tl.ExplainTalkManager(dv);
        }
Example #2
0
        private void SetTalk(int iTm)
        {
            try
            {
                //如果序号是最后一段对话
                if (iTm >= _drTalk.Length)
                {
                    //如果有后续对话
                    if (_sEndAdd != "0" || string.IsNullOrEmpty(_sEndAdd))
                    {
                        //用第一个事件的结尾查找另一个事件的开端
                        _drDq = DataHelper.XkfyData.Tables["DevelopQuestData"].Select("iID='" + _sEndAdd + "'");
                        if (_drDq.Length == 0)
                        {
                            //一般而言不会执行到这段
                            return;
                        }

                        string iType = _drDq[0]["iType"].ToString();
                        if (iType == "3")
                        {
                            Satisfy();
                            return;
                        }
                        else
                        {
                            //触发战斗,优先执行战斗
                            if (_drDq[0]["iDevelopType"].ToString() == "3")
                            {
                                _drBa        = DataHelper.XkfyData.Tables["BattleAreaData"].Select("iID$0='" + _drDq[0]["iArg3"].ToString() + "'");
                                gbZd.Visible = true;
                                return;
                            }
                            //无条件就直接执行
                            SetTalkDr(_drDq[0]["iArg3"].ToString());
                            iTm = 0;
                        }
                    }
                    else
                    {
                        //事件结束
                        txtNext.Text = "结束";
                        //txtNext.Enabled = false;
                        return;
                    }
                }
                StringBuilder sbMsg       = new StringBuilder();
                string        sBackground = _drDq[0]["sBackground"].ToString();
                string        path        = "";
                if (PicFile.ContainsKey(sBackground))
                {
                    path = PicFile[sBackground];
                }

                //画出背景图
                if (File.Exists(path))
                {
                    Image img = Image.FromFile(path);
                    panelBackground.BackgroundImage = img;
                }
                else
                {
                    sbMsg.AppendFormat("没有找到名称为【{0}】的背景图片文件!", _drDq[0]["sBackground"]);
                }

                //判断是否有选项
                if (_drTalk[iTm]["bInFields"].ToString() == "1")
                {
                    for (int i = 1; i < 5; i++)
                    {
                        string sButtonName = _drTalk[iTm]["sButtonName" + i].ToString();
                        if (sButtonName == "0" || string.IsNullOrEmpty(sButtonName))
                        {
                            continue;
                        }

                        switch (i)
                        {
                        case 1:
                            btnA.Visible = true;
                            btnA.Text    = sButtonName;
                            btnA.Tag     = _drTalk[iTm]["sBArg" + i].ToString();
                            break;

                        case 2:
                            btnB.Visible = true;
                            btnB.Text    = sButtonName;
                            btnB.Tag     = _drTalk[iTm]["sBArg" + i].ToString();
                            break;

                        case 3:
                            btnC.Visible = true;
                            btnC.Text    = sButtonName;
                            btnC.Tag     = _drTalk[iTm]["sBArg" + i].ToString();
                            break;

                        case 4:
                            btnD.Visible = true;
                            btnD.Text    = sButtonName;
                            btnD.Tag     = _drTalk[iTm]["sBArg" + i].ToString();
                            break;
                        }
                    }
                }

                //显示对话内容
                txtTalk.Text = _drTalk[iTm]["sManager"].ToString();
                _curIndex    = iTm;
                int iMasgPlace = int.Parse(_drTalk[iTm]["iMasgPlace"].ToString());

                //画出人物位置
                Graphics g = panel1.CreateGraphics();//pictureBox1.CreateGraphics();
                g.Clear(panel1.BackColor);
                for (int i = 1; i < 9; i++)
                {
                    string sNpcQName = _drTalk[iTm]["sNpcQName" + i].ToString();
                    if (sNpcQName == "0" || string.IsNullOrEmpty(sNpcQName))
                    {
                        continue;
                    }
                    DrawTalk(iMasgPlace);
                    path = "";
                    if (PicFile.ContainsKey(sNpcQName))
                    {
                        path = PicFile[sNpcQName];
                    }
                    if (File.Exists(path))
                    {
                        Image img = Image.FromFile(path);
                        DrawImage(img, i, g);
                    }
                    else
                    {
                        sbMsg.AppendFormat("\r\n没有找到名称为【{0}】的人物贴图文件!", sNpcQName);
                    }
                }
                g.Dispose();

                if (chkTalk.Checked)
                {
                    TalkManagerEdit msgForm = null;
                    bool            wExist  = _tl.CheckFormIsOpen("TalkManager_Edit");

                    if (!wExist)
                    {
                        msgForm = new TalkManagerEdit("debug");
                        msgForm.Show();
                        msgForm.BindData(_drTalk[iTm]);
                    }
                    else
                    {
                        msgForm = (TalkManagerEdit)Application.OpenForms["TalkManager_Edit"];
                        msgForm.Show();
                        msgForm.BindData(_drTalk[iTm]);
                    }
                }
                lblMsg.Text       = sbMsg.ToString();
                lblWin.Text      += _tl.ExplainTalkManager(_drTalk[iTm]);
                panelTalk.Visible = true;
                iTm++;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void dg1_CurrentCellChanged(object sender, EventArgs e)
        {
            txtExplain.Text = "";
            DataGridViewRow dv = dg1.CurrentRow;

            if (dv?.Cells[1].Value == null)
            {
                return;
            }
            DataTable     dt          = DataHelper.DdlDataSet.Tables["TalkManager.iGtype"];
            StringBuilder explainText = new StringBuilder();

            switch (_configKey)
            {
            case "Map":

                string npcId = dv.Cells["iNpcID"].Value.ToString();
                explainText.Append(ExplainHelper.GetNpcName(npcId.Substring(0, npcId.Length - 3)));
                explainText.Append("\r\n");
                explainText.Append("点击对话:");
                explainText.Append("\r\n");
                explainText.Append(ExplainHelper.GetMapTalkManager(dv.Cells["sDialogueQID"].Value.ToString()));
                explainText.Append("\r\n");
                explainText.Append("NPC移动时对话:");
                explainText.Append("\r\n");
                explainText.Append(ExplainHelper.GetMapTalkManager(dv.Cells["sMobileQID"].Value.ToString()));
                txtExplain.Text = explainText.ToString();
                break;

            case "NpcConduct":
                string[] tmp = dv.Cells["sConduct"].Value.ToString().Replace("(", "").Replace(")", "").Split(',');
                if (tmp.Length == 4)
                {
                    txtExplain.Text = ExplainHelper.GetNpcName(tmp[3].Substring(0, tmp[3].Length - 3));
                }
                break;
            }
            switch (_tbName)
            {
            case "DevelopQuestData":
                string[] striType      = dv.Cells["iType"].Value.ToString().Split(',');
                string[] striArg1      = dv.Cells["iArg1"].Value.ToString().Split(',');
                string[] striArg2      = dv.Cells["iArg2"].Value.ToString().Split(',');
                string[] striCondition = dv.Cells["iCondition"].Value.ToString().Split(',');
                string[] explain       = tl.ExplainDevelopQuest(striCondition, striType, striArg1, striArg2);
                txtExplain.Text = explain[0] + @"\r\n\r\n" + explain[1];
                break;

            //战斗奖励
            case "RewardData":
                string[] sRewardData = dv.Cells["sRewardData"].Value.ToString().Split('*');
                txtExplain.Text = tl.ExplainRewardData(sRewardData, dt);
                break;

            //战斗结果
            case "BattleAreaData":
                gbZhanDou.Visible = true;
                ExplainBattleArea(dv, dt);
                break;

            //内功
            case "BattleNeigong":
                txtExplain.Text = tl.ExplainNeiGong(dv.Cells["ID"].Value.ToString());
                break;

            //对话
            case "TalkManager":
                txtExplain.Text = tl.ExplainTalkManager(dv);
                break;

            //招式
            case "RoutineData":
                txtExplain.Text = tl.ExplainRoutineData(dv);
                break;

            //mapTalkManager
            case "MapTalkManager":
                string iGiftId = dv.Cells["iGiftID"].Value.ToString();
                if (iGiftId == "0")
                {
                    break;
                }
                DataRow[] drRw = DataHelper.XkfyData.Tables["RewardData"].Select("iRID='" + iGiftId + "'");
                if (drRw.Length != 1)
                {
                    txtExplain.Text = @"奖励ID有误,请检查!";
                }
                else
                {
                    txtExplain.Text = tl.ExplainRewardData(drRw[0]["sRewardData"].ToString().Split('*'), dt);
                }
                break;

            case "QuestDataManager":
                if (dv.Cells["sOConditions"].Value.ToString() != "0")
                {
                    string[] sOConditions = dv.Cells["sOConditions"].Value.ToString().Split('*');
                    txtExplain.Text = @"触发条件:" + tl.ExplainQuestDataCon(sOConditions, dt);
                }
                //关闭剧情
                string finshQType = dv.Cells["sFinshQType"].Value.ToString();
                if (finshQType != "0" && finshQType != "(1,0,0)")
                {
                    string[] sFinshQType = finshQType.Split('*');
                    txtExplain.Text += @"\r\n关闭事件:" + tl.ExplainQuestDataFinish(sFinshQType);
                }
                string iGiftId1 = dv.Cells["iGiftID1"].Value.ToString();
                if (iGiftId1 == "0")
                {
                    break;
                }
                drRw = DataHelper.XkfyData.Tables["RewardData"].Select("iRID='" + iGiftId1 + "'");
                if (drRw.Length != 1)
                {
                    txtExplain.Text += @"\r\n获得奖励:奖励ID有误,请检查!";
                }
                else
                {
                    txtExplain.Text += @"\r\n获得奖励:" + tl.ExplainRewardData(drRw[0]["sRewardData"].ToString().Split('*'), dt);
                }
                break;

            //战斗补充文件
            case "BattleSchedule":
                txtExplain.Text = tl.ExplainBattleSchedule(dv);
                break;

            case "ItemData":
                StringBuilder sbExplain = new StringBuilder();
                if (dv.Cells[0].Value.ToString() == "")
                {
                    return;
                }
                string snpclike = dv.Cells["sNpcLike$28"].Value.ToString();
                if (snpclike != "0" && snpclike != "")
                {
                    string[] snpclikeArray = snpclike.Split('*');
                    for (int i = 0; i < snpclikeArray.Length; i++)
                    {
                        string[] str = snpclikeArray[i].Replace("(", "").Replace(")", "").Split(',');
                        sbExplain.AppendFormat("送给【{0}】增加{1}点好感  ", DataHelper.GetValue("NpcData", "sNpcName", "iID", str[0]), str[1]);
                        sbExplain.Append("\r\n");
                    }
                }
                sbExplain.Append("\r\n");
                string sUseLimit = dv.Cells["sUseLimit$29"].Value.ToString();
                if (sUseLimit != "0" && !string.IsNullOrEmpty(sUseLimit))
                {
                    string[] useLimit = sUseLimit.Replace("(", "").Replace(")", "").Split(',');
                    if (useLimit.Length < 3)
                    {
                        return;
                    }
                    string name = string.Empty;
                    switch (useLimit[0])
                    {
                    case "0":
                        name = DataHelper.GetDicValue("MB", useLimit[1]);
                        break;

                    case "1":
                        name = DataHelper.GetDicValue("JBG", useLimit[1]);
                        break;

                    case "2":
                        name = DataHelper.GetDicValue("ZS", useLimit[1]);
                        break;

                    case "4":
                        name = DataHelper.GetDicValue("JY", useLimit[1]);
                        break;
                    }
                    sbExplain.AppendFormat("使用条件【{0}】{1}", name, useLimit[2]);
                }
                txtExplain.Text = sbExplain.ToString();
                break;
            }
        }