Exemplo n.º 1
0
        private void ActivityItemForm_MouseClick(object sender, MouseEventArgs e)
        {
            Form form = sender as Form;

            FlowLayoutPanel ActivityDetail_flowLayoutPanel = (FlowLayoutPanel)form.Parent.Parent.Controls["ActivityDetail_flowLayoutPanel"];

            ActivityDetail_flowLayoutPanel.Controls.Clear();

            ActivityItemDetailForm activityItemDetailForm = new ActivityItemDetailForm();

            activityItemDetailForm.TopLevel = false;

            MyRegularExpression mre = new MyRegularExpression();

            //刷新详细信息界面
            string[] DetailTime  = mre.GetTaskListDetailTimeByItem(TableText);
            string   Level       = mre.GetTaskListLevelByItem(TableText);
            string   Description = mre.GetTaskListDescriptionByItem(TableText);

            activityItemDetailForm.DetailTime  = DetailTime;
            activityItemDetailForm.Level       = Level;
            activityItemDetailForm.Description = Description;


            ActivityDetail_flowLayoutPanel.Controls.Add(activityItemDetailForm);
            activityItemDetailForm.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 返回单行内容
        /// </summary>
        /// <param name="ws">Worksheet</param>
        /// <param name="nRows">行数</param>
        /// <param name="Length">每行长度</param>
        /// <param name="IsNumber">类型(0表示过滤非数字字符用于加引号)</param>
        /// <returns></returns>
        public List <String> GetRowValues(Worksheet ws, int nRows, int Length, bool IsNumber)
        {
            List <String> sRowValues = new List <String>();
            int           i          = 1;

            if (Length >= 1)
            {
                //行的第一个内容不为空
                for (int index = 1; index < Length; index++)
                {
                    if (ws.Cells[nRows, index].ToString() == "")
                    {
                        sRowValues.Add("\"\"");
                    }
                    else
                    {
                        if (IsNumber)
                        {
                            MyRegularExpression mre = new MyRegularExpression();
                            if (mre.IsNumber(ws.Cells[nRows, index].ToString()))
                            {
                                sRowValues.Add(ws.Cells[nRows, index].ToString());
                            }
                            else
                            {
                                sRowValues.Add("\"" + ws.Cells[nRows, index].ToString() + "\"");
                            }
                        }
                        else
                        {
                            sRowValues.Add(ws.Cells[nRows, index].ToString());
                        }
                    }
                    i++;
                }
            }
            else
            {
                MessageBox.Show("行数小于1。");
                return(null);
            }

            if (i == 1)
            {
                MessageBox.Show("该行无数据。");
                return(null);
            }

            return(sRowValues);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 返回单行内容根据长度 基于NPOI
        /// </summary>
        /// <param name="sheet">ISheet</param>
        /// <param name="nRow">行数</param>
        /// <param name="Length">长度</param>
        /// <returns></returns>
        public List <String> GetRowValues(ISheet sheet, int nRow, int Length)
        {
            List <String> sRowValues = new List <String>();

            IRow cells = sheet.GetRow(nRow);

            if (cells != null)
            {
                for (int i = 0; i < Length; i++)
                {
                    if (cells.GetCell(i) == null)
                    {
                        sRowValues.Add("\"\"");
                    }
                    else
                    {
                        //如果是含有公式的格子
                        if (cells.GetCell(i).CellType == CellType.Formula)
                        {
                            XSSFFormulaEvaluator eva = new XSSFFormulaEvaluator(workbook);
                            if (eva.Evaluate(cells.GetCell(i)).CellType == CellType.Numeric)
                            {
                                sRowValues.Add(eva.Evaluate(cells.GetCell(i)).NumberValue.ToString());
                            }
                            else
                            {
                                sRowValues.Add("\"" + eva.Evaluate(cells.GetCell(i)).StringValue + "\"");
                            }
                        }
                        else
                        {
                            MyRegularExpression mre = new MyRegularExpression();
                            if (mre.IsNumber(cells.GetCell(i).ToString()))
                            {
                                sRowValues.Add(cells.GetCell(i).ToString());
                            }
                            else
                            {
                                sRowValues.Add("\"" + cells.GetCell(i).ToString() + "\"");
                            }
                        }
                    }
                }
            }

            return(sRowValues);
        }
Exemplo n.º 4
0
        private void ActivityItemForm_Load(object sender, EventArgs e)
        {
            Form form = sender as Form;
            MyRegularExpression mre = new MyRegularExpression();
            MyFilesOpration     mfo = new MyFilesOpration();
            string ImagePath        = mfo.GetImagePathByControl(GamePath, mfo.GetControlText(GamePath), mre.GetTaskListIcoByItem(TableText), 0);

            //设置图标
            if (ImagePath != "")
            {
                //设置button边框样式
                label_activity.BackgroundImage = Image.FromFile(ImagePath);
                label_activity.Height          = label_activity.BackgroundImage.Height;
                label_activity.Width           = label_activity.BackgroundImage.Width;
            }
            //读取不到图片
            else
            {
                //判断button代表的类型,设置button文字
                label_activity.Text = TaskId;
            }

            //标题文字
            Title_label.Text = mre.GetTaskListTitleByItem(TableText);

            //推荐图标
            if (mre.GetTaskListRecommendByItem(TableText))
            {
                Recommend_label.Visible = true;
            }

            //人数文字
            if (mre.GetTaskListTeamNumStrByItem(TableText) != "")
            {
                TeamNumStr_label.Text = mre.GetTaskListTeamNumStrByItem(TableText);
            }

            //展示物品组
        }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(LuaDataType_textBox.Text) ||
                string.IsNullOrWhiteSpace(TaskId_textBox.Text) ||
                string.IsNullOrWhiteSpace(LogId_textBox.Text) ||
                string.IsNullOrWhiteSpace(LogId_XSJ_textBox.Text)
                )
            {
                MessageBox.Show("请先填入基础数据。");
                return;
            }

            MyRegularExpression mre = new MyRegularExpression();

            if (!mre.IsNumber(LuaDataType_textBox.Text) ||
                !mre.IsNumber(TaskId_textBox.Text) ||
                !mre.IsNumber(LogId_textBox.Text) ||
                !mre.IsNumber(LogId_XSJ_textBox.Text)
                )
            {
                MessageBox.Show("请在基础数据中填入数值。");
                return;
            }

            //起始掩码id
            int nTaskId      = Convert.ToInt32(TaskId_textBox.Text);
            int nLuaDataType = Convert.ToInt32(LuaDataType_textBox.Text);

            //抽奖表
            ScratchDraw scratchDraw = new ScratchDraw();

            scratchDraw.nLuaDataType = nLuaDataType;


            //基础配置
            ScratchDrawBaseData baseData = new ScratchDrawBaseData();

            baseData.nLuaDataType = nLuaDataType;
            baseData.nTaskId      = nTaskId;
            baseData.nLogId       = Convert.ToInt32(LogId_textBox.Text);
            baseData.nLogId_XSJ   = Convert.ToInt32(LogId_XSJ_textBox.Text);

            //规则配置
            ScratchDrawOption Op = new ScratchDrawOption();


            //基础配置所在位置
            int[] vs         = eo.GetRowAndColumn(eo.sheet, "活动时间");
            int   BaseRow    = vs[0] + 1;
            int   BaseColumn = vs[1];

            //活动时间
            string time       = eo.sheet.GetRow(BaseRow).GetCell(BaseColumn).ToString();
            string sStartTime = DateTime.Parse(time.Substring(0, time.IndexOf("-"))).ToString("yyyy-MM-dd 10:00");
            string sEndTime   = DateTime.Parse(time.Substring(time.IndexOf("-") + 1, time.Length - time.IndexOf("-") - 1)).ToString("yyyy-MM-dd 23:59");

            Op.sStartTime = sStartTime;
            Op.sEndTime   = sEndTime;

            //OptionCost
            //消耗的筹码币
            ScratchDrawOptionCost OptionCost = new ScratchDrawOptionCost();
            int OptionCostItemType           = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 2).ToString());
            int OptionCostItemNum            = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 3).ToString());

            OptionCost.nItemType = OptionCostItemType;
            OptionCost.nItemNum  = OptionCostItemNum;
            Op.OptionCost        = OptionCost;

            //OptionAward
            //不一致的奖励
            ScratchDrawOptionAward OptionAward = new ScratchDrawOptionAward();
            int OptionAwardItemType            = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 6).ToString());
            int OptionAwardItemNum             = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 7).ToString());
            int OptionAwardItemMonpoly         = Convert.ToInt32(eo.CharBindConvert(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 8).ToString()));

            OptionAward.nItemType    = OptionAwardItemType;
            OptionAward.nItemNum     = OptionAwardItemNum;
            OptionAward.nItemMonpoly = OptionAwardItemMonpoly;
            Op.OptionAward           = OptionAward;

            //ResetAllDraw
            //重置奖池的配置
            ScratchDrawResetAllDraw ResetAllDraw = new ScratchDrawResetAllDraw();
            int ResetAllDrawItemType             = OptionCostItemType;
            int ResetAllDrawItemNum = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 4).ToString());

            ResetAllDraw.nTaskId   = nTaskId + 1;
            ResetAllDraw.nItemType = ResetAllDrawItemType;
            ResetAllDraw.nItemNum  = ResetAllDrawItemNum;
            Op.ResetAllDraw        = ResetAllDraw;

            //ReasetItem
            //重置物品的配置
            ScratchDrawResetItem ResetItem = new ScratchDrawResetItem();
            int ResetItemItemNum           = Convert.ToInt32(eo.sheet.GetRow(BaseRow).GetCell(BaseColumn + 5).ToString());

            for (int i = 0; i < 3; i++)
            {
                ScratchDrawResetItemValue ResetItemValue = new ScratchDrawResetItemValue();
                ResetItemValue.nTaskId   = nTaskId + 2 + i;
                ResetItemValue.nItemType = OptionCostItemType;
                ResetItemValue.nItemNum  = ResetItemItemNum;
                ResetItem.ResetItemValue.Add(ResetItemValue);
            }
            Op.ResetItem = ResetItem;

            //AwardList
            ScratchDrawAwardList AwardList = new ScratchDrawAwardList();
            //广播内容
            ScratchDrawBroadCastMsg BroadCast = new ScratchDrawBroadCastMsg();

            //奖励表所在位置
            //int[] AwardListPos = eo.GetRowAndColumn(eo.sheet, "超高价值道具");
            for (int i = 0; i < AwardList.AwardListItemName.Count; i++)
            {
                ScratchDrawAwardListItem AwardListItem = new ScratchDrawAwardListItem();
                int[] pos    = eo.GetMerGedRegionRange(eo.sheet, AwardList.AwardListItemName[i]);
                int   Length = pos[2] - pos[0];
                for (int j = 0; j < Length; j++)
                {
                    int AwardListItemValueRow = pos[0] + 1 + j;
                    ScratchDrawAwardListItemValue AwardListItemValue = new ScratchDrawAwardListItemValue();
                    ScratchDrawAwardListNotice    Notice             = new ScratchDrawAwardListNotice();
                    AwardListItemValue.nItemType    = Convert.ToInt32(eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 2).ToString());
                    AwardListItemValue.nItemMonpoly = Convert.ToInt32(eo.CharBindConvert(eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 3).ToString()));
                    AwardListItemValue.nItemNum     = Convert.ToInt32(eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 4).ToString());
                    AwardListItemValue.nChance      = Convert.ToInt32(Convert.ToDouble(eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 5).NumericCellValue) * 10000);
                    AwardListItemValue.nIndex       = j + 1;
                    AwardListItemValue.nAwardLev    = AwardList.AwardListItemName.Count - i;

                    string nServerLimit = eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 6).ToString();
                    if (string.IsNullOrWhiteSpace(nServerLimit))
                    {
                        AwardListItemValue.nServerLimit = 0;
                    }
                    else
                    {
                        AwardListItemValue.nServerLimit = Convert.ToInt32(nServerLimit);
                    }

                    Notice.Type.Add(eo.GetNoticeType(eo.sheet.GetRow(AwardListItemValueRow).GetCell(pos[1] + 7).ToString()));

                    AwardListItemValue.tNotice = Notice;
                    AwardListItem.AwardListItemValue.Add(AwardListItemValue);
                }
                AwardList.AwardListItem.Add(AwardListItem);

                string BroadCastMsg = eo.sheet.GetRow(pos[0] + 1).GetCell(pos[1] + 8).ToString();
                if (string.IsNullOrWhiteSpace(BroadCastMsg))
                {
                    BroadCastMsg = BroadCast.DefalutMsg;
                }
                BroadCast.BroadCastMsg.Add("\t\t[" + (i + 1) + "]={\r\n\t\t\tsAward=\"" + BroadCastMsg + "\",\r\n\t\t},\r\n");
            }
            //int[] AwardListItemPos = eo.GetMerGedRegionRange(eo.sheet, "超高价值道具");


            //tScratchList
            ScratchDrawResetItemRandom RandomList = new ScratchDrawResetItemRandom();

            for (int i = 0; i < RandomList.RandomListItemName.Count; i++)
            {
                ScratchDrawResetItemValueRandom RandomListValues = new ScratchDrawResetItemValueRandom();
                int[] pos          = eo.GetRowAndColumn(eo.sheet, RandomList.RandomListItemName[i]);
                int   randomrow    = pos[0] + 2;
                int   randomcolumn = pos[1] + 1;
                for (int j = 0; j < AwardList.AwardListItemName.Count; j++)
                {
                    int Chance = Convert.ToInt32(Convert.ToDouble(eo.sheet.GetRow(randomrow + j).GetCell(randomcolumn).NumericCellValue) * 100000);
                    RandomListValues.Chance.Add(Chance);
                }
                RandomList.ScratchDrawResetItemValueRandom.Add(RandomListValues);
            }

            scratchDraw.BaseData   = baseData;
            scratchDraw.OptionData = Op;
            scratchDraw.AwardList  = AwardList;
            scratchDraw.RandomList = RandomList;
            scratchDraw.BroadCast  = BroadCast;

            // Console.WriteLine(scratchDraw.GetStr());
            //桌面路径
            string Deskdir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

            File.WriteAllText(@Deskdir + "\\刮刮卡配置.lua", scratchDraw.GetStr());
            Process.Start(Deskdir);
            toolStripStatusLabel.Text = "已导出至桌面!";
        }